Now working. The password can be set from within the pad editor.

Currently there are only two remaining issues:
 1 After the password is set, re-authentication is needed
 2 The toolbar button does not yet have a nice icon
This commit is contained in:
jaseg 2011-12-08 22:45:54 +01:00
parent c905fd76c1
commit a161b59601
8 changed files with 56 additions and 49 deletions

View file

@ -3471,7 +3471,7 @@ function OUTER(gscope)
function handleClick(evt)
{
//hide the dropdowns
window.top.padeditbar.toogleDropDown("none");
window.top.padeditbar.toggleDropDown("none");
inCallStack("handleClick", function()
{

View file

@ -51,6 +51,11 @@ function createCookie(name, value, days, path)
document.cookie = name + "=" + value + expires + "; path=" + path;
}
function setPassword(){
console.log("setting password");
pad.setPassword($("#setpasswordfield").val());
}
function readCookie(name)
{
var nameEQ = name + "=";
@ -489,6 +494,13 @@ var pad = {
changedBy: pad.myUserInfo.name || "unnamed"
});
},
setPassword: function(newPassword){
pad.collabClient.sendClientMessage(
{
type: "setPassword",
password: newPassword
});
},
changeViewOption: function(key, value)
{
var options = {

View file

@ -96,18 +96,18 @@ var padeditbar = (function()
{
if(cmd == "showusers")
{
self.toogleDropDown("users");
self.toggleDropDown("users");
}
else if (cmd == 'embed')
{
var padurl = window.location.href.split("?")[0];
$('#embedinput').val("<iframe src='" + padurl + "?showControls=true&showChat=true&showLineNumbers=true&useMonospaceFont=false' width=600 height=400>");
self.toogleDropDown("embed");
self.toggleDropDown("embed");
$('#embedinput').focus().select();
}
else if (cmd == 'import_export')
{
self.toogleDropDown("importexport");
self.toggleDropDown("importexport");
}
else if (cmd == 'readonly')
@ -116,13 +116,16 @@ var padeditbar = (function()
var readonlyLink = basePath + "/ro/" + clientVars.readOnlyId;
$('#readonlyImage').attr("src","https://chart.googleapis.com/chart?chs=200x200&cht=qr&chld=H|0&chl=" + readonlyLink);
$('#readonlyInput').val(readonlyLink);
self.toogleDropDown("readonly");
self.toggleDropDown("readonly");
$('#readonlyInput').focus().select();
}
else if (cmd == 'save')
{
padsavedrevs.saveNow();
}
else if (cmd == 'password'){
self.toggleDropDown("setpassword");
}
else
{
padeditor.ace.callWithAce(function(ace)
@ -162,9 +165,9 @@ var padeditbar = (function()
}
padeditor.ace.focus();
},
toogleDropDown: function(moduleName)
toggleDropDown: function(moduleName)
{
var modules = ["embed", "users", "readonly", "importexport"];
var modules = ["embed", "users", "readonly", "importexport", "setpassword"];
//hide all modules
if(moduleName == "none")