|
|
@ -72,6 +72,23 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var getLastName = module.getLastName = function (cb) {
|
|
|
|
|
|
|
|
Cryptpad.getAttribute('username', function (err, userName) {
|
|
|
|
|
|
|
|
cb(err, userName || '');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var setName = module.setName = function (uname, cb) {
|
|
|
|
|
|
|
|
if (typeof(uname) !== 'string') {
|
|
|
|
|
|
|
|
return void cb(new Error('expected string'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
uname = Cryptpad.fixHTML(uname.trim()).slice(0, 32);
|
|
|
|
|
|
|
|
Cryptpad.setAttribute('username', uname, function (err, data) {
|
|
|
|
|
|
|
|
if (err) { return void cb(err); }
|
|
|
|
|
|
|
|
cb(void 0, uname);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
module.Wizard = Wizard;
|
|
|
|
module.Wizard = Wizard;
|
|
|
|
|
|
|
|
|
|
|
|
// special UI elements
|
|
|
|
// special UI elements
|
|
|
@ -825,6 +842,10 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setEditable(true);
|
|
|
|
setEditable(true);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// shortcircuiting before all of this code since it's not quite the
|
|
|
|
|
|
|
|
// behaviour we want, and it's a bit of work to make it Do The Right Thing
|
|
|
|
|
|
|
|
|
|
|
|
if (First) {
|
|
|
|
if (First) {
|
|
|
|
// assume the first user to the poll wants to be the administrator...
|
|
|
|
// assume the first user to the poll wants to be the administrator...
|
|
|
@ -840,39 +861,33 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
module.activeColumn = '';
|
|
|
|
module.activeColumn = '';
|
|
|
|
var promptForName = function () {
|
|
|
|
var promptForName = function () {
|
|
|
|
// HERE
|
|
|
|
|
|
|
|
Cryptpad.prompt(Messages.promptName, "", function (name, ev) {
|
|
|
|
|
|
|
|
if (name === null) {
|
|
|
|
|
|
|
|
name = '';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!module.isEditable) { return; }
|
|
|
|
var followUp = function (name) {
|
|
|
|
|
|
|
|
if (!name) { return; }
|
|
|
|
var id = module.activeColumn = coluid();
|
|
|
|
var id = module.activeColumn = coluid();
|
|
|
|
|
|
|
|
|
|
|
|
Cryptpad.setPadAttribute('column', id, function (err) {
|
|
|
|
Cryptpad.setPadAttribute('column', id, function (err) {
|
|
|
|
if (err) {
|
|
|
|
if (err) { return void console.error("Couldn't remember your column id"); }
|
|
|
|
console.error("Couldn't remember your column id");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(id);
|
|
|
|
|
|
|
|
makeUser(module.rt.proxy, id, name).focus().val(name);
|
|
|
|
makeUser(module.rt.proxy, id, name).focus().val(name);
|
|
|
|
makeUserEditable(id, true);
|
|
|
|
makeUserEditable(id, true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getLastName(function (err, uname) {
|
|
|
|
|
|
|
|
if (!uname) {
|
|
|
|
|
|
|
|
return void Cryptpad.prompt(Messages.promptName, "", function (name, ev) {
|
|
|
|
|
|
|
|
if (!(name || module.isEditable)) { return; }
|
|
|
|
|
|
|
|
followUp(name);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
followUp(uname);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (column === null) {
|
|
|
|
if (column === null) { return void promptForName(); }
|
|
|
|
//console.log("Looks like you're new to this poll, why don't you make a column");
|
|
|
|
|
|
|
|
promptForName();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// column might be defined, but that column might have been deleted...
|
|
|
|
// column might be defined, but that column might have been deleted...
|
|
|
|
if (proxy.table.colsOrder.indexOf(column) === -1) {
|
|
|
|
if (proxy.table.colsOrder.indexOf(column) === -1) { return void promptForName(); }
|
|
|
|
promptForName();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|