password-manager/frontend/beta/js/Clipperz/PM/Components/Panels/DataPanel.js

487 lines
24 KiB
JavaScript
Raw Normal View History

/*
Copyright 2008-2011 Clipperz Srl
This file is part of Clipperz's Javascript Crypto Library.
Javascript Crypto Library provides web developers with an extensive
and efficient set of cryptographic functions. The library aims to
obtain maximum execution speed while preserving modularity and
reusability.
For further information about its features and functionalities please
refer to http://www.clipperz.com
* Javascript Crypto Library is free software: you can redistribute
it and/or modify it under the terms of the GNU Affero General Public
License as published by the Free Software Foundation, either version
3 of the License, or (at your option) any later version.
* Javascript Crypto Library is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
License along with Javascript Crypto Library. If not, see
<http://www.gnu.org/licenses/>.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
if (typeof(Clipperz.PM.Components.Panels) == 'undefined') { Clipperz.PM.Components.Panels = {}; }
//#############################################################################
Clipperz.PM.Components.Panels.DataPanel = function(anElement, args) {
args = args || {};
Clipperz.PM.Components.Panels.DataPanel.superclass.constructor.call(this, anElement, args);
this._progressWidth = 400;
this.render();
return this;
}
//=============================================================================
YAHOO.extendX(Clipperz.PM.Components.Panels.DataPanel, Clipperz.PM.Components.Panels.BasePanel, {
'toString': function() {
return "Clipperz.PM.Components.DataPanel component";
},
//-------------------------------------------------------------------------
'render': function() {
MochiKit.Signal.disconnectAllTo(this);
Clipperz.NotificationCenter.unregister(this);
this.element().update("");
Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'table', border:'0', cellspacing:'0', cellpadding:'0', children:[
{tag:'tbody', children:[
{tag:'tr', children:[
{tag:'td', valign:'top', width:'200', children:[
{tag:'ul', id:"dataSubMenu", cls:'subMenu', children:[
{tag:'li', id:'offlineCopyTab', htmlString:Clipperz.PM.Strings['offlineCopyTabLabel']},
{tag:'li', id:'sharingTab', htmlString:Clipperz.PM.Strings['sharingTabLabel']},
{tag:'li', id:'importTab', htmlString:Clipperz.PM.Strings['importTabLabel']},
{tag:'li', id:'printingTab', htmlString:Clipperz.PM.Strings['printingTabLabel']}
]}
]},
{tag:'td', valign:'top', children:[
{tag:'ul', cls:'clipperzTabPanels', children:[
{tag:'li', id:this.getId('offlineCopyPanel'), children:[
{tag:'div', cls:'clipperzSubPanel', children:[
{tag:'h5', htmlString:Clipperz.PM.Strings['offlineCopyTabTitle']},
{tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['offlineCopyTabDescription']},
{tag:'div', id:this.getId('offlineCopyLinkBox'), children:[
{tag:'a', id:'offlineCopyLink', href:'#', htmlString:Clipperz.PM.Strings['offlineCopyDownloadLinkLabel']}
]},
{tag:'div', id:this.getId('offlineCopyLinkBox_read-only'), children:[
{tag:'span', cls:'read-only', htmlString:Clipperz.PM.Strings['offlineCopyDownloadLinkLabel']}
]}
]}
]},
{tag:'li', id:this.getId('sharingPanel'), children:[
{tag:'div', cls:'clipperzSubPanel', children:[
{tag:'h5', htmlString:Clipperz.PM.Strings['sharingTabTitle']},
{tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['sharingTabDescription']}
]}
]},
{tag:'li', id:this.getId('importPanel'), children:[
{tag:'div', cls:'clipperzSubPanel', children:[
{tag:'div', id:this.getId('importPanelMainComponent')}
]}
]},
{tag:'li', id:this.getId('printingPanel'), children:[
{tag:'div', cls:'clipperzSubPanel', children:[
{tag:'h5', htmlString:Clipperz.PM.Strings['printingTabTitle']},
{tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['printingTabDescription']},
{tag:'div', id:this.getId('printingLinkBox'), children:[
{tag:'a', id:'printingLink', href:'#', htmlString:Clipperz.PM.Strings['printingLinkLabel']}
]},
{tag:'hr'},
{tag:'div', cls:'panelDescription', htmlString:Clipperz.PM.Strings['exportTabDescription']},
{tag:'div', id:this.getId('exportLinkBox'), children:[
{tag:'a', id:'exportLink', href:'#', htmlString:Clipperz.PM.Strings['exportLinkLabel']}
]}
]}
]}
]}
]}
]}
]}
]});
this.tabPanelController().setUp();
if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
this.getElement('offlineCopyLinkBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
} else {
this.getElement('offlineCopyLinkBox_read-only').setVisibilityMode(YAHOO.ext.Element.DISPLAY).hide();
MochiKit.Signal.connect('offlineCopyLink', 'onclick', this, 'downloadOfflineCopy');
}
new Clipperz.PM.Components.Import.MainComponent(this.getElement('importPanelMainComponent'), {user:this.user()});
MochiKit.Signal.connect('printingLink', 'onclick', this, 'printAllData');
MochiKit.Signal.connect('exportLink', 'onclick', this, 'exportAllData');
Clipperz.NotificationCenter.register(null, 'switchLanguage', this, 'switchLanguageHandler');
},
//-------------------------------------------------------------------------
'tabPanelController': function() {
if (this._tabPanelController == null) {
var tabPanelControllerConfig;
tabPanelControllerConfig = {}
tabPanelControllerConfig['offlineCopyTab'] = this.getId('offlineCopyPanel');
tabPanelControllerConfig['sharingTab'] = this.getId('sharingPanel');
tabPanelControllerConfig['importTab'] = this.getId('importPanel');
tabPanelControllerConfig['printingTab'] = this.getId('printingPanel');
this._tabPanelController = new Clipperz.PM.Components.TabPanel.TabPanelController({
name: 'dataTabPanel',
config:tabPanelControllerConfig,
selectedTab:'offlineCopyTab'
});
}
return this._tabPanelController;
},
//-------------------------------------------------------------------------
'downloadOfflineCopy': function(anEvent) {
var downloadHref;
downloadHref = window.location.href.replace(/\/[^\/]*$/,'') + Clipperz_dumpUrl;
if (Clipperz_IEisBroken == true) {
window.open(downloadHref, "");
} else {
var deferredResult;
var newWindow;
newWindow = window.open("", "");
anEvent.preventDefault();
deferredResult = new MochiKit.Async.Deferred();
deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'echo', {'echo':"echo"});
deferredResult.addCallback(function(aWindow) {
aWindow.location.href = downloadHref;
}, newWindow);
deferredResult.callback();
}
},
//-------------------------------------------------------------------------
'compareRecords': function(a, b) {
return MochiKit.Base.compare(a.label().toLowerCase(), b.label().toLowerCase());
},
'logo': function() {
var result;
if (Clipperz_IEisBroken == true) {
if (Clipperz.PM.Proxy.defaultProxy.isReadOnly()) {
result = "<span><span class=\"clipperzLogoSpan\">clipper</span><span class=\"clipperzLoggoZSpan\">z</span></span>";
} else {
result = "<img src=\"./images/exportLogo.png\" />";
}
} else {
result = "<img src=\"data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAANYAAABOCAIAAADTtH9XAAANIWlDQ1BJQ0MgUHJvZmlsZQAAeJyV13k0lG8bB/BrFsYyZhhjDyO77LKHLJFItmwp2bdhJiZRypIUIkso2iiSFC0kEtWPLCHJkq2oyJI9kmXeP6R6f+f9ve95rz+ecz3385xz389zzud7nxsAr+FKpZKRABAQSAuyNjEgOTg6kTBdgAJewAEzaLi6B1P1LS3N4R9roRMQAADtcq5UKvmf3/uPhQtycHQCQMgCANF7vd8OAES39d4WAIhHaFQaAMIHAIjuPq4eAIhwAJANsrU2BEAUAADOe70vBwCc23pfDwC4EHdvGgCiG4CREOjhGwiAmQBg1PXwDHYHwMkCgIdHsHsAAC4ZACwCAigeALgPACDlTg2iAeCZAEDOwdGJtL7kffEAW/kAmMx+jx1JByjNAZDa/XtM9BEAtytAbuLvsTlrQAAAgrs12EtFGQAAEFgDAIYBOn1OAgCTCrCaQqcv59Lpq9cBUH0ANWT3w0EhP/8XAtEM8L/u17/5Z6EQAEgAhBgiH3kUFY4OZzjBGImJZjrJbMRcy3Ka9Qw2ju0srozdhyOFkMKZSjzPlc6dzpPJW8tPEcjelC14WaiedFgkd/N10VbxYxL5km3SJ2Rub+mUi5a/o9CjdFr5vsp71bNqZeqDmklaFdrDOmm6T/XG9DMMnhtO7sgyrjOZNb26q9FsYXeuRcue15avrdqsV2wL93bYddp3O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result;
},
'progressWidth': function() {
return this._progressWidth;
},
'updateProgress': function(aProgressComponent, aPercentage) {
},
//-------------------------------------------------------------------------
'printAllData': function(anEvent) {
var newWindow;
var allRecords;
//MochiKit.Logging.logDebug(">>> printAllData");
newWindow = window.open("", "");
newWindow.document.write(
"<html>" +
"<header>" +
" <title>Clipperz export data</title>" +
"<style>" +
"#exportedData {" +
" width: 600px;" +
"}" +
".ext-mb-progress-wrap {" +
" border:1px solid #6593cf;" +
" margin-bottom: 10px;" +
" width: " + this.progressWidth() + "px;" +
"}" +
".ext-mb-progress {" +
" height:18px;" +
" background:transparent url(./images/default/basic-dialog/progress2.gif) repeat-x 1px 1px;" +
"}" +
".ext-mb-progress-bar {" +
" height:18px;" +
" overflow:hidden;" +
" width:0;" +
" background:#8bb8f3;" +
"}" +
"body {" +
" font-family: sans-serif;" +
"}" +
"div#logo {" +
" border-bottom: 1px dotted #aaaaaa;" +
" margin-bottom: 15px;" +
"}" +
"div.recordBlock h2 {" +
" font-size: 14pt;" +
" margin: 0px;" +
" padding: 0px;" +
" border: 0px;" +
" color: #666666;" +
"}" +
"div.recordBlock div.recordNotes p {" +
" margin: 0px;" +
" padding: 0px;" +
" border: 0px;" +
" color: #aaaaaa;" +
" font-size: 10pt;" +
" line-height: 18pt;" +
" border-left: 1px solid #aaaaaa;" +
" padding-left: 10px;" +
"}" +
"div.recordBlock dl {" +
" margin: 0px;" +
" padding: 0px;" +
" border: 0px;" +
" color: #999999;" +
" padding-bottom: 10px;" +
" border-bottom: 1px dotted #aaaaaa;" +
" margin-top: 10px;" +
" margin-bottom: 15px;" +
"}" +
"div.recordBlock dl dt {" +
" display: block;" +
" float: left;" +
" min-width: 100px;" +
" white-space: nowrap;" +
" overflow: hidden;" +
" margin-right: 10px;" +
" font-size: 10pt;" +
" line-height: 18pt;" +
"}" +
"div.recordBlock dl dd {" +
" color: #666666;" +
" font-size: 10pt;" +
" line-height: 18pt;" +
"}" +
"" +
"</style>" +
"" +
"<!--[if IE]>" +
"<style>" +
"div.recordBlock dl dt {" +
" width: 100px;" +
"}" +
"</style>" +
"<![endif]-->" +
"" +
"</header>" +
"<body>" +
" <div id=\"logo\">" + this.logo() +
" <div id=\"progressWrapper\"><div class=\"ext-mb-progress-wrap\"><div class=\"ext-mb-progress\"><div id=\"progress\" class=\"ext-mb-progress-bar\">&#160;</div></div></div></div>" +
" </div>" +
"</body>" +
"</html>"
);
anEvent.preventDefault();
allRecords = MochiKit.Base.values(this.user().records());
allRecords.sort(this.compareRecords);
/*
deferredResult = new MochiKit.Async.Deferred();
MochiKit.Iter.forEach(allRecords, MochiKit.Base.partial(function(aDeferredResult, aWindow, aRecord) {
var printerRecord;
printerRecord = new Clipperz.PM.Components.Printing.Record({record:aRecord});
aDeferredResult.addCallback(MochiKit.Base.method(printerRecord, 'deferredDrawToWindow', aWindow));
}, deferredResult, newWindow));
deferredResult.callback();
return deferredResult;
*/
MochiKit.DOM.withWindow(newWindow, MochiKit.Base.bind(function(someRecords) {
var currentWindow;
var deferredResult;
var progressBar;
var progressWrapper;
var i, c;
currentWindow = MochiKit.DOM.currentWindow();
progressBar = MochiKit.DOM.getElement('progress');
progressWrapper = MochiKit.DOM.getElement('progressWrapper');
deferredResult = new MochiKit.Async.Deferred();
c = someRecords.length;
for (i=0; i<c; i++) {
deferredResult.addCallback(function(aWindow, aRecord) {
var printerRecord;
printerRecord = new Clipperz.PM.Components.Printing.Record({record:aRecord});
return printerRecord.deferredDrawToWindow(aWindow);
}, currentWindow, someRecords[i])
deferredResult.addCallback(MochiKit.Base.bind(function(aProgressBar, aProgress) {
MochiKit.Style.setElementDimensions(aProgressBar, {w:aProgress * this.progressWidth()});
}, this, progressBar, ((i+1)/c)));
deferredResult.addCallback(MochiKit.Async.wait, 0.2);
}
deferredResult.addCallback(function(aWindow, aProgressWrapper) {
MochiKit.DOM.replaceChildNodes(aProgressWrapper);
MochiKit.Style.hideElement(aProgressWrapper);
aWindow.stop();
}, currentWindow, progressWrapper);
deferredResult.callback();
}, this, allRecords));
},
//-------------------------------------------------------------------------
'exportAllData': function(anEvent) {
// var deferredResult;
var newWindow;
var allRecords;
//MochiKit.Logging.logDebug(">>> printAllData");
newWindow = window.open("", "");
newWindow.document.write(
"<html>" +
"<header>" +
" <title>Clipperz export data</title>" +
"<style>" +
"#exportedData {" +
" width: 600px;" +
"}" +
".ext-mb-progress-wrap {" +
" margin-top:4px;" +
" margin-bottom: 10px;" +
" border:1px solid #6593cf;" +
" width: " + this.progressWidth() + "px;" +
"}" +
".ext-mb-progress {" +
" height:18px;" +
" background:transparent url(./images/default/basic-dialog/progress2.gif) repeat-x 1px 1px;" +
"}" +
".ext-mb-progress-bar {" +
" height:18px;" +
" overflow:hidden;" +
" width:0;" +
" background:#8bb8f3;" +
"}" +
"</style>" +
"" +
"<!--[if IE]>" +
"<style>" +
"</style>" +
"<![endif]-->" +
"" +
"</header>" +
"<body>" +
" <div id=\"logo\">" + this.logo() + "</div>" +
" <div id=\"progressWrapper\">" +
" <div class=\"description\">" + Clipperz.PM.Strings['exportDataInProgressDescription'] + "</div>" +
" <div class=\"ext-mb-progress-wrap\"><div class=\"ext-mb-progress\"><div id=\"progress\" class=\"ext-mb-progress-bar\">&#160;</div></div></div>" +
" </div>" +
" <div id=\"textareaWrapper\">" +
" <div class=\"description\">" + Clipperz.PM.Strings['exportDataDescription'] + "</div>" +
" <textarea id=\"exportedData\" cols=\"80\" rows=\"20\">[</textarea>" +
" </div>" +
"</body>" +
"</html>"
);
anEvent.preventDefault();
allRecords = MochiKit.Base.values(this.user().records());
allRecords.sort(this.compareRecords);
MochiKit.DOM.withWindow(newWindow, MochiKit.Base.bind(function(someRecords) {
var currentWindow;
var deferredResult;
var textareaWrapper;
var textarea;
var progressBar;
var progressWrapper;
var i, c;
currentWindow = MochiKit.DOM.currentWindow();
textarea = MochiKit.DOM.getElement('exportedData');
textareaWrapper = MochiKit.DOM.getElement('textareaWrapper');
MochiKit.Style.hideElement(textareaWrapper);
progressBar = MochiKit.DOM.getElement('progress');
progressWrapper = MochiKit.DOM.getElement('progressWrapper');
deferredResult = new MochiKit.Async.Deferred();
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("exportAllData - 1: " + res); return res;});
c = someRecords.length;
for (i=0; i<c; i++) {
deferredResult.addCallback(MochiKit.Base.method(someRecords[i], 'deferredData'));
deferredResult.addCallback(MochiKit.Base.method(someRecords[i], 'exportedData'));
deferredResult.addCallback(MochiKit.Base.bind(function(aTextarea, aProgressBar, aProgress, someRecordExportedData) {
aTextarea.value = aTextarea.value + "\n" + someRecordExportedData + ",";
MochiKit.Style.setElementDimensions(aProgressBar, {w:aProgress * this.progressWidth()});
}, this, textarea, progressBar, ((i+1)/c)));
deferredResult.addCallback(MochiKit.Async.wait, 0.2);
}
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("exportAllData - 2: " + res); return res;});
deferredResult.addCallback(function(aTextareaWrapper, aTextarea, aProgressWrapper) {
aTextarea.value = aTextarea.value.slice(0, -1) + "\n]";
// MochiKit.DOM.replaceChildNodes(aProgressWrapper);
MochiKit.Style.hideElement(aProgressWrapper);
MochiKit.Style.showElement(aTextareaWrapper);
aTextarea.focus();
aTextarea.select();
}, textareaWrapper, textarea, progressWrapper);
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("exportAllData - 3: " + res); return res;});
deferredResult.addBoth(function(aWindow) {
aWindow.stop();
}, currentWindow);
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("exportAllData - 4: " + res); return res;});
deferredResult.callback();
}, this, allRecords));
},
//-------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});