rem
stringlengths 0
126k
| add
stringlengths 0
441k
| context
stringlengths 15
136k
|
---|---|---|
$(getAnswerVoteUpButton(postId)).attr("src", scriptUrl + "media/images/vote-arrow-up.png"); $(getAnswerVoteDownButton(postId)).attr("src", scriptUrl + "media/images/vote-arrow-down.png"); | $(getAnswerVoteUpButton(postId)).attr("src", mediaUrl("media/images/vote-arrow-up.png")); $(getAnswerVoteDownButton(postId)).attr("src", mediaUrl("media/images/vote-arrow-down.png")); | var setVoteImage = function(voteType, undo, object){ var flag = undo ? "" : "-on"; var arrow = (voteType == VoteType.questionUpVote || voteType == VoteType.answerUpVote) ? "up" : "down"; object.attr("src", scriptUrl + "media/images/vote-arrow-"+ arrow + flag +".png"); // if undo voting, then undo the pair of arrows. if(undo){ if(voteType == VoteType.questionUpVote || voteType == VoteType.questionDownVote){ $(getQuestionVoteUpButton()).attr("src", scriptUrl + "media/images/vote-arrow-up.png"); $(getQuestionVoteDownButton()).attr("src", scriptUrl + "media/images/vote-arrow-down.png"); } else{ $(getAnswerVoteUpButton(postId)).attr("src", scriptUrl + "media/images/vote-arrow-up.png"); $(getAnswerVoteDownButton(postId)).attr("src", scriptUrl + "media/images/vote-arrow-down.png"); } } }; |
this.width = parseInt(newWidth,10); | setWidth: function(newWidth) { if (this.rule && parseInt(newWidth,10) >= 0) { this.width = parseInt(newWidth,10); this.rule.style.width = parseInt(newWidth,10) + "px"; } }, |
|
setWidth: function(newWidth) { var delta = this.cellWidth - this.width; this.width = parseInt(newWidth,10); this.cellWidth = this.width + delta; this.options.width = newWidth; if (this.rule && parseInt(newWidth,10) >= 0) { this.rule.style.width = parseInt(newWidth,10) + "px"; | setWidth: function(newWidth, asCellWidth) { asCellWidth = $defined(asCellWidth) ? asCellWidth : false; var delta = this.cellWidth - this.width; if (!asCellWidth) { this.width = parseInt(newWidth,10); this.cellWidth = this.width + delta; this.options.width = newWidth; } else { this.width = parseInt(newWidth,10) - delta; this.cellWidth = newWidth; this.options.width = this.width; } if (this.rule && parseInt(this.width,10) >= 0) { this.rule.style.width = parseInt(this.width,10) + "px"; | setWidth: function(newWidth) { var delta = this.cellWidth - this.width; this.width = parseInt(newWidth,10); this.cellWidth = this.width + delta; this.options.width = newWidth; if (this.rule && parseInt(newWidth,10) >= 0) { this.rule.style.width = parseInt(newWidth,10) + "px"; } if (this.cellRule && parseInt(this.cellWidth,10) >= 0) { this.cellRule.style.width = parseInt(this.cellWidth,10) + "px"; } }, |
if (this.rule && parseInt(newWidth,10) >= 0) { this.rule.style.width = parseInt(newWidth,10) + "px"; } | this.cellWidth = this.width + delta; if (this.rule && parseInt(newWidth,10) >= 0) { this.rule.style.width = parseInt(newWidth,10) + "px"; } if (this.cellRule && parseInt(this.cellWidth,10) >= 0) { this.cellRule.style.width = parseInt(this.cellWidth,10) + "px"; } | setWidth: function(newWidth) { this.width = parseInt(newWidth,10); if (this.rule && parseInt(newWidth,10) >= 0) { this.rule.style.width = parseInt(newWidth,10) + "px"; } }, |
alert(url); | var share_page = function(service_name){ if (SERVICE_DATA[service_name]){ var url = SERVICE_DATA[service_name]['url']; url = url.replace('{URL}', URL); url = url.replace('{TEXT}', TEXT); alert(url); var params = SERVICE_DATA[service_name]['params']; if(!window.open(url, "sharing", params)){ window.location.href=share_url; } } } |
|
this.resizeBox(this.shimWidth, this.shimHeight); | shiftFxCorrection = 20; this.resizeBox(this.shimWidth + shiftFxCorrection, this.shimHeight + 30 + shiftFxCorrection); | shimLoaded : function() { // iframe load fires on element creation and actual load. Check variable to ensure that we're dealing with the second. if (this.urlIsSet) { response = window.frames['ux-lightbox-shim'].response; if(response) { if (response.error) { this.setMessage(response.error, 200, 100, false); } else { this.close(); } } else { els.msg.hide(); els.loading.hide(); this.resizeBox(this.shimWidth, this.shimHeight); els.shim.fadeIn(); els.header.fadeIn(); els.shim.setStyle({ alpha: '(opacity=100)' }); // @todo Should this code live in feEdit.js? wrapper = window.frames['ux-lightbox-shim'].document.getElementsByClassName('formsOnPageWrapper')[0]; if (Ext.get(wrapper)) { Ext.get(wrapper).setHeight(this.shimHeight - 75); } // @todo Move this code out of the lightbox and into feEdit.js forms = window.frames['ux-lightbox-shim'].document.forms; editForm = Ext.get(forms[0]); if (editForm) { editForm.on('submit', function(evt, el) { this.displayContentUpdateMessage(); }, this); } } } }, |
Ext.get(wrapper).setHeight(this.shimHeight - 75); | Ext.get(wrapper).setHeight(this.shimHeight - 45); | shimLoaded : function() { // iframe load fires on element creation and actual load. Check variable to ensure that we're dealing with the second. if (this.urlIsSet) { response = window.frames['ux-lightbox-shim'].response; if(response) { if (response.error) { this.setMessage(response.error, 200, 100, false); } else { this.close(); } } else { els.msg.hide(); els.loading.hide(); this.resizeBox(this.shimWidth, this.shimHeight); els.shim.fadeIn(); els.header.fadeIn(); els.shim.setStyle({ alpha: '(opacity=100)' }); // @todo Should this code live in feEdit.js? wrapper = window.frames['ux-lightbox-shim'].document.getElementsByClassName('formsOnPageWrapper')[0]; if (Ext.get(wrapper)) { Ext.get(wrapper).setHeight(this.shimHeight - 75); } // @todo Move this code out of the lightbox and into feEdit.js forms = window.frames['ux-lightbox-shim'].document.forms; editForm = Ext.get(forms[0]); if (editForm) { editForm.on('submit', function(evt, el) { this.displayContentUpdateMessage(); }, this); } } } }, |
wrapper = window.frames['ux-lightbox-shim'].document.getElementsByClassName('formsOnPageWrapper')[0]; if (Ext.get(wrapper)) { Ext.get(wrapper).setHeight(this.shimHeight - 75); } | shimLoaded : function() { // iframe load fires on element creation and actual load. Check variable to ensure that we're dealing with the second. if (this.urlIsSet) { response = window.frames['ux-lightbox-shim'].response; if(response) { if (response.error) { this.setMessage(response.error, 200, 100, false); } else { this.close(); } } else { els.msg.hide(); els.loading.hide(); this.resizeBox(this.shimWidth, this.shimHeight); els.shim.fadeIn(); els.header.fadeIn(); els.shim.setStyle({ alpha: '(opacity=100)' }); // @todo Move this code out of the lightbox and into feEdit.js forms = window.frames['ux-lightbox-shim'].document.forms; editForm = Ext.get(forms[0]); if (editForm) { editForm.on('submit', function(evt, el) { this.displayContentUpdateMessage(); }, this); } } } }, |
|
return '<a href="/Gemma/expressionExperiment/showExpressionExperiment.html?id=' + record.get("id") + '" target="_blank">' + value + '</a>'; | return '<a href="/Gemma/expressionExperiment/showExpressionExperiment.html?id=' + (record.get("sourceExperiment") ? record.get("sourceExperiment") : record.get("id")) + '" target="_blank">' + value + '</a>'; | var shortNameRenderer = function(value, metadata, record, rowIndex, colIndex, store) { return '<a href="/Gemma/expressionExperiment/showExpressionExperiment.html?id=' + record.get("id") + '" target="_blank">' + value + '</a>'; }; |
this.contentContainer.setStyles({ width: null, height: null }); | show : function(e) { if (this.list.count() ==0) { return; } this.target = e.target; this.contentContainer.setStyle('visibility','hidden'); this.contentContainer.setStyle('display','block'); document.id(document.body).adopt(this.contentContainer); /* we have to size the container for IE to render the chrome correctly * but just in the menu/sub menu case - there is some horrible peekaboo * bug in IE related to ULs that we just couldn't figure out */ this.contentContainer.setContentBoxSize(this.subDomObj.getMarginBoxSize()); this.position(this.contentContainer, document.body, { horizontal: [e.page.x + ' left'], vertical: [e.page.y + ' top', e.page.y + ' bottom'], offsets: this.chromeOffsets }); this.contentContainer.setStyle('visibility',''); this.showChrome(this.contentContainer); document.addEvent('mousedown', this.hide); document.addEvent('keyup', this.keypressHandler); e.stop(); } |
|
if (canPostComments(id)) link.parent().find("textarea").get(0).focus(); | if (canPostComments(id)) { link.parent().find("textarea").get(0).focus(); } | show: function(id) { var jDiv = jDivInit(id); getComments(id, jDiv); renderForm(id); jDiv.show(); var link = $('#comments-link-' + objectType + '-' + id); if (canPostComments(id)) link.parent().find("textarea").get(0).focus(); link.remove(); }, |
this.setActive(true); | show: function() { if (this.open || this.menu.list.count() == 0) { return; } this.menu.show(); this.open = true; this.setActive(true); }, |
|
this.contentContainer.setStyles({ width: null, height: null }); | show : function() { if (this.button) { if (Jx.Menu.Menus[0]) { if (Jx.Menu.Menus[0] != this) { Jx.Menu.Menus[0].button.blur(); Jx.Menu.Menus[0].hide(); } else { this.hide(); return; } } Jx.Menu.Menus[0] = this; this.button.focus(); if (this.list.count() == 0) { return; } } this.contentContainer.setStyle('display','none'); document.id(document.body).adopt(this.contentContainer); this.contentContainer.setStyles({ visibility: 'hidden', display: 'block' }); /* we have to size the container for IE to render the chrome correctly * but just in the menu/sub menu case - there is some horrible * peekaboo bug in IE related to ULs that we just couldn't figure out */ this.contentContainer.setStyles({ width: null, height: null }); this.contentContainer.setContentBoxSize(this.subDomObj.getMarginBoxSize()); this.showChrome(this.contentContainer); this.position(this.contentContainer, this.domObj, $merge({ offsets: this.chromeOffsets }, this.options.position)); this.stack(this.contentContainer); this.contentContainer.setStyle('visibility','visible'); if (this.button && this.button.domA) { this.button.domA.addClass(this.button.options.activeClass); } /* fix bug in IE that closes the menu as it opens * because of bubbling (I think) */ document.addEvent('mousedown', this.bound.hide); document.addEvent('keydown', this.bound.keypress); this.fireEvent('show', this); }, |
|
document.addEvent('mousedown', this.hide); document.addEvent('keydown', this.keypressHandler); | document.addEvent('mousedown', this.bound.hide); document.addEvent('keydown', this.bound.keypress); | show : function() { if (this.button) { if (Jx.Menu.Menus[0]) { if (Jx.Menu.Menus[0] != this) { Jx.Menu.Menus[0].button.blur(); Jx.Menu.Menus[0].hide(); } else { this.hide(); return; } } Jx.Menu.Menus[0] = this; this.button.focus(); if (this.list.count() == 0) { return; } } this.contentContainer.setStyle('display','none'); document.id(document.body).adopt(this.contentContainer); this.contentContainer.setStyles({ visibility: 'hidden', display: 'block' }); /* we have to size the container for IE to render the chrome correctly * but just in the menu/sub menu case - there is some horrible * peekaboo bug in IE related to ULs that we just couldn't figure out */ this.contentContainer.setStyles({ width: null, height: null }); this.contentContainer.setContentBoxSize(this.subDomObj.getMarginBoxSize()); this.showChrome(this.contentContainer); this.position(this.contentContainer, this.domObj, $merge({ offsets: this.chromeOffsets }, this.options.position)); this.stack(this.contentContainer); this.contentContainer.setStyle('visibility','visible'); if (this.button && this.button.domA) { this.button.domA.addClass(this.button.options.activeClass); } /* fix bug in IE that closes the menu as it opens because of bubbling */ document.addEvent('mousedown', this.hide); document.addEvent('keydown', this.keypressHandler); this.fireEvent('show', this); }, |
document.addEvent('mousedown', this.hide); document.addEvent('keyup', this.keypressHandler); | document.addEvent('mousedown', this.bound.hide); document.addEvent('keyup', this.bound.keypress); | show : function(e) { if (this.list.count() ==0) { return; } this.target = e.target; this.contentContainer.setStyle('visibility','hidden'); this.contentContainer.setStyle('display','block'); document.id(document.body).adopt(this.contentContainer); /* we have to size the container for IE to render the chrome correctly * but just in the menu/sub menu case - there is some horrible peekaboo * bug in IE related to ULs that we just couldn't figure out */ this.contentContainer.setStyles({ width: null, height: null }); this.contentContainer.setContentBoxSize(this.subDomObj.getMarginBoxSize()); this.position(this.contentContainer, document.body, { horizontal: [e.page.x + ' left'], vertical: [e.page.y + ' top', e.page.y + ' bottom'], offsets: this.chromeOffsets }); this.contentContainer.setStyle('visibility',''); this.showChrome(this.contentContainer); document.addEvent('mousedown', this.hide); document.addEvent('keyup', this.keypressHandler); e.stop(); } |
this.contentContainer.setContentBoxSize(this.contentContainer.getMarginBoxSize()); | this.contentContainer.setContentBoxSize(this.subDomObj.getMarginBoxSize()); | show : function() { if (this.button) { if (Jx.Menu.Menus[0]) { if (Jx.Menu.Menus[0] != this) { Jx.Menu.Menus[0].button.blur(); Jx.Menu.Menus[0].hide(); } else { this.hide(); return; } } Jx.Menu.Menus[0] = this; this.button.focus(); if (this.list.count() == 0) { return; } } this.contentContainer.setStyle('display','none'); document.id(document.body).adopt(this.contentContainer); this.contentContainer.setStyles({ visibility: 'hidden', display: 'block' }); /* we have to size the container for IE to render the chrome correctly * but just in the menu/sub menu case - there is some horrible peekaboo * bug in IE related to ULs that we just couldn't figure out */ this.contentContainer.setContentBoxSize(this.contentContainer.getMarginBoxSize()); this.showChrome(this.contentContainer); this.position(this.contentContainer, this.domObj, $merge({ offsets: this.chromeOffsets }, this.options.position)); this.stack(this.contentContainer); this.contentContainer.setStyle('visibility','visible'); if (this.button && this.button.domA) { this.button.domA.addClass(this.button.options.activeClass); } /* fix bug in IE that closes the menu as it opens because of bubbling */ document.addEvent('mousedown', this.bound.mousedown); document.addEvent('keydown', this.bound.keypress); this.fireEvent('show', this); }, |
this.stack(this.contentContainer); | show : function() { if (this.button) { if (Jx.Menu.Menus[0]) { if (Jx.Menu.Menus[0] != this) { Jx.Menu.Menus[0].button.blur(); Jx.Menu.Menus[0].hide(); } else { this.hide(); return; } } Jx.Menu.Menus[0] = this; this.button.focus(); if (this.list.count() == 0) { return; } } this.contentContainer.setStyle('display','none'); document.id(document.body).adopt(this.contentContainer); this.contentContainer.setStyles({ visibility: 'hidden', display: 'block' }); /* we have to size the container for IE to render the chrome correctly * but just in the menu/sub menu case - there is some horrible peekaboo * bug in IE related to ULs that we just couldn't figure out */ this.contentContainer.setContentBoxSize(this.contentContainer.getMarginBoxSize()); this.showChrome(this.contentContainer); this.position(this.contentContainer, this.domObj, $merge({ offsets: this.chromeOffsets }, this.options.position)); this.contentContainer.setStyle('visibility','visible'); if (this.button && this.button.domA) { this.button.domA.addClass(this.button.options.activeClass); } /* fix bug in IE that closes the menu as it opens because of bubbling */ document.addEvent('mousedown', this.bound.mousedown); document.addEvent('keydown', this.bound.keypress); this.fireEvent('show', this); }, |
|
this.stack(); | show : function( ) { /* prepare the dialog for display */ this.domObj.setStyles({ 'display': 'block', 'visibility': 'hidden' }); this.toolbar.update(); Jx.Dialog.orderDialogs(this); /* do the modal thing */ if (this.options.modal && this.options.parent.mask) { var opts = $merge(this.options.maskOptions || {}, { style: { 'z-index': Jx.getNumber(this.domObj.getStyle('z-index')) - 1 } }); this.options.parent.mask(opts); } if (this.options.closed) { var m = this.domObj.measure(function(){ return this.getSizes(['margin'],['top','bottom']).margin; }); var size = this.title.getMarginBoxSize(); this.domObj.resize({height: m.top + size.height + m.bottom}); } else { this.domObj.resize(this.options); } if (this.firstShow) { this.contentContainer.resize({forceResize: true}); this.layoutContent(); this.firstShow = false; /* if the chrome got built before the first dialog show, it might * not have been properly created and we should clear it so it * does get built properly */ if (this.chrome) { this.chrome.dispose(); this.chrome = null; } } /* update or create the chrome */ this.showChrome(this.domObj); /* put it in the right place using auto-positioning */ this.position(this.domObj, this.options.parent, this.options); this.domObj.setStyle('visibility', 'visible'); }, |
|
Jx.Dialog.orderDialogs(this); | show : function( ) { /* prepare the dialog for display */ this.domObj.setStyles({ 'display': 'block', 'visibility': 'hidden' }); this.toolbar.update(); Jx.Dialog.orderDialogs(this); /* do the modal thing */ if (this.options.modal && this.options.parent.mask) { var opts = $merge(this.options.maskOptions || {}, { style: { 'z-index': Jx.getNumber(this.domObj.getStyle('z-index')) - 1 } }); this.options.parent.mask(opts); } if (this.options.closed) { var m = this.domObj.measure(function(){ return this.getSizes(['margin'],['top','bottom']).margin; }); var size = this.title.getMarginBoxSize(); this.domObj.resize({height: m.top + size.height + m.bottom}); } else { this.domObj.resize(this.options); } if (this.firstShow) { this.contentContainer.resize({forceResize: true}); this.layoutContent(); this.firstShow = false; /* if the chrome got built before the first dialog show, it might * not have been properly created and we should clear it so it * does get built properly */ if (this.chrome) { this.chrome.dispose(); this.chrome = null; } } /* update or create the chrome */ this.showChrome(this.domObj); /* put it in the right place using auto-positioning */ this.position(this.domObj, this.options.parent, this.options); this.domObj.setStyle('visibility', 'visible'); }, |
|
items.each( function(e) { e.className = "item shown"; }); | for (var i = 0; i < items.length; i++) items[i].className = "item shown"; | function show_all(){ items = document.getElementsByClassName("item", "items"); items.each( function(e) { e.className = "item shown"; });} |
_sgffx.setXulObjectVisibility('showfaxmenuitem', 1); | var showActiveMenu = function() { if (_sgffx.systemArea == 'team') { _sgffx.setXulObjectVisibility('sipgateffxDND', 1); } else { _sgffx.setXulObjectVisibility('sipgateffxDND', 0); } _sgffx.setXulObjectVisibility('showcreditmenuitem', 1); _sgffx.setXulObjectVisibility('showvoicemailmenuitem', 1); _sgffx.setXulObjectVisibility('showphonebookmenuitem', 1); _sgffx.setXulObjectVisibility('showhistorymenuitem', 1); _sgffx.setXulObjectVisibility('showfaxmenuitem', 1); _sgffx.setXulObjectVisibility('showitemizedmenuitem', 1); _sgffx.setXulObjectVisibility('pollbalance', 1); _sgffx.setXulObjectVisibility('showsmsformmenuitem', 1); _sgffx.setXulObjectVisibility('showphonenumberformmenuitem', 1); _sgffx.setXulObjectVisibility('item_logoff', 1); _sgffx.setXulObjectVisibility('separator1', 1); _sgffx.setXulObjectVisibility('separator2', 1); if (!_sgffx.getPref("extensions.sipgateffx.parsenumbers", "bool")) { _sgffx.setXulObjectVisibility('dialactivate', 1); } _sgffx.setXulObjectVisibility('item_logon', 0); _sgffx.setXulObjectVisibility('sipgateffx_loggedout', 0); _sgffx.setXulObjectVisibility('sipgateffx_loggedin', 1); } |
|
_sgffx.setXulObjectVisibility('showsmsformmenuitem', 1); | var showActiveMenu = function() { if (_sgffx.systemArea == 'team') { _sgffx.setXulObjectVisibility('sipgateffxDND', 1); } else { _sgffx.setXulObjectVisibility('sipgateffxDND', 0); } _sgffx.setXulObjectVisibility('showcreditmenuitem', 1); _sgffx.setXulObjectVisibility('showvoicemailmenuitem', 1); _sgffx.setXulObjectVisibility('showphonebookmenuitem', 1); _sgffx.setXulObjectVisibility('showhistorymenuitem', 1); _sgffx.setXulObjectVisibility('showfaxmenuitem', 1); _sgffx.setXulObjectVisibility('showitemizedmenuitem', 1); _sgffx.setXulObjectVisibility('pollbalance', 1); _sgffx.setXulObjectVisibility('showsmsformmenuitem', 1); _sgffx.setXulObjectVisibility('showphonenumberformmenuitem', 1); _sgffx.setXulObjectVisibility('item_logoff', 1); _sgffx.setXulObjectVisibility('separator1', 1); _sgffx.setXulObjectVisibility('separator2', 1); if (!_sgffx.getPref("extensions.sipgateffx.parsenumbers", "bool")) { _sgffx.setXulObjectVisibility('dialactivate', 1); } _sgffx.setXulObjectVisibility('item_logon', 0); _sgffx.setXulObjectVisibility('sipgateffx_loggedout', 0); _sgffx.setXulObjectVisibility('sipgateffx_loggedin', 1); } |
|
width : 420, | showAllMessages : function(t) { if (!this.allMessages) { return; } var msgs = new Ext.Window({ id : 'all-messages-window', title : t ? t : "Messages logged", layout : 'fit', closeAction : 'close', items : [{ xtype : 'panel', stateful : false, height : 200, autoScroll : true, width : 400, bodyStyle : 'padding:5px', html : "The following messages were generated:<br/>" + this.allMessages }], buttons : [{ text : "OK", handler : function() { Ext.getCmp('all-messages-window').close(); } }] }); msgs.show(); }, |
|
availableTabInFocus = true; | function showAvailableTab(){ $("#tabAvailable").css('background-color', highlight); $("#tabBorrowed").css('background-color', silver); $("#tabOwned").css('background-color', silver); $("#tabFriend").css('background-color', silver); $("#my_div").hide(); $("#borrowed_div").hide(); $("#friend_div").hide(); $("#others_div").show();} |
|
if(argument[0]==false) paging = false; | if(arguments[0]==false) paging = false; | function showAvailableTab(){ $("#tabAvailable").css('background-color', highlight); $("#tabBorrowed").css('background-color', silver); $("#tabOwned").css('background-color', silver); $("#tabFriend").css('background-color', silver); $("#my_div").hide(); $("#borrowed_div").hide(); $("#friend_div").hide(); $("#others_div").show(); paging = true; if(argument[0]==false) paging = false;//no pagination for search results} |
for (var i = 0; i < json.length; i++) | for (var i = 0; i < json.length; i++){ | var showComments = function(id, json) { var jDiv = jDivInit(id); //jDiv = jDiv.find("div.comments"); // this div should contain any fetched comments.. //jDiv.find("div[id^='comment-" + objectType + "-'" + "]").remove(); // clean previous calls.. jDiv.children().remove(); removeLoader(); if (json && json.length > 0) { for (var i = 0; i < json.length; i++) renderComment(jDiv, json[i]); jDiv.children().show(); } }; |
} | var showComments = function(id, json) { var jDiv = jDivInit(id); //jDiv = jDiv.find("div.comments"); // this div should contain any fetched comments.. //jDiv.find("div[id^='comment-" + objectType + "-'" + "]").remove(); // clean previous calls.. jDiv.children().remove(); removeLoader(); if (json && json.length > 0) { for (var i = 0; i < json.length; i++) renderComment(jDiv, json[i]); jDiv.children().show(); } }; |
|
uploadForm.on('start', function(result) { | uploadForm.on('start', function(taskId) { | var showDesignUploadForm = function() { var uploadForm = new Gemma.FileUploadForm({ title : 'Select the design file', id : 'upload-design-form', style : 'margin : 5px', allowBlank : false }); uploadForm.on('start', function(result) { Ext.getCmp('submit-design-button').disable(); }.createDelegate(this)); uploadForm.on('finish', function(result) { if (result.success) { Ext.getCmp('submit-design-button').enable(); serverFilePath = result.localFile; } }); var w = new Ext.Window({ title : "Experimental design upload", closeAction : 'close', id : 'experimental-design-upload-form-window', width : 550, items : [{ xtype : 'panel', collapsible : true, title : 'Instructions', collapsed : false, frame : false, border : true, html : '<p>Experimental design submission works in two phases. ' + 'First you must upload your design file (file format instructions' + ' <a target="_blank" href="' + Gemma.HOST + 'faculty/pavlidis/wiki/display/gemma/Experimental+Design+Upload">here</a>). ' + 'Then click "submit". If your file format is invalid or does not match the properties of the ' + 'experiment the design is intended for, you will see an error message.</p>' }, uploadForm], buttons : [{ id : 'submit-design-button', value : 'Submit', handler : submitDesign, text : "Submit dataset", disabled : true }, { value : 'Cancel', text : 'Cancel', enabled : true, handler : function() { w.close(); } }] }); w.show();}; |
title : "Experimental design upload", closeAction : 'close', id : 'experimental-design-upload-form-window', width : 550, items : [{ xtype : 'panel', collapsible : true, title : 'Instructions', collapsed : false, frame : false, border : true, html : '<p>Experimental design submission works in two phases. ' + 'First you must upload your design file (file format instructions' + ' <a target="_blank" href="http: 'Then click "submit". If your file format is invalid or does not match the properties of the ' + 'experiment the design is intended for, you will see an error message.</p>' }, uploadForm], buttons : [{ id : 'submit-design-button', value : 'Submit', handler : submitDesign, text : "Submit dataset", disabled : true }, { value : 'Cancel', text : 'Cancel', enabled : true, handler : function() { w.close(); } }] }); | title : "Experimental design upload", closeAction : 'close', id : 'experimental-design-upload-form-window', width : 550, items : [{ xtype : 'panel', collapsible : true, title : 'Instructions', collapsed : false, frame : false, border : true, html : '<p>Experimental design submission works in two phases. ' + 'First you must upload your design file (file format instructions' + ' <a target="_blank" href="' + Gemma.HOST + 'faculty/pavlidis/wiki/display/gemma/Experimental+Design+Upload">here</a>). ' + 'Then click "submit". If your file format is invalid or does not match the properties of the ' + 'experiment the design is intended for, you will see an error message.</p>' }, uploadForm], buttons : [{ id : 'submit-design-button', value : 'Submit', handler : submitDesign, text : "Submit dataset", disabled : true }, { value : 'Cancel', text : 'Cancel', enabled : true, handler : function() { w.close(); } }] }); | var showDesignUploadForm = function() { var uploadForm = new Gemma.FileUploadForm({ title : 'Select the design file', id : 'upload-design-form', style : 'margin : 5px', allowBlank : false }); uploadForm.on('start', function(result) { Ext.getCmp('submit-design-button').disable(); }.createDelegate(this)); uploadForm.on('finish', function(result) { if (result.success) { Ext.getCmp('submit-design-button').enable(); serverFilePath = result.localFile; } }); var w = new Ext.Window({ title : "Experimental design upload", closeAction : 'close', id : 'experimental-design-upload-form-window', width : 550, items : [{ xtype : 'panel', collapsible : true, title : 'Instructions', collapsed : false, frame : false, border : true, html : '<p>Experimental design submission works in two phases. ' + 'First you must upload your design file (file format instructions' + ' <a target="_blank" href="http://www.chibi.ubc.ca/faculty/pavlidis/wiki/display/gemma/Experimental+Design+Upload">here</a>). ' + 'Then click "submit". If your file format is invalid or does not match the properties of the ' + 'experiment the design is intended for, you will see an error message.</p>' }, uploadForm], buttons : [{ id : 'submit-design-button', value : 'Submit', handler : submitDesign, text : "Submit dataset", disabled : true }, { value : 'Cancel', text : 'Cancel', enabled : true, handler : function() { w.close(); } }] }); w.show();}; |
html : '<p>Experimental design submission works in two phases. ' + 'First you must upload your design file (file format instructions' + ' <a target="_blank" href="http: + 'Then click "submit". If your file format is invalid or does not match the properties of the ' + 'experiment the design is intended for, you will see an error message.</p>' | html : '<p>Experimental design submission works in two phases. ' + 'First you must upload your design file (file format instructions' + ' <a target="_blank" href="http: 'Then click "submit". If your file format is invalid or does not match the properties of the ' + 'experiment the design is intended for, you will see an error message.</p>' | var showDesignUploadForm = function() { var uploadForm = new Gemma.FileUploadForm({ title : 'Select the design file', id : 'upload-design-form', style : 'margin : 5px', allowBlank : false }); uploadForm.on('start', function(result) { Ext.getCmp('submit-design-button').disable(); }.createDelegate(this)); uploadForm.on('finish', function(result) { if (result.success) { Ext.getCmp('submit-design-button').enable(); serverFilePath = result.localFile; } }); var w = new Ext.Window({ title : "Experimental design upload", closeAction : 'close', id : 'experimental-design-upload-form-window', width : 550, items : [{ xtype : 'panel', collapsible : true, title : 'Instructions', collapsed : false, frame : false, border : true, html : '<p>Experimental design submission works in two phases. ' + 'First you must upload your design file (file format instructions' + ' <a target="_blank" href="http://www.chibi.ubc.ca/faculty/pavlidis/wiki/display/gemma/Experimental+Design+Upload">here</a>). ' + 'Then click "submit". If your file format is invalid or does not match the properties of the ' + 'experiment the design is intended for, you will see an error message.</p>' }, uploadForm], buttons : [{ id : 'submit-design-button', value : 'Submit', handler : submitDesign, text : "Submit dataset", disabled : true }, { value : 'Cancel', text : 'Cancel', enabled : true, handler : function() { w.close(); } }] }); w.show();}; |
availableTabInFocus = false; | function showFriendsTab(){ $("#tabFriend").css('background-color', highlight); $("#tabFriend").show(); $("#tabAvailable").css('background-color', silver); $("#tabBorrowed").css('background-color', silver); $("#tabOwned").css('background-color', silver); $("#my_div").hide(); $("#borrowed_div").hide(); $("#others_div").hide(); $("#friend_div").show();} |
|
loadTags(albumPos); | function showImage(albumPos) { var img = document.createElement("img"); img.onload = function(evt) { document.getElementById("albumImage").src = this.src; document.getElementById("albumImage").width=this.width; document.getElementById("albumImage").height=this.height; } img.src = window.location.href + "gallery/"+ this.albumName +"/" + albumItems[albumPos]; return false;} |
|
this.log("showlist"); | showList: function() { this.log("showlist"); if(this.listVisible()) return; this.listWrapper.removeClass(this.css.hidden); this.setListDisplay(); }, |
|
runHook("showObject", FBEFORE); | runHook("showObject", FBEFORE, obj); | function showObject(obj) { runHook("showObject", FBEFORE); var theObj=(olNs4 ? obj : obj.style); theObj.visibility = 'visible'; runHook("showObject", FAFTER);} |
runHook("showObject", FAFTER); | runHook("showObject", FAFTER, obj); | function showObject(obj) { runHook("showObject", FBEFORE); var theObj=(olNs4 ? obj : obj.style); theObj.visibility = 'visible'; runHook("showObject", FAFTER);} |
availableTabInFocus = false; | function showOwnedTab(){ $("#tabOwned").css('background-color', highlight); $("#tabAvailable").css('background-color', silver); $("#tabBorrowed").css('background-color', silver); $("#tabFriend").css('background-color', silver); if (own_count > 25) $("#searchMineBar").show(); $("#borrowed_div").hide(); $("#others_div").hide(); $("#friend_div").hide(); $("#my_div").show();} |
|
this.popup.domObj.setStyles({ 'width' : cell.getContentBoxSize().width }); | showPopUp : function(cell) { if(this.popup.domObj != null) { this.popup.domObj.setStyles({ 'width' : cell.getContentBoxSize().width }); Jx.Widget.prototype.position(this.popup.domObj, cell, { horizontal: ['left left'], vertical: ['top top'] }); this.activeCell.field.domObj.inject(this.popup.innerWrapper, 'top'); this.popup.domObj.show(); this.setPopUpButtons(); this.setPopUpStylesAfterRendering(); }else{ this.createPopUp(cell); } }, |
|
readerChecks = []; writerChecks = []; | readerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-read-chk", disabled : true })]; writerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-write-chk", disabled : true })]; | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; readerChecks = []; writerChecks = []; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ if (readerChecks.size() != 0) { Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); } if (writerChecks.size() != 0) { Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); } this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext .getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk") .getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
callback : function() { | callback : function(updatedInfo) { | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; var canManage = securityInfo.currentUserCanwrite; // FIXME: // Server returns null if the currently logged user belongs to no // custom groups which is bad (for following reasons) and technikally // incorrect. // All users belong to the user group anyway but can't edit it. // Adding an array=null to a Component bombs. Adding a null check // doesn't // help because the panel has a 'field set' already declared, which at // runtime has to have at least one checkbox in it. // A way out of this is to apply the combo boxes and the field set at // the same time if they are necessary. // My kungfu no enough strong ;p readerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-read-chk", disabled : true })]; writerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-write-chk", disabled : true })]; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ if (readerChecks.size() != 0) { Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); } if (writerChecks.size() != 0) { Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); } this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic, disabled : !canManage }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', disabled : !canManage, columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', disabled : !canManage, columns : 1 }] }] }], buttons : [{ text : "Save changes", disabled : !canManage, handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); | Gemma.SecurityManager.updateSecurityLink(elid, updatedInfo.entityClass, updatedInfo.entityId, updatedInfo.publiclyReadable, shared, updatedInfo.currentUserCanwrite); | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; var canManage = securityInfo.currentUserCanwrite; // FIXME: // Server returns null if the currently logged user belongs to no // custom groups which is bad (for following reasons) and technikally // incorrect. // All users belong to the user group anyway but can't edit it. // Adding an array=null to a Component bombs. Adding a null check // doesn't // help because the panel has a 'field set' already declared, which at // runtime has to have at least one checkbox in it. // A way out of this is to apply the combo boxes and the field set at // the same time if they are necessary. // My kungfu no enough strong ;p readerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-read-chk", disabled : true })]; writerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-write-chk", disabled : true })]; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ if (readerChecks.size() != 0) { Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); } if (writerChecks.size() != 0) { Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); } this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic, disabled : !canManage }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', disabled : !canManage, columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', disabled : !canManage, columns : 1 }] }] }], buttons : [{ text : "Save changes", disabled : !canManage, handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); | Gemma.SecurityManager.updateSecurityLink(elid, updatedInfo.entityClass, updatedInfo.entityId, updatedInfo.publiclyReadable, updatedInfo.shared, updatedInfo.currentUserCanwrite); | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; var canManage = securityInfo.currentUserCanwrite; // FIXME: // Server returns null if the currently logged user belongs to no // custom groups which is bad (for following reasons) and technikally // incorrect. // All users belong to the user group anyway but can't edit it. // Adding an array=null to a Component bombs. Adding a null check // doesn't // help because the panel has a 'field set' already declared, which at // runtime has to have at least one checkbox in it. // A way out of this is to apply the combo boxes and the field set at // the same time if they are necessary. // My kungfu no enough strong ;p readerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-read-chk", disabled : true })]; writerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-write-chk", disabled : true })]; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ if (readerChecks.size() != 0) { Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); } if (writerChecks.size() != 0) { Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); } this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic, disabled : !canManage }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', disabled : !canManage, columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', disabled : !canManage, columns : 1 }] }] }], buttons : [{ text : "Save changes", disabled : !canManage, handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); | Gemma.SecurityManager.updateSecurityLink(elid, clazz, id, isPublic, isShared, canEdit); | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; var canManage = securityInfo.currentUserCanwrite; // FIXME: // Server returns null if the currently logged user belongs to no // custom groups which is bad (for following reasons) and technikally // incorrect. // All users belong to the user group anyway but can't edit it. // Adding an array=null to a Component bombs. Adding a null check // doesn't // help because the panel has a 'field set' already declared, which at // runtime has to have at least one checkbox in it. // A way out of this is to apply the combo boxes and the field set at // the same time if they are necessary. // My kungfu no enough strong ;p readerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-read-chk", disabled : true })]; writerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-write-chk", disabled : true })]; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ if (readerChecks.size() != 0) { Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); } if (writerChecks.size() != 0) { Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); } this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic, disabled : !canManage }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', disabled : !canManage, columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', disabled : !canManage, columns : 1 }] }] }], buttons : [{ text : "Save changes", disabled : !canManage, handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
SecurityController.updatePermissions(securityInfo, { | SecurityController.updatePermission(securityInfo, { | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; readerChecks = []; writerChecks = []; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermissions(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; readerChecks = []; writerChecks = []; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
|
this.doLayout(); | if (readerChecks.size() != 0) { Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); } if (writerChecks.size() != 0) { Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); } this.doLayout(); | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; readerChecks = []; writerChecks = []; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' | items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext .getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk") .getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, shared); | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; readerChecks = []; writerChecks = []; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { | errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; readerChecks = []; writerChecks = []; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); | Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, sared); | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; readerChecks = []; writerChecks = []; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue(); | } }); | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; readerChecks = []; writerChecks = []; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); | } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; readerChecks = []; writerChecks = []; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext.getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { | items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic, disabled : !canManage }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', disabled : !canManage, columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', disabled : !canManage, columns : 1 }] }] }], buttons : [{ text : "Save changes", disabled : !canManage, handler : function(b, e) { | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; // FIXME: // Server returns null if the currently logged user belongs to no // custom groups which is bad (for following reasons) and technikally // incorrect. // All users belong to the user group anyway but can't edit it. // Adding an array=null to a Component bombs. Adding a null check // doesn't // help because the panel has a 'field set' already declared, which at // runtime has to have at least one checkbox in it. // A way out of this is to apply the combo boxes and the field set at // the same time if they are necessary. // My kungfu no enough strong ;p readerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-read-chk", disabled : true })]; writerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-write-chk", disabled : true })]; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ if (readerChecks.size() != 0) { Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); } if (writerChecks.size() != 0) { Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); } this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext .getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk") .getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; | var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink(elid, securityInfo.publiclyReadable, sared); } }); | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; // FIXME: // Server returns null if the currently logged user belongs to no // custom groups which is bad (for following reasons) and technikally // incorrect. // All users belong to the user group anyway but can't edit it. // Adding an array=null to a Component bombs. Adding a null check // doesn't // help because the panel has a 'field set' already declared, which at // runtime has to have at least one checkbox in it. // A way out of this is to apply the combo boxes and the field set at // the same time if they are necessary. // My kungfu no enough strong ;p readerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-read-chk", disabled : true })]; writerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-write-chk", disabled : true })]; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ if (readerChecks.size() != 0) { Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); } if (writerChecks.size() != 0) { Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); } this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext .getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk") .getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; | }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; // FIXME: // Server returns null if the currently logged user belongs to no // custom groups which is bad (for following reasons) and technikally // incorrect. // All users belong to the user group anyway but can't edit it. // Adding an array=null to a Component bombs. Adding a null check // doesn't // help because the panel has a 'field set' already declared, which at // runtime has to have at least one checkbox in it. // A way out of this is to apply the combo boxes and the field set at // the same time if they are necessary. // My kungfu no enough strong ;p readerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-read-chk", disabled : true })]; writerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-write-chk", disabled : true })]; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ if (readerChecks.size() != 0) { Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); } if (writerChecks.size() != 0) { Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); } this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext .getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk") .getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk") .getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); | }] }); | var showSecurityForm = function(securityInfo) { var isPublic = securityInfo.publiclyReadable; var isShared = securityInfo.shared; var readers = securityInfo.groupsThatCanRead; var writers = securityInfo.groupsThatCanWrite; var availableGroups = securityInfo.availableGroups; // FIXME: // Server returns null if the currently logged user belongs to no // custom groups which is bad (for following reasons) and technikally // incorrect. // All users belong to the user group anyway but can't edit it. // Adding an array=null to a Component bombs. Adding a null check // doesn't // help because the panel has a 'field set' already declared, which at // runtime has to have at least one checkbox in it. // A way out of this is to apply the combo boxes and the field set at // the same time if they are necessary. // My kungfu no enough strong ;p readerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-read-chk", disabled : true })]; writerChecks = [new Ext.form.Checkbox({ checked : true, boxLabel : 'Users', id : 'user' + "-write-chk", disabled : true })]; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; readerChecks.push(new Ext.form.Checkbox({ checked : readers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-read-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); writerChecks.push(new Ext.form.Checkbox({ checked : writers.indexOf(groupName) >= 0, boxLabel : groupName, id : groupName + "-write-chk", disabled : groupName === Gemma.SecurityManager.adminGroupName })); } /* * show panel... */ var sp = new Ext.Window({ title : "Security for: " + Ext.util.Format.ellipsis(securityInfo.entityName, 70, true), height : 300, width : 500, minimizable : false, maximizable : false, modal : true, bodyStyle : 'padding:5px 5px 0', stateful : false, initComponent : function() { Ext.Window.superclass.initComponent.call(this); /* * Add checkboxes as needed... */ if (readerChecks.size() != 0) { Ext.apply(Ext.getCmp('reader-checks'), { items : readerChecks }); } if (writerChecks.size() != 0) { Ext.apply(Ext.getCmp('writer-checks'), { items : writerChecks }); } this.doLayout(); }, items : [{ xtype : 'form', layout : 'column', autoHeight : true, autoWidth : true, defaults : { layout : 'form', border : false, bodyStyle : 'padding:4px' }, items : [{ xtype : 'fieldset', autoHeight : true, autoWidth : true, items : [{ xtype : 'checkbox', boxLabel : "Public", id : 'public-checkbox', checked : isPublic }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : "Readers", id : 'reader-checks', columns : 1 }, { xtype : 'checkboxgroup', width : 300, itemCls : 'x-check-group-alt', fieldLabel : 'Writers', id : 'writer-checks', columns : 1 }] }] }], buttons : [{ text : "Save changes", handler : function(b, e) { var loadMask = new Ext.LoadMask(sp.getEl(), { msg : "Saving changes..." }); loadMask.show(); securityInfo.publiclyReadable = Ext .getCmp('public-checkbox').getValue(); var updatedGroupsThatCanRead = []; var updatedGroupsThatCanWrite = []; var shared = false; for (var i = 0, len = availableGroups.length; i < len; i++) { var groupName = availableGroups[i]; if (groupName === Gemma.SecurityManager.adminGroupName) { continue; } if (Ext.getCmp(groupName + "-write-chk").getValue()) { updatedGroupsThatCanWrite.push(groupName); shared = true; } if (Ext.getCmp(groupName + "-read-chk").getValue() || Ext.getCmp(groupName + "-write-chk") .getValue()) { updatedGroupsThatCanRead.push(groupName); shared = true; } } securityInfo.groupsThatCanWrite = updatedGroupsThatCanWrite; securityInfo.groupsThatCanRead = updatedGroupsThatCanRead; SecurityController.updatePermission(securityInfo, { callback : function() { sp.destroy(); Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, shared); }, errorHandler : function() { sp.destroy(); alert("There was an error saving the settings."); Gemma.SecurityManager.updateSecurityLink( elid, securityInfo.publiclyReadable, sared); } }); } }, { text : 'Cancel', handler : function(b, e) { sp.destroy(); } }] }); sp.show(); // remove the load mask from the table. Gemma.SecurityManager.updateSecurityLink(elid, isPublic, isShared); }; |
updateBadge(data); | var badge = {}; var badgeDisplay = "Quota Used"; var remaining = (data[0].limit - data[0].usagemb); badgeDisplay = localStorage['badgeDisplay']; switch(badgeDisplay){ case "Quota Used": badgeContent = fB(data[i].usagemb,byteFormat,0)+''; break; case "Quota Remaining": badgeContent = fB(remaining,byteFormat,0)+''; break; case "Quota Remaining per day": badgeContent = dataperday+''; break; case "Percent Used": badgeContent = pc+'%'; break; case "Percent Remaining": badgeContent = 100-pc+'%'; break; case "Target": badgeContent = fB(data.target,byteFormat,0)+''; break; default: badgeContent = ''; } badge.text = badgeContent; chrome.browserAction.setBadgeText(badge); | function showUsage(data) { var divEl = document.getElementById("maindiv"); divEl.innerHTML = ""; if(data != null && data[0].error == null) { for(var i = 0; i < data.length; i++) { //For testing: Pretend we're in line, in deficit or over quota //data[i].usagemb = 76000; //28746+8415; // Define variables var daysleft = (data[i].daysleft > 0)? data[i].daysleft:1; //minimum days left is one var pc = Math.round((data[i].usagemb/data[i].limit)*100); var remaining = (data[i].limit - data[i].usagemb); var dataperday = Math.round(remaining/daysleft); // TODO: Days in the "BILLING" month BUG: Current Month. var today = new Date(); var year = today.getYear(); var month = today.getMonth(); var hour = today.getHours(); var daysinmonth = getLastDayOfMonth(month,year); // Calculate the target surplus/deficit // Trying to do maths (MATH) while drinking vodka+wicked is hard var expectedusageperday = Math.round(data[i].limit/daysinmonth); var currentusageperday = 0; var target = 0; if (daysinmonth==daysleft) { currentusageperday = Math.round(data[i].usagemb); target = (expectedusageperday-currentusageperday)*(daysinmonth-(daysleft-1)); } else { currentusageperday = Math.round(data[i].usagemb/(daysinmonth-daysleft)); target = (expectedusageperday-currentusageperday)*(daysinmonth-daysleft); } var targetastime = Math.round(target/expectedusageperday); // Grammarian corrections for human readability of target var targetreadable = ''; if(target<0) { targetastime = targetastime*-1; } else if(targetastime<1) { targetreadable = Math.round(target/expectedusageperday*24) + 'hr'; targetastime = targetreadable; } else if(targetastime<1.5) { targetreadable = '1 day'; targetastime += 'd'; } else { targetreadable = Math.round(targetastime) + ' days'; targetastime += 'd'; } data.target = target; updateBadge(data); // Create the 'usage meter' var tbl = document.createElement("table"); tbl.className = 'usagemeter'; tbl.style.width = usagemeterwidth+'px'; tbl.style.height = '20px'; tbl.style.backgroundColor = "#fff"; var trow = tbl.insertRow(0); var usedtcol = trow.insertCell(0); var freeWidth = (data[i].limit - data[i].usagemb)/data[i].limit*usagemeterwidth; var usedWidth = usagemeterwidth - freeWidth; if (pc<100) { var freetcol = trow.insertCell(1); freetcol.style.backgroundColor = "#fff"; freetcol.style.backgroundImage = "url(bar_empty.svg)"; freetcol.style.width = freeWidth + 'px'; } if (pc<90) { freetcol.innerHTML = "<div id='pc'>"+pc+"%</div>"; } else { usedtcol.innerHTML = "<div id='pc' class='used'>"+pc+"%</div>"; } usedtcol.style.width = usedWidth + 'px'; // Deficit or Surplus? Red or Green, Remove negative numbers + write help if (target<0) { usedtcol.style.backgroundImage="url(bar_deficit.svg)"; targettype = "Deficit"; targetcolor='red'; var usedbgcolor = 'red'; target = target*-1; abbrtext = 'Minimal quota usage for the next ' +targetreadable+' will bring you back within your limit.'; // Make the badge red, because we're in deficit! badgeColor = {} badgeColor.color = new Array(255, 0, 0, 100); chrome.browserAction.setBadgeBackgroundColor(badgeColor); } else { usedtcol.style.backgroundImage="url(bar_surplus.svg)"; targettype = "Surplus"; targetcolor='green'; var usedbgcolor = '#8D4'; abbrtext = 'Quota is in surplus. You may utilise an additional '+fB(target)+' quota ('+targetreadable+' typical usage) without adverse quota affect.'; // Ooooh. Green badge, all is good! badgeColor = {} badgeColor.color = new Array(0, 213, 7, 100); chrome.browserAction.setBadgeBackgroundColor(badgeColor); } usedtcol.style.backgroundColor = usedbgcolor; //calculate last update time var minutesSinceUpdate = 0; if(localStorage['cacheTime']) { minutesSinceUpdate = parseInt(((new Date()).getTime() - localStorage['cacheTime'])/1000/60); } // TODO: Last update with a quota change, write lastUpdate time to localStorage. // How to convert dates to epoch: Date.parse() or Date.UTC() /* if(localStorage['lastUpdate']!=0) { minutesSinceUpdate = (today.getTime()-localStorage['lastUpdate'])/1000; }*/ // Arrow displaying how much time in the month has elapsed var indicator = document.createElement("img"); indicator.id="indicator"; indicator.src="indicator.svg"; var remWidth = (daysleft/daysinmonth)*usagemeterwidth; var elapWidth = usagemeterwidth - remWidth; indicator.style.marginLeft = elapWidth-8 + 'px'; // Information on how long until the quota resets if(daysleft<=1) { resetreadable = (24-hour) + ' hrs'; } else if(daysleft<=2) { resetreadable = '1 day ' + (24-hour) + ' hours'; } else { if (hour == 0) { resetreadable = Math.round(daysleft) + ' days '; } else { resetreadable = Math.floor(daysleft)-1 + ' days ' + Math.round(24-hour) + ' hrs'; } } // Additional information about the ISP and quota var header = document.createElement("h1"); header.innerHTML = '<b>' + data[i].name + '</b><br>'; var content = document.createElement("table"); // Display in MB if values are less than 1GB if (remaining<gbformat){ remaining = fB(remaining,'MB'); dataperday =fB(dataperday,'MB'); } else { remaining = fB(remaining); dataperday =fB(dataperday); } content.innerHTML = "" +"<tr><th>Quota</th>" +"<td>"+ data[i].usagemb + "/" + data[i].limit +"</td></tr>" +"<tr><th>Remaining</th>" +"<td>"+ remaining + " ("+ (100-pc) + "%) </td></tr>" +"<tr><th></th>" +"<td>"+dataperday+" per day</td></tr>" +"<tr><th>Target "+targettype+"</th>" +"<td><span style='color:"+targetcolor+"'>" + fB(target) +" (<abbr title='"+abbrtext+"'>"+targetastime+"</abbr>)</span></td></tr>" +"<tr><th>Time Remaining</th>" +"<td>"+resetreadable+"</td></tr>" +"<tr><th>Last Update</th><td>" + minutesSinceUpdate + " minutes ago</td></tr>"; // Testing lines //content.innerHTML += data[0].daysleft + " DEBUG<br>"; //content.innerHTML += expectedusageperday + " expectedusageperday DEBUG<br>"; //content.innerHTML += currentusageperday + " currentusageperday DEBUG<br>"; //content.innerHTML += daysinmonth + " daysinmonth DEBUG<br>"; //content.innerHTML += daysleft + " daysleft DEBUG<br>"; // Write the header, the usage meter and the content to the popup. divEl.appendChild(header); divEl.appendChild(tbl); divEl.appendChild(indicator); divEl.appendChild(content); } } else { divEl.innerHTML = data[0].error; }} |
dataperday =fB(dataperday,'MB'); | function showUsage(data) { var divEl = document.getElementById("maindiv"); divEl.innerHTML = ""; if(data != null && data[0].error == null) { for(var i = 0; i < data.length; i++) { //For testing: Pretend we're in line, in deficit or over quota //data[i].usagemb = 76000; //28746+8415; // Define variables var daysleft = (data[i].daysleft > 0)? data[i].daysleft:1; //minimum days left is one var pc = Math.round((data[i].usagemb/data[i].limit)*100); var remaining = (data[i].limit - data[i].usagemb); var dataperday = Math.round(remaining/daysleft); // TODO: Days in the "BILLING" month BUG: Current Month. var today = new Date(); var year = today.getYear(); var month = today.getMonth(); var hour = today.getHours(); var daysinmonth = getLastDayOfMonth(month,year); // Calculate the target surplus/deficit // Trying to do maths (MATH) while drinking vodka+wicked is hard var expectedusageperday = Math.round(data[i].limit/daysinmonth); var currentusageperday = 0; var target = 0; if (daysinmonth==daysleft) { currentusageperday = Math.round(data[i].usagemb); target = (expectedusageperday-currentusageperday)*(daysinmonth-(daysleft-1)); } else { currentusageperday = Math.round(data[i].usagemb/(daysinmonth-daysleft)); target = (expectedusageperday-currentusageperday)*(daysinmonth-daysleft); } var targetastime = Math.round(target/expectedusageperday); // Grammarian corrections for human readability of target var targetreadable = ''; if(target<0) { targetastime = targetastime*-1; } else if(targetastime<1) { targetreadable = Math.round(target/expectedusageperday*24) + 'hr'; targetastime = targetreadable; } else if(targetastime<1.5) { targetreadable = '1 day'; targetastime += 'd'; } else { targetreadable = Math.round(targetastime) + ' days'; targetastime += 'd'; } data.target = target; // Update the Chrome extension "badge" var badge = {}; var badgeDisplay = "Quota Used"; var remaining = (data[i].limit - data[i].usagemb); badgeDisplay = localStorage['badgeDisplay']; /* TODO: Show suffix on badge. Too complex for tonight and not really useful. var format = 'none'; //if (localStorage['formatData'] == 'formatted') { format = 'GB'; } //else { var suf = false; } */ switch(badgeDisplay){ case "Quota Used": badgeContent = fB(data[i].usagemb,byteFormat,0)+''; break; case "Quota Remaining": badgeContent = fB(remaining,byteFormat,0)+''; break; case "Quota Remaining per day": badgeContent = dataperday+''; break; case "Percent Used": badgeContent = pc+'%'; break; case "Percent Remaining": badgeContent = 100-pc+'%'; break; case "Target": badgeContent = fB(data.target,byteFormat,0)+''; break; default: badgeContent = ''; } badge.text = badgeContent; chrome.browserAction.setBadgeText(badge); // Create the 'usage meter' var tbl = document.createElement("table"); tbl.className = 'usagemeter'; tbl.style.width = usagemeterwidth+'px'; tbl.style.height = '20px'; tbl.style.backgroundColor = "#fff"; var trow = tbl.insertRow(0); var usedtcol = trow.insertCell(0); var freeWidth = (data[i].limit - data[i].usagemb)/data[i].limit*usagemeterwidth; var usedWidth = usagemeterwidth - freeWidth; if (pc<100) { var freetcol = trow.insertCell(1); freetcol.style.backgroundColor = "#fff"; freetcol.style.backgroundImage = "url(bar_empty.svg)"; freetcol.style.width = freeWidth + 'px'; } if (pc<90) { freetcol.innerHTML = "<div id='pc'>"+pc+"%</div>"; } else { usedtcol.innerHTML = "<div id='pc' class='used'>"+pc+"%</div>"; } usedtcol.style.width = usedWidth + 'px'; // Deficit or Surplus? Red or Green, Remove negative numbers + write help if (target<0) { usedtcol.style.backgroundImage="url(bar_deficit.svg)"; targettype = "Deficit"; targetcolor='red'; var usedbgcolor = 'red'; target = target*-1; abbrtext = 'Minimal quota usage for the next ' +targetreadable+' will bring you back within your limit.'; // Make the badge red, because we're in deficit! badgeColor = {} badgeColor.color = new Array(255, 0, 0, 100); chrome.browserAction.setBadgeBackgroundColor(badgeColor); } else { usedtcol.style.backgroundImage="url(bar_surplus.svg)"; targettype = "Surplus"; targetcolor='green'; var usedbgcolor = '#8D4'; abbrtext = 'Quota is in surplus. You may utilise an additional '+fB(target)+' quota ('+targetreadable+' typical usage) without adverse quota affect.'; // Ooooh. Green badge, all is good! badgeColor = {} badgeColor.color = new Array(0, 213, 7, 100); chrome.browserAction.setBadgeBackgroundColor(badgeColor); } usedtcol.style.backgroundColor = usedbgcolor; //calculate last update time var minutesSinceUpdate = 0; if(localStorage['cacheTime']) { minutesSinceUpdate = parseInt(((new Date()).getTime() - localStorage['cacheTime'])/1000/60); } // TODO: Last update with a quota change, write lastUpdate time to localStorage. // How to convert dates to epoch: Date.parse() or Date.UTC() /* if(localStorage['lastUpdate']!=0) { minutesSinceUpdate = (today.getTime()-localStorage['lastUpdate'])/1000; }*/ // Arrow displaying how much time in the month has elapsed var indicator = document.createElement("img"); indicator.id="indicator"; indicator.src="indicator.svg"; var remWidth = (daysleft/daysinmonth)*usagemeterwidth; var elapWidth = usagemeterwidth - remWidth; indicator.style.marginLeft = elapWidth-8 + 'px'; // Information on how long until the quota resets if(daysleft<=1) { resetreadable = (24-hour) + ' hrs'; } else if(daysleft<=2) { resetreadable = '1 day ' + (24-hour) + ' hours'; } else { if (hour == 0) { resetreadable = Math.round(daysleft) + ' days '; } else { resetreadable = Math.floor(daysleft)-1 + ' days ' + Math.round(24-hour) + ' hrs'; } } // Additional information about the ISP and quota var header = document.createElement("h1"); header.innerHTML = '<b>' + data[i].name + '</b><br>'; var content = document.createElement("table"); // Display in MB if values are less than 1GB if (remaining<gbformat){ remaining = fB(remaining,'MB'); dataperday =fB(dataperday,'MB'); } else { remaining = fB(remaining); dataperday =fB(dataperday); } content.innerHTML = "" +"<tr><th>Quota</th>" +"<td>"+ data[i].usagemb + "/" + data[i].limit +"</td></tr>" +"<tr><th>Remaining</th>" +"<td>"+ remaining + " ("+ (100-pc) + "%) </td></tr>" +"<tr><th></th>" +"<td>"+dataperday+" per day</td></tr>" +"<tr><th>Target "+targettype+"</th>" +"<td><span style='color:"+targetcolor+"'>" + fB(target) +" (<abbr title='"+abbrtext+"'>"+targetastime+"</abbr>)</span></td></tr>" +"<tr><th>Time Remaining</th>" +"<td>"+resetreadable+"</td></tr>" +"<tr><th>Last Update</th><td>" + minutesSinceUpdate + " minutes ago</td></tr>"; // Testing lines //content.innerHTML += data[0].daysleft + " DEBUG<br>"; //content.innerHTML += expectedusageperday + " expectedusageperday DEBUG<br>"; //content.innerHTML += currentusageperday + " currentusageperday DEBUG<br>"; //content.innerHTML += daysinmonth + " daysinmonth DEBUG<br>"; //content.innerHTML += daysleft + " daysleft DEBUG<br>"; // Write the header, the usage meter and the content to the popup. divEl.appendChild(header); divEl.appendChild(tbl); divEl.appendChild(indicator); divEl.appendChild(content); } } else { divEl.innerHTML = data[0].error; }} |
|
dataperday =fB(dataperday); | } if (dataperday < gbformat){ dataperday = fB(dataperday,'MB'); } else { dataperday = fB(dataperday); | function showUsage(data) { var divEl = document.getElementById("maindiv"); divEl.innerHTML = ""; if(data != null && data[0].error == null) { for(var i = 0; i < data.length; i++) { //For testing: Pretend we're in line, in deficit or over quota //data[i].usagemb = 76000; //28746+8415; // Define variables var daysleft = (data[i].daysleft > 0)? data[i].daysleft:1; //minimum days left is one var pc = Math.round((data[i].usagemb/data[i].limit)*100); var remaining = (data[i].limit - data[i].usagemb); var dataperday = Math.round(remaining/daysleft); // TODO: Days in the "BILLING" month BUG: Current Month. var today = new Date(); var year = today.getYear(); var month = today.getMonth(); var hour = today.getHours(); var daysinmonth = getLastDayOfMonth(month,year); // Calculate the target surplus/deficit // Trying to do maths (MATH) while drinking vodka+wicked is hard var expectedusageperday = Math.round(data[i].limit/daysinmonth); var currentusageperday = 0; var target = 0; if (daysinmonth==daysleft) { currentusageperday = Math.round(data[i].usagemb); target = (expectedusageperday-currentusageperday)*(daysinmonth-(daysleft-1)); } else { currentusageperday = Math.round(data[i].usagemb/(daysinmonth-daysleft)); target = (expectedusageperday-currentusageperday)*(daysinmonth-daysleft); } var targetastime = Math.round(target/expectedusageperday); // Grammarian corrections for human readability of target var targetreadable = ''; if(target<0) { targetastime = targetastime*-1; } else if(targetastime<1) { targetreadable = Math.round(target/expectedusageperday*24) + 'hr'; targetastime = targetreadable; } else if(targetastime<1.5) { targetreadable = '1 day'; targetastime += 'd'; } else { targetreadable = Math.round(targetastime) + ' days'; targetastime += 'd'; } data.target = target; // Update the Chrome extension "badge" var badge = {}; var badgeDisplay = "Quota Used"; var remaining = (data[i].limit - data[i].usagemb); badgeDisplay = localStorage['badgeDisplay']; /* TODO: Show suffix on badge. Too complex for tonight and not really useful. var format = 'none'; //if (localStorage['formatData'] == 'formatted') { format = 'GB'; } //else { var suf = false; } */ switch(badgeDisplay){ case "Quota Used": badgeContent = fB(data[i].usagemb,byteFormat,0)+''; break; case "Quota Remaining": badgeContent = fB(remaining,byteFormat,0)+''; break; case "Quota Remaining per day": badgeContent = dataperday+''; break; case "Percent Used": badgeContent = pc+'%'; break; case "Percent Remaining": badgeContent = 100-pc+'%'; break; case "Target": badgeContent = fB(data.target,byteFormat,0)+''; break; default: badgeContent = ''; } badge.text = badgeContent; chrome.browserAction.setBadgeText(badge); // Create the 'usage meter' var tbl = document.createElement("table"); tbl.className = 'usagemeter'; tbl.style.width = usagemeterwidth+'px'; tbl.style.height = '20px'; tbl.style.backgroundColor = "#fff"; var trow = tbl.insertRow(0); var usedtcol = trow.insertCell(0); var freeWidth = (data[i].limit - data[i].usagemb)/data[i].limit*usagemeterwidth; var usedWidth = usagemeterwidth - freeWidth; if (pc<100) { var freetcol = trow.insertCell(1); freetcol.style.backgroundColor = "#fff"; freetcol.style.backgroundImage = "url(bar_empty.svg)"; freetcol.style.width = freeWidth + 'px'; } if (pc<90) { freetcol.innerHTML = "<div id='pc'>"+pc+"%</div>"; } else { usedtcol.innerHTML = "<div id='pc' class='used'>"+pc+"%</div>"; } usedtcol.style.width = usedWidth + 'px'; // Deficit or Surplus? Red or Green, Remove negative numbers + write help if (target<0) { usedtcol.style.backgroundImage="url(bar_deficit.svg)"; targettype = "Deficit"; targetcolor='red'; var usedbgcolor = 'red'; target = target*-1; abbrtext = 'Minimal quota usage for the next ' +targetreadable+' will bring you back within your limit.'; // Make the badge red, because we're in deficit! badgeColor = {} badgeColor.color = new Array(255, 0, 0, 100); chrome.browserAction.setBadgeBackgroundColor(badgeColor); } else { usedtcol.style.backgroundImage="url(bar_surplus.svg)"; targettype = "Surplus"; targetcolor='green'; var usedbgcolor = '#8D4'; abbrtext = 'Quota is in surplus. You may utilise an additional '+fB(target)+' quota ('+targetreadable+' typical usage) without adverse quota affect.'; // Ooooh. Green badge, all is good! badgeColor = {} badgeColor.color = new Array(0, 213, 7, 100); chrome.browserAction.setBadgeBackgroundColor(badgeColor); } usedtcol.style.backgroundColor = usedbgcolor; //calculate last update time var minutesSinceUpdate = 0; if(localStorage['cacheTime']) { minutesSinceUpdate = parseInt(((new Date()).getTime() - localStorage['cacheTime'])/1000/60); } // TODO: Last update with a quota change, write lastUpdate time to localStorage. // How to convert dates to epoch: Date.parse() or Date.UTC() /* if(localStorage['lastUpdate']!=0) { minutesSinceUpdate = (today.getTime()-localStorage['lastUpdate'])/1000; }*/ // Arrow displaying how much time in the month has elapsed var indicator = document.createElement("img"); indicator.id="indicator"; indicator.src="indicator.svg"; var remWidth = (daysleft/daysinmonth)*usagemeterwidth; var elapWidth = usagemeterwidth - remWidth; indicator.style.marginLeft = elapWidth-8 + 'px'; // Information on how long until the quota resets if(daysleft<=1) { resetreadable = (24-hour) + ' hrs'; } else if(daysleft<=2) { resetreadable = '1 day ' + (24-hour) + ' hours'; } else { if (hour == 0) { resetreadable = Math.round(daysleft) + ' days '; } else { resetreadable = Math.floor(daysleft)-1 + ' days ' + Math.round(24-hour) + ' hrs'; } } // Additional information about the ISP and quota var header = document.createElement("h1"); header.innerHTML = '<b>' + data[i].name + '</b><br>'; var content = document.createElement("table"); // Display in MB if values are less than 1GB if (remaining<gbformat){ remaining = fB(remaining,'MB'); dataperday =fB(dataperday,'MB'); } else { remaining = fB(remaining); dataperday =fB(dataperday); } content.innerHTML = "" +"<tr><th>Quota</th>" +"<td>"+ data[i].usagemb + "/" + data[i].limit +"</td></tr>" +"<tr><th>Remaining</th>" +"<td>"+ remaining + " ("+ (100-pc) + "%) </td></tr>" +"<tr><th></th>" +"<td>"+dataperday+" per day</td></tr>" +"<tr><th>Target "+targettype+"</th>" +"<td><span style='color:"+targetcolor+"'>" + fB(target) +" (<abbr title='"+abbrtext+"'>"+targetastime+"</abbr>)</span></td></tr>" +"<tr><th>Time Remaining</th>" +"<td>"+resetreadable+"</td></tr>" +"<tr><th>Last Update</th><td>" + minutesSinceUpdate + " minutes ago</td></tr>"; // Testing lines //content.innerHTML += data[0].daysleft + " DEBUG<br>"; //content.innerHTML += expectedusageperday + " expectedusageperday DEBUG<br>"; //content.innerHTML += currentusageperday + " currentusageperday DEBUG<br>"; //content.innerHTML += daysinmonth + " daysinmonth DEBUG<br>"; //content.innerHTML += daysleft + " daysleft DEBUG<br>"; // Write the header, the usage meter and the content to the popup. divEl.appendChild(header); divEl.appendChild(tbl); divEl.appendChild(indicator); divEl.appendChild(content); } } else { divEl.innerHTML = data[0].error; }} |
var remaining = (data[0].limit - data[0].usagemb); | var remaining = (data[i].limit - data[i].usagemb); | function showUsage(data) { var divEl = document.getElementById("maindiv"); divEl.innerHTML = ""; if(data != null && data[0].error == null) { for(var i = 0; i < data.length; i++) { //For testing: Pretend we're in line, in deficit or over quota //data[i].usagemb = 76000; //28746+8415; // Define variables var daysleft = (data[i].daysleft > 0)? data[i].daysleft:1; //minimum days left is one var pc = Math.round((data[i].usagemb/data[i].limit)*100); var remaining = (data[i].limit - data[i].usagemb); var dataperday = Math.round(remaining/daysleft); // TODO: Days in the "BILLING" month BUG: Current Month. var today = new Date(); var year = today.getYear(); var month = today.getMonth(); var hour = today.getHours(); var daysinmonth = getLastDayOfMonth(month,year); // Calculate the target surplus/deficit // Trying to do maths (MATH) while drinking vodka+wicked is hard var expectedusageperday = Math.round(data[i].limit/daysinmonth); var currentusageperday = 0; var target = 0; if (daysinmonth==daysleft) { currentusageperday = Math.round(data[i].usagemb); target = (expectedusageperday-currentusageperday)*(daysinmonth-(daysleft-1)); } else { currentusageperday = Math.round(data[i].usagemb/(daysinmonth-daysleft)); target = (expectedusageperday-currentusageperday)*(daysinmonth-daysleft); } var targetastime = Math.round(target/expectedusageperday); // Grammarian corrections for human readability of target var targetreadable = ''; if(target<0) { targetastime = targetastime*-1; } else if(targetastime<1) { targetreadable = Math.round(target/expectedusageperday*24) + 'hr'; targetastime = targetreadable; } else if(targetastime<1.5) { targetreadable = '1 day'; targetastime += 'd'; } else { targetreadable = Math.round(targetastime) + ' days'; targetastime += 'd'; } data.target = target; // Update the Chrome extension "badge" var badge = {}; var badgeDisplay = "Quota Used"; var remaining = (data[0].limit - data[0].usagemb); badgeDisplay = localStorage['badgeDisplay']; /* TODO: Show suffix on badge. Too complex for tonight and not really useful. var format = 'none'; //if (localStorage['formatData'] == 'formatted') { format = 'GB'; } //else { var suf = false; } */ switch(badgeDisplay){ case "Quota Used": badgeContent = fB(data[i].usagemb,byteFormat,0)+''; break; case "Quota Remaining": badgeContent = fB(remaining,byteFormat,0)+''; break; case "Quota Remaining per day": badgeContent = dataperday+''; break; case "Percent Used": badgeContent = pc+'%'; break; case "Percent Remaining": badgeContent = 100-pc+'%'; break; case "Target": badgeContent = fB(data.target,byteFormat,0)+''; break; default: badgeContent = ''; } badge.text = badgeContent; chrome.browserAction.setBadgeText(badge); // Create the 'usage meter' var tbl = document.createElement("table"); tbl.className = 'usagemeter'; tbl.style.width = usagemeterwidth+'px'; tbl.style.height = '20px'; tbl.style.backgroundColor = "#fff"; var trow = tbl.insertRow(0); var usedtcol = trow.insertCell(0); var freeWidth = (data[i].limit - data[i].usagemb)/data[i].limit*usagemeterwidth; var usedWidth = usagemeterwidth - freeWidth; if (pc<100) { var freetcol = trow.insertCell(1); freetcol.style.backgroundColor = "#fff"; freetcol.style.backgroundImage = "url(bar_empty.svg)"; freetcol.style.width = freeWidth + 'px'; } if (pc<90) { freetcol.innerHTML = "<div id='pc'>"+pc+"%</div>"; } else { usedtcol.innerHTML = "<div id='pc' class='used'>"+pc+"%</div>"; } usedtcol.style.width = usedWidth + 'px'; // Deficit or Surplus? Red or Green, Remove negative numbers + write help if (target<0) { usedtcol.style.backgroundImage="url(bar_deficit.svg)"; targettype = "Deficit"; targetcolor='red'; var usedbgcolor = 'red'; target = target*-1; abbrtext = 'Minimal quota usage for the next ' +targetreadable+' will bring you back within your limit.'; // Make the badge red, because we're in deficit! badgeColor = {} badgeColor.color = new Array(255, 0, 0, 100); chrome.browserAction.setBadgeBackgroundColor(badgeColor); } else { usedtcol.style.backgroundImage="url(bar_surplus.svg)"; targettype = "Surplus"; targetcolor='green'; var usedbgcolor = '#8D4'; abbrtext = 'Quota is in surplus. You may utilise an additional '+fB(target)+' quota ('+targetreadable+' typical usage) without adverse quota affect.'; // Ooooh. Green badge, all is good! badgeColor = {} badgeColor.color = new Array(0, 213, 7, 100); chrome.browserAction.setBadgeBackgroundColor(badgeColor); } usedtcol.style.backgroundColor = usedbgcolor; //calculate last update time var minutesSinceUpdate = 0; if(localStorage['cacheTime']) { minutesSinceUpdate = parseInt(((new Date()).getTime() - localStorage['cacheTime'])/1000/60); } // TODO: Last update with a quota change, write lastUpdate time to localStorage. // How to convert dates to epoch: Date.parse() or Date.UTC() /* if(localStorage['lastUpdate']!=0) { minutesSinceUpdate = (today.getTime()-localStorage['lastUpdate'])/1000; }*/ // Arrow displaying how much time in the month has elapsed var indicator = document.createElement("img"); indicator.id="indicator"; indicator.src="indicator.svg"; var remWidth = (daysleft/daysinmonth)*usagemeterwidth; var elapWidth = usagemeterwidth - remWidth; indicator.style.marginLeft = elapWidth-8 + 'px'; // Information on how long until the quota resets if(daysleft<=1) { resetreadable = (24-hour) + ' hrs'; } else if(daysleft<=2) { resetreadable = '1 day ' + (24-hour) + ' hours'; } else { if (hour == 0) { resetreadable = Math.round(daysleft) + ' days '; } else { resetreadable = Math.floor(daysleft)-1 + ' days ' + Math.round(24-hour) + ' hrs'; } } // Additional information about the ISP and quota var header = document.createElement("h1"); header.innerHTML = '<b>' + data[i].name + '</b><br>'; var content = document.createElement("table"); // Display in MB if values are less than 1GB if (remaining<gbformat){ remaining = fB(remaining,'MB'); dataperday =fB(dataperday,'MB'); } else { remaining = fB(remaining); dataperday =fB(dataperday); } content.innerHTML = "" +"<tr><th>Quota</th>" +"<td>"+ data[i].usagemb + "/" + data[i].limit +"</td></tr>" +"<tr><th>Remaining</th>" +"<td>"+ remaining + " ("+ (100-pc) + "%) </td></tr>" +"<tr><th></th>" +"<td>"+dataperday+" per day</td></tr>" +"<tr><th>Target "+targettype+"</th>" +"<td><span style='color:"+targetcolor+"'>" + fB(target) +" (<abbr title='"+abbrtext+"'>"+targetastime+"</abbr>)</span></td></tr>" +"<tr><th>Time Remaining</th>" +"<td>"+resetreadable+"</td></tr>" +"<tr><th>Last Update</th><td>" + minutesSinceUpdate + " minutes ago</td></tr>"; // Testing lines //content.innerHTML += data[0].daysleft + " DEBUG<br>"; //content.innerHTML += expectedusageperday + " expectedusageperday DEBUG<br>"; //content.innerHTML += currentusageperday + " currentusageperday DEBUG<br>"; //content.innerHTML += daysinmonth + " daysinmonth DEBUG<br>"; //content.innerHTML += daysleft + " daysleft DEBUG<br>"; // Write the header, the usage meter and the content to the popup. divEl.appendChild(header); divEl.appendChild(tbl); divEl.appendChild(indicator); divEl.appendChild(content); } } else { divEl.innerHTML = data[0].error; }} |
slide: function(options, additions) { options = $.extend({ easing: "swing", duration: 300 }, options, additions); if ( !options.toHide.size() ) { options.toShow.animate({height: "show"}, options); return; } if ( !options.toShow.size() ) { options.toHide.animate({height: "hide"}, options); return; } var overflow = options.toShow.css('overflow'), percentDone = 0, showProps = {}, hideProps = {}, fxAttrs = [ "height", "paddingTop", "paddingBottom" ], originalWidth; var s = options.toShow; originalWidth = s[0].style.width; s.width( parseInt(s.parent().width(),10) - parseInt(s.css("paddingLeft"),10) - parseInt(s.css("paddingRight"),10) - (parseInt(s.css("borderLeftWidth"),10) || 0) - (parseInt(s.css("borderRightWidth"),10) || 0) ); $.each(fxAttrs, function(i, prop) { hideProps[prop] = 'hide'; var parts = ('' + $.css(options.toShow[0], prop)).match(/^([\d+-.]+)(.*)$/); showProps[prop] = { value: parts[1], unit: parts[2] || 'px' }; }); options.toShow.css({ height: 0, overflow: 'hidden' }).show(); options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{ step: function(now, settings) { if (settings.prop == 'height') { percentDone = ( settings.end - settings.start === 0 ) ? 0 : (settings.now - settings.start) / (settings.end - settings.start); } options.toShow[0].style[settings.prop] = (percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit; }, duration: options.duration, easing: options.easing, complete: function() { if ( !options.autoHeight ) { options.toShow.css("height", ""); } options.toShow.css("width", originalWidth); options.toShow.css({overflow: overflow}); options.complete(); } }); }, | (function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","left"],e=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(e=="show")a.css(f,b=="pos"?-g:g);var i={};i[f]=(e=="show"?b=="pos"? "+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); | slide: function(options, additions) { options = $.extend({ easing: "swing", duration: 300 }, options, additions); if ( !options.toHide.size() ) { options.toShow.animate({height: "show"}, options); return; } if ( !options.toShow.size() ) { options.toHide.animate({height: "hide"}, options); return; } var overflow = options.toShow.css('overflow'), percentDone = 0, showProps = {}, hideProps = {}, fxAttrs = [ "height", "paddingTop", "paddingBottom" ], originalWidth; // fix width before calculating height of hidden element var s = options.toShow; originalWidth = s[0].style.width; s.width( parseInt(s.parent().width(),10) - parseInt(s.css("paddingLeft"),10) - parseInt(s.css("paddingRight"),10) - (parseInt(s.css("borderLeftWidth"),10) || 0) - (parseInt(s.css("borderRightWidth"),10) || 0) ); $.each(fxAttrs, function(i, prop) { hideProps[prop] = 'hide'; var parts = ('' + $.css(options.toShow[0], prop)).match(/^([\d+-.]+)(.*)$/); showProps[prop] = { value: parts[1], unit: parts[2] || 'px' }; }); options.toShow.css({ height: 0, overflow: 'hidden' }).show(); options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{ step: function(now, settings) { // only calculate the percent when animating height // IE gets very inconsistent results when animating elements // with small values, which is common for padding if (settings.prop == 'height') { percentDone = ( settings.end - settings.start === 0 ) ? 0 : (settings.now - settings.start) / (settings.end - settings.start); } options.toShow[0].style[settings.prop] = (percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit; }, duration: options.duration, easing: options.easing, complete: function() { if ( !options.autoHeight ) { options.toShow.css("height", ""); } options.toShow.css("width", originalWidth); options.toShow.css({overflow: overflow}); options.complete(); } }); }, |
alert(url); | var socialSharing = function(){ var SERVICE_DATA = { //url - template for the sharing service url, params are for the popup twitter: { url: "http://twitter.com/share?url={URL}&ref=twitbtn&text={TEXT}", params: "width=820,height=526,toolbar=1,status=1,resizable=1,scrollbars=1" }, facebook: { url: "http://www.facebook.com/sharer.php?u={URL}&ref=fbshare&t={TEXT}", params: "width=630,height=436,toolbar=1,status=1,resizable=1,scrollbars=1" } }; var URL = ""; var TEXT = ""; var share_page = function(service_name){ if (SERVICE_DATA[service_name]){ var url = SERVICE_DATA[service_name]['url']; url = url.replace('{URL}', URL); url = url.replace('{TEXT}', TEXT); alert(url); var params = SERVICE_DATA[service_name]['params']; if(!window.open(url, "sharing", params)){ window.location.href=share_url; } } } return{ init: function(page_url, text_to_share){ URL = window.location.href; TEXT = escape($('div.headNormal > a').html()); var fb = $('a.fb-share') var tw = $('a.twitter-share'); copyAltToTitle(fb); copyAltToTitle(tw); setupButtonEventHandlers(fb, function(){share_page("facebook")}); setupButtonEventHandlers(tw, function(){share_page("twitter")}); }, }}(); |
|
var current = this.current, store = this.grid.store, sorter = store.getStrategy('sort'), data = el.retrieve('jxCellData'), dir = 'asc', opt = this.options; | var current = this.current, grid = this.grid, gridTableBody = grid.gridTableBody, gridParent = gridTableBody.getParent(), rowTableBody = grid.rowTableBody, rowParent = rowTableBody.getParent(), useHeaders = grid.row.useHeaders(), store = grid.store, sorter = store.getStrategy('sort'), data = el.retrieve('jxCellData'), dir = 'asc', opt = this.options; | sort: function(el) { var current = this.current, store = this.grid.store, sorter = store.getStrategy('sort'), data = el.retrieve('jxCellData'), dir = 'asc', opt = this.options; if (sorter && $defined(data.column) && data.column.isSortable()) { if (el.hasClass(opt.ascendingClass)) { el.removeClass(opt.ascendingClass).addClass(opt.descendingClass); dir = 'desc'; } else if (el.hasClass(opt.descendingClass)) { el.removeClass(opt.descendingClass).addClass(opt.ascendingClass); } else { el.addClass(opt.ascendingClass); } if (current && el != current) { current.removeClass(opt.ascendingClass).removeClass(opt.descendingClass); } this.current = el; sorter.sort(data.column.name, null, dir); } } |
if (sorter && $defined(data.column) && data.column.isSortable()) { if (el.hasClass(opt.ascendingClass)) { el.removeClass(opt.ascendingClass).addClass(opt.descendingClass); dir = 'desc'; } else if (el.hasClass(opt.descendingClass)) { el.removeClass(opt.descendingClass).addClass(opt.ascendingClass); } else { el.addClass(opt.ascendingClass); } if (current && el != current) { current.removeClass(opt.ascendingClass).removeClass(opt.descendingClass); } this.current = el; sorter.sort(data.column.name, null, dir); } } | if (sorter && $defined(data.column) && data.column.isSortable()) { if (el.hasClass(opt.ascendingClass)) { el.removeClass(opt.ascendingClass).addClass(opt.descendingClass); dir = 'desc'; } else if (el.hasClass(opt.descendingClass)) { el.removeClass(opt.descendingClass).addClass(opt.ascendingClass); } else { el.addClass(opt.ascendingClass); } if (current && el != current) { current.removeClass(opt.ascendingClass).removeClass(opt.descendingClass); } this.current = el; gridTableBody.dispose(); if (useHeaders) { rowTableBody.dispose(); } store.each(function(record, index) { record.dom = { cell: gridTableBody.childNodes[index], row: useHeaders ? rowTableBody.childNodes[index] : null }; }); sorter.sort(data.column.name, null, dir); store.each(function(record, index) { record.dom.cell.inject(gridTableBody); if (useHeaders) { record.dom.row.inject(rowTableBody); } }); if (gridParent) { gridParent.adopt(gridTableBody); } if (useHeaders && rowParent) { rowParent.adopt(rowTableBody); } } } | sort: function(el) { var current = this.current, store = this.grid.store, sorter = store.getStrategy('sort'), data = el.retrieve('jxCellData'), dir = 'asc', opt = this.options; if (sorter && $defined(data.column) && data.column.isSortable()) { if (el.hasClass(opt.ascendingClass)) { el.removeClass(opt.ascendingClass).addClass(opt.descendingClass); dir = 'desc'; } else if (el.hasClass(opt.descendingClass)) { el.removeClass(opt.descendingClass).addClass(opt.ascendingClass); } else { el.addClass(opt.ascendingClass); } if (current && el != current) { current.removeClass(opt.ascendingClass).removeClass(opt.descendingClass); } this.current = el; sorter.sort(data.column.name, null, dir); } } |
if (onSuccessFn) onSuccessFn(r.getResult().Result); | if (onSuccessFn) onSuccessFn(r.Result); | sortedSetContainsItem: function(id, item, onSuccessFn, onErrorFn) { this.gateway.getFromService('SortedSetContainsItem', { Id: id || null, Item: item || null }, function(r) { if (onSuccessFn) onSuccessFn(r.getResult().Result); }, onErrorFn || RedisClient.errorFn); }, |
} else if (clazz == "Gene") { | } else if (clazz == "Gene" || clazz == 'GeneSetValueObject' || clazz == 'ExpressionExperimentSetValueObject') { | sortInfo : function(record) { var clazz = record.resultsClass; if (clazz == "ExpressionExperimentValueObject") { return record.shortName; } else if (clazz == "CompositeSequence") { return record.name; } else if (clazz == "ArrayDesignValueObject") { return record.shortName; } else if (/^BioSequence.*/.exec(clazz)) { // because we get proxies. return record.name; } else if (clazz == "Gene") { return record.name; } else { return clazz; } }, |
} else if (clazz == "Gene" || clazz == 'GeneSetValueObject' || clazz == 'ExpressionExperimentSetValueObject') { | } else if (clazz == "GeneValueObject" || clazz == 'GeneSetValueObject' || clazz == 'ExpressionExperimentSetValueObject') { | sortInfo : function(record) { var clazz = record.resultsClass; if (clazz == "ExpressionExperimentValueObject") { return record.shortName; } else if (clazz == "CompositeSequence") { return record.name; } else if (clazz == "ArrayDesignValueObject") { return record.shortName; } else if (/^BioSequence.*/.exec(clazz)) { // because we get proxies. return record.name; } else if (clazz == "Gene" || clazz == 'GeneSetValueObject' || clazz == 'ExpressionExperimentSetValueObject') { return record.name; } else { return clazz; } }, |
if (arg === null) { return 'null'; } else if (typeof arg === 'undefined') { return 'undefined'; } var result = ''; | console._source_of = function source_of (arg, limit, stack) { if (arg === null) { return 'null'; } else if (typeof arg === 'undefined') { return 'undefined'; } var result = ''; if (arg && arg.nodeType == 1) { // Is element? result = '<'+ arg.tagName; for (var i=0, ii=arg.attributes.length; i<ii; i++) { if (arg.attributes[i].specified) { result +=' '+ arg.attributes[i].name +'="'+ arg.attributes[i].value +'"'; } } if (arg.childNodes && arg.childNodes.length === 0) { result += '/'; } return result + '>'; } var kind = Object.prototype.toString.call(arg).replace('[object ', '').replace(']',''); switch (kind) { case 'String': return '"'+ arg +'"'; case 'Array': case 'HTMLCollection': case 'NodeList': // Is array-like object? result = '['; var arr_list = []; for (var j=0, jj=arg.length; j<jj; j++) { arr_list[j] = source_of(arg[j], limit, stack); } return result + arr_list.join(', ') +']'; case 'RegExp': return "/"+ arg.source +"/"; case 'Date': return arg; default: if (typeof arg === 'object') { if (!limit) return '{?}'; // Check circular references var stack_length = stack.length; for (var si=0; si<stack_length; si++) { if (stack[si] === arg) { return '#'; } } stack[stack_length++] = arg; var indent = repeatString(console._indent, stack_length); if (Object.getOwnPropertyNames) { var keys = Object.getOwnPropertyNames(arg).sort(); } else { keys = []; for (var key in arg) { keys.push(key); } } if (!keys.length) { return "{}"; } result = '{'; var arr_obj = []; for (var n=0, nn=keys.length; n<nn; n++) { key = keys[n]; try { var value = source_of(arg[key], limit-1, stack); arr_obj.push("\n"+ indent + '"'+ key +'": '+ value); } catch (e) {} } return result + arr_obj.join(', ') +'\n'+ repeatString(console._indent, stack_length - 1) + '}'; } else { return arg; } } }; |
|
if (arg && arg.nodeType == 1) { result = '<'+ arg.tagName; for (var i=0, ii=arg.attributes.length; i<ii; i++) { if (arg.attributes[i].specified) { result +=' '+ arg.attributes[i].name +'="'+ arg.attributes[i].value +'"'; | var aType = typeof arg; switch (aType) { case 'string': return '"' + arg +'"'; case 'function': break; case 'object': if (arg === null) { return 'null'; | console._source_of = function source_of (arg, limit, stack) { if (arg === null) { return 'null'; } else if (typeof arg === 'undefined') { return 'undefined'; } var result = ''; if (arg && arg.nodeType == 1) { // Is element? result = '<'+ arg.tagName; for (var i=0, ii=arg.attributes.length; i<ii; i++) { if (arg.attributes[i].specified) { result +=' '+ arg.attributes[i].name +'="'+ arg.attributes[i].value +'"'; } } if (arg.childNodes && arg.childNodes.length === 0) { result += '/'; } return result + '>'; } var kind = Object.prototype.toString.call(arg).replace('[object ', '').replace(']',''); switch (kind) { case 'String': return '"'+ arg +'"'; case 'Array': case 'HTMLCollection': case 'NodeList': // Is array-like object? result = '['; var arr_list = []; for (var j=0, jj=arg.length; j<jj; j++) { arr_list[j] = source_of(arg[j], limit, stack); } return result + arr_list.join(', ') +']'; case 'RegExp': return "/"+ arg.source +"/"; case 'Date': return arg; default: if (typeof arg === 'object') { if (!limit) return '{?}'; // Check circular references var stack_length = stack.length; for (var si=0; si<stack_length; si++) { if (stack[si] === arg) { return '#'; } } stack[stack_length++] = arg; var indent = repeatString(console._indent, stack_length); if (Object.getOwnPropertyNames) { var keys = Object.getOwnPropertyNames(arg).sort(); } else { keys = []; for (var key in arg) { keys.push(key); } } if (!keys.length) { return "{}"; } result = '{'; var arr_obj = []; for (var n=0, nn=keys.length; n<nn; n++) { key = keys[n]; try { var value = source_of(arg[key], limit-1, stack); arr_obj.push("\n"+ indent + '"'+ key +'": '+ value); } catch (e) {} } return result + arr_obj.join(', ') +'\n'+ repeatString(console._indent, stack_length - 1) + '}'; } else { return arg; } } }; |
} if (arg.childNodes && arg.childNodes.length === 0) { result += '/'; } return result + '>'; | break; default: return String(arg); | console._source_of = function source_of (arg, limit, stack) { if (arg === null) { return 'null'; } else if (typeof arg === 'undefined') { return 'undefined'; } var result = ''; if (arg && arg.nodeType == 1) { // Is element? result = '<'+ arg.tagName; for (var i=0, ii=arg.attributes.length; i<ii; i++) { if (arg.attributes[i].specified) { result +=' '+ arg.attributes[i].name +'="'+ arg.attributes[i].value +'"'; } } if (arg.childNodes && arg.childNodes.length === 0) { result += '/'; } return result + '>'; } var kind = Object.prototype.toString.call(arg).replace('[object ', '').replace(']',''); switch (kind) { case 'String': return '"'+ arg +'"'; case 'Array': case 'HTMLCollection': case 'NodeList': // Is array-like object? result = '['; var arr_list = []; for (var j=0, jj=arg.length; j<jj; j++) { arr_list[j] = source_of(arg[j], limit, stack); } return result + arr_list.join(', ') +']'; case 'RegExp': return "/"+ arg.source +"/"; case 'Date': return arg; default: if (typeof arg === 'object') { if (!limit) return '{?}'; // Check circular references var stack_length = stack.length; for (var si=0; si<stack_length; si++) { if (stack[si] === arg) { return '#'; } } stack[stack_length++] = arg; var indent = repeatString(console._indent, stack_length); if (Object.getOwnPropertyNames) { var keys = Object.getOwnPropertyNames(arg).sort(); } else { keys = []; for (var key in arg) { keys.push(key); } } if (!keys.length) { return "{}"; } result = '{'; var arr_obj = []; for (var n=0, nn=keys.length; n<nn; n++) { key = keys[n]; try { var value = source_of(arg[key], limit-1, stack); arr_obj.push("\n"+ indent + '"'+ key +'": '+ value); } catch (e) {} } return result + arr_obj.join(', ') +'\n'+ repeatString(console._indent, stack_length - 1) + '}'; } else { return arg; } } }; |
switch (kind) { case 'String': return '"'+ arg +'"'; | if (kind == 'Object') { prefix = ''; } else { prefix = kind + ' '; var primitive = primitiveOf(arg); if (primitive) { prefix += primitive + ' '; } } if (!limit) { return prefix + '{?}'; } var stack_length = stack.length; for (var si=0; si<stack_length; si++) { if (stack[si] === arg) { return '#'; } } stack[stack_length++] = arg; var indent = repeatString(console._indent, stack_length); if (Object.getOwnPropertyNames) { var keys = Object.getOwnPropertyNames(arg); } else { keys = []; for (var key in arg) { keys.push(key); } } var result = prefix + '{'; if (!keys.length) { return result + "}"; } keys = keys.sort(); var arr_obj = []; for (var n=0, nn=keys.length; n<nn; n++) { key = keys[n]; try { var value = source_of(arg[key], limit-1, stack); arr_obj.push("\n"+ indent + '"'+ key +'": '+ value); } catch (e) {} } return result + arr_obj.join(', ') +'\n'+ repeatString(console._indent, stack_length - 1) + '}'; | console._source_of = function source_of (arg, limit, stack) { if (arg === null) { return 'null'; } else if (typeof arg === 'undefined') { return 'undefined'; } var result = ''; if (arg && arg.nodeType == 1) { // Is element? result = '<'+ arg.tagName; for (var i=0, ii=arg.attributes.length; i<ii; i++) { if (arg.attributes[i].specified) { result +=' '+ arg.attributes[i].name +'="'+ arg.attributes[i].value +'"'; } } if (arg.childNodes && arg.childNodes.length === 0) { result += '/'; } return result + '>'; } var kind = Object.prototype.toString.call(arg).replace('[object ', '').replace(']',''); switch (kind) { case 'String': return '"'+ arg +'"'; case 'Array': case 'HTMLCollection': case 'NodeList': // Is array-like object? result = '['; var arr_list = []; for (var j=0, jj=arg.length; j<jj; j++) { arr_list[j] = source_of(arg[j], limit, stack); } return result + arr_list.join(', ') +']'; case 'RegExp': return "/"+ arg.source +"/"; case 'Date': return arg; default: if (typeof arg === 'object') { if (!limit) return '{?}'; // Check circular references var stack_length = stack.length; for (var si=0; si<stack_length; si++) { if (stack[si] === arg) { return '#'; } } stack[stack_length++] = arg; var indent = repeatString(console._indent, stack_length); if (Object.getOwnPropertyNames) { var keys = Object.getOwnPropertyNames(arg).sort(); } else { keys = []; for (var key in arg) { keys.push(key); } } if (!keys.length) { return "{}"; } result = '{'; var arr_obj = []; for (var n=0, nn=keys.length; n<nn; n++) { key = keys[n]; try { var value = source_of(arg[key], limit-1, stack); arr_obj.push("\n"+ indent + '"'+ key +'": '+ value); } catch (e) {} } return result + arr_obj.join(', ') +'\n'+ repeatString(console._indent, stack_length - 1) + '}'; } else { return arg; } } }; |
case 'Array': case 'HTMLCollection': case 'NodeList': result = '['; var arr_list = []; for (var j=0, jj=arg.length; j<jj; j++) { arr_list[j] = source_of(arg[j], limit, stack); } return result + arr_list.join(', ') +']'; case 'RegExp': return "/"+ arg.source +"/"; case 'Date': return arg; default: if (typeof arg === 'object') { if (!limit) return '{?}'; var stack_length = stack.length; for (var si=0; si<stack_length; si++) { if (stack[si] === arg) { return '#'; } } stack[stack_length++] = arg; var indent = repeatString(console._indent, stack_length); if (Object.getOwnPropertyNames) { var keys = Object.getOwnPropertyNames(arg).sort(); } else { keys = []; for (var key in arg) { keys.push(key); } } if (!keys.length) { return "{}"; } result = '{'; var arr_obj = []; for (var n=0, nn=keys.length; n<nn; n++) { key = keys[n]; try { var value = source_of(arg[key], limit-1, stack); arr_obj.push("\n"+ indent + '"'+ key +'": '+ value); } catch (e) {} } return result + arr_obj.join(', ') +'\n'+ repeatString(console._indent, stack_length - 1) + '}'; } else { return arg; } } | console._source_of = function source_of (arg, limit, stack) { if (arg === null) { return 'null'; } else if (typeof arg === 'undefined') { return 'undefined'; } var result = ''; if (arg && arg.nodeType == 1) { // Is element? result = '<'+ arg.tagName; for (var i=0, ii=arg.attributes.length; i<ii; i++) { if (arg.attributes[i].specified) { result +=' '+ arg.attributes[i].name +'="'+ arg.attributes[i].value +'"'; } } if (arg.childNodes && arg.childNodes.length === 0) { result += '/'; } return result + '>'; } var kind = Object.prototype.toString.call(arg).replace('[object ', '').replace(']',''); switch (kind) { case 'String': return '"'+ arg +'"'; case 'Array': case 'HTMLCollection': case 'NodeList': // Is array-like object? result = '['; var arr_list = []; for (var j=0, jj=arg.length; j<jj; j++) { arr_list[j] = source_of(arg[j], limit, stack); } return result + arr_list.join(', ') +']'; case 'RegExp': return "/"+ arg.source +"/"; case 'Date': return arg; default: if (typeof arg === 'object') { if (!limit) return '{?}'; // Check circular references var stack_length = stack.length; for (var si=0; si<stack_length; si++) { if (stack[si] === arg) { return '#'; } } stack[stack_length++] = arg; var indent = repeatString(console._indent, stack_length); if (Object.getOwnPropertyNames) { var keys = Object.getOwnPropertyNames(arg).sort(); } else { keys = []; for (var key in arg) { keys.push(key); } } if (!keys.length) { return "{}"; } result = '{'; var arr_obj = []; for (var n=0, nn=keys.length; n<nn; n++) { key = keys[n]; try { var value = source_of(arg[key], limit-1, stack); arr_obj.push("\n"+ indent + '"'+ key +'": '+ value); } catch (e) {} } return result + arr_obj.join(', ') +'\n'+ repeatString(console._indent, stack_length - 1) + '}'; } else { return arg; } } }; |
|
else this.nav['isValidBrowser']=false;this.set_base_url();for(var i=0;i<this.scripts_to_load.length;i++){setTimeout("eAL.load_script('"+this.baseURL+this.scripts_to_load[i]+".js');",1);this.waiting_loading[this.scripts_to_load[i]+".js"]=false;}this.add_event(window,"load",EAL.prototype.window_loaded);};EAL.prototype ={has_error:function(){this.error=true;for(var i in EAL.prototype){EAL.prototype[i]=function(){};}},window_loaded:function(){eAL.win="loaded";if (document.forms){for (var i=0;i<document.forms.length;i++){var form=document.forms[i];form.edit_area_replaced_submit=null;try{form.edit_area_replaced_submit=form.onsubmit;form.onsubmit="";}catch (e){}eAL.add_event(form,"submit",EAL.prototype.submit);eAL.add_event(form,"reset",EAL.prototype.reset);}}eAL.add_event(window,"unload",function(){for(var i in eAs){eAL.delete_instance(i);}});},init_ie_textarea:function(id){var t=document.getElementById(id);try{if(t&&typeof(t.focused)=="undefined"){t.focus();t.focused=true;t.selectionStart=t.selectionEnd=0;get_IE_selection(t);eAL.add_event(t,"focus",IE_textarea_focus);eAL.add_event(t,"blur",IE_textarea_blur);}}catch(ex){}},init:function(settings){if(!settings["id"])this.has_error();if(this.error)return;if(eAs[settings["id"]])eAL.delete_instance(settings["id"]);for(var i in this.default_settings){if(typeof(settings[i])=="undefined")settings[i]=this.default_settings[i];}if(settings["browsers"]=="known"&&this.nav['isValidBrowser']==false){return;}if(settings["begin_toolbar"].length>0)settings["toolbar"]=settings["begin_toolbar"] +","+settings["toolbar"];if(settings["end_toolbar"].length>0)settings["toolbar"]=settings["toolbar"] +","+settings["end_toolbar"];settings["tab_toolbar"]=settings["toolbar"].replace(/ /g,"").split(",");settings["plugins"]=settings["plugins"].replace(/ /g,"").split(",");for(var i=0;i<settings["plugins"].length;i++){if(settings["plugins"][i].length==0)settings["plugins"].splice(i,1);}this.get_template();this.load_script(this.baseURL+"langs/"+settings["language"]+".js");if(settings["syntax"].length>0){settings["syntax"]=settings["syntax"].toLowerCase();this.load_script(this.baseURL+"reg_syntax/"+settings["syntax"]+".js");}eAs[settings["id"]]={"settings":settings};eAs[settings["id"]]["displayed"]=false;eAs[settings["id"]]["hidden"]=false;eAL.start(settings["id"]);},delete_instance:function(id){eAL.execCommand(id,"EA_delete");if(window.frames["frame_"+id]&&window.frames["frame_"+id].editArea){if(eAs[id]["displayed"])eAL.toggle(id,"off");window.frames["frame_"+id].editArea.execCommand("EA_unload");}var span=document.getElementById("EditAreaArroundInfos_"+id);if(span)span.parentNode.removeChild(span);var iframe=document.getElementById("frame_"+id);if(iframe){iframe.parentNode.removeChild(iframe);try{delete window.frames["frame_"+id];}catch (e){}}delete eAs[id];},start:function(id){if(this.win!="loaded"){setTimeout("eAL.start('"+id+"');",50);return;}for(var i in eAL.waiting_loading){if(eAL.waiting_loading[i]!="loaded"&&typeof(eAL.waiting_loading[i])!="function"){setTimeout("eAL.start('"+id+"');",50);return;}}if(!eAL.lang[eAs[id]["settings"]["language"]]||(eAs[id]["settings"]["syntax"].length>0&&!eAL.load_syntax[eAs[id]["settings"]["syntax"]])){setTimeout("eAL.start('"+id+"');",50);return;}if(eAs[id]["settings"]["syntax"].length>0)eAL.init_syntax_regexp();if(!document.getElementById("EditAreaArroundInfos_"+id)&&(eAs[id]["settings"]["debug"]||eAs[id]["settings"]["allow_toggle"])){var span=document.createElement("span");span.id="EditAreaArroundInfos_"+id;var html="";if(eAs[id]["settings"]["allow_toggle"]){checked=(eAs[id]["settings"]["display"]=="onload")?"checked":"";html+="<div id='edit_area_toggle_"+i+"'>";html+="<input id='edit_area_toggle_checkbox_"+id +"' class='toggle_"+id +"' type='checkbox' onclick='eAL.toggle(\""+id +"\");' accesskey='e' "+checked+" />";html+="<label for='edit_area_toggle_checkbox_"+id +"'>{$toggle}</label></div>";}if(eAs[id]["settings"]["debug"])html+="<textarea id='edit_area_debug_"+id +"' style='z-index:20;width:100%;height:120px;overflow:auto;border:solid black 1px;'></textarea><br />";html=eAL.translate(html,eAs[id]["settings"]["language"]);span.innerHTML=html;var father=document.getElementById(id).parentNode;var next=document.getElementById(id).nextSibling;if(next==null)father.appendChild(span); else father.insertBefore(span,next);}if(!eAs[id]["initialized"]){this.execCommand(id,"EA_init");if(eAs[id]["settings"]["display"]=="later"){eAs[id]["initialized"]=true;return;}}if(this.nav['isIE']){eAL.init_ie_textarea(id);}var html_toolbar_content="";area=eAs[id];for(var i=0;i<area["settings"]["tab_toolbar"].length;i++){html_toolbar_content+=this.get_control_html(area["settings"]["tab_toolbar"][i],area["settings"]["language"]);}if(!this.iframe_script){this.iframe_script="";for(var i=0;i<this.sub_scripts_to_load.length;i++)this.iframe_script+='<script language="javascript" type="text/javascript" src="'+this.baseURL+this.sub_scripts_to_load[i] +'.js"></script>';}for(var i=0;i<area["settings"]["plugins"].length;i++){if(!eAL.all_plugins_loaded)this.iframe_script+='<script language="javascript" type="text/javascript" src="'+this.baseURL+'plugins/'+area["settings"]["plugins"][i]+'/'+area["settings"]["plugins"][i] +'.js"></script>';this.iframe_script+='<script language="javascript" type="text/javascript" src="'+this.baseURL+'plugins/'+area["settings"]["plugins"][i]+'/langs/'+area["settings"]["language"] +'.js"></script>';}if(!this.iframe_css){this.iframe_css="<link href='"+this.baseURL +"edit_area.css' rel='stylesheet' type='text/css' />";}var template=this.template.replace(/\[__BASEURL__\]/g,this.baseURL);template=template.replace("[__TOOLBAR__]",html_toolbar_content);template=this.translate(template,area["settings"]["language"],"template");template=template.replace("[__CSSRULES__]",this.iframe_css);template=template.replace("[__JSCODE__]",this.iframe_script);template=template.replace("[__EA_VERSION__]",this.version);area.textarea=document.getElementById(area["settings"]["id"]);eAs[area["settings"]["id"]]["textarea"]=area.textarea;if(typeof(window.frames["frame_"+area["settings"]["id"]])!='undefined')delete window.frames["frame_"+area["settings"]["id"]];var father=area.textarea.parentNode;var content=document.createElement("iframe");content.name="frame_"+area["settings"]["id"];content.id="frame_"+area["settings"]["id"];content.style.borderWidth="0px";setAttribute(content,"frameBorder","0");content.style.overflow="hidden";content.style.display="none";var next=area.textarea.nextSibling;if(next==null)father.appendChild(content); else father.insertBefore(content,next);var frame=window.frames["frame_"+area["settings"]["id"]];frame.document.open();frame.eAs=eAs;frame.area_id=area["settings"]["id"];frame.document.area_id=area["settings"]["id"];frame.document.write(template);frame.document.close();},toggle:function(id,toggle_to){if(!toggle_to)toggle_to=(eAs[id]["displayed"]==true)?"off":"on";if(eAs[id]["displayed"]==true &&toggle_to=="off"){this.toggle_off(id);} | else t.isValidBrowser=false;t.set_base_url();for(var i=0;i<t.scripts_to_load.length;i++){setTimeout("eAL.load_script('"+t.baseURL+t.scripts_to_load[i]+".js');",1);t.waiting_loading[t.scripts_to_load[i]+".js"]=false;}t.add_event(window,"load",EAL.prototype.window_loaded);};EAL.prototype={has_error:function(){this.error=true;for(var i in EAL.prototype){EAL.prototype[i]=function(){};}},set_browser_infos:function(o){ua=navigator.userAgent;o.isWebKit=/WebKit/.test(ua);o.isGecko=!o.isWebKit&&/Gecko/.test(ua);o.isMac=/Mac/.test(ua);o.isIE=(navigator.appName=="Microsoft Internet Explorer");if(o.isIE){o.isIE=ua.replace(/^.*?MSIE\s+([0-9\.]+).*$/,"$1");if(o.isIE<6)o.has_error();}if(o.isOpera=(ua.indexOf('Opera')!=-1)){o.isOpera=ua.replace(/^.*?Opera.*?([0-9\.]+).*$/i,"$1");if(o.isOpera<9)o.has_error();o.isIE=false;}if(o.isFirefox=(ua.indexOf('Firefox')!=-1))o.isFirefox=ua.replace(/^.*?Firefox.*?([0-9\.]+).*$/i,"$1");if(ua.indexOf('Iceweasel')!=-1)o.isFirefox=ua.replace(/^.*?Iceweasel.*?([0-9\.]+).*$/i,"$1");if(ua.indexOf('GranParadiso')!=-1)o.isFirefox=ua.replace(/^.*?GranParadiso.*?([0-9\.]+).*$/i,"$1");if(ua.indexOf('BonEcho')!=-1)o.isFirefox=ua.replace(/^.*?BonEcho.*?([0-9\.]+).*$/i,"$1");if(ua.indexOf('SeaMonkey')!=-1)o.isFirefox=(ua.replace(/^.*?SeaMonkey.*?([0-9\.]+).*$/i,"$1"))+1;if(o.isCamino=(ua.indexOf('Camino')!=-1))o.isCamino=ua.replace(/^.*?Camino.*?([0-9\.]+).*$/i,"$1");if(o.isSafari=(ua.indexOf('Safari')!=-1))o.isSafari=ua.replace(/^.*?Version\/([0-9]+\.[0-9]+).*$/i,"$1");if(o.isChrome=(ua.indexOf('Chrome')!=-1)){o.isChrome=ua.replace(/^.*?Chrome.*?([0-9\.]+).*$/i,"$1");o.isSafari=false;}},window_loaded:function(){eAL.win="loaded";if(document.forms){for(var i=0;i<document.forms.length;i++){var form=document.forms[i];form.edit_area_replaced_submit=null;try{form.edit_area_replaced_submit=form.onsubmit;form.onsubmit="";}catch(e){}eAL.add_event(form,"submit",EAL.prototype.submit);eAL.add_event(form,"reset",EAL.prototype.reset);}}eAL.add_event(window,"unload",function(){for(var i in eAs){eAL.delete_instance(i);}});},init_ie_textarea:function(id){var a=document.getElementById(id);try{if(a&&typeof(a.focused)=="undefined"){a.focus();a.focused=true;a.selectionStart=a.selectionEnd=0;get_IE_selection(a);eAL.add_event(a,"focus",IE_textarea_focus);eAL.add_event(a,"blur",IE_textarea_blur);}}catch(ex){}},init:function(settings){var t=this,s=settings,i;if(!s["id"])t.has_error();if(t.error)return;if(eAs[s["id"]])t.delete_instance(s["id"]);for(i in t.default_settings){if(typeof(s[i])=="undefined")s[i]=t.default_settings[i];}if(s["browsers"]=="known"&&t.isValidBrowser==false){return;}if(s["begin_toolbar"].length>0)s["toolbar"]=s["begin_toolbar"]+","+s["toolbar"];if(s["end_toolbar"].length>0)s["toolbar"]=s["toolbar"]+","+s["end_toolbar"];s["tab_toolbar"]=s["toolbar"].replace(/ /g,"").split(",");s["plugins"]=s["plugins"].replace(/ /g,"").split(",");for(i=0;i<s["plugins"].length;i++){if(s["plugins"][i].length==0)s["plugins"].splice(i,1);}t.get_template();t.load_script(t.baseURL+"langs/"+s["language"]+".js");if(s["syntax"].length>0){s["syntax"]=s["syntax"].toLowerCase();t.load_script(t.baseURL+"reg_syntax/"+s["syntax"]+".js");}eAs[s["id"]]={"settings":s};eAs[s["id"]]["displayed"]=false;eAs[s["id"]]["hidden"]=false;t.start(s["id"]);},delete_instance:function(id){var d=document,fs=window.frames,span,iframe;eAL.execCommand(id,"EA_delete");if(fs["frame_"+id]&&fs["frame_"+id].editArea){if(eAs[id]["displayed"])eAL.toggle(id,"off");fs["frame_"+id].editArea.execCommand("EA_unload");}span=d.getElementById("EditAreaArroundInfos_"+id);if(span)span.parentNode.removeChild(span);iframe=d.getElementById("frame_"+id);if(iframe){iframe.parentNode.removeChild(iframe);try{delete fs["frame_"+id];}catch(e){}}delete eAs[id];},start:function(id){var t=this,d=document,f,span,father,next,html='',html_toolbar_content='',template,content,i;if(t.win!="loaded"){setTimeout("eAL.start('"+id+"');",50);return;}for(i in t.waiting_loading){if(t.waiting_loading[i]!="loaded"&&typeof(t.waiting_loading[i])!="function"){setTimeout("eAL.start('"+id+"');",50);return;}}if(!t.lang[eAs[id]["settings"]["language"]]||(eAs[id]["settings"]["syntax"].length>0&&!t.load_syntax[eAs[id]["settings"]["syntax"]])){setTimeout("eAL.start('"+id+"');",50);return;}if(eAs[id]["settings"]["syntax"].length>0)t.init_syntax_regexp();if(!d.getElementById("EditAreaArroundInfos_"+id)&&(eAs[id]["settings"]["debug"]||eAs[id]["settings"]["allow_toggle"])){span=d.createElement("span");span.id="EditAreaArroundInfos_"+id;if(eAs[id]["settings"]["allow_toggle"]){checked=(eAs[id]["settings"]["display"]=="onload")?"checked='checked'":"";html+="<div id='edit_area_toggle_"+i+"'>";html+="<input id='edit_area_toggle_checkbox_"+id+"' class='toggle_"+id+"' type='checkbox' onclick='eAL.toggle(\""+id+"\");' accesskey='e' "+checked+" />";html+="<label for='edit_area_toggle_checkbox_"+id+"'>{$toggle}</label></div>";}if(eAs[id]["settings"]["debug"])html+="<textarea id='edit_area_debug_"+id+"' spellcheck='off' style='z-index:20;width:100%;height:120px;overflow:auto;border:solid black 1px;'></textarea><br />";html=t.translate(html,eAs[id]["settings"]["language"]);span.innerHTML=html;father=d.getElementById(id).parentNode;next=d.getElementById(id).nextSibling;if(next==null)father.appendChild(span); else father.insertBefore(span,next);}if(!eAs[id]["initialized"]){t.execCommand(id,"EA_init");if(eAs[id]["settings"]["display"]=="later"){eAs[id]["initialized"]=true;return;}}if(t.isIE){t.init_ie_textarea(id);}var area=eAs[id];for(i=0;i<area["settings"]["tab_toolbar"].length;i++){html_toolbar_content+=t.get_control_html(area["settings"]["tab_toolbar"][i],area["settings"]["language"]);}html_toolbar_content=t.translate(html_toolbar_content,area["settings"]["language"],"template");if(!t.iframe_script){t.iframe_script="";for(i=0;i<t.sub_scripts_to_load.length;i++)t.iframe_script+='<script language="javascript" type="text/javascript" src="'+t.baseURL+t.sub_scripts_to_load[i]+'.js"></script>';}for(i=0;i<area["settings"]["plugins"].length;i++){if(!t.all_plugins_loaded)t.iframe_script+='<script language="javascript" type="text/javascript" src="'+t.baseURL+'plugins/'+area["settings"]["plugins"][i]+'/'+area["settings"]["plugins"][i]+'.js"></script>';t.iframe_script+='<script language="javascript" type="text/javascript" src="'+t.baseURL+'plugins/'+area["settings"]["plugins"][i]+'/langs/'+area["settings"]["language"]+'.js"></script>';}if(!t.iframe_css){t.iframe_css="<link href='"+t.baseURL+"edit_area.css' rel='stylesheet' type='text/css' />";}template=t.template.replace(/\[__BASEURL__\]/g,t.baseURL);template=template.replace("[__TOOLBAR__]",html_toolbar_content);template=t.translate(template,area["settings"]["language"],"template");template=template.replace("[__CSSRULES__]",t.iframe_css);template=template.replace("[__JSCODE__]",t.iframe_script);template=template.replace("[__EA_VERSION__]",t.version);area.textarea=d.getElementById(area["settings"]["id"]);eAs[area["settings"]["id"]]["textarea"]=area.textarea;if(typeof(window.frames["frame_"+area["settings"]["id"]])!='undefined')delete window.frames["frame_"+area["settings"]["id"]];father=area.textarea.parentNode;content=d.createElement("iframe");content.name="frame_"+area["settings"]["id"];content.id="frame_"+area["settings"]["id"];content.style.borderWidth="0px";setAttribute(content,"frameBorder","0");content.style.overflow="hidden";content.style.display="none";next=area.textarea.nextSibling;if(next==null)father.appendChild(content); else father.insertBefore(content,next);f=window.frames["frame_"+area["settings"]["id"]];f.document.open();f.eAs=eAs;f.area_id=area["settings"]["id"];f.document.area_id=area["settings"]["id"];f.document.write(template);f.document.close();},toggle:function(id,toggle_to){if(!toggle_to)toggle_to=(eAs[id]["displayed"]==true)?"off":"on";if(eAs[id]["displayed"]==true&&toggle_to=="off"){this.toggle_off(id);} | else this.nav['isValidBrowser']=false;this.set_base_url();for(var i=0;i<this.scripts_to_load.length;i++){setTimeout("eAL.load_script('"+this.baseURL+this.scripts_to_load[i]+".js');",1);this.waiting_loading[this.scripts_to_load[i]+".js"]=false;}this.add_event(window,"load",EAL.prototype.window_loaded);};EAL.prototype ={has_error:function(){this.error=true;for(var i in EAL.prototype){EAL.prototype[i]=function(){};}},window_loaded:function(){eAL.win="loaded";if (document.forms){for (var i=0;i<document.forms.length;i++){var form=document.forms[i];form.edit_area_replaced_submit=null;try{form.edit_area_replaced_submit=form.onsubmit;form.onsubmit="";}catch (e){}eAL.add_event(form,"submit",EAL.prototype.submit);eAL.add_event(form,"reset",EAL.prototype.reset);}}eAL.add_event(window,"unload",function(){for(var i in eAs){eAL.delete_instance(i);}});},init_ie_textarea:function(id){var t=document.getElementById(id);try{if(t&&typeof(t.focused)=="undefined"){t.focus();t.focused=true;t.selectionStart=t.selectionEnd=0;get_IE_selection(t);eAL.add_event(t,"focus",IE_textarea_focus);eAL.add_event(t,"blur",IE_textarea_blur);}}catch(ex){}},init:function(settings){if(!settings["id"])this.has_error();if(this.error)return;if(eAs[settings["id"]])eAL.delete_instance(settings["id"]);for(var i in this.default_settings){if(typeof(settings[i])=="undefined")settings[i]=this.default_settings[i];}if(settings["browsers"]=="known"&&this.nav['isValidBrowser']==false){return;}if(settings["begin_toolbar"].length>0)settings["toolbar"]=settings["begin_toolbar"] +","+settings["toolbar"];if(settings["end_toolbar"].length>0)settings["toolbar"]=settings["toolbar"] +","+settings["end_toolbar"];settings["tab_toolbar"]=settings["toolbar"].replace(/ /g,"").split(",");settings["plugins"]=settings["plugins"].replace(/ /g,"").split(",");for(var i=0;i<settings["plugins"].length;i++){if(settings["plugins"][i].length==0)settings["plugins"].splice(i,1);}this.get_template();this.load_script(this.baseURL+"langs/"+settings["language"]+".js");if(settings["syntax"].length>0){settings["syntax"]=settings["syntax"].toLowerCase();this.load_script(this.baseURL+"reg_syntax/"+settings["syntax"]+".js");}eAs[settings["id"]]={"settings":settings};eAs[settings["id"]]["displayed"]=false;eAs[settings["id"]]["hidden"]=false;eAL.start(settings["id"]);},delete_instance:function(id){eAL.execCommand(id,"EA_delete");if(window.frames["frame_"+id]&&window.frames["frame_"+id].editArea){if(eAs[id]["displayed"])eAL.toggle(id,"off");window.frames["frame_"+id].editArea.execCommand("EA_unload");}var span=document.getElementById("EditAreaArroundInfos_"+id);if(span)span.parentNode.removeChild(span);var iframe=document.getElementById("frame_"+id);if(iframe){iframe.parentNode.removeChild(iframe);try{delete window.frames["frame_"+id];}catch (e){}}delete eAs[id];},start:function(id){if(this.win!="loaded"){setTimeout("eAL.start('"+id+"');",50);return;}for(var i in eAL.waiting_loading){if(eAL.waiting_loading[i]!="loaded"&&typeof(eAL.waiting_loading[i])!="function"){setTimeout("eAL.start('"+id+"');",50);return;}}if(!eAL.lang[eAs[id]["settings"]["language"]]||(eAs[id]["settings"]["syntax"].length>0&&!eAL.load_syntax[eAs[id]["settings"]["syntax"]])){setTimeout("eAL.start('"+id+"');",50);return;}if(eAs[id]["settings"]["syntax"].length>0)eAL.init_syntax_regexp();if(!document.getElementById("EditAreaArroundInfos_"+id)&&(eAs[id]["settings"]["debug"]||eAs[id]["settings"]["allow_toggle"])){var span=document.createElement("span");span.id="EditAreaArroundInfos_"+id;var html="";if(eAs[id]["settings"]["allow_toggle"]){checked=(eAs[id]["settings"]["display"]=="onload")?"checked":"";html+="<div id='edit_area_toggle_"+i+"'>";html+="<input id='edit_area_toggle_checkbox_"+id +"' class='toggle_"+id +"' type='checkbox' onclick='eAL.toggle(\""+id +"\");' accesskey='e' "+checked+" />";html+="<label for='edit_area_toggle_checkbox_"+id +"'>{$toggle}</label></div>";}if(eAs[id]["settings"]["debug"])html+="<textarea id='edit_area_debug_"+id +"' style='z-index:20;width:100%;height:120px;overflow:auto;border:solid black 1px;'></textarea><br />";html=eAL.translate(html,eAs[id]["settings"]["language"]);span.innerHTML=html;var father=document.getElementById(id).parentNode;var next=document.getElementById(id).nextSibling;if(next==null)father.appendChild(span);else father.insertBefore(span,next);}if(!eAs[id]["initialized"]){this.execCommand(id,"EA_init");if(eAs[id]["settings"]["display"]=="later"){eAs[id]["initialized"]=true;return;}}if(this.nav['isIE']){eAL.init_ie_textarea(id);}var html_toolbar_content="";area=eAs[id];for(var i=0;i<area["settings"]["tab_toolbar"].length;i++){html_toolbar_content+=this.get_control_html(area["settings"]["tab_toolbar"][i],area["settings"]["language"]);}if(!this.iframe_script){this.iframe_script="";for(var i=0;i<this.sub_scripts_to_load.length;i++)this.iframe_script+='<script language="javascript" type="text/javascript" src="'+this.baseURL+this.sub_scripts_to_load[i] +'.js"></script>';}for(var i=0;i<area["settings"]["plugins"].length;i++){if(!eAL.all_plugins_loaded)this.iframe_script+='<script language="javascript" type="text/javascript" src="'+this.baseURL+'plugins/'+area["settings"]["plugins"][i]+'/'+area["settings"]["plugins"][i] +'.js"></script>';this.iframe_script+='<script language="javascript" type="text/javascript" src="'+this.baseURL+'plugins/'+area["settings"]["plugins"][i]+'/langs/'+area["settings"]["language"] +'.js"></script>';}if(!this.iframe_css){this.iframe_css="<link href='"+this.baseURL +"edit_area.css' rel='stylesheet' type='text/css' />";}var template=this.template.replace(/\[__BASEURL__\]/g,this.baseURL);template=template.replace("[__TOOLBAR__]",html_toolbar_content);template=this.translate(template,area["settings"]["language"],"template");template=template.replace("[__CSSRULES__]",this.iframe_css);template=template.replace("[__JSCODE__]",this.iframe_script);template=template.replace("[__EA_VERSION__]",this.version);area.textarea=document.getElementById(area["settings"]["id"]);eAs[area["settings"]["id"]]["textarea"]=area.textarea;if(typeof(window.frames["frame_"+area["settings"]["id"]])!='undefined')delete window.frames["frame_"+area["settings"]["id"]];var father=area.textarea.parentNode;var content=document.createElement("iframe");content.name="frame_"+area["settings"]["id"];content.id="frame_"+area["settings"]["id"];content.style.borderWidth="0px";setAttribute(content,"frameBorder","0");content.style.overflow="hidden";content.style.display="none";var next=area.textarea.nextSibling;if(next==null)father.appendChild(content);else father.insertBefore(content,next);var frame=window.frames["frame_"+area["settings"]["id"]];frame.document.open();frame.eAs=eAs;frame.area_id=area["settings"]["id"];frame.document.area_id=area["settings"]["id"];frame.document.write(template);frame.document.close();},toggle:function(id,toggle_to){if(!toggle_to)toggle_to=(eAs[id]["displayed"]==true)?"off":"on";if(eAs[id]["displayed"]==true &&toggle_to=="off"){this.toggle_off(id);} |
FB.login(); | FB.getLoginStatus(function(response){ if (response.session){ signin_form.submit(); } else { FB.login(); } }); | var start_facebook_login = function(){ set_provider_name($(this)); if (typeof FB != 'undefined'){ FB.login(); //FB.getLoginStatus(function(response){ // if (response.session){ // alert('you are logged in'); // } // else { // } //}); } return false; }; |
setup_enter_key_handler( openid_login_token_input, function(){ openid_submit_button.click(); return false; } ); | var start_login_with_extra_openid_token = function() { show_openid_input_fields($(this).attr('name')); set_provider_name($(this)); setup_event_handlers( openid_submit_button, function(){ signin_form.unbind( 'submit' ).submit( submit_with_extra_openid_token ); } ); return false; }; |
|
setup_event_handlers( password_button, function(){ signin_form.unbind( 'submit' ).submit( submit_action ); | focus_input.focus(); var submit_password_login = function(){ signin_form.unbind('submit').submit(submit_action); }; setup_enter_key_handler( submittable_input, function() { password_button.click(); return false; | var start_password_login_or_change = function(){ reset_form(); set_provider_name($(this)); var provider_name = $(this).attr('name'); var token_name = extra_token_name[provider_name] var password_action_input = $('input[name=password_action]'); if (userIsAuthenticated === true){ var password_button = $('input[name=change_password]'); var submit_action = submit_change_password; if (existing_login_methods && existing_login_methods[provider_name]){ var change_pw_heading = 'Change your {provider} password'; var password_heading_text = $.i18n._(change_pw_heading); var password_button_text = $.i18n._('Change password'); } else { var create_pw_heading = 'Create a password for {provider}'; var password_heading_text = $.i18n._(create_pw_heading); var password_button_text = $.i18n._('Create password'); } if (provider_name === 'local'){ var provider_cleaned_name = siteName; } else { var provider_cleaned_name = provider_name; } $('#password-heading').html( password_heading_text.replace('{provider}', provider_cleaned_name) ) password_button.val(password_button_text); password_action_input.val('change_password'); } else{ $('#password-heading>span').html(token_name); var password_button = $('input[name=login_with_password]'); var submit_action = submit_login_with_password; var create_pw_link = $('a.create-password-account') if (create_pw_link.length > 0){ create_pw_link.html($.i18n._('Create a password-protected account')); var url = create_pw_link.attr('href'); if (url.indexOf('?') !== -1){ url = url.replace(/\?.*$/,'?login_provider=' + provider_name); } else{ url += '?login_provider=' + provider_name; } create_pw_link.attr('href', url); } password_action_input.val('login'); } password_input_fields.show(); setup_event_handlers( password_button, function(){ signin_form.unbind( 'submit' ).submit( submit_action ); } ); return false; }; |
setup_event_handlers(password_button, submit_password_login); | var start_password_login_or_change = function(){ reset_form(); set_provider_name($(this)); var provider_name = $(this).attr('name'); var token_name = extra_token_name[provider_name] var password_action_input = $('input[name=password_action]'); if (userIsAuthenticated === true){ var password_button = $('input[name=change_password]'); var submit_action = submit_change_password; if (existing_login_methods && existing_login_methods[provider_name]){ var change_pw_heading = 'Change your {provider} password'; var password_heading_text = $.i18n._(change_pw_heading); var password_button_text = $.i18n._('Change password'); } else { var create_pw_heading = 'Create a password for {provider}'; var password_heading_text = $.i18n._(create_pw_heading); var password_button_text = $.i18n._('Create password'); } if (provider_name === 'local'){ var provider_cleaned_name = siteName; } else { var provider_cleaned_name = provider_name; } $('#password-heading').html( password_heading_text.replace('{provider}', provider_cleaned_name) ) password_button.val(password_button_text); password_action_input.val('change_password'); } else{ $('#password-heading>span').html(token_name); var password_button = $('input[name=login_with_password]'); var submit_action = submit_login_with_password; var create_pw_link = $('a.create-password-account') if (create_pw_link.length > 0){ create_pw_link.html($.i18n._('Create a password-protected account')); var url = create_pw_link.attr('href'); if (url.indexOf('?') !== -1){ url = url.replace(/\?.*$/,'?login_provider=' + provider_name); } else{ url += '?login_provider=' + provider_name; } create_pw_link.attr('href', url); } password_action_input.val('login'); } password_input_fields.show(); setup_event_handlers( password_button, function(){ signin_form.unbind( 'submit' ).submit( submit_action ); } ); return false; }; |
|
div=document.getElementById("pb_" + id + "_" + num + "_outer"); | div=document.getElementById("prog_" + id + "_" + num); | function startUpload(form, id, num) { form.style.display="none"; updateProgressbar(id + "_" + num); div=document.getElementById("pb_" + id + "_" + num + "_outer"); div.style.display="block"; num=parseInt(num, 10) + 1; createUploadIframe(frameElement, id, num); } |
this.setStatusText(this.VLC_STATUS[0]); | this.setStatusText(VLC_STATUS[0]); | ,statusChanged:function() { if (!this.status) { this.setStatusText(this.VLC_STATUS[0]); var width = this.getSliderLength(); var tb = $('#' +this.playerId + '_toolbar_slider' ); tb.width(width); return; } if (this.status == 3) { // playing //if(!this.sliderCreated) this.setStatusText('playing'); this.setPlaying(true); } else { this.setPlaying(false); if (this.sliderCreated && this.status != 4) { this.updateSlider(0); } if ((this.status == 0 || this.status == 5 || this.status == 6) ) { this.setStatusText(this.VLC_STATUS[this.status]); this.sliderCreated = false; } } if(!this.sliderCreated) this.setStatusText(this.VLC_STATUS[this.status]); return; } |
this.setStatusText(this.VLC_STATUS[this.status]); | this.setStatusText(VLC_STATUS[this.status]); | ,statusChanged:function() { if (!this.status) { this.setStatusText(this.VLC_STATUS[0]); var width = this.getSliderLength(); var tb = $('#' +this.playerId + '_toolbar_slider' ); tb.width(width); return; } if (this.status == 3) { // playing //if(!this.sliderCreated) this.setStatusText('playing'); this.setPlaying(true); } else { this.setPlaying(false); if (this.sliderCreated && this.status != 4) { this.updateSlider(0); } if ((this.status == 0 || this.status == 5 || this.status == 6) ) { this.setStatusText(this.VLC_STATUS[this.status]); this.sliderCreated = false; } } if(!this.sliderCreated) this.setStatusText(this.VLC_STATUS[this.status]); return; } |
if(!this.sliderCreated) this.setStatusText(this.VLC_STATUS[this.status]); | if(!this.sliderCreated) this.setStatusText(VLC_STATUS[this.status]); | ,statusChanged:function() { if (!this.status) { this.setStatusText(this.VLC_STATUS[0]); var width = this.getSliderLength(); var tb = $('#' +this.playerId + '_toolbar_slider' ); tb.width(width); return; } if (this.status == 3) { // playing //if(!this.sliderCreated) this.setStatusText('playing'); this.setPlaying(true); } else { this.setPlaying(false); if (this.sliderCreated && this.status != 4) { this.updateSlider(0); } if ((this.status == 0 || this.status == 5 || this.status == 6) ) { this.setStatusText(this.VLC_STATUS[this.status]); this.sliderCreated = false; } } if(!this.sliderCreated) this.setStatusText(this.VLC_STATUS[this.status]); return; } |
step: function(now, settings) { if (settings.prop == 'height') { percentDone = ( settings.end - settings.start === 0 ) ? 0 : (settings.now - settings.start) / (settings.end - settings.start); } options.toShow[0].style[settings.prop] = (percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit; }, | step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};e&&e.length&&d(e[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});d.ui.plugin.add("resizable","containment",{start:function(){var b=d(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof d?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement= | step: function(now, settings) { // only calculate the percent when animating height // IE gets very inconsistent results when animating elements // with small values, which is common for padding if (settings.prop == 'height') { percentDone = ( settings.end - settings.start === 0 ) ? 0 : (settings.now - settings.start) / (settings.end - settings.start); } options.toShow[0].style[settings.prop] = (percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit; }, |
e = e ? e : window.event; e.cancel = true; | stopEvent: function(e) { e.cancelBubble = true; e.returnValue = false; if (e.stopPropagation) {e.stopPropagation(); } if( e.preventDefault ) { e.preventDefault(); } }, |
|
if (onSuccessFn) onSuccessFn(r.getResult().Count); | if (onSuccessFn) onSuccessFn(r.Count); | storeIntersectFromSortedSets: function(id, fromSetIds, onSuccessFn, onErrorFn) { this.gateway.postToService('StoreIntersectFromSortedSets', { Id: id || null, FromSetIds: fromSetIds || null }, function(r) { if (onSuccessFn) onSuccessFn(r.getResult().Count); }, onErrorFn || RedisClient.errorFn); }, |
storeLoaded: function(store, response) { | storeLoaded: function(store) { | storeLoaded: function(store, response) { var template = '', tr, columns = [], useRowHeaders = this.row.useHeaders(); this.fireEvent('beginCreateGrid'); this.gridObj.getElement('tbody').empty(); // TODO: consider moving whole thing into Jx.Columns ?? // create a suitable column representation for everything // in the store that doesn't already have a representation store.options.columns.each(function(col, index) { if (!this.columns.getByName(col.name)) { var renderer = new Jx.Grid.Renderer.Text(), format = $defined(col.format) ? col.format : null, template = "<span class='jxGridCellContent'>"+ ($defined(col.label) ? col.label : col.name).capitalize() + "</span>", column; if ($defined(col.renderer)) { if ($type(col.renderer) == 'string') { if (Jx.Grid.Renderer[col.renderer.capitalize()]) { renderer = new Jx.Grid.Renderer[col.renderer.capitalize()](); } } else if ($type(col.renderer) == 'object' && $defined(col.renderer.type) && Jx.Grid.Renderer[col.renderer.type.capitalize()]) { renderer = new Jx.Grid.Renderer[col.renderer.type.capitalize()](col.renderer); } } if (format) { if ($type(format) == 'string' && $defined(Jx.Formatter[format.capitalize()])) { renderer.options.formatter = new Jx.Formatter[format.capitalize()](); } else if ($type(format) == 'object' && $defined(format.type) && $defined(Jx.Formatter[format.type.capitalize()])) { renderer.options.formatter = new Jx.Formatter[format.type.capitalize()](format); } } column = new Jx.Column({ grid: this, template: template, renderMode: $defined(col.renderMode) ? col.renderMode : $defined(col.width) ? 'fixed' : 'fit', width: $defined(col.width) ? col.width : null, isEditable: $defined(col.editable) ? col.editable : false, isSortable: $defined(col.sortable) ? col.sortable : false, isResizable: $defined(col.resizable) ? col.resizable : false, isHidden: $defined(col.hidden) ? col.hidden : false, name: col.name || '', renderer: renderer }); columns.push(column); } }, this); this.columns.addColumns(columns); if (this.columns.useHeaders()) { tr = new Element('tr'); this.columns.getHeaders(tr); this.colObj.getElement('thead').empty().adopt(tr); } this.columns.calculateWidths(); this.columns.createRules(this.styleSheet+'Columns', '.'+this.uniqueId); this.fireEvent('doneCreateGrid'); this.drawStore(); }, |
tr.adopt(new Element('th', { 'class': 'jxGridColHead', 'html': ' ', styles: { width: 1000 } })) | storeLoaded: function(store) { var template = '', tr, columns = [], useRowHeaders = this.row.useHeaders(); this.fireEvent('beginCreateGrid'); this.gridObj.getElement('tbody').empty(); // TODO: consider moving whole thing into Jx.Columns ?? // create a suitable column representation for everything // in the store that doesn't already have a representation store.options.columns.each(function(col, index) { if (!this.columns.getByName(col.name)) { var renderer = new Jx.Grid.Renderer.Text(), format = $defined(col.format) ? col.format : null, template = "<span class='jxGridCellContent'>"+ ($defined(col.label) ? col.label : col.name).capitalize() + "</span>", column; if ($defined(col.renderer)) { if ($type(col.renderer) == 'string') { if (Jx.Grid.Renderer[col.renderer.capitalize()]) { renderer = new Jx.Grid.Renderer[col.renderer.capitalize()](); } } else if ($type(col.renderer) == 'object' && $defined(col.renderer.type) && Jx.Grid.Renderer[col.renderer.type.capitalize()]) { renderer = new Jx.Grid.Renderer[col.renderer.type.capitalize()](col.renderer); } } if (format) { if ($type(format) == 'string' && $defined(Jx.Formatter[format.capitalize()])) { renderer.options.formatter = new Jx.Formatter[format.capitalize()](); } else if ($type(format) == 'object' && $defined(format.type) && $defined(Jx.Formatter[format.type.capitalize()])) { renderer.options.formatter = new Jx.Formatter[format.type.capitalize()](format); } } column = new Jx.Column({ grid: this, template: template, renderMode: $defined(col.renderMode) ? col.renderMode : $defined(col.width) ? 'fixed' : 'fit', width: $defined(col.width) ? col.width : null, isEditable: $defined(col.editable) ? col.editable : false, isSortable: $defined(col.sortable) ? col.sortable : false, isResizable: $defined(col.resizable) ? col.resizable : false, isHidden: $defined(col.hidden) ? col.hidden : false, name: col.name || '', renderer: renderer }); columns.push(column); } }, this); this.columns.addColumns(columns); if (this.columns.useHeaders()) { tr = new Element('tr'); this.columns.getHeaders(tr); this.colObj.getElement('thead').empty().adopt(tr); } this.columns.calculateWidths(); this.columns.createRules(this.styleSheet+'Columns', '.'+this.uniqueId); this.fireEvent('doneCreateGrid'); this.drawStore(); }, |
|
if (onSuccessFn) onSuccessFn(r.getResult().Count); | if (onSuccessFn) onSuccessFn(r.Count); | storeUnionFromSortedSets: function(id, fromSetIds, onSuccessFn, onErrorFn) { this.gateway.postToService('StoreUnionFromSortedSets', { Id: id || null, FromSetIds: fromSetIds || null }, function(r) { if (onSuccessFn) onSuccessFn(r.getResult().Count); }, onErrorFn || RedisClient.errorFn); }, |
success: function(data){callback(object, voteType, data)}}); | success: function(data){callback(object, voteType, data);} }); | var submit = function(object, voteType, callback) { $.ajax({ type: "POST", cache: false, dataType: "json", url: scriptUrl + $.i18n._("questions/") + questionId + "/" + $.i18n._("vote/"), data: { "type": voteType, "postId": postId }, error: handleFail, success: function(data){callback(object, voteType, data)}}); }; |
Ext.getCmp('biomaterial-grid-panel').init(); | var submitDesign = function() { ExperimentalDesignController.createDesignFromFile(dwr.util.getValue("expressionExperimentID"), serverFilePath, { callback : function() { Ext.getCmp('experimental-design-upload-form-window').close(); Ext.Msg.alert("Success", "Design imported."); Ext.getCmp('experimental-factor-grid').getStore().reload(); // Ext.getCmp('factor-value-grid').getStore().reload(); // should have started out empty anyway. Ext.getCmp('biomaterial-grid-panel').init(); } });}; |
|
if (onSubmitCallback) | if (onSubmitCallback){ | submitHandler: function(form) { disableSubmitButton(formSelector); if (onSubmitCallback) onSubmitCallback(); else form.submit(); } |
else | } else{ | submitHandler: function(form) { disableSubmitButton(formSelector); if (onSubmitCallback) onSubmitCallback(); else form.submit(); } |
} | submitHandler: function(form) { disableSubmitButton(formSelector); if (onSubmitCallback) onSubmitCallback(); else form.submit(); } |
|
success: function(response) { validator.settings.messages[element.name].remote = previous.originalMessage; var valid = response === true; if ( valid ) { var submitted = validator.formSubmitted; validator.prepareElement(element); validator.formSubmitted = submitted; validator.successList.push(element); validator.showErrors(); } else { var errors = {}; var message = (previous.message = response || validator.defaultMessage( element, "remote" )); errors[element.name] = $.isFunction(message) ? message(value) : message; validator.showErrors(errors); } previous.valid = valid; validator.stopRequest(element, valid); } | var Prototype={Version:"1.6.1_rc2",Browser:{IE:!!(window.attachEvent&&navigator.userAgent.indexOf("Opera")===-1),Opera:navigator.userAgent.indexOf("Opera")>-1,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")===-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){if(window.HTMLElement&&window.HTMLElement.prototype){return true}if(window.Element&&window.Element.prototype){return true}})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var A=document.createElement("div");if(A["__proto__"]&&A["__proto__"]!==document.createElement("form")["__proto__"]){return true}return false})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(A){return A}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var C;for(var B=0,D=arguments.length;B<D;B++){var A=arguments[B];try{C=A();break}catch(E){}}return C}};var Class=(function(){function A(){var G=null,F=$A(arguments);if(Object.isFunction(F[0])){G=F.shift()}function C(){this.initialize.apply(this,arguments)}Object.extend(C,Class.Methods);C.superclass=G;C.subclasses=[];if(G){var D=function(){};D.prototype=G.prototype;C.prototype=new D;G.subclasses.push(C)}for(var E=0;E<F.length;E++){C.addMethods(F[E])}if(!C.prototype.initialize){C.prototype.initialize=Prototype.emptyFunction}C.prototype.constructor=C;return C}function B(I){var E=this.superclass&&this.superclass.prototype;var D=Object.keys(I);if(!Object.keys({toString:true}).length){if(I.toString!=Object.prototype.toString){D.push("toString")}if(I.valueOf!=Object.prototype.valueOf){D.push("valueOf")}}for(var C=0,F=D.length;C<F;C++){var H=D[C],G=I[H];if(E&&Object.isFunction(G)&&G.argumentNames().first()=="$super"){var J=G;G=(function(K){return function(){return E[K].apply(this,arguments)}})(H).wrap(J);G.valueOf=J.valueOf.bind(J);G.toString=J.toString.bind(J)}this.prototype[H]=G}return this}return{create:A,Methods:{addMethods:B}}})();(function(){function L(Q){return Object.prototype.toString.call(Q).match(/^\[object\s(.*)\]$/)[1]}function H(Q,S){for(var R in S){Q[R]=S[R]}return Q}function K(Q){try{if(D(Q)){return"undefined"}if(Q===null){return"null"}return Q.inspect?Q.inspect():String(Q)}catch(R){if(R instanceof RangeError){return"..."}throw R}}function J(Q){var S=typeof Q;switch(S){case"undefined":case"function":case"unknown":return ;case"boolean":return Q.toString()}if(Q===null){return"null"}if(Q.toJSON){return Q.toJSON()}if(G(Q)){return }var R=[];for(var U in Q){var T=J(Q[U]);if(!D(T)){R.push(U.toJSON()+": "+T)}}return"{"+R.join(", ")+"}"}function C(Q){return $H(Q).toQueryString()}function E(Q){return Q&&Q.toHTML?Q.toHTML():String.interpret(Q)}function O(Q){var R=[];for(var S in Q){R.push(S)}return R}function M(Q){var R=[];for(var S in Q){R.push(Q[S])}return R}function I(Q){return H({},Q)}function G(Q){return !!(Q&&Q.nodeType==1)}function F(Q){return L(Q)==="Array"}function P(Q){return Q instanceof Hash}function B(Q){return typeof Q==="function"}function A(Q){return L(Q)==="String"}function N(Q){return L(Q)==="Number"}function D(Q){return typeof Q==="undefined"}H(Object,{extend:H,inspect:K,toJSON:J,toQueryString:C,toHTML:E,keys:O,values:M,clone:I,isElement:G,isArray:F,isHash:P,isFunction:B,isString:A,isNumber:N,isUndefined:D})})();Object.extend(Function.prototype,(function(){var K=Array.prototype.slice;function D(O,L){var N=O.length,M=L.length;while(M--){O[N+M]=L[M]}return O}function I(M,L){M=K.call(M,0);return D(M,L)}function G(){var L=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\ | success: function(response) { validator.settings.messages[element.name].remote = previous.originalMessage; var valid = response === true; if ( valid ) { var submitted = validator.formSubmitted; validator.prepareElement(element); validator.formSubmitted = submitted; validator.successList.push(element); validator.showErrors(); } else { var errors = {}; var message = (previous.message = response || validator.defaultMessage( element, "remote" )); errors[element.name] = $.isFunction(message) ? message(value) : message; validator.showErrors(errors); } previous.valid = valid; validator.stopRequest(element, valid); } |
success: function(f, a){ if (type == 'caserun') { Ext.getCmp('run_progress').updateProgress(a.result.passed, a.result.failed, a.result.blocked, a.result.complete); } Testopia.Util.notify.msg('Test ' + type + 's updated', 'The selected {0}s were updated successfully', type); if (grid.selectedRows) { grid.store.baseParams.addcases = grid.selectedRows.join(','); Ext.getCmp(type + '_filtered_txt').show(); } try { Ext.getCmp('case_details_panel').store.reload(); } catch (err) { } grid.store.reload({ callback: function(){ if (grid.selectedRows) { var sm = grid.getSelectionModel(); var sel = []; for (var i = 0; i < grid.selectedRows.length; i++) { var index = grid.store.find('case_id', grid.selectedRows[i]); if (index >= 0) sel.push(index); } sm.selectRows(sel); if (sm.getCount() < 1) { Ext.getCmp('case_details_panel').disable(); } } } }); }, | success: function(){ Ext.getCmp('attachments_panel').store.load(); Ext.getCmp('new_attachment_win').close(); }, | success: function(f, a){ if (type == 'caserun') { Ext.getCmp('run_progress').updateProgress(a.result.passed, a.result.failed, a.result.blocked, a.result.complete); } Testopia.Util.notify.msg('Test ' + type + 's updated', 'The selected {0}s were updated successfully', type); if (grid.selectedRows) { grid.store.baseParams.addcases = grid.selectedRows.join(','); Ext.getCmp(type + '_filtered_txt').show(); } try { Ext.getCmp('case_details_panel').store.reload(); } catch (err) { } grid.store.reload({ callback: function(){ if (grid.selectedRows) { var sm = grid.getSelectionModel(); var sel = []; for (var i = 0; i < grid.selectedRows.length; i++) { var index = grid.store.find('case_id', grid.selectedRows[i]); if (index >= 0) sel.push(index); } sm.selectRows(sel); if (sm.getCount() < 1) { Ext.getCmp('case_details_panel').disable(); } } } }); }, |
var blocks = new Array(); | var blocks = new jQuery(); | success: function(data, textStatus, XMLHttpRequest) { var json=data; try { if (!generalstats_is_undefined(json._ajax_nonce) && json._ajax_nonce!==null && json._ajax_nonce.length) XMLHttpRequest.query_params.put('_ajax_nonce', json._ajax_nonce); var blocks = new Array(); if (XMLHttpRequest.params.containsKey('fields') && XMLHttpRequest.params.get('fields')!==null && XMLHttpRequest.params.get('fields').length) blocks=jQuery.makeArray(jQuery(XMLHttpRequest.params.get('fields'))); if (XMLHttpRequest.params.containsKey('field') && XMLHttpRequest.params.get('field')!==null && XMLHttpRequest.params.get('field').length) { var field=jQuery.makeArray(jQuery('#'+XMLHttpRequest.params.get('field'))); if (field.length>0) blocks.push(field[0]); } if (blocks.length>0) { if (generalstats_is_undefined(json.result) || json.result===null || !json.result.length) throw -2; var result=json.result; if (XMLHttpRequest.params.containsKey('compare_string') && XMLHttpRequest.params.get('compare_string')!==null && XMLHttpRequest.params.get('compare_string').length && result.indexOf(XMLHttpRequest.params.get('compare_string'))!==0) throw -3; for (var i=0;i<blocks.length;i++) jQuery(blocks[i]).replaceWith(result); } } catch(error) { if (XMLHttpRequest.params.containsKey('callback_error') && XMLHttpRequest.params.get('callback_error')!==null) { var callback_error_function = XMLHttpRequest.params.get('callback_error'); window[callback_error_function(error)]; } } }, |
blocks=jQuery.makeArray(jQuery(XMLHttpRequest.params.get('fields'))); | blocks=jQuery(XMLHttpRequest.params.get('fields')); | success: function(data, textStatus, XMLHttpRequest) { var json=data; try { if (!generalstats_is_undefined(json._ajax_nonce) && json._ajax_nonce!==null && json._ajax_nonce.length) XMLHttpRequest.query_params.put('_ajax_nonce', json._ajax_nonce); var blocks = new Array(); if (XMLHttpRequest.params.containsKey('fields') && XMLHttpRequest.params.get('fields')!==null && XMLHttpRequest.params.get('fields').length) blocks=jQuery.makeArray(jQuery(XMLHttpRequest.params.get('fields'))); if (XMLHttpRequest.params.containsKey('field') && XMLHttpRequest.params.get('field')!==null && XMLHttpRequest.params.get('field').length) { var field=jQuery.makeArray(jQuery('#'+XMLHttpRequest.params.get('field'))); if (field.length>0) blocks.push(field[0]); } if (blocks.length>0) { if (generalstats_is_undefined(json.result) || json.result===null || !json.result.length) throw -2; var result=json.result; if (XMLHttpRequest.params.containsKey('compare_string') && XMLHttpRequest.params.get('compare_string')!==null && XMLHttpRequest.params.get('compare_string').length && result.indexOf(XMLHttpRequest.params.get('compare_string'))!==0) throw -3; for (var i=0;i<blocks.length;i++) jQuery(blocks[i]).replaceWith(result); } } catch(error) { if (XMLHttpRequest.params.containsKey('callback_error') && XMLHttpRequest.params.get('callback_error')!==null) { var callback_error_function = XMLHttpRequest.params.get('callback_error'); window[callback_error_function(error)]; } } }, |
if (XMLHttpRequest.params.containsKey('field') && XMLHttpRequest.params.get('field')!==null && XMLHttpRequest.params.get('field').length) { var field=jQuery.makeArray(jQuery('#'+XMLHttpRequest.params.get('field'))); | var field = new jQuery(); | success: function(data, textStatus, XMLHttpRequest) { var json=data; try { if (!generalstats_is_undefined(json._ajax_nonce) && json._ajax_nonce!==null && json._ajax_nonce.length) XMLHttpRequest.query_params.put('_ajax_nonce', json._ajax_nonce); var blocks = new Array(); if (XMLHttpRequest.params.containsKey('fields') && XMLHttpRequest.params.get('fields')!==null && XMLHttpRequest.params.get('fields').length) blocks=jQuery.makeArray(jQuery(XMLHttpRequest.params.get('fields'))); if (XMLHttpRequest.params.containsKey('field') && XMLHttpRequest.params.get('field')!==null && XMLHttpRequest.params.get('field').length) { var field=jQuery.makeArray(jQuery('#'+XMLHttpRequest.params.get('field'))); if (field.length>0) blocks.push(field[0]); } if (blocks.length>0) { if (generalstats_is_undefined(json.result) || json.result===null || !json.result.length) throw -2; var result=json.result; if (XMLHttpRequest.params.containsKey('compare_string') && XMLHttpRequest.params.get('compare_string')!==null && XMLHttpRequest.params.get('compare_string').length && result.indexOf(XMLHttpRequest.params.get('compare_string'))!==0) throw -3; for (var i=0;i<blocks.length;i++) jQuery(blocks[i]).replaceWith(result); } } catch(error) { if (XMLHttpRequest.params.containsKey('callback_error') && XMLHttpRequest.params.get('callback_error')!==null) { var callback_error_function = XMLHttpRequest.params.get('callback_error'); window[callback_error_function(error)]; } } }, |
if (field.length>0) blocks.push(field[0]); } | if (XMLHttpRequest.params.containsKey('field') && XMLHttpRequest.params.get('field')!==null && XMLHttpRequest.params.get('field').length) field=jQuery('#'+XMLHttpRequest.params.get('field')); | success: function(data, textStatus, XMLHttpRequest) { var json=data; try { if (!generalstats_is_undefined(json._ajax_nonce) && json._ajax_nonce!==null && json._ajax_nonce.length) XMLHttpRequest.query_params.put('_ajax_nonce', json._ajax_nonce); var blocks = new Array(); if (XMLHttpRequest.params.containsKey('fields') && XMLHttpRequest.params.get('fields')!==null && XMLHttpRequest.params.get('fields').length) blocks=jQuery.makeArray(jQuery(XMLHttpRequest.params.get('fields'))); if (XMLHttpRequest.params.containsKey('field') && XMLHttpRequest.params.get('field')!==null && XMLHttpRequest.params.get('field').length) { var field=jQuery.makeArray(jQuery('#'+XMLHttpRequest.params.get('field'))); if (field.length>0) blocks.push(field[0]); } if (blocks.length>0) { if (generalstats_is_undefined(json.result) || json.result===null || !json.result.length) throw -2; var result=json.result; if (XMLHttpRequest.params.containsKey('compare_string') && XMLHttpRequest.params.get('compare_string')!==null && XMLHttpRequest.params.get('compare_string').length && result.indexOf(XMLHttpRequest.params.get('compare_string'))!==0) throw -3; for (var i=0;i<blocks.length;i++) jQuery(blocks[i]).replaceWith(result); } } catch(error) { if (XMLHttpRequest.params.containsKey('callback_error') && XMLHttpRequest.params.get('callback_error')!==null) { var callback_error_function = XMLHttpRequest.params.get('callback_error'); window[callback_error_function(error)]; } } }, |
if (blocks.length>0) { | if (blocks.length>0 || field.length>0) { | success: function(data, textStatus, XMLHttpRequest) { var json=data; try { if (!generalstats_is_undefined(json._ajax_nonce) && json._ajax_nonce!==null && json._ajax_nonce.length) XMLHttpRequest.query_params.put('_ajax_nonce', json._ajax_nonce); var blocks = new Array(); if (XMLHttpRequest.params.containsKey('fields') && XMLHttpRequest.params.get('fields')!==null && XMLHttpRequest.params.get('fields').length) blocks=jQuery.makeArray(jQuery(XMLHttpRequest.params.get('fields'))); if (XMLHttpRequest.params.containsKey('field') && XMLHttpRequest.params.get('field')!==null && XMLHttpRequest.params.get('field').length) { var field=jQuery.makeArray(jQuery('#'+XMLHttpRequest.params.get('field'))); if (field.length>0) blocks.push(field[0]); } if (blocks.length>0) { if (generalstats_is_undefined(json.result) || json.result===null || !json.result.length) throw -2; var result=json.result; if (XMLHttpRequest.params.containsKey('compare_string') && XMLHttpRequest.params.get('compare_string')!==null && XMLHttpRequest.params.get('compare_string').length && result.indexOf(XMLHttpRequest.params.get('compare_string'))!==0) throw -3; for (var i=0;i<blocks.length;i++) jQuery(blocks[i]).replaceWith(result); } } catch(error) { if (XMLHttpRequest.params.containsKey('callback_error') && XMLHttpRequest.params.get('callback_error')!==null) { var callback_error_function = XMLHttpRequest.params.get('callback_error'); window[callback_error_function(error)]; } } }, |
for (var i=0;i<blocks.length;i++) jQuery(blocks[i]).replaceWith(result); | blocks.replaceWith(result); field.replaceWith(result); | success: function(data, textStatus, XMLHttpRequest) { var json=data; try { if (!generalstats_is_undefined(json._ajax_nonce) && json._ajax_nonce!==null && json._ajax_nonce.length) XMLHttpRequest.query_params.put('_ajax_nonce', json._ajax_nonce); var blocks = new Array(); if (XMLHttpRequest.params.containsKey('fields') && XMLHttpRequest.params.get('fields')!==null && XMLHttpRequest.params.get('fields').length) blocks=jQuery.makeArray(jQuery(XMLHttpRequest.params.get('fields'))); if (XMLHttpRequest.params.containsKey('field') && XMLHttpRequest.params.get('field')!==null && XMLHttpRequest.params.get('field').length) { var field=jQuery.makeArray(jQuery('#'+XMLHttpRequest.params.get('field'))); if (field.length>0) blocks.push(field[0]); } if (blocks.length>0) { if (generalstats_is_undefined(json.result) || json.result===null || !json.result.length) throw -2; var result=json.result; if (XMLHttpRequest.params.containsKey('compare_string') && XMLHttpRequest.params.get('compare_string')!==null && XMLHttpRequest.params.get('compare_string').length && result.indexOf(XMLHttpRequest.params.get('compare_string'))!==0) throw -3; for (var i=0;i<blocks.length;i++) jQuery(blocks[i]).replaceWith(result); } } catch(error) { if (XMLHttpRequest.params.containsKey('callback_error') && XMLHttpRequest.params.get('callback_error')!==null) { var callback_error_function = XMLHttpRequest.params.get('callback_error'); window[callback_error_function(error)]; } } }, |
jq('.hidden_items').remove() | jq('.hidden_items').remove(); | success: function(data) { jq('.hidden_items').remove() jq('form[name=tabbedview_form]').append(data); } |
$("#search_progress").hide(); renderOtherBooks(books); showAvailableTab();}, | $("#searchmine_progress").hide(); myBooks.render(books); showOwnedTab(); }, | success: function(books){ $("#search_progress").hide(); renderOtherBooks(books); showAvailableTab();}, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.