diff --git a/javascript/AssetAdmin.DragDrop.js b/javascript/AssetAdmin.DragDrop.js index dc3c59bf..5ec3acf6 100644 --- a/javascript/AssetAdmin.DragDrop.js +++ b/javascript/AssetAdmin.DragDrop.js @@ -1,6 +1,12 @@ +/** + * File: AssetAdmin.DragDrop.js + */ (function($) { $.entwine('ss', function($){ + /** + * Class: .AssetTableField.dragdrop + */ $('.AssetTableField.dragdrop').entwine({ onmatch: function() { var self = this; @@ -15,6 +21,8 @@ this._super(); }, /** + * Function: drop + * * Take selected files and move them to a folder target in the tree. */ drop: function(e, ui) { @@ -30,11 +38,15 @@ ) } }, + /** + * Function: getSelected + * * Get the IDs of all selected files in the table. * Used for drag'n'drop. * - * @return Array + * Returns: + * Array */ getSelected: function() { return this.find(':input[name=Files\[\]]:checked').map(function() { @@ -44,6 +56,7 @@ }); $('.AssetTableField .dragfile').entwine({ + // Constructor: onmatch onmatch: function() { var self = this; var container = this.parents('.AssetTableField'); @@ -64,6 +77,11 @@ this._super(); }, /** + * Function: onmousedown + * + * Parameters: + * (Event) e + * * Automatically select the checkbox in the same table row * to signify that this element is moved, and hint that * all checkboxed elements will be moved along with it. diff --git a/javascript/AssetAdmin.js b/javascript/AssetAdmin.js index 4e3a87f2..22261838 100755 --- a/javascript/AssetAdmin.js +++ b/javascript/AssetAdmin.js @@ -1,3 +1,7 @@ +/** + * File: AssetAdmin.js + */ + /** * Configuration for the left hand tree */ @@ -36,7 +40,18 @@ var _HANDLER_FORMS = { }); $.entwine('ss', function($){ + + /** + * Class: #Form_SyncForm + */ $('#Form_SyncForm').entwine({ + + /** + * Function: onsubmit + * + * Parameters: + * (Event) e + */ onsubmit: function(e) { var button = jQuery(this).find(':submit:first'); button.addClass('loading'); diff --git a/javascript/AssetTableField.js b/javascript/AssetTableField.js index 7bbf4b28..025a9b23 100644 --- a/javascript/AssetTableField.js +++ b/javascript/AssetTableField.js @@ -1,7 +1,14 @@ +/** + * File: AssetTableField.js + */ (function($) { $.entwine('ss', function($){ + /** + * Class: .AssetTableField + */ $('.AssetTableField').entwine({ + // Constructor: onmatch onmatch: function() { var self = this; @@ -30,6 +37,12 @@ this._super(); }, + /** + * Function: refresh + * + * Parameters: + * (Function) callback + */ refresh: function(callback) { var self = this; this.load( @@ -44,9 +57,12 @@ }); /** + * Class: .AssetTableField :checkbox + * * Checkboxes used to batch delete files */ $('.AssetTableField :checkbox').entwine({ + // Function: onchange onchange: function() { var container = this.parents('.AssetTableField'); var input = container.find('input#deletemarked'); @@ -59,14 +75,24 @@ }) /** + * Class: .AssetTableField input#deletemarked + * * Batch delete files marked by checkboxes in the table. * Refreshes the form field afterwards via ajax. */ $('.AssetTableField input#deletemarked').entwine({ + // Constructor: onmatch onmatch: function() { this.attr('disabled', 'disabled'); this._super(); }, + + /** + * Function: onclick + * + * Parameters: + * (Event) e + */ onclick: function(e) { if(!confirm(ss.i18n._t('AssetTableField.REALLYDELETE'))) return false; diff --git a/javascript/CMSMain.EditForm.js b/javascript/CMSMain.EditForm.js index 7f12fd99..a5326ca4 100644 --- a/javascript/CMSMain.EditForm.js +++ b/javascript/CMSMain.EditForm.js @@ -1,25 +1,44 @@ (function($) { $.entwine('ss', function($){ /** - * Alert the user on change of page-type - this might have implications + * Class: #Form_EditForm :input[name=ClassName] + * Alert the user on change of page-type. This might have implications * on the available form fields etc. - * @name ss.EditFormClassName */ - $('#Form_EditForm :input[name=ClassName]').entwine(/** @lends ss.EditFormClassName */{ + $('#Form_EditForm :input[name=ClassName]').entwine({ + // Function: onchange onchange: function() { alert(ss.i18n._t('CMSMAIN.ALERTCLASSNAME')); } }); /** - * @class Input validation on the URLSegment field - * @name ss.EditForm.URLSegment + * Class: #Form_EditForm input[name=URLSegment] + * + * Input validation on the URLSegment field */ - $('#Form_EditForm input[name=URLSegment]').entwine(/** @lends ss.EditForm.URLSegment */{ + $('#Form_EditForm input[name=URLSegment]').entwine({ + /** + * Property: FilterRegex + * Regex + */ FilterRegex: /[^A-Za-z0-9-]+/, + + /** + * Property: ValidationMessage + * String + */ ValidationMessage: ss.i18n._t('CMSMAIN.URLSEGMENTVALIDATION'), + + /** + * Property: MaxLength + * Int + */ MaxLength: 50, + /** + * Constructor: onmatch + */ onmatch : function() { var self = this; @@ -36,16 +55,27 @@ }, /** + * Function: suggestValue + * * Return a value matching the criteria. * - * @param {String} val - * @return val + * Parameters: + * (String) val + * + * Returns: + * String */ suggestValue: function(val) { // TODO Do we want to enforce lowercasing in URLs? return val.substr(0, this.getMaxLength()).replace(this.getFilterRegex(), '').toLowerCase(); }, + /** + * Function: validate + * + * Returns: + * Boolean + */ validate: function() { return ( this.val().length > this.getMaxLength() @@ -55,10 +85,12 @@ }); /** - * @class Input validation on the Title field - * @name ss.EditForm.Title + * Class: #Form_EditForm input[name=Title] + * + * Input validation on the Title field */ - $('#Form_EditForm input[name=Title]').entwine(/** @lends ss.EditForm.Title */{ + $('#Form_EditForm input[name=Title]').entwine({ + // Constructor: onmatch onmatch : function() { var self = this; @@ -71,6 +103,12 @@ this._super(); }, + /** + * Function: updateURLSegment + * + * Parameters: + * (DOMElement) field + */ updateURLSegment: function(field) { if(!field || !field.length) return; @@ -96,11 +134,13 @@ }); /** - * @class ParentID field combination - mostly toggling between + * Class: #Form_EditForm .parentTypeSelector + * + * ParentID field combination - mostly toggling between * the two radiobuttons and setting the hidden "ParentID" field - * @name ss.EditForm.parentTypeSelector */ - $('#Form_EditForm .parentTypeSelector').entwine(/** @lends ss.EditForm.parentTypeSelector */{ + $('#Form_EditForm .parentTypeSelector').entwine({ + // Constructor: onmatch onmatch : function() { var self = this; this.find(':input[name=ParentType]').bind('click', function(e) {self._toggleSelection(e);}); @@ -109,6 +149,12 @@ this._super(); }, + /** + * Function: _toggleSelection + * + * Parameters: + * (Event) e + */ _toggleSelection: function(e) { var selected = this.find(':input[name=ParentType]:checked').val(); // reset parent id if 'root' radiobutton is selected @@ -119,11 +165,13 @@ }); /** - * @class Toggle display of group dropdown in "access" tab, + * Class: #Form_EditForm #CanViewType, #Form_EditForm #CanEditType + * + * Toggle display of group dropdown in "access" tab, * based on selection of radiobuttons. - * @name ss.Form_EditForm.Access */ - $('#Form_EditForm #CanViewType, #Form_EditForm #CanEditType').entwine(/** @lends ss.Form_EditForm.Access */{ + $('#Form_EditForm #CanViewType, #Form_EditForm #CanEditType').entwine({ + // Constructor: onmatch onmatch: function() { // TODO Decouple var dropdown; @@ -143,11 +191,18 @@ }); /** - * @class Email containing the link to the archived version of the page. + * Class: #Form_EditForm .Actions #Form_EditForm_action_email + * + * Email containing the link to the archived version of the page. * Visible on readonly older versions of a specific page at the moment. - * @name ss.Form_EditForm_action_email */ - $('#Form_EditForm .Actions #Form_EditForm_action_email').entwine(/** @lends ss.Form_EditForm_action_email */{ + $('#Form_EditForm .Actions #Form_EditForm_action_email').entwine({ + /** + * Function: onclick + * + * Parameters: + * (Event) e + */ onclick: function(e) { window.open( 'mailto:?subject=' @@ -162,11 +217,18 @@ }); /** - * @class Open a printable representation of the form in a new window. + * Class: #Form_EditForm .Actions #Form_EditForm_action_print + * + * Open a printable representation of the form in a new window. * Used for readonly older versions of a specific page. - * @name ss.Form_EditForm_action_print */ - $('#Form_EditForm .Actions #Form_EditForm_action_print').entwine(/** @lends ss.Form_EditForm_action_print */{ + $('#Form_EditForm .Actions #Form_EditForm_action_print').entwine({ + /** + * Function: onclick + * + * Parameters: + * (Event) e + */ onclick: function(e) { var printURL = $(this[0].form).attr('action').replace(/\?.*$/,'') + '/printable/' @@ -180,10 +242,18 @@ }); /** - * @class A "rollback" to a specific version needs user confirmation. - * @name ss.Form_EditForm_action_rollback + * Class: #Form_EditForm .Actions #Form_EditForm_action_rollback + * + * A "rollback" to a specific version needs user confirmation. */ - $('#Form_EditForm .Actions #Form_EditForm_action_rollback').entwine(/** @lends ss.Form_EditForm_action_rollback */{ + $('#Form_EditForm .Actions #Form_EditForm_action_rollback').entwine({ + + /** + * Function: onclick + * + * Parameters: + * (Event) e + */ onclick: function(e) { // @todo i18n var form = this.parents('form:first'), version = form.find(':input[name=Version]').val(), message = ''; diff --git a/javascript/CMSMain.Translatable.js b/javascript/CMSMain.Translatable.js index 3a3f9eaa..4a34ad70 100755 --- a/javascript/CMSMain.Translatable.js +++ b/javascript/CMSMain.Translatable.js @@ -1,11 +1,18 @@ +/** + * File: CMSMain.Translatable.js + */ (function($) { $.entwine('ss', function($){ /** - * @class Dropdown with languages above CMS tree, causing a redirect upon translation - * @name ss.CMSMain.LangSelector + * Class: .CMSMain #Form_LangForm + * + * Dropdown with languages above CMS tree, causing a redirect upon translation */ - $('.CMSMain #Form_LangForm').entwine(/** @lends ss.CMSMain.LangSelector */{ + $('.CMSMain #Form_LangForm').entwine({ + /** + * Constructor: onmatch + */ onmatch: function() { var self = this; @@ -30,15 +37,22 @@ }); /** + * Class: .CMSMain .createTranslation + * * Loads /admin/createtranslation, which will create the new record, * and redirect to an edit form. * - * @class Dropdown in "Translation" tab in CMS forms, with button to + * Dropdown in "Translation" tab in CMS forms, with button to * trigger translating the currently loaded record. - * @name ss.CMSMain.createtranslation - * @requires jquery.metadata + * + * Requires: + * jquery.metadata */ - $('.CMSMain .createTranslation').entwine(/** @lends ss.CMSMain.createtranslation */{ + $('.CMSMain .createTranslation').entwine({ + + /** + * Constructor: onmatch + */ onmatch: function() { var self = this; diff --git a/javascript/CMSMain.Tree.js b/javascript/CMSMain.Tree.js index 44569e35..662cc0c7 100644 --- a/javascript/CMSMain.Tree.js +++ b/javascript/CMSMain.Tree.js @@ -1,12 +1,12 @@ +/** + * File: CMSMain.Tree.js + */ if(typeof SiteTreeHandlers == 'undefined') SiteTreeHandlers = {}; SiteTreeHandlers.parentChanged_url = 'admin/ajaxupdateparent'; SiteTreeHandlers.orderChanged_url = 'admin/ajaxupdatesort'; SiteTreeHandlers.loadPage_url = 'admin/getitem'; SiteTreeHandlers.loadTree_url = 'admin/getsubtree'; -/** - * Tree context menu - */ TreeContextMenu = { 'Edit this page' : function(treeNode) { treeNode.selectTreeNode(); diff --git a/javascript/CMSMain.js b/javascript/CMSMain.js index 4676390e..48288b14 100644 --- a/javascript/CMSMain.js +++ b/javascript/CMSMain.js @@ -1,11 +1,16 @@ +/** + * File: CMSMain.js + */ (function($) { $.entwine('ss', function($){ /** - * @class All forms in the right content panel should have closeable jQuery UI style titles. - * @name ss.contentPanel.form + * Class: #contentPanel form + * + * All forms in the right content panel should have closeable jQuery UI style titles. */ - $('#contentPanel form').entwine(/** @lends ss.contentPanel.form */{ + $('#contentPanel form').entwine({ + // Constructor: onmatch onmatch: function() { // Style as title bar this.find(':header:first').titlebar({ @@ -22,17 +27,22 @@ }); /** - * @class Control the site tree filter. + * Class: #Form_SearchTreeForm + * + * Control the site tree filter. * Toggles search form fields based on a dropdown selection, * similar to "Smart Search" criteria in iTunes. - * @name ss.Form_SeachTreeForm */ - $('#Form_SearchTreeForm').entwine(/** @lends ss.Form_SeachTreeForm */{ + $('#Form_SearchTreeForm').entwine({ /** - * @type DOMElement + * Variable: SelectEl + * {DOMElement} */ SelectEl: null, + /** + * Constructor: onmatch + */ onmatch: function() { var self = this; @@ -57,6 +67,9 @@ this._super(); }, + /** + * Function: _setOptions + */ _setOptions: function() { var self = this; @@ -80,6 +93,8 @@ }, /** + * Function: onsubmit + * * Filter tree based on selected criteria. */ onsubmit: function(e) { @@ -108,7 +123,13 @@ return false; }, - + + /** + * Function: onreset + * + * Parameters: + * (Event) e + */ onreset: function(e) { this.find('.field :input').clearFields(); this.find('.field').not('.show-default').hide(); @@ -127,6 +148,12 @@ return false; }, + /** + * Function: _addField + * + * Parameters: + * (Event) e + */ _addField: function(e) { var $select = $(e.target); // show formfield matching the option @@ -141,6 +168,9 @@ return false; }, + /** + * Function: _reloadSitetree + */ _reloadSitetree: function() { var self = this; @@ -160,13 +190,17 @@ }); /** - * @class Simple form with a page type dropdown + * Class: Form_SideReportsForm + * + * Simple form with a page type dropdown * which creates a new page through #Form_EditForm and adds a new tree node. - * @name ss.reports_holder */ $('#Form_SideReportsForm').entwine(/** @lends ss.reports_holder */{ ReportContainer: null, + /** + * Constructor: onmatch + */ onmatch: function() { var self = this; @@ -185,6 +219,12 @@ this._super(); }, + /** + * Function: onsubmit + * + * Parameters: + * (Event) e + */ onsubmit: function(e) { var self = this; @@ -213,9 +253,15 @@ }); /** + * Class: #SideReportsHolder form + * * All forms loaded via ajax from the Form_SideReports dropdown. */ $("#SideReportsHolder form").entwine({ + + /** + * Function: onsubmit + */ onsubmit: function() { var self = this; @@ -244,6 +290,10 @@ * Register the onclick handler that loads the page into EditForm */ $("#SideReportsHolder form ul a").entwine({ + + /** + * Function: onclick + */ onclick: function(e) { if (e.button!=2) { var $link = $(this); @@ -261,11 +311,11 @@ }); /** - * @class Simple form showing versions of a specific page. - * @name ss.Form_VersionsForm - * @requires ss.i18n + * Class: #Form_VersionsForm + * + * Simple form showing versions of a specific page. */ - $('#Form_VersionsForm').entwine(/** @lends ss.Form_VersionsForm */{ + $('#Form_VersionsForm').entwine({ onmatch: function() { var self = this; @@ -341,8 +391,11 @@ }, /** - * @param {boolean} loadEditForm Determines if responses should show in current panel, - * or in the edit form (in the case of 'compare versions'). + * Function: _submit + * + * Parameters: + * (bool) loadEditForm - Determines if responses should show in current panel, + * or in the edit form (in the case of 'compare versions'). */ _submit: function(loadEditForm) { var self = this; diff --git a/javascript/CommentTableField.js b/javascript/CommentTableField.js index 6ba82aac..8eb9ba4e 100644 --- a/javascript/CommentTableField.js +++ b/javascript/CommentTableField.js @@ -1,5 +1,16 @@ +/** + * File: CommentTableField.js + */ + +/** + * Class: CommentTableField + */ CommentTableField = Class.create(); CommentTableField.prototype = { + + /** + * Constructor: initialize + */ initialize: function() { var rules = {}; @@ -35,6 +46,9 @@ CommentTableField.prototype = { Behaviour.register(rules); }, + /** + * Function: removeRowAfterAjax + */ removeRowAfterAjax: function(e) { var img = Event.element(e); var link = Event.findElement(e,"a"); @@ -55,7 +69,14 @@ CommentTableField.prototype = { Event.stop(e); }, - // prevent submission of wrong form-button (CommentFilterButton) + /** + * Function: prepareSearch + * + * prevent submission of wrong form-button (CommentFilterButton) + * + * Parameters: + * (Event) e + */ prepareSearch: function(e) { // IE6 doesnt send an event-object with onkeypress var event = (e) ? e : window.event; @@ -72,9 +93,16 @@ CommentTableField.prototype = { CommentTableField.applyTo('div.CommentTableField'); +/** + * Class: CommentFilterButton + */ CommentFilterButton = Class.create(); CommentFilterButton.applyTo('#CommentFilterButton'); CommentFilterButton.prototype = { + + /** + * Constructor: initialize + */ initialize: function() { this.inputFields = new Array(); @@ -99,10 +127,22 @@ CommentFilterButton.prototype = { } }, + /** + * Function: isChanged + * + * Returns: + * (boolean) + */ isChanged: function() { return false; }, + /** + * Function: onclick + * + * Parameters: + * (Event) e + */ onclick: function(e) { try { var form = Event.findElement(e,"form"); diff --git a/javascript/LeftAndMain.AddForm.js b/javascript/LeftAndMain.AddForm.js index 91d8a0ea..f6a5bfba 100644 --- a/javascript/LeftAndMain.AddForm.js +++ b/javascript/LeftAndMain.AddForm.js @@ -1,28 +1,40 @@ +/** + * File: LeftAndMain.AddForm.js + */ (function($) { $.entwine('ss', function($){ /** - * @class Simple form with a page type dropdown + * Class: #Form_AddForm + * + * Simple form with a page type dropdown * which creates a new page through #Form_EditForm and adds a new tree node. - * @name ss.Form_AddForm - * @requires ss.i18n - * @requires ss.Form_EditForm + * + * Requires: + * ss.i18n + * #Form_EditForm */ - $('#Form_AddForm').entwine(/** @lends ss.Form_AddForm */{ + $('#Form_AddForm').entwine({ /** - * @type DOMElement + * Variable: Tree + * (DOMElement) */ Tree: null, /** - * @type Array Map of