From e486ef4c1ee1c9cdba32c5bf87c140e53d058e63 Mon Sep 17 00:00:00 2001 From: Fabian Pichler Date: Thu, 12 Mar 2026 10:05:16 +0100 Subject: [PATCH 01/73] default hide xwiki-menu --- src/main/webapp/templates/startpage.vm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/templates/startpage.vm b/src/main/webapp/templates/startpage.vm index 463cf79b1..e5b3ff760 100644 --- a/src/main/webapp/templates/startpage.vm +++ b/src/main/webapp/templates/startpage.vm @@ -15,4 +15,4 @@
#else
## class="content#if($showLeftPanels == "0")hideleft#end#if($showRightPanels == "0")hideright#end"> -#end \ No newline at end of file +#end From cac380e9e94e41f3f3e510fed7dbc51009824763 Mon Sep 17 00:00:00 2001 From: Fabian Pichler Date: Wed, 18 Mar 2026 01:41:48 +0100 Subject: [PATCH 02/73] format all css and js to reduce further PR diffs --- .prettierignore | 84 + .../resources/celJS/adminUi/accessRights.js | 74 +- .../resources/celJS/adminUi/admininterface.js | 338 +- .../resources/celJS/adminUi/admintoolbar.js | 1033 ++++--- .../webapp/resources/celJS/adminUi/menubar.js | 312 +- .../resources/celJS/adminUi/overlayResize.js | 67 +- .../sendNewsletterInjectedReceivers.js | 47 +- src/main/webapp/resources/celJS/base64.js | 99 +- .../celJS/celCookiesEnabled/CookiesEnabled.js | 95 +- .../celCookiesEnabled/cookiesEnabledQuery.js | 26 +- .../resources/celJS/celTabMenu/TabEditor.js | 2754 +++++++++-------- .../celJS/celTabMenu/celementsTabMenu.js | 12 +- .../resources/celJS/celTabMenu/ctrlKey.js | 8 +- .../celJS/celTabMenu/publishDatePicker.js | 8 +- .../resources/celJS/celanim/CelArrowBox.js | 435 +-- .../celJS/celanim/accordeon-block.js | 438 +-- .../celJS/celanim/accordeon-heading.js | 456 +-- .../resources/celJS/celanim/movieplayer.js | 598 ++-- .../resources/celJS/celanim/overlaySlide.js | 308 +- .../resources/celJS/celanim/slideshow.js | 850 +++-- .../celpresentation/CelPresentationLink.js | 259 +- .../CelementsResponsiveDesignImage.js | 185 +- .../celpresentation/CelementsSlideShow.js | 926 +++--- .../celJS/celpresentation/celYuiOverlay.js | 323 +- .../celJS/celpresentation/reorder.js | 163 +- .../celJS/celpresentation/sitemap.js | 68 +- .../celJS/contextMenu/contextmenu-hover.js | 125 +- .../celJS/contextMenu/contextmenu.js | 327 +- .../dateTimePicker/generateDateTimePicker.js | 150 +- src/main/webapp/resources/celJS/editResize.js | 113 +- .../celJS/editorsupport/DatePicker.js | 317 +- .../celJS/endlessScroll/endlessScroller.js | 253 +- .../resources/celJS/filebase/filebase.js | 287 +- .../resources/celJS/import/importManager.js | 141 +- .../webapp/resources/celJS/initCelements.js | 775 +++-- .../resources/celJS/layoutSupport/Outliner.js | 191 +- src/main/webapp/resources/celJS/login.js | 7 +- .../celJS/mediaLib/mediaLib-upload.js | 106 +- .../resources/celJS/mediaLib/mediaLib.js | 203 +- .../webapp/resources/celJS/mediaLib/resize.js | 100 +- .../resources/celJS/mobile/MobileSupport.js | 278 +- .../celJS/multimedia/player/cel_player.js | 384 ++- .../resources/celJS/navigation/imageSelect.js | 88 +- .../resources/celJS/navigation/nav-hover.js | 187 +- .../celJS/navigation/reorderMenuItems.js | 213 +- .../resources/celJS/uploadAttachment.js | 520 ++-- src/main/webapp/resources/celJS/validation.js | 1072 ++++--- .../webapp/resources/celRes/CelLayout.css | 154 +- .../ImageAndFilePicker/ImageAndFilePicker.css | 106 +- .../webapp/resources/celRes/analyticsQueue.js | 136 +- .../resources/celRes/celTabMenu/tabMenu.css | 732 ++--- .../webapp/resources/celRes/celYuiOverlay.css | 12 +- .../celRes/celanim/effectClasses.css | 392 +-- .../celRes/celanim/movieplayerDefaults.css | 150 +- .../resources/celRes/celanim/overlay.css | 3 +- .../resources/celRes/celanim/slideshow.css | 49 +- .../webapp/resources/celRes/celements2.css | 675 ++-- .../resources/celRes/celementsOverlay.css | 474 +-- .../webapp/resources/celRes/imagePicker.css | 22 +- .../webapp/resources/celRes/images/crop.css | 2 +- .../resources/celRes/import/GalleryImport.css | 277 +- .../resources/celRes/import/ImportManager.css | 357 ++- .../resources/celRes/jcrop/jquery.Jcrop.css | 67 +- src/main/webapp/resources/celRes/login.css | 48 +- .../celRes/multimedia/playerDefaults.css | 290 +- .../celRes/overlay/celementsOverlayV2.css | 17 +- .../resources/celRes/swiper-scrollbar.css | 10 +- .../webapp/resources/css/accessibility.css | 16 +- .../resources/js/xwiki/accordion/accordion.js | 403 +-- .../js/xwiki/actionbuttons/actionButtons.css | 5 +- .../js/xwiki/chartwizard/chwScripts.js | 1237 ++++---- .../js/xwiki/chartwizard/chwSkin.css | 264 +- .../js/xwiki/chartwizard/tdwScripts.js | 940 +++--- .../js/xwiki/chartwizard/tdwSkin.css | 134 +- .../resources/js/xwiki/compatibility.js | 179 +- .../resources/js/xwiki/editors/autosave.css | 8 +- .../resources/js/xwiki/editors/autosave.js | 501 +-- .../js/xwiki/editors/dataeditors.css | 346 ++- .../resources/js/xwiki/editors/dataeditors.js | 276 +- .../resources/js/xwiki/importer/import.css | 54 +- .../resources/js/xwiki/importer/import.js | 1401 +++++---- .../resources/js/xwiki/lightbox/lightbox.css | 231 +- .../resources/js/xwiki/lightbox/lightbox.js | 380 ++- .../js/xwiki/lightbox/lightboxIE.css | 255 +- .../resources/js/xwiki/panelwizard/Drag.js | 109 +- .../resources/js/xwiki/panelwizard/ieemu.js | 498 +-- .../js/xwiki/panelwizard/panelWizard.js | 204 +- .../resources/js/xwiki/panelwizard/toolTip.js | 91 +- .../resources/js/xwiki/table/livetable.css | 536 +++- .../resources/js/xwiki/table/livetable.js | 2077 +++++++------ .../webapp/resources/js/xwiki/table/table.css | 84 +- .../js/xwiki/table/tablefilterNsort.js | 894 ++++-- .../js/xwiki/viewers/attachments.css | 62 +- .../resources/js/xwiki/viewers/attachments.js | 413 +-- .../resources/js/xwiki/widgets/modalPopup.css | 7 +- .../resources/js/xwiki/widgets/modalPopup.js | 445 +-- src/main/webapp/resources/js/xwiki/xwiki.js | 1082 ++++--- .../layouts/baseskin/baseskin-content.css | 351 ++- .../resources/layouts/baseskin/baseskin.css | 994 +++--- .../layouts/layoutEditor/CelLayout.css | 154 +- .../layouts/layoutEditor/outlineCells.js | 76 +- .../resources/layouts/layoutEditor/reorder.js | 112 +- .../uicomponents/pagination/pagination.css | 86 +- .../resources/uicomponents/search/search.css | 252 +- .../resources/uicomponents/search/search.js | 43 +- .../resources/uicomponents/viewers/code.js | 43 +- .../uicomponents/viewers/comments.css | 148 +- .../uicomponents/viewers/comments.js | 945 +++--- .../uicomponents/widgets/confirmationBox.css | 14 +- .../uicomponents/widgets/confirmationBox.js | 135 +- .../widgets/confirmedAjaxRequest.js | 245 +- .../uicomponents/widgets/list/xlist.js | 191 +- .../uicomponents/widgets/notification.js | 331 +- .../widgets/validation/livevalidation.css | 13 +- .../validation/livevalidation_prototype.js | 951 +++--- src/main/webapp/skins/albatross/classes.css | 25 +- src/main/webapp/skins/albatross/colors.css | 169 +- .../webapp/skins/albatross/colorsblack.css | 605 ++-- .../webapp/skins/albatross/colorsblue.css | 263 +- src/main/webapp/skins/albatross/elements.css | 206 +- src/main/webapp/skins/albatross/ie.css | 10 +- .../js/xwiki/panelwizard/panelWizard.js | 449 +-- .../webapp/skins/albatross/microformats.css | 26 +- .../webapp/skins/albatross/presentation.css | 205 +- src/main/webapp/skins/albatross/print.css | 31 +- src/main/webapp/skins/albatross/rss.css | 8 +- .../webapp/skins/albatross/screenlayout.css | 526 ++-- src/main/webapp/skins/albatross/style.css | 170 +- src/main/webapp/skins/albatross/temp.css | 2 +- src/main/webapp/skins/albatross/wiki.css | 210 +- src/main/webapp/skins/albatross/xwiki.css | 87 +- 131 files changed, 23784 insertions(+), 17200 deletions(-) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..fbc2ad600 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,84 @@ +# Exclude reset.css +src/main/webapp/resources/celRes/resetCSS/ + +# Exclude jquery +src/main/webapp/resources/celJS/jquery-noconflict.js +src/main/webapp/resources/celJS/jquery.js +src/main/webapp/resources/celJS/jcrop/jquery.Jcrop.css + +# Exclude the jquery-* directory +src/main/webapp/resources/celJS/jquery-*/ + +# Exclude the prototype.js +src/main/webapp/resources/celJS/prototype.js + +# Exclude the deps directory +src/main/webapp/resources/deps/ + +# Exclude the yui3 directory +src/main/webapp/resources/celJS/yui3/ + +# Exclude the yui directory +src/main/webapp/resources/celJS/yui/ + +# Exclude the scriptaculous directory +src/main/webapp/resources/celJS/scriptaculous/ + +# Exclude the swiper-* directory +src/main/webapp/resources/celJS/swiper-*/ + +# Exclude the history.js directory +src/main/webapp/resources/celJS/history.js/ + +# Exclude the balupton-history directory +src/main/webapp/resources/celJS/balupton-history/ + +# Exclude the bootstrap directory +src/main/webapp/resources/celJS/bootstrap/ + +# Exclude the bootstrap-* directory +src/main/webapp/resources/celJS/bootstrap-*/ + +# Exclude the codemirror directory +src/main/webapp/resources/celJS/codemirror/ + +# Exclude the highslide directory +src/main/webapp/resources/celJS/highslide/ + +# Exclude the jshashtable directory +src/main/webapp/resources/celJS/jshashtable/ + +# Exclude the lytebox5 directory +src/main/webapp/resources/celJS/lytebox5/ + +# Exclude the font-awesome-v6 directory +src/main/webapp/resources/celRes/font-awesome-v6/ +src/main/webapp/resources/celRes/font-awesome/ + +# Exclude the glyphicons-halflings directory +src/main/webapp/resources/celRes/images/glyphicons-halflings/ + +# Exclude the google-fonts directory +src/main/webapp/resources/celRes/google-fonts/ + +# Exclude the moofx directory +src/main/webapp/resources/celJS/moofx/ + +# Exclude the supportLink directory +src/main/webapp/resources/celJS/supportLink/ + +# Exclude the SWFObject-2.2 directory +src/main/webapp/resources/celJS/SWFObject-2.2/ + +# Exclude the xwiki scriptaculous directory +src/main/webapp/resources/js/scriptaculous/ + +# Exclude the xwiki yui directory +src/main/webapp/resources/js/yui/ + +# Exclude all node_modules (usually ignored by default) +node_modules/ + +# Exclude minified files +**/*.min.js +**/*.min.css diff --git a/src/main/webapp/resources/celJS/adminUi/accessRights.js b/src/main/webapp/resources/celJS/adminUi/accessRights.js index 2a8216073..52458a641 100644 --- a/src/main/webapp/resources/celJS/adminUi/accessRights.js +++ b/src/main/webapp/resources/celJS/adminUi/accessRights.js @@ -1,36 +1,38 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -var saveAccessRights = function() { - getCelementsTabEditor().saveAndContinueAjax('accessRightForm', { onSuccess : function() { - getCelementsTabEditor().getTab('tbrights', true); - }}); -}; - -var registerChangeListener = function() { - $$('.cel_rightsSelect').each(function(elem) { - elem.stopObserving('change', saveAccessRights); - elem.observe('change', saveAccessRights); - }); -}; - -registerChangeListener(); - - $('tbrights-tab').observe('tabedit:tabchange', registerChangeListener); +/* + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +var saveAccessRights = function () { + getCelementsTabEditor().saveAndContinueAjax("accessRightForm", { + onSuccess: function () { + getCelementsTabEditor().getTab("tbrights", true); + }, + }); +}; + +var registerChangeListener = function () { + $$(".cel_rightsSelect").each(function (elem) { + elem.stopObserving("change", saveAccessRights); + elem.observe("change", saveAccessRights); + }); +}; + +registerChangeListener(); + +$("tbrights-tab").observe("tabedit:tabchange", registerChangeListener); diff --git a/src/main/webapp/resources/celJS/adminUi/admininterface.js b/src/main/webapp/resources/celJS/adminUi/admininterface.js index add30ce3c..680a2fa12 100644 --- a/src/main/webapp/resources/celJS/adminUi/admininterface.js +++ b/src/main/webapp/resources/celJS/adminUi/admininterface.js @@ -21,171 +21,187 @@ /*** Moo.fx effects for moving windows **/ fx.MoveX = Class.create(); fx.MoveX.prototype = Object.extend(new fx.Base(), { - initialize: function(el, options) { - this.el = $(el); - this.setOptions(options); - }, - increase: function() { - this.el.style.left = this.now + "px"; - } + initialize: function (el, options) { + this.el = $(el); + this.setOptions(options); + }, + increase: function () { + this.el.style.left = this.now + "px"; + }, }); fx.MoveY = Class.create(); fx.MoveY.prototype = Object.extend(new fx.Base(), { - initialize: function(el, options) { - this.el = $(el); - this.setOptions(options); - }, - increase: function() { - this.el.style.top = this.now + "px"; - } + initialize: function (el, options) { + this.el = $(el); + this.setOptions(options); + }, + increase: function () { + this.el.style.top = this.now + "px"; + }, }); /*** CLASS AdminInteface ***/ var AdminInterface = Class.create(); AdminInterface.prototype = { - // constructor - initialize : function() { - this.n = document.getElementsByTagName("body")[0]; - - // windows - this.windows = new Array(); - this.maxZIndex = 0; - this.tmpSheet = null; - this.minWinHeight = 150; - this.minWinWidth = 150; - - // observer mouse position - this.mousePos = new Array(0,0); // (X,Y) - Event.observe(document, 'mousemove', this.mouseMove); - }, - - newWindow : function(top,left,height,width,url) { - this.windows[this.windows.length] = new WMWindow(this.windows.length, this, this.n, top, left, height, width, 'wmwindow'); - return true; - }, - - setEventHandlers : function(){ - for(var i=0; i test2) // all but Explorer Mac - { - x = document.body.scrollWidth; - } - else // Explorer Mac; - //would also work in Explorer 6 Strict, Mozilla and Safari - { - x = document.body.offsetWidth; - } - - return x; - }, - - getDocumentHeight : function(){ - // determine size of the body element (taken from quirksmode.org - var x; - var test1 = document.body.scrollHeight; - var test2 = document.body.offsetHeight - if (test1 > test2) // all but Explorer Mac - { - x = document.body.scrollHeight; - } - else // Explorer Mac; - //would also work in Explorer 6 Strict, Mozilla and Safari - { - x = document.body.offsetHeight; - } - - return x; - }, - - fadeOut : function(){ - for(var i=0; i test2) // all but Explorer Mac + { + x = document.body.scrollWidth; + } else // Explorer Mac; + //would also work in Explorer 6 Strict, Mozilla and Safari + { + x = document.body.offsetWidth; + } + + return x; + }, + + getDocumentHeight: function () { + // determine size of the body element (taken from quirksmode.org + var x; + var test1 = document.body.scrollHeight; + var test2 = document.body.offsetHeight; + if (test1 > test2) // all but Explorer Mac + { + x = document.body.scrollHeight; + } else // Explorer Mac; + //would also work in Explorer 6 Strict, Mozilla and Safari + { + x = document.body.offsetHeight; + } + + return x; + }, + + fadeOut: function () { + for (var i = 0; i < this.windows.length; i++) { + if (this.windows[i]) this.windows[i].fadeOut(); + } + + return true; + }, + fadeIn: function () { + for (var i = 0; i < this.windows.length; i++) { + if (this.windows[i]) this.windows[i].fadeIn(); + } + + return true; + }, +}; diff --git a/src/main/webapp/resources/celJS/adminUi/admintoolbar.js b/src/main/webapp/resources/celJS/adminUi/admintoolbar.js index 5853b8d1d..3c9a759c9 100644 --- a/src/main/webapp/resources/celJS/adminUi/admintoolbar.js +++ b/src/main/webapp/resources/celJS/adminUi/admintoolbar.js @@ -1,471 +1,562 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -/* Helpers */ -function showAdminToolbar(url){ - - if(!url) url = ""; - - // first, remove context menu - if(myContextMenu) myContextMenu.hide(); - - // now show the toolbar - myAdminToolbar.show(url); -} - -function getDocumentDimensions(){ - // determine size of the body element (taken from quirksmode.org - var x,y; - var test1 = document.body.scrollHeight; - var test2 = document.body.offsetHeight; - if (test1 > test2) // all but Explorer Mac - { - x = document.body.scrollWidth; - y = document.body.scrollHeight; - } - else // Explorer Mac; - //would also work in Explorer 6 Strict, Mozilla and Safari - { - x = document.body.offsetWidth; - y = document.body.offsetHeight; - } - - return new Array(y,x); -} - -function getMousePosY(event){ - if (!event) var event = window.event; - - if(event.pageY){ - return event.pageY; - } else if(event.clientY){ - if (document.documentElement && document.documentElement.scrollTop){ - var topOffset = document.documentElement.scrollTop; - var leftOffset = document.documentElement.scrollLeft; - } else if (document.body) { - var topOffset = document.body.scrollTop; - var leftOffset = document.body.scrollLeft; - } else { - var topOffset = 0; - var leftOffset = 0; - } - - return event.clientY + topOffset + 2; - - } - return 0; -} - -/* Aspects */ - -Aspects = new Object(); - -Aspects.addBefore = function(obj, fname, before) { - var oldFunc = obj[fname]; - obj[fname] = function() { - return oldFunc.apply(this, before(arguments, oldFunc, obj)); - }; -}; - -Aspects.addAfter = function(obj, fname, after) { - var oldFunc = obj[fname]; - obj[fname] = function() { - return after(oldFunc.apply(this, arguments), arguments, oldFunc, obj); - }; -}; - -Aspects.addAround = function(obj, fname, around) { - var oldFunc = obj[fname]; - obj[fname] = function() { - return around(arguments, oldFunc, this); - }; -}; - -// aspects setting event handlers -function aopizeMouseDown(arguments, oldFunc, me){ - - if(myAdminToolbar.adminDiv) myAdminToolbar.adminDiv.resetEventHandlers(); - - document.onmousemove = me.mouseDrag; - - return arguments; -} - -function aopizeMouseUp(result, arguments, oldFunc, me){ - - if(myAdminToolbar.adminDiv) myAdminToolbar.adminDiv.setEventHandlers(); - - document.onmousemove = me.mouseMove; - - return result; -} - -function aopizeMouseOver(arguments, oldFunc, me){ - - if(myAdminToolbar.adminDiv) myAdminToolbar.adminDiv.resetEventHandlers(); - me.n.onmouseout = me.mouseOut; - - document.onmousemove = me.mouseMove; - document.onmouseup = me.mouseUp; - document.onmousedown = me.mouseDown; - - return arguments; -} - -function aopizeMouseOut(result, arguments, oldFunc, me){ - - if(myAdminToolbar.adminDiv) myAdminToolbar.adminDiv.setEventHandlers(); - - document.onmousemove = null; - document.onmouseup = null; - document.onmousedown = null; - - return result; -} - -/* Admin Toolbar Class */ -function AdminToolbar(){ - var me = this; - - var overlayDiv = null; - var adminDiv = null; - - this.show = function(url){ - - if(!this.overlayDiv){ - - var docDim = getDocumentDimensions(); - // overlay div - this.overlayDiv = new Div('admin_overlay', null, document.getElementsByTagName('body')[0], 0,0,docDim[0],docDim[1],'admin_overlay'); - for(var i = 0; i <= 60; i++) - this.overlayDiv.setOpacity(i); - } - - if(!this.adminDiv){ - this.adminDiv = new AdminWindow(null, document.getElementsByTagName('body')[0], 100,5,300,docDim[1]-12,'admin_div'); - } - - this.adminDiv.setContent(url); - }; - - this.hide = function(){ - if(this.adminDiv){ - this.adminDiv.resetEventHandlers(); - this.adminDiv.remove(); - this.adminDiv = null; - } - if(this.overlayDiv){ - for(var i = 60; i >= 0; i--) - this.overlayDiv.setOpacity(i); - this.overlayDiv.remove(); - } - this.overlayDiv = null; - - }; - - this.resize = function(){ - var docDim = getDocumentDimensions(); - if(me.overlayDiv) - me.overlayDiv.setSize(docDim[0], docDim[1]); - if(me.adminDiv) - me.adminDiv.setSize(300, docDim[1]-12); - }; -} - -/*** CLASS AdminWindow ***/ -function AdminWindow(parent, parent_node, top, left, height, width, className){ - - var me = this; - - this.inheritFrom = Div; - - this.mousePosRelY = 0; - - this.closeDiv = null; - this.contentDiv = null; - this.titleDiv = null; - - this.contentUrl = null; - this.title = null; - - this.AdminWindow = function(parent, parent_node, top, left, height, width, className){ - - this.inheritFrom('admin_div', parent, parent_node, top, left, height, width, className); - - // create close element - this.closeDiv = new CloseDiv(this, this.n, 0, this.w + this.pl + this.pr - 50, this.pt, 50, 'admin_close'); - this.closeDiv.setSize(this.pt - (this.closeDiv.totalh - this.closeDiv.h), this.pt - (this.closeDiv.totalw - this.closeDiv.w)); - this.closeDiv.setContent("close"); - - // create title - this.titleDiv = new Div('title', this, this.n, 0,0, this.pt, this.totalw - 50, 'admin_title'); - this.titleDiv.setSize(this.pt - (this.titleDiv.totalh - this.titleDiv.h), this.w + this.pl + this.pr - (this.titleDiv.totalw - this.titleDiv.w) - this.closeDiv.totalw); - this.setTitle('celements2.0 admin mode'); - - // create content - this.contentDiv = new ContentDiv(this, this.n, this.pt, this.pl, this.h, this.w, 'admin_content'); - this.contentDiv.setSize(this.h - (this.contentDiv.totalh - this.contentDiv.h), this.w - (this.contentDiv.totalw - this.contentDiv.w)); - - return true; - }; - - this.setTitle = function(title){ - this.title = title; - this.titleDiv.setContent(title); - - return true; - }; - - this.AdminWindow(parent, parent_node, top, left, height, width, className); - - this.setContent = function(url){ - - if(!url) url = defaultUrl; - - this.contentDiv.setContent(url); - this.contentUrl = url; - - return true; - }; - - this.setSize = function(height, width){ - - this.n.style.height = height + 'px'; - this.n.style.width = (width-2) + 'px'; - - this.h = height; - this.w = width; - - this.totalw = this.w + this.bl + this.pl + this.pr + this.br; - this.totalh = this.h + this.bt + this.pt + this.pb + this.bb; - - this.closeDiv.setPosition(0, this.w + this.pl + this.pr - 50); - - this.contentDiv.setSize(this.h - (this.contentDiv.totalh - this.contentDiv.h), this.w - (this.contentDiv.totalw - this.contentDiv.w)); - this.titleDiv.setSize(this.pt - (this.titleDiv.totalh - this.titleDiv.h), this.w + this.pl + this.pr - (this.titleDiv.totalw - this.titleDiv.w) - this.closeDiv.totalw); - - return true; - - }; - this.mouseDown = function(e){ - - me.setClass('admin_div_selected'); - - // store the position of the click - me.mousePosRelY = getMousePosY(e) - me.t; - - return true; - }; - - this.mouseUp = function(e){ - - // deselect - me.setClass('admin_div'); - - return true; - }; - - this.mouseDrag = function(e){ - - var y_tmp = getMousePosY(e); - var y = y_tmp - me.mousePosRelY; - - //edges - if(y < 0) y = 0; - var docDim = getDocumentDimensions(); - if(y + me.totalh > docDim[0]) y = docDim[0] - me.totalh; - - me.setPosition(y, 5); - - return true; - }; - - this.setEventHandlers = function(){ - - this.n.onmouseover = this.mouseOver; - this.n.onmouseout = this.mouseOut; - - this.closeDiv.setEventHandlers(); - - return true; - }; - - this.resetEventHandlers = function(){ - this.n.onmouseover = null; - this.n.onmouseout = null; - - this.closeDiv.resetEventHandlers(); - return true; - }; - - // add aspects - Aspects.addBefore(this, "mouseDown", aopizeMouseDown); - Aspects.addAfter(this, "mouseUp", aopizeMouseUp); - Aspects.addBefore(this, "mouseOver", aopizeMouseOver); - Aspects.addAfter(this, "mouseOut", aopizeMouseOut); - - // set event handlers - this.setEventHandlers(); - - return true; -}; - -/*** CLASS ContentDiv ***/ -function ContentDiv(parent, parent_node, top, left, height, width, className){ - - var me = this; - - this.inheritFrom = Div; - - this.http_request = false; - - - this.ContentDiv = function(parent, parent_node, top, left, height, width, className){ - - this.inheritFrom('content', parent, parent_node, top, left, height, width, className); - - return true; - }; - - // call constructor - this.ContentDiv(parent, parent_node, top, left, height, width, className); - - this.setContent = function(url){ - - if(!url) url = ""; - - me.n.innerHTML = "