Index: lams_central/web/ckeditor/plugins/confighelper/LICENSE =================================================================== diff -u --- lams_central/web/ckeditor/plugins/confighelper/LICENSE (revision 0) +++ lams_central/web/ckeditor/plugins/confighelper/LICENSE (revision a6c94a5454507a7c6502caf4c054000f36cc6778) @@ -0,0 +1,363 @@ +Mozilla Public License, version 2.0 + +1. Definitions + +1.1. "Contributor" + + means each individual or legal entity that creates, contributes to the + creation of, or owns Covered Software. + +1.2. "Contributor Version" + + means the combination of the Contributions of others (if any) used by a + Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + + means Source Code Form to which the initial Contributor has attached the + notice in Exhibit A, the Executable Form of such Source Code Form, and + Modifications of such Source Code Form, in each case including portions + thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + a. that the initial Contributor has attached the notice described in + Exhibit B to the Covered Software; or + + b. that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the terms of + a Secondary License. + +1.6. "Executable Form" + + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + + means a work that combines Covered Software with other material, in a + separate file or files, that is not Covered Software. + +1.8. "License" + + means this document. + +1.9. "Licensable" + + means having the right to grant, to the maximum extent possible, whether + at the time of the initial grant or subsequently, any and all of the + rights conveyed by this License. + +1.10. "Modifications" + + means any of the following: + + a. any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered Software; or + + b. any new file in Source Code Form that contains any Covered Software. + +1.11. "Patent Claims" of a Contributor + + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the License, + by the making, using, selling, offering for sale, having made, import, + or transfer of either its Contributions or its Contributor Version. + +1.12. "Secondary License" + + means either the GNU General Public License, Version 2.0, the GNU Lesser + General Public License, Version 2.1, the GNU Affero General Public + License, Version 3.0, or any later versions of those licenses. + +1.13. "Source Code Form" + + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that controls, is + controlled by, or is under common control with You. For purposes of this + definition, "control" means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by contract or + otherwise, or (b) ownership of more than fifty percent (50%) of the + outstanding shares or beneficial ownership of such entity. + + +2. License Grants and Conditions + +2.1. Grants + + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + a. under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + + b. under Patent Claims of such Contributor to make, use, sell, offer for + sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + + The licenses granted in Section 2.1 with respect to any Contribution + become effective for each Contribution on the date the Contributor first + distributes such Contribution. + +2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under + this License. No additional rights or licenses will be implied from the + distribution or licensing of Covered Software under this License. + Notwithstanding Section 2.1(b) above, no patent license is granted by a + Contributor: + + a. for any code that a Contributor has removed from Covered Software; or + + b. for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + c. under Patent Claims infringed by Covered Software in the absence of + its Contributions. + + This License does not grant any rights in the trademarks, service marks, + or logos of any Contributor (except as may be necessary to comply with + the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this + License (see Section 10.2) or under the terms of a Secondary License (if + permitted under the terms of Section 3.3). + +2.5. Representation + + Each Contributor represents that the Contributor believes its + Contributions are its original creation(s) or it has sufficient rights to + grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + + This License is not intended to limit any rights You have under + applicable copyright doctrines of fair use, fair dealing, or other + equivalents. + +2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in + Section 2.1. + + +3. Responsibilities + +3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under + the terms of this License. You must inform recipients that the Source + Code Form of the Covered Software is governed by the terms of this + License, and how they can obtain a copy of this License. You may not + attempt to alter or restrict the recipients' rights in the Source Code + Form. + +3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + a. such Covered Software must also be made available in Source Code Form, + as described in Section 3.1, and You must inform recipients of the + Executable Form how they can obtain a copy of such Source Code Form by + reasonable means in a timely manner, at a charge no more than the cost + of distribution to the recipient; and + + b. You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter the + recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for + the Covered Software. If the Larger Work is a combination of Covered + Software with a work governed by one or more Secondary Licenses, and the + Covered Software is not Incompatible With Secondary Licenses, this + License permits You to additionally distribute such Covered Software + under the terms of such Secondary License(s), so that the recipient of + the Larger Work may, at their option, further distribute the Covered + Software under the terms of either this License or such Secondary + License(s). + +3.4. Notices + + You may not remove or alter the substance of any license notices + (including copyright notices, patent notices, disclaimers of warranty, or + limitations of liability) contained within the Source Code Form of the + Covered Software, except that You may alter any license notices to the + extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on + behalf of any Contributor. You must make it absolutely clear that any + such warranty, support, indemnity, or liability obligation is offered by + You alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + + If it is impossible for You to comply with any of the terms of this License + with respect to some or all of the Covered Software due to statute, + judicial order, or regulation then You must: (a) comply with the terms of + this License to the maximum extent possible; and (b) describe the + limitations and the code they affect. Such description must be placed in a + text file included with all distributions of the Covered Software under + this License. Except to the extent prohibited by statute or regulation, + such description must be sufficiently detailed for a recipient of ordinary + skill to be able to understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically if You + fail to comply with any of its terms. However, if You become compliant, + then the rights granted under this License from a particular Contributor + are reinstated (a) provisionally, unless and until such Contributor + explicitly and finally terminates Your grants, and (b) on an ongoing + basis, if such Contributor fails to notify You of the non-compliance by + some reasonable means prior to 60 days after You have come back into + compliance. Moreover, Your grants from a particular Contributor are + reinstated on an ongoing basis if such Contributor notifies You of the + non-compliance by some reasonable means, this is the first time You have + received notice of non-compliance with this License from such + Contributor, and You become compliant prior to 30 days after Your receipt + of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, + counter-claims, and cross-claims) alleging that a Contributor Version + directly or indirectly infringes any patent, then the rights granted to + You by any and all Contributors for the Covered Software under Section + 2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user + license agreements (excluding distributors and resellers) which have been + validly granted by You or Your distributors under this License prior to + termination shall survive termination. + +6. Disclaimer of Warranty + + Covered Software is provided under this License on an "as is" basis, + without warranty of any kind, either expressed, implied, or statutory, + including, without limitation, warranties that the Covered Software is free + of defects, merchantable, fit for a particular purpose or non-infringing. + The entire risk as to the quality and performance of the Covered Software + is with You. Should any Covered Software prove defective in any respect, + You (not any Contributor) assume the cost of any necessary servicing, + repair, or correction. This disclaimer of warranty constitutes an essential + part of this License. No use of any Covered Software is authorized under + this License except under this disclaimer. + +7. Limitation of Liability + + Under no circumstances and under no legal theory, whether tort (including + negligence), contract, or otherwise, shall any Contributor, or anyone who + distributes Covered Software as permitted above, be liable to You for any + direct, indirect, special, incidental, or consequential damages of any + character including, without limitation, damages for lost profits, loss of + goodwill, work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses, even if such party shall have been + informed of the possibility of such damages. This limitation of liability + shall not apply to liability for death or personal injury resulting from + such party's negligence to the extent applicable law prohibits such + limitation. Some jurisdictions do not allow the exclusion or limitation of + incidental or consequential damages, so this exclusion and limitation may + not apply to You. + +8. Litigation + + Any litigation relating to this License may be brought only in the courts + of a jurisdiction where the defendant maintains its principal place of + business and such litigation shall be governed by laws of that + jurisdiction, without reference to its conflict-of-law provisions. Nothing + in this Section shall prevent a party's ability to bring cross-claims or + counter-claims. + +9. Miscellaneous + + This License represents the complete agreement concerning the subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. Any law or regulation which provides that + the language of a contract shall be construed against the drafter shall not + be used to construe this License against a Contributor. + + +10. Versions of the License + +10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + +10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version + of the License under which You originally received the Covered Software, + or under the terms of any subsequent version published by the license + steward. + +10.3. Modified Versions + + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a + modified version of this License if you rename the license and remove + any references to the name of the license steward (except to note that + such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary + Licenses If You choose to distribute Source Code Form that is + Incompatible With Secondary Licenses under the terms of this version of + the License, the notice described in Exhibit B of this License must be + attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the + terms of the Mozilla Public License, v. + 2.0. If a copy of the MPL was not + distributed with this file, You can + obtain one at + http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, +then You may include the notice in a location (such as a LICENSE file in a +relevant directory) where a recipient would be likely to look for such a +notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice + + This Source Code Form is "Incompatible + With Secondary Licenses", as defined by + the Mozilla Public License, v. 2.0. + Index: lams_central/web/ckeditor/plugins/confighelper/README.md =================================================================== diff -u --- lams_central/web/ckeditor/plugins/confighelper/README.md (revision 0) +++ lams_central/web/ckeditor/plugins/confighelper/README.md (revision a6c94a5454507a7c6502caf4c054000f36cc6778) @@ -0,0 +1,5 @@ +confighelper +============ + +Configuration Helper + HTML5 placeholder for CKEditor. +See docs/install.html for full details and install instructions Index: lams_central/web/ckeditor/plugins/confighelper/docs/install.html =================================================================== diff -u --- lams_central/web/ckeditor/plugins/confighelper/docs/install.html (revision 0) +++ lams_central/web/ckeditor/plugins/confighelper/docs/install.html (revision a6c94a5454507a7c6502caf4c054000f36cc6778) @@ -0,0 +1,128 @@ + + + + +Configuration Helper plugin + + + + +

Configuration Helper Plugin for CKEditor

+ +

Introduction

+

This plugin tries to help setup CKEditor by providing additional configuration options to perform some +kind of common tasks.

+

Currently if offers a "removeDialogFields" that allows to remove individual fields in the dialogs (versus removing whole tabs with +removeDialogTabs, and "dialogFieldsDefaultValues" +defines default values for dialog fields.

+ +

Author:

+

Alfonso Martínez de Lizarrondo

+ +

Version history:

+
    +
  1. 1.0: 26-February-2012. First version.
  2. +
  3. 1.1: 16-February-2012. Added placeholder.
  4. +
  5. 1.2: 23-April-2012. Added hideDialogFields.
  6. +
  7. 1.3: 1-December-2012. Compatibility with CKEditor 4.
  8. +
  9. 1.4: 28-March-2013. Compatibility of the "placeholder" attribute with the inline mode of CKEditor 4.
  10. +
  11. 1.5: 16-April-2013. Version 1.4 was broken in CKEditor 3.
  12. +
  13. 1.6: 16-August-2013. Handle the setData method to update the "placeholder" status
  14. +
  15. 1.7: 6-October-2013. Patch by bfavors to fix handling placeholder on initial load of editor
  16. +
  17. 1.8: 9-March-2014. Check for IE11 by Russel Ward
    + Set caret into the empty paragraph correctly on first focus, patch by glanchow +
  18. +
  19. 1.8.1: 5-April-2014. Fix IE8 & IE9 problem with "inline textarea" if it's empty on start +
  20. +
  21. 1.8.2: 12-April-2014. Protect detection of empty content. Thanks to tanihito. +
  22. +
  23. 1.8.3: 30-November-2014. Force SCAYT to use the language that it's specified as the language for the contents.
    + Listen to the contentDom event to avoid problems when calling setData in WYSIWYG mode. Thanks to noam-si. +
  24. +
  25. 1.8.4: 25-November-2018: + Prevent editing the placeholder text if startupFocus is true. Thanks to Albince Paliakkara
    + Prevent leaking editor instances on destroy. Thanks to Ben Demboski +
  26. +
+ +

Installation

+

1. Copying the files

+

Extract the contents of the zip in you plugins directory, so it ends up like + this
+ +

+
+ckeditor\
+	...
+	images\
+	lang\
+	plugins\
+		...
+		confighelper\
+			plugin.js
+			docs\
+				install.html
+		...
+	skins\
+	themes\
+
+

2. Adding it to CKEditor

+

Now add the plugin in your config.js or custom js configuration +file: +config.extraPlugins='confighelper'; +

+ +

3. Configuration

+

config.removeDialogFields

+

This entry is a string, the fields are defined as dialogName + ":" + tab + ":" + field. Fields are joined with semicolons. +In order to learn the name of the parameters you can use the "Developer Tools plugin", launch that sample and open the dialog that you want to customize. +Now a little popup with appear showing the info about that field, for example: +

Element Information
+Dialog window name : image
+Tab name : info
+Element ID : txtBorder
+Element type : text
+
+so in order to remove the class attribute for images the config is: +
config.removeDialogFields="image:info:txtBorder";
+removing another field +
config.removeDialogFields="image:info:txtBorder;image:info:txtHSpace";
+ +

config.dialogFieldsDefaultValues

+

This setting uses directly a JSON object as the configuration value, first an object that has the dialog names as properties, each property is +a new object with the name of the tabs and finally each property name maps to the field name and it's value is the default value to use for the field.

+

An example might be much better as I might have messed up something in the description:

+
config.dialogFieldsDefaultValues =
+{
+	image:
+		{
+			advanced:
+				{
+					txtGenClass : 'myClass',
+					txtGenTitle : 'Image title'
+				}
+		}
+};
+
+ +

config.placeholder

+

This a text that will be shown when the editor is empty following the HTML5 placeholder attribute. When the user focus the editor, the content is +cleared automatically.

+

The value can be set in the configuration or as an attribute of the replaced element

+
config.placeholder = 'Type here...';
+ +

config.hideDialogFields

+

This entry uses the same sintax that the 'removeDialogFields' option. The difference is that some fields can't be removed easily as other parts of the dialog +might not be ready and might try to always use it, generating a javascript error. In other cases the layout might be broken if the field is removed instead of hidden.
+In those cases it's possible to hide the fields using this entry, and the preview in the image dialog is an example of such a field.

+
config.hideDialogFields="image:info:htmlPreview";
+ + + +

Disclaimers

+

CKEditor is © CKSource.com

+ + Index: lams_central/web/ckeditor/plugins/confighelper/docs/styles.css =================================================================== diff -u --- lams_central/web/ckeditor/plugins/confighelper/docs/styles.css (revision 0) +++ lams_central/web/ckeditor/plugins/confighelper/docs/styles.css (revision a6c94a5454507a7c6502caf4c054000f36cc6778) @@ -0,0 +1,59 @@ +body { + font-family: Arial, Helvetica, sans-serif; + font-size: 90%; +} +h1 { + text-align:center; + font-size:180%; +} +h2 { + border-bottom:2px solid #CCC; + margin:1em 0 0.4em 0; +} +h3 { + margin-bottom:0.4em; +} +p { + margin:0 0 1em 1em; + text-align:justify; +} +ol { + margin:0 0 1.2em 1em; + padding:0; + list-style-type:none; +} +ol li { + margin:0.2em 0; +} +pre, code { + font-size:100%; + font-family:"Courier New", Courier, mono; + background-color: #CCCCCC; + border:1px solid #999; + padding:0.2em 1em; + margin: 0.4em 0; + display:block; + white-space: pre; + overflow: auto; +} +form { + margin:0 0 0 1em; +} +span.key { + color: #006600; +} +#install { + display:none +} +#languages ul { + display:inline; + list-style-type:none; + margin:0; + padding:0; +} +#languages li { + display:inline; + margin:0; + padding:0; + vertical-align:bottom; +} \ No newline at end of file Index: lams_central/web/ckeditor/plugins/confighelper/plugin.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/confighelper/plugin.js (revision 0) +++ lams_central/web/ckeditor/plugins/confighelper/plugin.js (revision a6c94a5454507a7c6502caf4c054000f36cc6778) @@ -0,0 +1,363 @@ +/** + * @file Configuration helper plugin for CKEditor + * Copyright (C) 2012 Alfonso Martínez de Lizarrondo + * + */ +(function() { + 'use strict'; + + // Check if the browser supports the placeholder attribute on textareas natively. + var supportsPlaceholder = ('placeholder' in document.createElement( 'textarea' ) ); + + // If the data is "empty" (BR, P) or the placeholder then return an empty string. + // Otherwise return the original data + function dataIsEmpty( data ) { + if ( !data) + return true; + + if ( data.length > 20 ) + return false; + + var value = data.replace( /[\n|\t]*/g, '' ).toLowerCase(); + //*LAMS* added '

' clause + if ( value == '

' || !value || value == '
' || value == '

 

' || value == '


' || value == '

 

' || value == ' ' || value == ' ' || value == ' 
' || value == '
' ) + return true; + + return false; + } + + function addPlaceholder(ev) { + var editor = ev.editor; + var root = (editor.editable ? editor.editable() : (editor.mode == 'wysiwyg' ? editor.document && editor.document.getBody() : editor.textarea ) ); + var placeholder = ev.listenerData; + if (!root) + return; + + if (editor.mode == 'wysiwyg') { + // If the blur is due to a dialog, don't apply the placeholder + if ( CKEDITOR.dialog._.currentTop ) + return; + + if ( !root ) + return; + + if ( dataIsEmpty( root.getHtml() ) ) { + root.setHtml( placeholder ); + root.addClass( 'placeholder' ); + } + } + + if (editor.mode == 'source') { + if ( supportsPlaceholder ) { + if (ev.name == 'mode') { + root.setAttribute( 'placeholder', placeholder ); + } + return; + } + + if ( dataIsEmpty( root.getValue() ) ) { + root.setValue( placeholder ); + root.addClass( 'placeholder' ); + } + } + } + + function removePlaceholder(ev) { + var editor = ev.editor; + var root = (editor.editable ? editor.editable() : (editor.mode == 'wysiwyg' ? editor.document && editor.document.getBody() : editor.textarea ) ); + if (!root) + return; + + if (editor.mode == 'wysiwyg' ) { + if (!root.hasClass( 'placeholder' )) + return; + + root.removeClass( 'placeholder' ); + // fill it properly + if (CKEDITOR.dtd[ root.getName() ]['p']) { + root.setHtml( '


' ); + // Set caret in position + var range = new CKEDITOR.dom.range(editor.document); + range.moveToElementEditablePosition(root.getFirst(), true); + editor.getSelection().selectRanges([ range ]); + } else { + root.setHtml(' '); + } + } + + if (editor.mode == 'source') { + if ( !root.hasClass( 'placeholder' ) ) + return; + + root.removeClass( 'placeholder' ); + root.setValue( '' ); + } + } + + function getLang( element ) { + if (!element) + return null; + + return element.getAttribute( 'lang' ) || getLang( element.getParent() ); + } + + CKEDITOR.plugins.add( 'confighelper', { + getPlaceholderCss : function() { + return '.placeholder{ color: #999; }'; + }, + + onLoad : function() { + // v4 + if (CKEDITOR.addCss) + CKEDITOR.addCss( this.getPlaceholderCss() ); + }, + + init : function( editor ) { + + // correct focus status after switch mode + editor.on( 'mode', function( ev ) { + // Let's update to match reality + ev.editor.focusManager.hasFocus = false; + // Now focus it: + }); + + // Placeholder - Start + // Get the placeholder from the replaced element or from the configuration + var placeholder = editor.element.getAttribute( 'placeholder' ) || editor.config.placeholder; + + if (placeholder) { + // CSS for WYSIWYG mode + // v3 + if (editor.addCss) + editor.addCss(this.getPlaceholderCss()); + + // CSS for textarea mode + var node = CKEDITOR.document.getHead().append( 'style' ); + node.setAttribute( 'type', 'text/css' ); + var content = 'textarea.placeholder { color: #999; font-style: italic; }'; + + if ( CKEDITOR.env.ie && CKEDITOR.env.version < 11) + node.$.styleSheet.cssText = content; + else + node.$.innerHTML = content; + + // Watch for the calls to getData to remove the placeholder + editor.on( 'getData', function( ev ) { + var element = (editor.editable ? editor.editable() : (editor.mode == 'wysiwyg' ? editor.document && editor.document.getBody() : editor.textarea ) ); + + if ( element && element.hasClass( 'placeholder' ) ) + ev.data.dataValue = ''; + }); + + // Watch for setData to remove placeholder class + editor.on('setData', function(ev) { + if ( CKEDITOR.dialog._.currentTop ) + return; + + if ( editor.mode == 'source' && supportsPlaceholder ) + return; + + var root = (editor.editable ? editor.editable() : (editor.mode == 'wysiwyg' ? editor.document && editor.document.getBody() : editor.textarea ) ); + + if ( !root ) + return; + + if ( !dataIsEmpty( ev.data.dataValue ) ) { + // Remove the class if new data is not empty + if ( root.hasClass( 'placeholder' ) ) + root.removeClass( 'placeholder' ); + } else { + // if data is empty, set it to the placeholder + addPlaceholder(ev); + } + }); + + editor.on('blur', addPlaceholder, null, placeholder); + editor.on('mode', addPlaceholder, null, placeholder); + editor.on('contentDom', addPlaceholder, null, placeholder); + + editor.on('focus', removePlaceholder); + editor.on('key', removePlaceholder); + editor.on('beforeModeUnload', removePlaceholder); + } // Placeholder - End + + + // SCAYT lang from element lang: + var lang = editor.config.contentsLanguage || getLang( editor.element ); + if ( lang && editor.plugins.scayt && !editor.config.scayt_sLang ) { + try { + // Remove the stored language + if (localStorage) + localStorage.removeItem( 'scayt_0_lang' ); + } catch (e) { /* */} + + // Convert from HTML5 Lang to spellchecker.net values + var map = { + 'en' : 'en_US', + 'en-us': 'en_US', + 'en-gb': 'en_GB', + 'pt-br': 'pt_BR', + 'da' : 'da_DK', + 'da-dk': 'da_DK', + 'nl-nl': 'nl_NL', + 'en-ca': 'en_CA', + 'fi-fi': 'fi_FI', + 'fr' : 'fr_FR', + 'fr-fr': 'fr_FR', + 'fr-ca': 'fr_CA', + 'de' : 'de_DE', + 'de-de': 'de_DE', + 'el-gr': 'el_GR', + 'it' : 'it_IT', + 'it-it': 'it_IT', + 'nb-no': 'nb_NO', + 'pt' : 'pt_PT', + 'pt-pt': 'pt_PT', + 'es' : 'es_ES', + 'es-es': 'es_ES', + 'sv-se': 'sv_SE' + }; + editor.config.scayt_sLang = map[ lang.toLowerCase() ]; + } + + // Parse the config to turn it into a js object + // format= dialogName:tabName:fieldName + var parseDefinitionToObject = function( value ) { + // Allow JSON definitions + if (typeof value == 'object') + return value; + + var contents = value.split( ';' ), + tabsToProcess = {}, + i; + + for ( i = 0; i < contents.length; i++ ) { + var parts = contents[ i ].split( ':' ); + if ( parts.length == 3 ) { + var dialogName = parts[ 0 ], + tabName = parts[ 1 ], + fieldName = parts[ 2 ]; + + if ( !tabsToProcess[ dialogName ] ) + tabsToProcess[ dialogName ] = {}; + if ( !tabsToProcess[ dialogName ][ tabName ] ) + tabsToProcess[ dialogName ][ tabName ] = []; + + tabsToProcess[ dialogName ][ tabName ].push( fieldName ); + } + } + return tabsToProcess; + }; + + // Customize dialogs: + function customizeDialogs( ev ) { + if ( editor != ev.editor ) + return; + + var dialogName = ev.data.name, + dialogDefinition = ev.data.definition, + tabsToProcess, + i, name, fields, tab; + + if (dialogName == 'tableProperties') + dialogName = 'table'; + + // Parse the config to turn it into a js object + if ( !( 'removeDialogFields' in editor._ ) && editor.config.removeDialogFields ) + editor._.removeDialogFields = parseDefinitionToObject( editor.config.removeDialogFields ); + + // Remove fields of this dialog. + if ( editor._.removeDialogFields && ( tabsToProcess = editor._.removeDialogFields[ dialogName ] ) ) { + for ( name in tabsToProcess ) { + fields = tabsToProcess[ name ]; + tab = dialogDefinition.getContents( name ); + + for ( i = 0; i < fields.length ; i++ ) + tab.remove( fields[ i ] ); + } + } + + + if ( !( 'hideDialogFields' in editor._ ) && editor.config.hideDialogFields ) + editor._.hideDialogFields = parseDefinitionToObject( editor.config.hideDialogFields ); + + // Remove fields of this dialog. + if ( editor._.hideDialogFields && ( tabsToProcess = editor._.hideDialogFields[ dialogName ] ) ) { + for ( name in tabsToProcess ) { + fields = tabsToProcess[ name ]; + tab = dialogDefinition.getContents( name ); + + for ( i = 0; i < fields.length ; i++ ) + tab.get( fields[ i ] ).hidden = true; + } + } + + // Set default values. + if ( editor.config.dialogFieldsDefaultValues && ( tabsToProcess = editor.config.dialogFieldsDefaultValues[ dialogName ] ) ) { + for ( name in tabsToProcess ) { + fields = tabsToProcess[ name ]; + tab = dialogDefinition.getContents( name ); + + for ( var fieldName in fields ) { + var dialogField = tab.get( fieldName ); + if ( dialogField ) + dialogField[ 'default' ] = fields[ fieldName ]; + } + } + } + + + } + + CKEDITOR.on( 'dialogDefinition', customizeDialogs ); + editor.once( 'beforeDestroy', function() { + CKEDITOR.removeListener( 'dialogDefinition', customizeDialogs ); + }); + + } + } ); + +})(); + + /** + * Allows to define which dialog fiels must be removed + * @name CKEDITOR.config.removeDialogFields + * @type {String} + * @example + * editor.config.removeDialogFields = "image:info:txtBorder;image:info:txtHSpace"; + */ + + /** + * Allows to define which dialog fiels must be hidden + * @name CKEDITOR.config.hideDialogFields + * @type {String} + * @example + * editor.config.hideDialogFields = "image:info:htmlPreview"; + */ + + /** + * Allows to define default values for dialog fields + * @name CKEDITOR.config.dialogFieldsDefaultValues + * @type {Object} + * @example + config.dialogFieldsDefaultValues = + { + image: + { + advanced: + { + txtGenClass : 'myClass', + txtGenTitle : 'Image title' + } + } + }; + */ + + + /** + * Placeholder text for empty editor + * @name CKEDITOR.config.placeholder + * @type {String} + * @example + * editor.config.placeholder = "Please, type here..."; + */ Index: lams_central/web/includes/javascript/ckconfig_custom.js =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -ra6c94a5454507a7c6502caf4c054000f36cc6778 --- lams_central/web/includes/javascript/ckconfig_custom.js (.../ckconfig_custom.js) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_central/web/includes/javascript/ckconfig_custom.js (.../ckconfig_custom.js) (revision a6c94a5454507a7c6502caf4c054000f36cc6778) @@ -131,7 +131,7 @@ CKEDITOR.config.format_tags = 'div;h1;h2;h3;h4;h5;h6;pre;address;p' ; CKEDITOR.config.enterMode = 'div'; CKEDITOR.plugins.addExternal('wikilink', CKEDITOR.basePath + '../tool/lawiki10/wikilink/', 'plugin.js'); -CKEDITOR.config.extraPlugins = 'wikilink,jlatexmath,image2,html5audio,bootstrapTabs,bootpanel,bootsnippets'; +CKEDITOR.config.extraPlugins = 'wikilink,jlatexmath,image2,html5audio,confighelper,bootstrapTabs,bootpanel,bootsnippets'; CKEDITOR.config.enterMode = CKEDITOR.ENTER_DIV; CKEDITOR.config.removePlugins = 'elementspath,about,specialchar'; CKEDITOR.config.allowedContent = true; @@ -150,6 +150,13 @@ }); CKEDITOR.on('instanceReady', function(e){ + + //add custom classes + var classes = e.editor.config.classes; + if (classes) { + e.editor._.editable.$.classList.add(classes); + } + var height = e.editor.config.height; if ( ! height ) { height = "60px"; Index: lams_central/web/includes/javascript/jquery-ui.touch-punch.js =================================================================== diff -u --- lams_central/web/includes/javascript/jquery-ui.touch-punch.js (revision 0) +++ lams_central/web/includes/javascript/jquery-ui.touch-punch.js (revision a6c94a5454507a7c6502caf4c054000f36cc6778) @@ -0,0 +1,11 @@ +/*! + * jQuery UI Touch Punch 0.2.3 + * + * Copyright 2011–2014, Dave Furfero + * Dual licensed under the MIT or GPL Version 2 licenses. + * + * Depends: + * jquery.ui.widget.js + * jquery.ui.mouse.js + */ +!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery); \ No newline at end of file Index: lams_tool_assessment/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -r50badebd77a913275818f3966f85503a56581e5b -ra6c94a5454507a7c6502caf4c054000f36cc6778 --- lams_tool_assessment/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 50badebd77a913275818f3966f85503a56581e5b) +++ lams_tool_assessment/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision a6c94a5454507a7c6502caf4c054000f36cc6778) @@ -54,9 +54,9 @@ label.authoring.choice.one.answer =One answer only label.authoring.choice.multiple.answers =Multiple answers allowed label.authoring.choice.overall.feedback =Overall feedback -label.authoring.choice.feedback.on.correct =For any correct response -label.authoring.choice.feedback.on.partially.correct =For any partially correct response -label.authoring.choice.feedback.on.incorrect =For any incorrect response +label.authoring.choice.feedback.on.correct =Feedback on any correct response +label.authoring.choice.feedback.on.partially.correct =Feedback on any partially correct response +label.authoring.choice.feedback.on.incorrect =Feedback on any incorrect response label.authoring.choice.add.option =Add another answer label.authoring.matching.pairs.add.matching.pairs =Add question label.authoring.matching.pairs.matching.pairs =Matching pairs Index: lams_tool_assessment/web/WEB-INF/tags/CKEditor.tag =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -ra6c94a5454507a7c6502caf4c054000f36cc6778 --- lams_tool_assessment/web/WEB-INF/tags/CKEditor.tag (.../CKEditor.tag) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_tool_assessment/web/WEB-INF/tags/CKEditor.tag (.../CKEditor.tag) (revision a6c94a5454507a7c6502caf4c054000f36cc6778) @@ -3,6 +3,8 @@ <%@ taglib uri="tags-function" prefix="fn" %> <%@ attribute name="id" required="true" rtexprvalue="true"%> +<%@ attribute name="classes" required="false" rtexprvalue="true"%> +<%@ attribute name="placeholder" required="false" rtexprvalue="true"%> <%@ attribute name="value" required="true" rtexprvalue="true"%> <%@ attribute name="toolbarSet" required="false" rtexprvalue="true"%> <%@ attribute name="height" required="false" rtexprvalue="true"%> @@ -66,6 +68,7 @@ if (editor) { editor.destroy(true); } var instance = CKEDITOR.${method}( "${id}", { + classes : "${classes}", width : "${width}", height : "${height}", toolbar : "${toolbarSet}", Index: lams_tool_assessment/web/includes/javascript/assessmentoption.js =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -ra6c94a5454507a7c6502caf4c054000f36cc6778 --- lams_tool_assessment/web/includes/javascript/assessmentoption.js (.../assessmentoption.js) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_tool_assessment/web/includes/javascript/assessmentoption.js (.../assessmentoption.js) (revision a6c94a5454507a7c6502caf4c054000f36cc6778) @@ -1,9 +1,9 @@ - //This is Assessment Question option area. - var optionTargetDiv = "#optionArea"; +//This is Assessment Question option area. +var optionTargetDiv = "#optionArea"; - // Please set these 2 variables in JSP file for using tag reason: - // var removeOptionUrl = ""; - // var addOptionUrl = ""; +// Please set these 2 variables in JSP file for using tag reason: +// var removeOptionUrl = ""; +// var addOptionUrl = ""; function addOption(){ //store old InstanceIds before doing Ajax call. We need to keep record of old ones to prevent reinitializing new CKEditor two times. @@ -23,6 +23,9 @@ contentFolderID: contentFolderID, questionType: questionType, optionList: optionList + }, + function() { + initializeOptionItems(); } ); } @@ -34,13 +37,16 @@ var optionList = $("#optionForm").serialize(true); $.ajaxSetup({ cache: true }); $(optionTargetDiv).load( - url, - { - contentFolderID: contentFolderID, - questionType: questionType, - optionIndex: idx, - optionList: optionList - } + url, + { + contentFolderID: contentFolderID, + questionType: questionType, + optionIndex: idx, + optionList: optionList + }, + function() { + initializeOptionItems(); + } ); } function upOption(idx){ @@ -50,13 +56,16 @@ var optionList = $("#optionForm").serialize(true); $.ajaxSetup({ cache: true }); $(optionTargetDiv).load( - url, - { - contentFolderID: contentFolderID, - questionType: questionType, - optionIndex: idx, - optionList: optionList - } + url, + { + contentFolderID: contentFolderID, + questionType: questionType, + optionIndex: idx, + optionList: optionList + }, + function() { + initializeOptionItems(); + } ); } function downOption(idx){ @@ -66,13 +75,16 @@ var optionList = $("#optionForm").serialize(true); $.ajaxSetup({ cache: true }); $(optionTargetDiv).load( - url, - { - contentFolderID: contentFolderID, - questionType: questionType, - optionIndex: idx, - optionList: optionList - } + url, + { + contentFolderID: contentFolderID, + questionType: questionType, + optionIndex: idx, + optionList: optionList + }, + function() { + initializeOptionItems(); + } ); } Index: lams_tool_assessment/web/pages/authoring/parts/addmultiplechoice.jsp =================================================================== diff -u -r67d7232f087b9f5c72ff41f7bbebe29cff81e099 -ra6c94a5454507a7c6502caf4c054000f36cc6778 --- lams_tool_assessment/web/pages/authoring/parts/addmultiplechoice.jsp (.../addmultiplechoice.jsp) (revision 67d7232f087b9f5c72ff41f7bbebe29cff81e099) +++ lams_tool_assessment/web/pages/authoring/parts/addmultiplechoice.jsp (.../addmultiplechoice.jsp) (revision a6c94a5454507a7c6502caf4c054000f36cc6778) @@ -6,7 +6,205 @@ <%@ include file="/common/header.jsp"%> + + + + + + + @@ -159,26 +442,24 @@ - - - -
- - +
+
+ +
+ +
+ +
- -
- - - -
+ + +
- -
+ +
+ @@ -234,57 +517,55 @@
- -
in form-group"> - +
+ +
+ + +
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
+
-
- -
- -
- <%@ include file="optionlist.jsp"%> - - - - -
- - -
- - -
in"> -
- - -
+ +
+
+ <%@ include file="optionlist.jsp"%> -
- - -
- -
- - -
-
+ + + +
- -
+ +
Index: lams_tool_assessment/web/pages/authoring/parts/option.jsp =================================================================== diff -u -r67d7232f087b9f5c72ff41f7bbebe29cff81e099 -ra6c94a5454507a7c6502caf4c054000f36cc6778 --- lams_tool_assessment/web/pages/authoring/parts/option.jsp (.../option.jsp) (revision 67d7232f087b9f5c72ff41f7bbebe29cff81e099) +++ lams_tool_assessment/web/pages/authoring/parts/option.jsp (.../option.jsp) (revision a6c94a5454507a7c6502caf4c054000f36cc6778) @@ -1,26 +1,28 @@ -
-   ${status.index+1} +
+ +
-
- -
+
\ No newline at end of file Index: lams_tool_assessment/web/pages/authoring/parts/optionlist.jsp =================================================================== diff -u -r67d7232f087b9f5c72ff41f7bbebe29cff81e099 -ra6c94a5454507a7c6502caf4c054000f36cc6778 --- lams_tool_assessment/web/pages/authoring/parts/optionlist.jsp (.../optionlist.jsp) (revision 67d7232f087b9f5c72ff41f7bbebe29cff81e099) +++ lams_tool_assessment/web/pages/authoring/parts/optionlist.jsp (.../optionlist.jsp) (revision a6c94a5454507a7c6502caf4c054000f36cc6778) @@ -1,12 +1,26 @@ <%@ include file="/common/taglibs.jsp"%> + +
- +
+ +
+ + + - +
+ ${status.index+1} + <%@ include file="option.jsp"%> @@ -29,7 +43,8 @@ + - " + " onclick="javascript:removeOption(${status.index})">
- +
+
\ No newline at end of file