Merge remote-tracking branch 'dario/master'

This commit is contained in:
Giulio Cesare Solaroli 2015-11-24 18:22:42 +01:00
commit a509b34c63
4 changed files with 60 additions and 15 deletions

View File

@ -516,7 +516,7 @@ Clipperz.log("<<< Connection.messageExceptionHandler")
'uploadAttachment': function(someArguments, aProgressCallback) { 'uploadAttachment': function(someArguments, aProgressCallback) {
return Clipperz.Async.callbacks("Connction.uploadAttachment", [ return Clipperz.Async.callbacks("Connction.uploadAttachment", [
MochiKit.Base.method(this, 'message', 'knock', {'requestType':'MESSAGE'}), MochiKit.Base.method(this, 'message', 'echo', {'echo':"echo"}),
MochiKit.Base.method(this.proxy(), 'uploadAttachment', someArguments, aProgressCallback, this.sharedSecret()), MochiKit.Base.method(this.proxy(), 'uploadAttachment', someArguments, aProgressCallback, this.sharedSecret()),
], {trace:false}); ], {trace:false});
@ -525,7 +525,7 @@ Clipperz.log("<<< Connection.messageExceptionHandler")
'downloadAttachment': function(someArguments, aProgressCallback) { 'downloadAttachment': function(someArguments, aProgressCallback) {
return Clipperz.Async.callbacks("Connction.uploadAttachment", [ return Clipperz.Async.callbacks("Connction.uploadAttachment", [
MochiKit.Base.method(this, 'message', 'knock', {'requestType':'MESSAGE'}), MochiKit.Base.method(this, 'message', 'echo', {'echo':"echo"}),
MochiKit.Base.method(this.proxy(), 'downloadAttachment', someArguments, aProgressCallback, this.sharedSecret()), MochiKit.Base.method(this.proxy(), 'downloadAttachment', someArguments, aProgressCallback, this.sharedSecret()),
], {trace:false}); ], {trace:false});

View File

@ -116,29 +116,54 @@ Clipperz.PM.UI.Components.ExtraFeatures.OTPClass = React.createClass({
'<meta charset="utf-8">' + '<meta charset="utf-8">' +
'<title>Active One Time Passwords - Clipperz</title>' + '<title>Active One Time Passwords - Clipperz</title>' +
'<style>' + '<style>' +
'li { padding-bottom: 10px; }' + 'body { margin: 0; padding: 0.5cm; }' +
'ul { font-size: 0.24cm; font-family: monospace; list-style-type: none; padding: 1em; border: 1px solid; display: inline-block; background: lightblue; border-radius: 10px; margin: 0.2cm; width: 7cm; height: 3.6cm; vertical-align: bottom;}' +
'h2 { font-size: 0.24cm; margin: 0; padding-right: 0.15cm;}' +
'h2 span { display: inline-block; width: 50%;}' +
'h2 span.right { text-align: right; }' +
'li { line-height: 0.34cm; }' +
'li span { display: block; }' + 'li span { display: block; }' +
'span.password { font-family: monospace; font-size: 16pt; padding-bottom: 5px; }' + 'span.password { font-family: monospace; font-size: 16pt; padding-bottom: 5px; }' +
'span.label { font-family: sans-serif; font-size: 12pt; }' + 'span.label { font-family: sans-serif; font-size: 12pt; }' +
'</style>' + '</style>' +
'</head>' + '</head>' +
'<body>' + '<body>' +
'<ul>' + // '<ul>' +
MochiKit.Base.map(function (anOTP) { // MochiKit.Base.map(function (anOTP) {
return '<li>' + // return '<li>' +
'<span class="password">' + anOTP.password() + '</span>' + // '<span class="password">' + anOTP.password() + '</span>' +
'<span class="label">' + anOTP.label() + '</span>' + // '<span class="label">' + anOTP.label() + '</span>' +
'</li>'; // '</li>';
}, filteredOtpList).join('') + // }, filteredOtpList).join('') +
'</ul>' + // '</ul>' +
this.renderPrintedOtpList(filteredOtpList) +
'</body>' + '</body>' +
'</html>' '</html>'
); );
// newWindow.document.close(); newWindow.document.close();
// newWindow.focus(); newWindow.focus();
// newWindow.print(); newWindow.print();
// newWindow.close(); newWindow.close();
},
renderPrintedOtpList: function(aList) {
var result;
var i;
var date = new Date();
var header = '<h2><span class="left">Clipperz OTPs</span><span class="right">'+date.getDate()+'/'+date.getMonth()+'/'+date.getFullYear()+'</span></h2>'
result = '<ul>'+header;
for (i in aList) {
if (i%10 == 0 && i != 0) {
result += '</ul><ul>'+header;
}
result += '<li>\u2610 '+aList[i].password()+'</li>';
}
return result;
}, },
//========================================================================= //=========================================================================

View File

@ -77,6 +77,16 @@ Clipperz.PM.UI.Components.HelpClass = React.createClass({
]), React.DOM.dd({}, "previous/next card"), ]), React.DOM.dd({}, "previous/next card"),
]) ])
]), ]),
React.DOM.div({'className':'helpBlock'}, [
React.DOM.h4({}, "Misc"),
React.DOM.dl({}, [
React.DOM.dt({}, [
React.DOM.span({'className':'key'}, 'l o c k'),
]), React.DOM.dd({}, "lock application"),
])
]),
/* /*
Mousetrap.bind(['left', 'h', 'esc'], MochiKit.Base.method(this, 'exitCurrentSelection')); Mousetrap.bind(['left', 'h', 'esc'], MochiKit.Base.method(this, 'exitCurrentSelection'));

View File

@ -113,6 +113,8 @@ Clipperz.PM.UI.MainController = function() {
Mousetrap.bind(['?'], MochiKit.Base.method(this, 'showHelp_handler')); Mousetrap.bind(['?'], MochiKit.Base.method(this, 'showHelp_handler'));
Mousetrap.bind(['l o c k'], MochiKit.Base.method(this, 'lockShortcut'));
// Mousetrap.bind(['t e s t'], MochiKit.Base.method(this, 'downloadExport_handler')); // Mousetrap.bind(['t e s t'], MochiKit.Base.method(this, 'downloadExport_handler'));
return this; return this;
@ -408,6 +410,12 @@ Clipperz.log("THE BROWSER IS OFFLINE");
return deferredResult; return deferredResult;
}, },
lockShortcut: function(anEvent) {
anEvent.preventDefault();
return this.lock();
},
lock: function () { lock: function () {
var deferredResult; var deferredResult;
@ -1853,6 +1861,8 @@ Clipperz.log("THE BROWSER IS OFFLINE");
addCardClick_handler: function () { addCardClick_handler: function () {
var newRecord; var newRecord;
this.selectAllCards();
return Clipperz.Async.callbacks("MainController.addCardClick_handler", [ return Clipperz.Async.callbacks("MainController.addCardClick_handler", [
MochiKit.Base.method(this.user(), 'createNewRecord'), MochiKit.Base.method(this.user(), 'createNewRecord'),
function (aValue) { function (aValue) {