Move JavaScript modules into WoltLabSuite/Core namespace
authorMatthias Schmidt <gravatronics@live.com>
Thu, 4 Aug 2016 19:31:50 +0000 (21:31 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 4 Aug 2016 19:31:50 +0000 (21:31 +0200)
files/js/WoltLab/Conversation/Ui/Participant/Add.js [deleted file]
files/js/WoltLabSuite/Core/Conversation/Ui/Participant/Add.js [new file with mode: 0644]
templates/conversationAdd.tpl
templates/conversationList.tpl
templates/conversationQuickReply.tpl

diff --git a/files/js/WoltLab/Conversation/Ui/Participant/Add.js b/files/js/WoltLab/Conversation/Ui/Participant/Add.js
deleted file mode 100644 (file)
index c483259..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * Adds participants to an existing conversation.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2016 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @module     WoltLab/Conversation/Ui/Participant/Add
- */
-define(['Ajax', 'Language', 'Ui/Dialog', 'Ui/Notification', 'WoltLab/WCF/Ui/ItemList/User'], function(Ajax, Language, UiDialog, UiNotification, UiItemListUser) {
-       "use strict";
-       
-       /**
-        * @constructor
-        * @param       {int}   conversationId          conversation id
-        */
-       function UiParticipantAdd(conversationId) { this.init(conversationId); }
-       UiParticipantAdd.prototype = {
-               /**
-                * Manages the form to add one or more participants to an existing conversation.
-                * 
-                * @param       {int}   conversationId          conversation id
-                */
-               init: function(conversationId) {
-                       this._conversationId = conversationId;
-                       
-                       Ajax.api(this, {
-                               actionName: 'getAddParticipantsForm'
-                       });
-               },
-               
-               _ajaxSetup: function() {
-                       return {
-                               data: {
-                                       className: 'wcf\\data\\conversation\\ConversationAction',
-                                       objectIDs: [ this._conversationId ]
-                               }
-                       };
-               },
-               
-               /**
-                * Handles successful Ajax requests.
-                * 
-                * @param       {Object}        data            response data
-                */
-               _ajaxSuccess: function(data) {
-                       switch (data.actionName) {
-                               case 'addParticipants':
-                                       this._handleResponse(data);
-                                       break;
-                               
-                               case 'getAddParticipantsForm':
-                                       this._render(data);
-                                       break;
-                       }
-               },
-               
-               /**
-                * Shows the success message and closes the dialog overlay.
-                * 
-                * @param       {Object}        data            response data
-                */
-               _handleResponse: function(data) {
-                       //noinspection JSUnresolvedVariable
-                       if (data.returnValues.count) {
-                               //noinspection JSUnresolvedVariable
-                               UiNotification.show(data.returnValues.successMessage);
-                       }
-                       
-                       UiDialog.close(this);
-               },
-               
-               /**
-                * Renders the dialog to add participants.
-                * 
-                * @param       {object}        data            response data
-                */
-               _render: function(data) {
-                       //noinspection JSUnresolvedVariable
-                       UiDialog.open(this, data.returnValues.template);
-                       
-                       var buttonSubmit = document.getElementById('addParticipants');
-                       buttonSubmit.disabled = true;
-                       
-                       //noinspection JSUnresolvedVariable
-                       UiItemListUser.init('participantsInput', {
-                               callbackChange: function(elementId, values) { buttonSubmit.disabled = (values.length === 0); },
-                               excludedSearchValues: data.returnValues.excludedSearchValues,
-                               maxItems: data.returnValues.maxItems
-                       });
-                       
-                       buttonSubmit.addEventListener('click', this._submit.bind(this));
-               },
-               
-               /**
-                * Sends a request to add participants.
-                */
-               _submit: function() {
-                       var values = UiItemListUser.getValues('participantsInput'), participants = [];
-                       for (var i = 0, length = values.length; i < length; i++) {
-                               participants.push(values[i].value);
-                       }
-                       
-                       Ajax.api(this, {
-                               actionName: 'addParticipants',
-                               parameters: {
-                                       participants: participants
-                               }
-                       });
-               },
-               
-               _dialogSetup: function() {
-                       return {
-                               id: 'conversationAddParticipants',
-                               options: {
-                                       title: Language.get('wcf.conversation.edit.addParticipants')
-                               },
-                               source: null
-                       };
-               }
-       };
-       
-       return UiParticipantAdd;
-});
diff --git a/files/js/WoltLabSuite/Core/Conversation/Ui/Participant/Add.js b/files/js/WoltLabSuite/Core/Conversation/Ui/Participant/Add.js
new file mode 100644 (file)
index 0000000..fe5517f
--- /dev/null
@@ -0,0 +1,123 @@
+/**
+ * Adds participants to an existing conversation.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2016 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module     WoltLabSuite/Core/Conversation/Ui/Participant/Add
+ */
+define(['Ajax', 'Language', 'Ui/Dialog', 'Ui/Notification', 'WoltLabSuite/Core/Ui/ItemList/User'], function(Ajax, Language, UiDialog, UiNotification, UiItemListUser) {
+       "use strict";
+       
+       /**
+        * @constructor
+        * @param       {int}   conversationId          conversation id
+        */
+       function UiParticipantAdd(conversationId) { this.init(conversationId); }
+       UiParticipantAdd.prototype = {
+               /**
+                * Manages the form to add one or more participants to an existing conversation.
+                * 
+                * @param       {int}   conversationId          conversation id
+                */
+               init: function(conversationId) {
+                       this._conversationId = conversationId;
+                       
+                       Ajax.api(this, {
+                               actionName: 'getAddParticipantsForm'
+                       });
+               },
+               
+               _ajaxSetup: function() {
+                       return {
+                               data: {
+                                       className: 'wcf\\data\\conversation\\ConversationAction',
+                                       objectIDs: [ this._conversationId ]
+                               }
+                       };
+               },
+               
+               /**
+                * Handles successful Ajax requests.
+                * 
+                * @param       {Object}        data            response data
+                */
+               _ajaxSuccess: function(data) {
+                       switch (data.actionName) {
+                               case 'addParticipants':
+                                       this._handleResponse(data);
+                                       break;
+                               
+                               case 'getAddParticipantsForm':
+                                       this._render(data);
+                                       break;
+                       }
+               },
+               
+               /**
+                * Shows the success message and closes the dialog overlay.
+                * 
+                * @param       {Object}        data            response data
+                */
+               _handleResponse: function(data) {
+                       //noinspection JSUnresolvedVariable
+                       if (data.returnValues.count) {
+                               //noinspection JSUnresolvedVariable
+                               UiNotification.show(data.returnValues.successMessage);
+                       }
+                       
+                       UiDialog.close(this);
+               },
+               
+               /**
+                * Renders the dialog to add participants.
+                * 
+                * @param       {object}        data            response data
+                */
+               _render: function(data) {
+                       //noinspection JSUnresolvedVariable
+                       UiDialog.open(this, data.returnValues.template);
+                       
+                       var buttonSubmit = document.getElementById('addParticipants');
+                       buttonSubmit.disabled = true;
+                       
+                       //noinspection JSUnresolvedVariable
+                       UiItemListUser.init('participantsInput', {
+                               callbackChange: function(elementId, values) { buttonSubmit.disabled = (values.length === 0); },
+                               excludedSearchValues: data.returnValues.excludedSearchValues,
+                               maxItems: data.returnValues.maxItems
+                       });
+                       
+                       buttonSubmit.addEventListener('click', this._submit.bind(this));
+               },
+               
+               /**
+                * Sends a request to add participants.
+                */
+               _submit: function() {
+                       var values = UiItemListUser.getValues('participantsInput'), participants = [];
+                       for (var i = 0, length = values.length; i < length; i++) {
+                               participants.push(values[i].value);
+                       }
+                       
+                       Ajax.api(this, {
+                               actionName: 'addParticipants',
+                               parameters: {
+                                       participants: participants
+                               }
+                       });
+               },
+               
+               _dialogSetup: function() {
+                       return {
+                               id: 'conversationAddParticipants',
+                               options: {
+                                       title: Language.get('wcf.conversation.edit.addParticipants')
+                               },
+                               source: null
+                       };
+               }
+       };
+       
+       return UiParticipantAdd;
+});
index db9b381660e9a99a9795d3159e64af66b3183b16..66258ab103b7805a2f6dd6cafd6f394551165efd 100644 (file)
 </form>
 
 <script data-relocate="true">
-       require(['WoltLab/WCF/Ui/ItemList/User'], function(UiItemListUser) {
+       require(['WoltLabSuite/Core/Ui/ItemList/User'], function(UiItemListUser) {
                UiItemListUser.init('participants', {
                        maxItems: {@$__wcf->getSession()->getPermission('user.conversation.maxParticipants')}
                });
index fc14304f15b22d3a41f3d2eb7319cf1e5488a310..1cfc499f5d7b1dfcfce957de862e08bb54e343e2 100644 (file)
 
 <script data-relocate="true" src="{@$__wcf->getPath()}js/WCF.Conversation{if !ENABLE_DEBUG_MODE}.min{/if}.js?v={@LAST_UPDATE_TIME}"></script>
 <script data-relocate="true">
-       require(['Language', 'WoltLab/WCF/Ui/ItemList/User'], function(Language, UiItemListUser) {
+       require(['Language', 'WoltLabSuite/Core/Ui/ItemList/User'], function(Language, UiItemListUser) {
                Language.addObject({
                        'wcf.conversation.edit.addParticipants': '{lang}wcf.conversation.edit.addParticipants{/lang}',
                        'wcf.conversation.edit.assignLabel': '{lang}wcf.conversation.edit.assignLabel{/lang}',
index 6e31837546f2d962e1915e1deb4596f696e2d855..70dae15750369671df3bc5e37e1aaa60c10e1417 100644 (file)
@@ -25,7 +25,7 @@
        </article>
        
        <script data-relocate="true">
-               require(['WoltLab/WCF/Ui/Message/Reply'], function(UiMessageReply) {
+               require(['WoltLabSuite/Core/Ui/Message/Reply'], function(UiMessageReply) {
                        new UiMessageReply({
                                ajax: {
                                        className: 'wcf\\data\\conversation\\message\\ConversationMessageAction'