Index: ivy.xml =================================================================== --- ivy.xml (revision 31842) +++ ivy.xml (working copy) @@ -43,6 +43,6 @@ - + Index: main/plugin-cart/plugin.xml =================================================================== --- main/plugin-cart/plugin.xml (revision 31842) +++ main/plugin-cart/plugin.xml (working copy) @@ -42,14 +42,14 @@ + point="org.ametys.core.ui.MessageTargetFactoriesManager" + class="org.ametys.core.ui.StaticClientSideElement"> cart - js/Ametys/plugins/cart/Cart.i18n.js - js/Ametys/plugins/cart/CartsDAO.i18n.js + js/Ametys/plugins/cart/Cart.js + js/Ametys/plugins/cart/CartsDAO.js js/Ametys/plugins/cart/CartMessageTargetFactory.js @@ -58,12 +58,12 @@ - - @@ -72,7 +72,7 @@ - @@ -101,8 +101,8 @@ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.SimpleMenu"> @@ -115,8 +115,8 @@ + point="org.ametys.core.ui.RibbonTabsManager" + class="org.ametys.core.ui.StaticClientSideElement"> ^(uitool-carts|uitool-cart\$.*|uitool-cart-rights)$ @@ -127,8 +127,8 @@ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartsActions.exportCsv ^cart$ @@ -145,13 +145,12 @@ img/actions/export_48.png - js/Ametys/plugins/cart/actions/CartsActions.i18n.js js/Ametys/plugins/cart/controllers/CartController.js + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartsActions.exportXml ^cart$ @@ -168,13 +167,12 @@ img/actions/export_48.png - js/Ametys/plugins/cart/actions/CartsActions.i18n.js js/Ametys/plugins/cart/controllers/CartController.js + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.SimpleMenu"> ^cart$ false @@ -203,8 +201,8 @@ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartsActions.printList ^cart$ @@ -221,13 +219,12 @@ img/actions/print_48.png - js/Ametys/plugins/cart/actions/CartsActions.i18n.js js/Ametys/plugins/cart/controllers/CartController.js + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartsActions.printDetails ^cart$ @@ -244,13 +241,12 @@ img/actions/print_48.png - js/Ametys/plugins/cart/actions/CartsActions.i18n.js js/Ametys/plugins/cart/controllers/CartController.js + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.SimpleMenu"> @@ -263,8 +259,8 @@ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartsActions.newCart @@ -277,14 +273,12 @@ img/actions/add_48.png - js/Ametys/plugins/cart/helper/CreateOrEditCart.i18n.js - js/Ametys/plugins/cart/actions/CartsActions.i18n.js Plugin_Cart_Rights_Create + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartsActions.editCart ^cart$ @@ -304,14 +298,12 @@ img/actions/edit_48.png - js/Ametys/plugins/cart/helper/CreateOrEditCart.i18n.js - js/Ametys/plugins/cart/actions/CartsActions.i18n.js js/Ametys/plugins/cart/controllers/CartController.js + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartsActions.deleteCart ^cart$ @@ -330,13 +322,12 @@ img/actions/delete_48.png - js/Ametys/plugins/cart/actions/CartsActions.i18n.js js/Ametys/plugins/cart/controllers/CartController.js + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartsActions.removeCartElements ^cart$ @@ -354,7 +345,6 @@ img/actions/delete-items_48.png - js/Ametys/plugins/cart/actions/CartsActions.i18n.js js/Ametys/plugins/cart/controllers/CartController.js @@ -364,8 +354,8 @@ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.SimpleMenu"> @@ -385,7 +375,7 @@ Ametys.plugins.cart.tool.CartsTool @@ -399,9 +389,8 @@ l - js/Ametys/plugins/cart/actions/CartsActions.i18n.js - js/Ametys/plugins/cart/tool/CartsTool.i18n.js - js/Ametys/plugins/cart/tool/CartsTool/CartEntry.i18n.js + js/Ametys/plugins/cart/tool/CartsTool.js + js/Ametys/plugins/cart/tool/CartsTool/CartEntry.js @@ -411,8 +400,8 @@ + point="org.ametys.core.ui.UIToolsFactoriesManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.tool.CartTool uitool-cart @@ -426,8 +415,8 @@ - js/Ametys/plugins/cart/tool/CartTool/CartElementEntry.i18n.js - js/Ametys/plugins/cart/tool/CartTool.i18n.js + js/Ametys/plugins/cart/tool/CartTool/CartElementEntry.js + js/Ametys/plugins/cart/tool/CartTool.js @@ -436,8 +425,8 @@ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartsActions.addContents ^content$ @@ -452,9 +441,7 @@ img/actions/add-items_48.png - js/Ametys/plugins/cart/tool/CartsTool/CartEntry.i18n.js - js/Ametys/plugins/cart/helper/ChooseCart.i18n.js - js/Ametys/plugins/cart/actions/CartsActions.i18n.js + js/Ametys/plugins/cart/tool/CartsTool/CartEntry.js css/cart.css @@ -463,8 +450,8 @@ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartsActions.addContentsToNewCart ^content$ @@ -478,15 +465,13 @@ img/actions/add-items-new_48.png - js/Ametys/plugins/cart/helper/CreateOrEditCart.i18n.js - js/Ametys/plugins/cart/actions/CartsActions.i18n.js Plugin_Cart_Rights_AddContent + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.SimpleMenu"> @@ -500,9 +485,9 @@ - + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> + Ametys.plugins.cart.actions.CartsActions.addResources ^resource$ @@ -515,10 +500,8 @@ img/actions/add-items_48.png - js/Ametys/plugins/cms/explorer/controllers/ExplorerNodeController.js - js/Ametys/plugins/cart/tool/CartsTool/CartEntry.i18n.js - js/Ametys/plugins/cart/helper/ChooseCart.i18n.js - js/Ametys/plugins/cart/actions/CartsActions.i18n.js + js/Ametys/explorer/controllers/ExplorerNodeController.js + js/Ametys/plugins/cart/tool/CartsTool/CartEntry.js css/cart.css @@ -527,9 +510,9 @@ - + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> + Ametys.plugins.cart.actions.CartsActions.addResourcesToNewCart ^resource$ @@ -542,17 +525,15 @@ img/actions/add-items-new_48.png - js/Ametys/plugins/cms/explorer/controllers/ExplorerNodeController.js - js/Ametys/plugins/cart/helper/CreateOrEditCart.i18n.js - js/Ametys/plugins/cart/actions/CartsActions.i18n.js + js/Ametys/explorer/controllers/ExplorerNodeController.js Plugin_Cart_Rights_AddResource - + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.SimpleMenu"> + @@ -568,8 +549,8 @@ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> uitool-cart-rights ^cart$ @@ -598,8 +579,8 @@ + point="org.ametys.core.ui.UIToolsFactoriesManager" + class="org.ametys.core.ui.StaticClientSideElement"> uitool-cart-rights Ametys.plugins.cart.tool.CartRightsTool @@ -622,7 +603,7 @@ r - js/Ametys/plugins/cart/tool/CartRightsTool.i18n.js + js/Ametys/plugins/cart/tool/CartRightsTool.js js/Ametys/plugins/cart/tool/CartRightsTool/CartRightsEntry.js @@ -631,8 +612,8 @@ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartRightsActions.changeVisibility ^cart$ @@ -657,13 +638,13 @@ js/Ametys/plugins/cart/controllers/CartController.js - js/Ametys/plugins/cart/actions/CartRightsActions.i18n.js + js/Ametys/plugins/cart/actions/CartRightsActions.js + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartRightsActions.changeVisibility ^cart$ @@ -688,13 +669,13 @@ js/Ametys/plugins/cart/controllers/CartController.js - js/Ametys/plugins/cart/actions/CartRightsActions.i18n.js + js/Ametys/plugins/cart/actions/CartRightsActions.js + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartRightsActions.changeVisibility ^cart$ @@ -719,13 +700,13 @@ js/Ametys/plugins/cart/controllers/CartController.js - js/Ametys/plugins/cart/actions/CartRightsActions.i18n.js + js/Ametys/plugins/cart/actions/CartRightsActions.js + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.SimpleMenu"> ^cart$ false @@ -765,16 +746,16 @@ + point="org.ametys.core.ui.RibbonTabsManager" + class="org.ametys.core.ui.StaticClientSideElement"> ^uitool-cart-rights$ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartRightsActions.addUsers ^cart-profile$ @@ -789,14 +770,13 @@ img/users/add_48.png - js/Ametys/runtime/uihelper/SelectUser.i18n.js - js/Ametys/plugins/cart/actions/CartRightsActions.i18n.js + js/Ametys/plugins/cart/actions/CartRightsActions.js + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartRightsActions.addGroups ^cart-profile$ @@ -811,14 +791,13 @@ img/groups/add_48.png - js/Ametys/runtime/uihelper/SelectGroup.i18n.js - js/Ametys/plugins/cart/actions/CartRightsActions.i18n.js + js/Ametys/plugins/cart/actions/CartRightsActions.js + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.cart.actions.CartRightsActions.removeAssignment ^cart-profile$ @@ -834,7 +813,7 @@ img/rights/remove_48.png - js/Ametys/plugins/cart/actions/CartRightsActions.i18n.js + js/Ametys/plugins/cart/actions/CartRightsActions.js @@ -843,8 +822,8 @@ + point="org.ametys.core.ui.RelationsManager" + class="org.ametys.core.ui.StaticClientSideElement"> PLUGINS_CART_RELATIONS_ADDTOCART_DESCRIPTION @@ -854,25 +833,25 @@ - js/Ametys/plugins/cart/relations/AddToCartRelationHandler.i18n.js + js/Ametys/plugins/cart/relations/AddToCartRelationHandler.js + point="org.ametys.core.ui.StaticFileImportsManager" + class="org.ametys.core.ui.StaticFileImportsClientSideElement"> - js/Ametys/plugins/cart/relations/AddToCartRelationHandler.i18n.js + js/Ametys/plugins/cart/relations/AddToCartRelationHandler.js js/Ametys/plugins/cart/relations/AddContentToCartRelationHandler.js Plugin_Cart_Rights_AddContent + point="org.ametys.core.ui.StaticFileImportsManager" + class="org.ametys.core.ui.StaticFileImportsClientSideElement"> - js/Ametys/plugins/cart/relations/AddToCartRelationHandler.i18n.js + js/Ametys/plugins/cart/relations/AddToCartRelationHandler.js js/Ametys/plugins/cart/relations/AddResourceToCartRelationHandler.js Plugin_Cart_Rights_AddResource @@ -882,7 +861,7 @@ - @@ -891,13 +870,13 @@ + point="org.ametys.core.ui.StaticFileImportsManager" + class="org.ametys.core.ui.StaticFileImportsClientSideElement"> - js/Ametys/plugins/cart/actions/CartsActions.i18n.js - js/Ametys/plugins/cart/helper/CreateOrEditCart.i18n.js - js/Ametys/plugins/cart/helper/ChooseCart.i18n.js - js/Ametys/plugins/cart/CartSearchExtensions.i18n.js + js/Ametys/plugins/cart/actions/CartsActions.js + js/Ametys/plugins/cart/helper/CreateOrEditCart.js + js/Ametys/plugins/cart/helper/ChooseCart.js + js/Ametys/plugins/cart/CartSearchExtensions.js Plugin_Cart_Rights_SearchExtensions_SaveCart Index: main/plugin-cart/resources/js/Ametys/plugins/cart/Cart.i18n.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/Cart.i18n.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/Cart.i18n.js (working copy) @@ -1,134 +0,0 @@ -/* - * Copyright 2013 Anyware Services - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * This class is the representation of a cart. - * @private - */ -Ext.define( - "Ametys.plugins.cart.Cart", - { - config: { - /** - * @cfg {String} id The unique id of the cart - */ - /** - * @method getId Get the #cfg-id - * @return {String} The id - */ - /** @ignore */ - id: null, - /** - * @cfg {String} title The title of the cart - */ - /** - * @method getTitle Get the #cfg-title - * @return {String} The title - */ - /** @ignore */ - title: null, - /** - * @cfg {String} description The description of the cart - */ - /** - * @method getDescription Get the #cfg-description - * @return {String} The description - */ - /** @ignore */ - description: null, - /** - * @cfg {boolean} canRead True if the cart is in read-access for the current user - */ - /** - * @method getCanRead Get the #cfg-canRead - * @return {boolean} True if the cart is in read-access - */ - /** @ignore */ - canRead: false, - /** - * @cfg {boolean} canWrite True if the cart is in write-access for the current user - */ - /** - * @method getCanWrite Get the #cfg-canWrite - * @return {boolean} True if the cart is in write-access - */ - /** @ignore */ - canWrite: false, - /** - * @cfg {String} authorLogin The login of cart owner - */ - /** - * @method getAuthor Get the #cfg-author - * @return {String} The login of cart owner - */ - /** @ignore */ - authorLogin: null, - /** - * @cfg {String} authorFullName The full name of cart owner - */ - /** - * @method getAuthorFullName Get the #cfg-authorFullName - * @return {String} The full name of cart owner - */ - /** @ignore */ - authorFullName: null, - - /** - * @cfg {String} visibility The visibility of the cart - */ - /** - * @method getVisibility Get the #cfg-visibility - * @return {String} The visibility - */ - /** @ignore */ - visibility: null - }, - - - /** - * Creates a content instance - * @param {Object} config See configuration doc. - */ - constructor: function (config) - { - this.initConfig(config); - - this.messageTarget = config.messageTarget || Ametys.message.MessageTarget.CONTENT; - }, - - /** - * Get the cart's properties - * @return {Object} The cart's properties - */ - getProperties: function (initialProperty) - { - initialProperty = initialProperty || {}; - - return Ext.apply ({ - id: this.id, - title: this.title, - description: this.description, - visibility: this.visibility, - canRead: this.canRead, - canWrite: this.canWrite, - authorLogin: this.authorLogin, - authorFullName: this.authorFullName - }, initialProperty - ); - } - } -); - Index: main/plugin-cart/resources/js/Ametys/plugins/cart/Cart.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/Cart.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/Cart.js (working copy) @@ -118,14 +118,14 @@ initialProperty = initialProperty || {}; return Ext.apply ({ - id: this.id, - title: this.title, - description: this.description, - visibility: this.visibility, - canRead: this.canRead, - canWrite: this.canWrite, - authorLogin: this.authorLogin, - authorFullName: this.authorFullName + id: this._id, + title: this._title, + description: this._description, + visibility: this._visibility, + canRead: this._canRead, + canWrite: this._canWrite, + authorLogin: this._authorLogin, + authorFullName: this._authorFullName }, initialProperty ); } Index: main/plugin-cart/resources/js/Ametys/plugins/cart/CartSearchExtensions.i18n.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/CartSearchExtensions.i18n.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/CartSearchExtensions.i18n.js (working copy) @@ -1,77 +0,0 @@ -/* - * Copyright 2015 Anyware Services - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Extensions for search tools - * @private - */ -Ext.define('Ametys.plugins.cart.CartSearchExtensions', { - singleton: true, - - /** - * Add the search extensions for cart - */ - addSearchExtension: function () - { - var items = this._getItemsForSearch(); - Ametys.plugins.cms.search.SearchToolExtensions.registerAdditionalButton(items); - }, - - /** - * Get items for search tool - * @private - */ - _getItemsForSearch: function (type) - { - return { - icon: Ametys.getPluginResourcesPrefix('cart') + '/img/actions/add-items_16.png', - // text: "", - tooltip: { - title: "", - text: "", - image: Ametys.getPluginResourcesPrefix('cart') + '/img/actions/add-items_48.png', - inribbon: false - }, - - menu: { - items: [{ - icon: Ametys.getPluginResourcesPrefix('cart') + '/img/actions/add-items_16.png', - text: "", - handler: Ametys.plugins.cart.actions.CartsActions.addQuery, - scope: Ametys.plugins.cart.actions.CartsActions, - tooltip: { - title: "", - text: "", - image: Ametys.getPluginResourcesPrefix('cart') + '/img/actions/add-items_48.png', - inribbon: false - } - },{ - icon: Ametys.getPluginResourcesPrefix('cart') + '/img/actions/add-items-new_16.png', - text: "", - handler: Ametys.plugins.cart.actions.CartsActions.addQueryToNewCart, - scope: Ametys.plugins.cart.actions.CartsActions, - tooltip: { - title: "", - text: "", - image: Ametys.getPluginResourcesPrefix('cart') + '/img/actions/add-items-new_48.png', - inribbon: false - } - }] - } - }; - } -}); - -Ametys.plugins.cart.CartSearchExtensions.addSearchExtension(); Index: main/plugin-cart/resources/js/Ametys/plugins/cart/CartsDAO.i18n.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/CartsDAO.i18n.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/CartsDAO.i18n.js (working copy) @@ -1,242 +0,0 @@ -/* - * Copyright 2013 Anyware Services - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * The carts DAO - * @private - */ -Ext.define('Ametys.plugins.cart.CartsDAO', { - singleton: true, - - /** - * Retrieve carts from the cache, or by doing a server request. - * @param {String[]} cartIds Cart identifiers - * @param {Function} callback The callback function called after retrieving the carts. Has the following parameters: - * @param {Ametys.plugins.cart.Cart[]} callback.carts An array of retrieved carts. Can be empty. - * @param {String[]} callback.unknownCarts Array of unknown cart ids among the requested list. - * @param {Ametys.plugins.cart.Cart[]} callback.notAllowedCarts An array of not-allowed carts. Can be empty. - * @param {Object} [scope=window] The callback scope, default to window. Can be null. - * @param {Boolean} [displayErrors=false] Set to true to display error dialog box if unknown carts are reported. - * @private - */ - getCarts: function(cartIds, callback, scope, displayErrors) - { - this._initCache(); - - cartIds = Ext.isArray(cartIds) ? cartIds : [cartIds]; - - var resolved = {}, unresolved = [], cart; - - Ext.Array.each(cartIds, function(id) { - cart = this._getFromCache(id); - if (cart) - { - resolved[id] = cart; - } - else if (!Ext.Array.contains(this._resolving, id)) - { - this._resolving.push(id); - unresolved.push(id); - } - }, this); - - if (unresolved.length > 0) - { - this._sendGetCartRequest(cartIds, callback, scope, displayErrors); - } - else - { - callback.call(scope || window, Ext.Object.getValues(resolved), []); - } - }, - - /** - * @private - * Send request to server to retrieve carts. - * @param {String[]} ids The id of carts to retrieve - * @param {Function} callback The callback function to be called after server process - * @param {Object[]} callback.cartData An array of retrieved cart data. Can be empty. - * @param {String[]} callback.unknownCarts Array of unknown cart ids among the requested list. - * @param {Object} [scope=window] The callback scope. - * @param {Boolean} [displayErrors=false] Set to true to display error dialog box for unknown carts - */ - _sendGetCartRequest: function(ids, callback, scope, displayErrors) - { - var params = { - ids: ids || [] - }; - - Ametys.data.ServerComm.send({ - plugin: 'cart', - url: 'cart/list.json', - parameters: params, - priority: Ametys.data.ServerComm.PRIORITY_MAJOR, - waitMessage: true, - errorMessage: { - msg: "", - category: this.self.getName() - }, - responseType: 'text', - callback: { - handler: this._sendGetCartRequestCb, - scope: this, - arguments: { - callback: callback, - scope: scope, - displayErrors: displayErrors || false - } - } - }); - }, - - /** - * Callback function called after #_sendGetCartRequest is processed - * @param {Object} response The response object. - * @param {Object} params The callback arguments (see {@link #_sendGetCartRequest documentation) - * @private - */ - _sendGetCartRequestCb: function (response, params) - { - var callback = params.callback || Ext.emptyFn; - var scope = params.scope || window; - var displayErrors = params.displayErrors || false; - - var result = Ext.JSON.decode(Ext.dom.Query.selectValue('', response)); - - var carts = []; - var notAllowedCarts = []; - var unknownCarts = result.unknownCarts || []; - - // Populate cache. - Ext.Array.forEach(result.carts, function(data) { - var cart = Ext.create ('Ametys.plugins.cart.Cart', data); - carts.push(cart); - this._addToCache(data.id, cart); - }, this); - - Ext.Array.forEach(result.notAllowedCarts, function(data) { - var cart = Ext.create ('Ametys.plugins.cart.Cart', data); - notAllowedCarts.push(cart); - }, this); - - if (displayErrors && unknownCarts.length > 0) - { - Ametys.log.ErrorDialog.display({ - title: "", - text: "", - details: unknownCarts.join(", "), - category: this.self.getName() - }); - } - - // Execute callback with the retrieved carts - callback.call(scope, carts, unknownCarts, notAllowedCarts); - }, - - /** - * @property {Object} _cache The DAO cache. Keys are cart id, Values are an object representing the cart data. - * @private - */ - _cache: null, - /** - * @property {Object} _cacheExpirations The object holding the expiration times for each entry in the cache - * @private - */ - _cacheExpirations : null, - /** - * @property {String[]} _resolving Array of the requested cart that are currently being resolved on the server. - * Used to avoid making several requests for the same cart in a short period of time. - * @private - */ - _resolving: null, - - /** - * Update a cart in the cache. Nothing will be done if the entry is not present in the cache. - * This must be done when some data of a cart are modified. - * @param {String} cartId the cart id - * @param {Object} dataToUpdate The properties to update for this cart. - */ - localUpdate: function(cartId, dataToUpdate) - { - this._initCache(); - - var cart = this._getFromCache(cartId); - if (cart) - { - Ext.apply(cart, dataToUpdate); - this._addToCache(cartId, cart); - } - }, - - /** - * Remove a cart in the cache. - * This must be used to invalidate an entry in the cache. - * Typically it must be done when a cart have just been removed on the server. - * @param {String} cartId the cart id - */ - localRemove: function(cartId) - { - this._initCache(); - - delete this._cache[cartId]; - delete this._cacheExpirations[cartId]; - delete this._resolving[cartId]; - - }, - - /** - * Cache initialization - * @private - */ - _initCache: function() - { - if (this._cache == null) - { - this._cache = {}; - this._cacheExpirations = {}; - this._resolving = []; - } - }, - - /** - * Internal method to put an entry in the cache. - * @private - */ - _addToCache: function(cartId, cartData) - { - this._cache[cartId] = cartData; - this._cacheExpirations[cartId] = Ext.Date.add(new Date(), Ext.Date.MINUTE, 15); - - Ext.Array.remove(this._resolving, cartId); - }, - - /** - * Internal method to retrieve an entry in the cache. - * @private - */ - _getFromCache: function(cartId) - { - if (this._cacheExpirations[cartId] && new Date() <= this._cacheExpirations[cartId]) - { - return this._cache[cartId]; - } - else - { - this.localRemove(cartId); - return null; - } - } -}); Index: main/plugin-cart/resources/js/Ametys/plugins/cart/CartsDAO.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/CartsDAO.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/CartsDAO.js (working copy) @@ -167,16 +167,20 @@ * Update a cart in the cache. Nothing will be done if the entry is not present in the cache. * This must be done when some data of a cart are modified. * @param {String} cartId the cart id - * @param {Object} dataToUpdate The properties to update for this cart. + * @param {Object} [confToUpdate] The config properties to update for this cart. + * @param {Object} [propsToUpdate] The properties to update for this cart. */ - localUpdate: function(cartId, dataToUpdate) + localUpdate: function(cartId, confToUpdate, propsToUpdate) { this._initCache(); + confToUpdate = confToUpdate || {}; + propsToUpdate = propsToUpdate || {}; var cart = this._getFromCache(cartId); if (cart) { - Ext.apply(cart, dataToUpdate); + cart.setConfig(confToUpdate); + Ext.apply(cart, propsToUpdate); this._addToCache(cartId, cart); } }, Index: main/plugin-cart/resources/js/Ametys/plugins/cart/actions/CartRightsActions.i18n.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/actions/CartRightsActions.i18n.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/actions/CartRightsActions.i18n.js (working copy) @@ -1,297 +0,0 @@ -/* - * Copyright 2013 Anyware Services - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Actions related to cart visibility. - * @private - */ -Ext.define('Ametys.plugins.cart.actions.CartRightsActions', { - singleton: true, - - /** - * Change the visibility of a cart. - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - changeVisibility: function(controller) - { - var cartTarget = controller.getMatchingTargets()[0]; - var cartId = cartTarget.getParameters().id; - var visibility = controller.getInitialConfig('visibility'); - - if (cartTarget && visibility && visibility != cartTarget.getParameters().visibility) - { - var params = { - cartId: cartId, - visibility: visibility - }; - - Ametys.data.ServerComm.send({ - plugin: 'cart', - url: 'visibility/change-visibility', - parameters: params, - priority: Ametys.data.ServerComm.PRIORITY_MAJOR, - waitMessage: true, - errorMessage: true, - callback: { - handler: this._changeVisibilityCb, - scope: this, - arguments: params - } - }); - } - }, - - /** - * Callback function for the #changeVisibility method. - * @param {Object} response The response object. - * @param {Object} args The request callback arguments (see {@link #changeVisibility}) - * @private - */ - _changeVisibilityCb: function(response, args) - { - var msg = Ext.dom.Query.selectValue('ActionResult/message', response); - - if (msg == 'not-allowed') - { - Ametys.Msg.show({ - title: "", - msg: "", - buttons: Ext.Msg.OK, - icon: Ext.Msg.ERROR - }); - } - else - { - Ametys.plugins.cart.CartsDAO.localUpdate(args.cartId, { - visibility: args.visibility - }); - - Ext.create('Ametys.message.Message', { - type: Ametys.message.Message.MODIFIED, - targets: { - type: 'cart', - parameters: { - id: args.cartId - } - } - }); - } - }, - - // --------------- Add users ----------------------// - - /** - * Add users to a cart profile. - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - addUsers: function(controller) - { - var targets = controller.getMatchingTargets(); - if (targets && targets.length > 0) - { - Ametys.runtime.uihelper.SelectUser.act({ - callback: Ext.bind(this._add, this, ['users', targets[0]], 1) - }); - } - }, - - // --------------- Add groups ----------------------// - - /** - * Add groups to a cart profile. - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - addGroups: function(controller) - { - var targets = controller.getMatchingTargets(); - if (targets && targets.length > 0) - { - Ametys.runtime.uihelper.SelectGroup.act({ - callback: Ext.bind(this._add, this, ['groups', targets[0]], 1) - }); - } - }, - - /** - * Add the select users to a cart visibility profile. - * @param {Object[]} entries The group or user entries (depending on the type parameter). - * @param {String} type The type of the entries to add: 'users' or 'groups' - * @param {Ametys.message.MessageTarget} profileTarget The cart profile target retrieved from the controller - * @private - */ - _add: function (entries, type, profileTarget) - { - var url = type == 'users' ? 'profile/add-users' : 'profile/add-groups'; - - var params = { - cartId: profileTarget.getParameters().cartId, - profileId: profileTarget.getParameters().id, - ids: Ext.Object.getKeys(entries) - } - - Ametys.data.ServerComm.send({ - plugin: 'cart', - url: url, - parameters: params, - priority: Ametys.data.ServerComm.PRIORITY_MAJOR, - waitMessage: true, - errorMessage: true, - callback: { - handler: this._addCb, - scope: this, - arguments: params - } - }); - }, - - /** - * Callback function called after the AJAX request made in #_addUsers has been processed. - * @param {Object} response The response object. - * @param {Object} args The request callback arguments (see {@link #_add}) - * @private - */ - _addCb: function(response, args) - { - var msg = Ext.dom.Query.selectValue('ActionResult/message', response); - if (msg == 'not-allowed') - { - Ametys.Msg.show({ - title: "", - msg: "", - buttons: Ext.Msg.OK, - icon: Ext.Msg.ERROR - }); - } - else - { - Ext.create('Ametys.message.Message', { - type: Ametys.message.Message.MODIFIED, - targets: [{ - type: 'cart-profile', - parameters: { - id: args.profileId, - cartId: args.cartId - } - }] - }); - } - }, - - // --------------- Remove ----------------------// - - /** - * Remove the assignment for the selected users/groups for the current cart profile. - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - removeAssignment: function(controller) - { - var targets = controller.getMatchingTargets(); - if (targets && targets.length > 0) - { - var userTargets = targets[0].getSubtargets('user', 1); - var groupTargets = targets[0].getSubtargets('group', 1); - - if (!Ext.isEmpty(userTargets) || !Ext.isEmpty(groupTargets)) - { - Ametys.Msg.confirm( - "", - "", - Ext.bind(this._doDelete, this, [targets[0], userTargets, groupTargets], 1), - this - ); - } - } - }, - - /** - * Callback function invoked after the 'delete' confirm box is closed - * @param {String} buttonId Id of the button that was clicked - * @param {Ametys.message.MessageTarget} profileTarget The visibility right profile target - * @param {Ametys.message.MessageTarget[]} userTargets The user targets - * @param {Ametys.message.MessageTarget[]} groupTargets The group targets - * @private - */ - _doDelete: function(buttonId, profileTarget, userTargets, groupTargets) - { - if (buttonId == 'yes') - { - var userIds = Ext.Array.map(userTargets, function(target) { - return target.getParameters().id; - }); - - var groupIds = Ext.Array.map(groupTargets, function(target) { - return target.getParameters().id; - }); - - var params = { - cartId: profileTarget.getParameters().cartId, - profileId: profileTarget.getParameters().id, - userIds: userIds, - groupIds: groupIds - } - - if (userIds.length > 0 || groupIds.length > 0) - { - Ametys.data.ServerComm.send({ - plugin: 'cart', - url: 'profile/delete-entries', - parameters: params, - priority: Ametys.data.ServerComm.PRIORITY_MAJOR, - waitMessage: true, - errorMessage: true, - callback: { - handler: this._doDeleteCb, - scope: this, - arguments: params - } - }); - } - } - }, - - /** - * Callback function called after deletion process on the server. - * @param {Object} response The response object. - * @param {Object} args The request callback arguments (see {@link #_doDelete}) - * @private - */ - _doDeleteCb: function(response, args) - { - var msg = Ext.dom.Query.selectValue('ActionResult/message', response); - if (msg == 'not-allowed') - { - Ametys.Msg.show({ - title: "", - msg: "", - buttons: Ext.Msg.OK, - icon: Ext.Msg.ERROR - }); - } - else - { - Ext.create('Ametys.message.Message', { - type: Ametys.message.Message.MODIFIED, - targets: [{ - type: 'cart-profile', - parameters: { - id: args.profileId, - cartId: args.cartId - } - }] - }); - } - } -}); Index: main/plugin-cart/resources/js/Ametys/plugins/cart/actions/CartRightsActions.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/actions/CartRightsActions.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/actions/CartRightsActions.js (working copy) @@ -102,7 +102,7 @@ var targets = controller.getMatchingTargets(); if (targets && targets.length > 0) { - Ametys.runtime.uihelper.SelectUser.act({ + Ametys.helper.SelectUser.act({ callback: Ext.bind(this._add, this, ['users', targets[0]], 1) }); } @@ -119,7 +119,7 @@ var targets = controller.getMatchingTargets(); if (targets && targets.length > 0) { - Ametys.runtime.uihelper.SelectGroup.act({ + Ametys.helper.SelectGroup.act({ callback: Ext.bind(this._add, this, ['groups', targets[0]], 1) }); } Index: main/plugin-cart/resources/js/Ametys/plugins/cart/actions/CartsActions.i18n.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/actions/CartsActions.i18n.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/actions/CartsActions.i18n.js (working copy) @@ -1,530 +0,0 @@ -/* - * Copyright 2013 Anyware Services - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * CRUD actions on carts - * @private - */ -Ext.define('Ametys.plugins.cart.actions.CartsActions', { - singleton: true, - - /** - * This action creates a new cart - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - newCart: function(controller) - { - Ametys.plugins.cart.helper.CreateOrEditCart.act('new', {}, function (cartId) {Ametys.tool.ToolsManager.openTool('uitool-cart', {id: cartId})}); - }, - - /** - * This action edits the selected cart - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - editCart: function(controller) - { - var targets = controller.getMatchingTargets(); - - if (targets.length > 0) - { - Ametys.plugins.cart.helper.CreateOrEditCart.act("edit", targets[0].getParameters()); - } - }, - - /** - * Delete the selected carts - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - deleteCart: function(controller) - { - var targets = controller.getMatchingTargets(); - - if (targets.length > 0) - { - Ametys.Msg.confirm("", - "", - function(btn) { - if(btn == 'yes') - { - this._doDelete(targets); - } - - }, - this); - } - - }, - - /** - * Callback function invoked after the #deleteCart confirm box is validated - * @param {Ametys.message.MessageTarget[]} targets The carts targets - * @private - */ - _doDelete: function (targets) - { - var ids = []; - - for (var i=0; i < targets.length; i++) - { - ids.push(targets[i].getParameters().id); - } - - Ametys.data.ServerComm.send({ - plugin: "cart", - url: "cart/delete", - parameters: { id: ids }, - priority: Ametys.data.ServerComm.PRIORITY_MAJOR, - waitMessage: true, - errorMessage: "", - responseType: 'text', - callback: { - handler: this._deleteCb, - scope: this - } - }); - }, - - /** - * Callback function called after deletion is process. - * @param response The JSON result - * @private - */ - _deleteCb: function (response) - { - if (!Ametys.data.ServerComm.isBadResponse(response)) - { - var result = Ext.JSON.decode(Ext.dom.Query.selectValue('', response)); - - Ext.create("Ametys.message.Message", { - type: Ametys.message.Message.DELETED, - targets: { - type: "cart", - parameters: {ids: result.deletedCarts} - } - }); - - var notallowedCarts = result.notallowedCarts; - if (notallowedCarts.length > 0) - { - Ametys.Msg.show({ - title: "", - msg: "" + notallowedCarts.join(','), - buttons: Ext.Msg.OK, - icon: Ext.Msg.ERROR - }); - } - - // Remove cart from navigation history - Ametys.cms.navhistory.HistoryDAO.removeEntries (result.deletedCarts); - } - }, - - /** - * Export selected cart to CSV format - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - exportCsv: function(controller) - { - var targets = controller.getMatchingTargets(); - if (targets && targets.length > 0) - { - var args = 'cartId=' + encodeURIComponent(targets[0].getParameters().id); - window.location.href = Ametys.getPluginDirectPrefix('cart') + '/cart/export.csv?' + args; - } - }, - - /** - * Export selected cart to XML format - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - exportXml: function(controller) - { - var targets = controller.getMatchingTargets(); - if (targets && targets.length > 0) - { - var args = 'cartId=' + encodeURIComponent(targets[0].getParameters().id); - window.location.href = Ametys.getPluginDirectPrefix('cart') + '/cart/export.xml?' + args; - } - }, - - /** - * Print the selected cart (mode list) - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - printList: function(controller) - { - var targets = controller.getMatchingTargets(); - if (targets && targets.length > 0) - { - Ametys.openWindow (Ametys.getPluginDirectPrefix('cart') + '/cart/print', {cartId: targets[0].getParameters().id}, 'GET'); - } - }, - - /** - * Print the selected cart (mode details) - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - printDetails: function(controller) - { - var targets = controller.getMatchingTargets(); - if (targets && targets.length > 0) - { - Ametys.openWindow (Ametys.getPluginDirectPrefix('cart') + '/cart/print/details', {cartId: targets[0].getParameters().id}, 'GET'); - } - }, - - /** - * Add contents to an existing cart - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - addContents: function (controller) - { - var targets = controller.getMatchingTargets(); - - var contentIds = []; - for (var i = 0; i < targets.length; i++) - { - contentIds.push(targets[i].getParameters().id); - } - - Ametys.plugins.cart.helper.ChooseCart.act({ - icon: Ametys.getPluginResourcesPrefix('cart') + '/img/actions/add-items_16.png', - title: "", - helpMessage: "", - callback: Ext.bind (this.addElementsToCart, this, ['content', {ids: contentIds}], true) - }); - }, - - /** - * Add contents to a new cart - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - addContentsToNewCart: function(controller) - { - var targets = controller.getMatchingTargets(); - - var contentIds = []; - for (var i = 0; i < targets.length; i++) - { - contentIds.push(targets[i].getParameters().id); - } - - Ametys.plugins.cart.helper.CreateOrEditCart.act('new', {}, Ext.bind (this.addElementsToCart, this, ['content', {ids: contentIds}], true)); - }, - - /** - * Add resources to an existing cart - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - addResources: function (controller) - { - var targets = controller.getMatchingTargets(); - - var resourcesId = []; - for (var i = 0; i < targets.length; i++) - { - resourcesId.push(targets[i].getParameters().id); - } - - Ametys.plugins.cart.helper.ChooseCart.act({ - icon: Ametys.getPluginResourcesPrefix('cart') + '/img/actions/add-items_16.png', - title: "", - helpMessage: "", - callback: Ext.bind (this.addElementsToCart, this, ['resource', {ids: resourcesId}], true) - }); - }, - - /** - * Add resources to an existing cart - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - addResourcesToNewCart: function (controller) - { - var targets = controller.getMatchingTargets(); - - var resourcesId = []; - for (var i = 0; i < targets.length; i++) - { - resourcesId.push(targets[i].getParameters().id); - } - - Ametys.plugins.cart.helper.CreateOrEditCart.act('new', {}, Ext.bind (this.addElementsToCart, this, ['resource', {ids: resourcesId}], true)); - }, - - /** - * Add query to an existing cart - * @param {Ext.button.Button} button The button calling this function - */ - addQuery: function (button) - { - var toolId = button.toolId || button.parentMenu.ownerButton.toolId; - var tool = Ametys.tool.ToolsManager.getTool(toolId); - if (tool.getCurrentSearchParameters) - { - Ametys.plugins.cart.helper.ChooseCart.act({ - icon: Ametys.getPluginResourcesPrefix('cart') + '/img/actions/add-items_16.png', - title: "", - helpMessage: "", - callback: Ext.bind (this._chooseCartCb, this, [tool], true) - }); - } - }, - - /** - * Add query to an existing cart - * @param {Ext.button.Button} button The button calling this function - */ - addQueryToNewCart: function (button) - { - var toolId = button.toolId || button.parentMenu.ownerButton.toolId; - var tool = Ametys.tool.ToolsManager.getTool(toolId); - if (tool.getCurrentSearchParameters) - { - Ametys.plugins.cart.helper.CreateOrEditCart.act('new', {}, Ext.bind (this._chooseCartCb, this, [tool], true)); - } - }, - - /** - * Callback function called after choosing a cart - * @param {String} cartId The cart id - * @param {Object} tool The search tool - * @private - */ - _chooseCartCb: function (cartId, tool) - { - Ametys.Msg.prompt ("", "", Ext.bind(this._enterTitleCb, this, [cartId, tool], true)); - }, - - /** - * Callback function called after entering title - * @param {String} buttonId The id of the button pressed - * @param {String} text The text - * @param {Object} opts The config object passed to prompt dialog. - * @param {String} cartId The cart id - * @param {Object} tool The search tool - * @private - */ - _enterTitleCb: function (buttonId, text, opts, cartId, tool) - { - if (buttonId == 'ok') - { - var toolRole = tool.getFactory().getRole(); - - var query = Ext.JSON.encode({ - toolRole: tool.getFactory().getRole(), - toolParams: tool.getCurrentSearchParameters(), - exportParams: tool.getSearchParametersForExport(), - printUrlPlugin: tool._printUrlPlugin, - printUrl: tool._printUrl - }); - - this.addElementsToCart(cartId, 'cartQuery', { - title: text, - description: query - }); - } - }, - - /** - * Add elements to the cart - * @param cartId The cart id - * @param type The type of elements to add - * @param elmtParams The parameters of elements to add - * @param {Function} callback A extra optional callback function - * @param {Boolean} callback.success True if the modification was a success - */ - addElementsToCart: function (cartId, type, elmtParams, callback) - { - var params = Ext.merge (elmtParams, { - type: type, - cartId: cartId - }); - - Ametys.data.ServerComm.send({ - plugin: "cart", - url: "cart/add-elements", - parameters: params, - - priority: Ametys.data.ServerComm.PRIORITY_MAJOR, - waitMessage: true, - errorMessage: true, - callback: { - handler: this._addElementsToCartCb, - scope: this, - arguments: {cartId: cartId, type: type, elements: elmtParams, callback: callback} - } - }); - }, - - /** - * Function called after adding elements to a cart. - * @private - */ - _addElementsToCartCb: function (response, params) - { - var msg = Ext.dom.Query.selectValue("> ActionResult > msg", response, ''); - var callback = params['callback']; - - if (msg == 'not-allowed') - { - Ametys.Msg.show({ - title: "", - msg: "", - buttons: Ext.Msg.OK, - icon: Ext.Msg.ERROR - }); - if (typeof(callback) == 'function') - { - callback(false); - } - return; - } - - var id = Ext.dom.Query.selectValue("> ActionResult > id", response); - - Ext.create("Ametys.message.Message", { - type: Ametys.message.Message.MODIFIED, - targets: { - type: "cart", - parameters: { - id: id - } - } - }); - - // Open cart - Ametys.tool.ToolsManager.openTool('uitool-cart', {id: id}); - - if (typeof(callback) == 'function') - { - callback(true); - } - }, - - /** - * Remove elements from the cart - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - removeCartElements: function (controller) - { - var targets = controller.getMatchingTargets(); - - if (targets && targets.length > 0) - { - var cartId = targets[0].getParameters().id; - var stargets = targets[0].getSubtargets(/^(content|resource|cartQuery)$/); - - if (stargets.length > 0) - { - var elmts = []; - - for (var i=0; i < stargets.length; i++) - { - elmts.push({ - id: stargets[i].getParameters().id, - type: stargets[i].getType() - }) - } - - if (elmts.length > 0) - { - Ametys.Msg.confirm("", - "", - function(btn) { - if(btn == 'yes') - { - this._doRemoveElements(cartId, elmts); - } - }, - this); - } - } - } - }, - - /** - * Removes elements from cart - * @param {String} cartId The id of the cart - * @param {Object} cartElements The elements to remove - * @private - */ - _doRemoveElements: function (cartId, cartElements) - { - Ametys.data.ServerComm.send({ - plugin: "cart", - url: "cart/remove-elements", - - parameters: { - cartId: cartId, - cartElements: cartElements - }, - priority: Ametys.data.ServerComm.PRIORITY_MAJOR, - errorMessage: "", - - callback: { - handler: this._removeElementsCb, - scope: this, - arguments: { - cartId: cartId, - cartElements: cartElements - } - } - }); - }, - - /** - * Callback function called after deletion is process - * @param {Object} response The server response - * @param {Object} params The callback arguments - * @private - */ - _removeElementsCb: function (response, params) - { - var msg = Ext.dom.Query.selectValue('ActionResult > msg', response); - if (msg == 'not-allowed') - { - Ametys.Msg.show({ - title: "", - msg: "", - buttons: Ext.Msg.OK, - icon: Ext.Msg.ERROR - }); - } - else - { - var elmts = params.cartElements; - - var targets = []; - for (var i=0; i < elmts.length; i++) - { - targets.push({ - type: 'cartElement', - parameters: { - id: elmts[i].id, - cartElementType: elmts[i].type, - cartId: params.cartId - } - }); - } - - Ext.create("Ametys.message.Message", { - type: Ametys.message.Message.DELETED, - targets: targets - }); - } - } -}); - Index: main/plugin-cart/resources/js/Ametys/plugins/cart/actions/CartsActions.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/actions/CartsActions.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/actions/CartsActions.js (working copy) @@ -128,7 +128,7 @@ } // Remove cart from navigation history - Ametys.cms.navhistory.HistoryDAO.removeEntries (result.deletedCarts); + Ametys.navhistory.HistoryDAO.removeEntries (result.deletedCarts); } }, @@ -270,7 +270,7 @@ */ addQuery: function (button) { - var toolId = button.toolId || button.parentMenu.ownerButton.toolId; + var toolId = button.toolId || button.parentMenu.up('button').toolId; var tool = Ametys.tool.ToolsManager.getTool(toolId); if (tool.getCurrentSearchParameters) { @@ -289,7 +289,7 @@ */ addQueryToNewCart: function (button) { - var toolId = button.toolId || button.parentMenu.ownerButton.toolId; + var toolId = button.toolId || button.parentMenu.up('button').toolId; var tool = Ametys.tool.ToolsManager.getTool(toolId); if (tool.getCurrentSearchParameters) { Index: main/plugin-cart/resources/js/Ametys/plugins/cart/helper/ChooseCart.i18n.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/helper/ChooseCart.i18n.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/helper/ChooseCart.i18n.js (working copy) @@ -1,262 +0,0 @@ -/* - * Copyright 2012 Anyware Services - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * This helper allows to choose one cart in WRITE access from a combo list - * @private - */ -Ext.define('Ametys.plugins.cart.helper.ChooseCart', { - singleton: true, - - /** - * @property {String} The id of the last selected cart. - * @private - */ - _lastSelectedCartId: null, - - /** - * @property {Boolean} _initialized True if the dialog box was already initialized - * @private - */ - _initialized: false, - - /** - * @property _cbFn The callback function to call after choosing a cart - */ - - constructor: function() - { - this.callParent(arguments); - Ametys.message.MessageBus.on(Ametys.message.Message.SELECTION_CHANGED, this._onSelectionChanged, this); - }, - - /** - * Open the dialog box to choose a cart in WRITE access - * @param {Object} config The configuration options: - * @param {String} [config.title] The dialog box title - * @param {String} [config.helpMessage] The dialog box help message - * @param {String} [config.callback] The callback function to be called after cart selection - */ - act: function(config) - { - this._cbFn = config.callback; - - if (!this._delayedInitialize(config.title, config.icon, config.helpMessage)) - { - return false; - } - this._box.show(); - this._initForm(); - }, - - /** - * @private - * Initialize the dialog box. - * @param {String} title The dialog box title - * @param {String} icon The dialog box icon path - * @param {String} helpMessage The help message text - */ - _delayedInitialize: function (title, icon, helpMessage) - { - if (!this._initialized) - { - this._store = this._createStore(); - - this._box = Ext.create('Ametys.window.DialogBox', { - - title: title || "", - icon: icon || Ametys.getPluginResourcesPrefix('cart') + "/img/cart_16.png", - - cls: 'ametys-dialogbox cart', - width: 430, - /*height: 170,*/ - layout: { - type: 'vbox', - align: 'stretch' - }, - - items : [{ - xtype: 'component', - cls: 'text', - html: helpMessage || "" - }, - { - xtype: 'combobox', - fieldLabel : "", - labelWidth: 60, - labelAlign: 'right', - labelSeparator: '', - name :'cart', - - typeAhead: true, - editable: true, - forceSelection: true, - triggerAction: 'all', - - store: this._store, - displayField: 'title', - valueField: 'id', - width: 390, - allowBlank: false, - - cls: 'ametys', - listConfig: { - cls: 'ametys-boundlist' - } - }, - { - xtype: 'component', - cls: 'no-cart', - hidden: true, - html: "" - }, - { - xtype: 'component', - cls: 'link', - html: "" - }, - ], - - closeAction: 'hide', - buttons : [ { - text :"", - handler : Ext.bind(this._ok, this) - }, { - text :"", - handler: function () {this._box.hide()}, - scope: this - } - ] - }); - - this._initialized = true; - } - else - { - this._box.setIcon(icon || Ametys.getPluginResourcesPrefix('cart') + "/img/cart_16.png"); - this._box.setTitle(title || ""); - this._box.items.getAt(0).update(helpMessage || ""); - } - return true; - }, - - /** - * Function to create a new cart - */ - _createCart: function () - { - this._box.hide(); - Ametys.plugins.cart.helper.CreateOrEditCart.act('new', {}, this._cbFn); - }, - - /** - * Creates the cart store - * @return {Ext.data.Store} The cart store - * @private - */ - _createStore: function() - { - return Ext.create('Ext.data.Store', { - model: 'Ametys.plugins.cart.tool.CartsTool.CartEntry', - sortOnLoad: true, - sorters: [{property: 'title', direction:'ASC'}], - - proxy: { - type: 'ametys', - plugin: 'cart', - url: 'carts/list.xml', - extraParams: {profile: 'write_access'}, - reader: { - type: 'xml', - root: 'carts', - record: '> cart' - } - }, - autoLoad: true - }); - }, - - /** - * @private - * Initialize fields - */ - _initForm: function () - { - if (!this._clickEventRegistered) - { - var action = this._box.items.getAt(3); - action.mon(action.getEl(), 'click', this._createCart, this, {delegate: 'a.action'}); - this._clickEventRegistered = true; - } - - this._store.load({callback: this._onLoadCarts, scope: this}); - - }, - - /** - * Callback function called after carts are loaded - * @private - */ - _onLoadCarts: function (records, operation, success) - { - if (records.length == 0) - { - this._box.items.getAt(2).setVisible(true); - } - else - { - this._box.items.getAt(2).setVisible(false); - this._box.down('combo').setValue(this._lastSelectedCartId); - } - - }, - - /** - * The ok button handler. Will call the callback when cart is chosen. - * @private - */ - _ok: function() - { - if (!this._box.down('combo').isValid()) - { - return; - } - - this._box.hide(); - - if (Ext.isFunction(this._cbFn)) - { - this._cbFn (this._box.down('combo').getValue()); - } - }, - - /** - * Listener when the selection has changed. - * Update the last selected cart id. - * @param {Ametys.message.Message} message The selection message. - * @private - */ - _onSelectionChanged: function (message) - { - var target = message.getTarget('cart'); - if (target != null) - { - this._lastSelectedCartId = target.getParameters().id; - } - } - -}); - Index: main/plugin-cart/resources/js/Ametys/plugins/cart/helper/ChooseCart.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/helper/ChooseCart.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/helper/ChooseCart.js (working copy) @@ -127,7 +127,7 @@ xtype: 'component', cls: 'link', html: "" - }, + } ], closeAction: 'hide', @@ -181,7 +181,7 @@ extraParams: {profile: 'write_access'}, reader: { type: 'xml', - root: 'carts', + rootProperty: 'carts', record: '> cart' } }, Index: main/plugin-cart/resources/js/Ametys/plugins/cart/helper/CreateOrEditCart.i18n.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/helper/CreateOrEditCart.i18n.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/helper/CreateOrEditCart.i18n.js (working copy) @@ -1,251 +0,0 @@ -/* - * Copyright 2012 Anyware Services - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Dialog box used to create or edit a cart. - * @private - */ -Ext.define('Ametys.plugins.cart.helper.CreateOrEditCart', { - singleton: true, - - /** - * @property {Function} _cbFn The callback function to callback after creation - * @private - */ - - /** - * @property {Object} _params The parameters - * @private - */ - - /** - * @property {Boolean} _initialized True if the dialog box was already initialized - * @private - */ - _initialized: false, - - /** - * Do the job (open the dialog box and so on) - * @param {String} mode The mode: "new" to create a new cart, "edit" to edit a cart - * @param {Object} params The cart parameters. Can be null for creation. - * @param {String} params.id The id of cart to edit. Can not be null if mode is 'edit'. - * @param {String} params.title The cart title - * @param {String} params.description The cart description - * @param {Function} callback The callback on successful creation/modification of the cart. The arguments are: - * @param {Function} callback.id The cart of the created or modified cart - */ - act: function (mode, params, callback) - { - this._mode = mode; - this._cbFn = callback; - this._params = params || {}; - - if (!this._delayedInitialize()) - { - return false; - } - - this._box.setTitle(mode == 'edit' ? "" : ""); - this._box.setIcon(mode == 'edit' ? Ametys.getPluginResourcesPrefix('cart') + "/img/actions/edit_16.png" : Ametys.getPluginResourcesPrefix('cart') + "/img/actions/add_16.png"); - - this._box.show(); - this._initForm(params); - }, - - /** - * @private - * Initialize the dialog box. - */ - _delayedInitialize: function () - { - if (this._initialized) - { - return true; - } - - this._form = new Ext.FormPanel({ - border :false, - bodyStyle :'padding:10px 10px 0', - - defaults: { - cls: 'ametys', - labelWidth: 100, - labelAlign: 'right', - labelSeparator: '', - msgTarget: 'side' - }, - - items:[{ - xtype: 'textfield', - fieldLabel :"", - name: 'title', - width: 380, - allowBlank: false - }, - { - xtype: 'textarea', - fieldLabel :"", - name :'description', - width: 380, - height: 50 - } - ] - }); - - this._box = Ext.create('Ametys.window.DialogBox', { - - title :"", - icon : Ametys.getPluginResourcesPrefix('cart') + "/img/actions/add_16.png", - - layout :'fit', - width: 430, - height: 190, - - items : [ this._form ], - - closeAction: 'hide', - buttons : [ { - text :"", - handler : Ext.bind(this._ok, this) - }, { - text :"", - handler : Ext.bind(this._cancel, this) - } - ] - }); - - this._initialized = true; - return true; - }, - - /** - * @private - * Initialize the box form - * @param {Object} params The cart parameters - */ - _initForm: function (params) - { - var form = this._form.getForm(); - - form.findField('title').setValue(params.title || ''); - form.findField('description').setValue(params.description || ''); - - form.findField('title').clearInvalid(); - form.findField('description').clearInvalid(); - }, - - /** - * The cancel button handler - * @private - */ - _cancel: function() - { - this._box.close(); - }, - - /** - * Callback on the ok button. - * @private - */ - _ok: function() - { - var form = this._form.getForm(); - if (!form.isValid()) - { - return; - } - - var params = { - title: form.findField('title').getValue(), - description: form.findField('description').getValue(), - id: this._params.id || null - } - - - var url = this._mode == 'edit' ? 'cart/update' : 'cart/create'; - - var result = Ametys.data.ServerComm.send({ - plugin: 'cart', - url: url, - parameters: params, - priority: Ametys.data.ServerComm.PRIORITY_MAJOR, - waitMessage: true, - errorMessage: true, - callback: { - handler: this._onCreatedOrUpdated, - scope: this, - arguments: params - } - }); - }, - - /** - * Sends the corresponding message on the bus on successful cart creation/modification - * @param {Object} response The server response - * @param {Object} params The callback arguments - * @private - */ - _onCreatedOrUpdated: function(response, params) - { - var errorMsg = this._mode == 'edit' ? "" : ""; - if (Ametys.data.ServerComm.handleBadResponse(errorMsg, response, 'Ametys.plugins.cart.helper.CreateOrEditCart')) - { - return; - } - - this._box.close(); - - var msg = Ext.dom.Query.selectValue('ActionResult > message', response); - if (msg == 'not-allowed') - { - Ametys.Msg.show({ - title: "", - msg: "", - buttons: Ext.Msg.OK, - icon: Ext.Msg.ERROR - }); - } - else - { - var messageType = this._mode == 'edit' ? Ametys.message.Message.MODIFIED : Ametys.message.Message.CREATED; - var cartId = Ext.dom.Query.selectValue('ActionResult > id', response); - - if (messageType == Ametys.message.Message.MODIFIED) - { - Ametys.plugins.cart.CartsDAO.localUpdate(cartId, { - title: params.title, - description: params.description - }); - } - - Ext.create("Ametys.message.Message", { - type: messageType, - targets: { - type: 'cart', - parameters: { - id: cartId - } - } - }); - } - - if (Ext.isFunction(this._cbFn)) - { - this._cbFn(cartId); - } - } -}); - Index: main/plugin-cart/resources/js/Ametys/plugins/cart/relations/AddToCartRelationHandler.i18n.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/relations/AddToCartRelationHandler.i18n.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/relations/AddToCartRelationHandler.i18n.js (working copy) @@ -1,164 +0,0 @@ -/* - * Copyright 2014 Anyware Services - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -if (!Ametys.getObjectByName('Ametys.plugins.cart.relations.AddToCartRelationHandler')) -{ // If statement is important to protect against undesired double define - - /** - * This is a relation handler between: - * * source : content or ressource - * * destination : cart - * - * It will add the contents and resources to the cart - * @private - */ - Ext.define('Ametys.plugins.cart.relations.AddToCartRelationHandler', { - extend: 'Ametys.relation.RelationHandler', - - statics: { - /** - * Add an allowed target type. - * @param {String} type The target type to allow - */ - addAllowedTargetType: function(type) - { - if (!Ext.Array.contains(this._allowedTargetTypes, type)) - { - this._allowedTargetTypes.push(type); - } - }, - - /** - * @protected - * @property {String[]} allowedTargetTypes The array of allowed target types. - * @static - */ - _allowedTargetTypes: [] - }, - - /** - * @private - * True if the target is matching one of the allowed type. - * @param {Object/Ametys.message.MessageTarget} target The target to test - * @return {Boolean} True if the target is matching one of the #allowedTargetTypes - */ - _matching: function(target) - { - return Ext.Array.findBy(this.statics()._allowedTargetTypes, function(type) { - return target.type === type; - }) != null; - }, - - /** - * @private - * True if the target is not matching one of the allowed type. - * @param {Object/Ametys.message.MessageTarget} target The target to test - * @return {Boolean} True if the target type does not match #targetType - */ - _nonMatching: function(target) - { - return !this._matching(target); - }, - - supportedRelations: function(source, target) - { - // Are source contents/resources and only contents/resources ? - var sourceTargets = Ametys.message.MessageTargetHelper.findTargets(source.targets, Ext.bind(this._matching, this), 1); - if (sourceTargets.length == 0 || Ametys.message.MessageTargetHelper.findTargets(source.targets, Ext.bind(this._nonMatching, this)).length > 0) - { - return []; - } - - // Are target a single content ? - var destTargets = Ametys.message.MessageTargetHelper.findTargets(target.targets, "cart", 1); - if (destTargets.length != 1 || Ametys.message.MessageTargetHelper.findTargets(target.targets, /.*/).length != 1) - { - return []; - } - - return [ - Ext.create('Ametys.relation.Relation', { - type: Ametys.relation.Relation.REFERENCE, - label: "", - description: "", - smallIcon: null, - mediumIcon: null, - largeIcon: null - }) - ]; - }, - - link: function(source, target, callback, relationType) - { - var cartId = target.getTarget().getParameters()['id']; - - var contentIds = []; - var contentTitles = []; - var resourceIds = []; - var resourceNames = []; - - var sourceTargets = Ametys.message.MessageTargetHelper.findTargets(source.targets, Ext.bind(this._matching, this), 1); - for (var i = 0; i < sourceTargets.length; i++) - { - var sourceTarget = sourceTargets[i]; - - switch (sourceTarget.getType()) - { - case 'content': - contentIds.push(sourceTarget.getParameters()['id']); - contentTitles.push(sourceTarget.getParameters()['title']); - break; - case 'resource': - resourceIds.push(sourceTarget.getParameters()['id']); - resourceNames.push(sourceTarget.getParameters()['name']); - break; - default: - } - } - - if (contentIds.length > 0 || resourceIds.length > 0) - { - Ametys.Msg.confirm("", - "" + contentTitles.concat(resourceNames).join(", ") + "", - Ext.bind(this._confirmLinkCb, this, [cartId, contentIds, resourceIds, callback], 1)); - } - }, - - /** - * @private - * Callback function invoked after the confirm box is closed - * @param {String} buttonId The id of the button pressed. If 'yes' the drag and drop will be effective. - * @param {String} cartId The id of cart - * @param {String[]} contentIds The ids of contents to add - * @param {String[]} resourceIds The ids of resources to add - * @param {Function} callback The callback function to call after adding - */ - _confirmLinkCb: function (buttonId, cartId, contentIds, resourceIds, callback) - { - if (buttonId == 'yes') - { - if (contentIds.length > 0) - { - Ametys.plugins.cart.actions.CartsActions.addElementsToCart(cartId, 'content', {ids: contentIds}, callback); - } - if (resourceIds.length > 0) - { - Ametys.plugins.cart.actions.CartsActions.addElementsToCart(cartId, 'resource', {ids: resourceIds}, callback); - } - } - } - }); -} Index: main/plugin-cart/resources/js/Ametys/plugins/cart/relations/AddToCartRelationHandler.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/relations/AddToCartRelationHandler.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/relations/AddToCartRelationHandler.js (working copy) @@ -58,7 +58,8 @@ _matching: function(target) { return Ext.Array.findBy(this.statics()._allowedTargetTypes, function(type) { - return target.type === type; + var targetType = target.isMessageTarget ? target.getType() : target.type; + return targetType === type; }) != null; }, Index: main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartRightsTool.i18n.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartRightsTool.i18n.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartRightsTool.i18n.js (working copy) @@ -1,471 +0,0 @@ -/* - - * Copyright 2013 Anyware Services - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Unique tool allowing an user to handle the visibility of a cart. - * A contributor can add or remove users and groups in the read-only or read-write profiles. - * @private - */ -Ext.define('Ametys.plugins.cart.tool.CartRightsTool', { - extend: "Ametys.tool.SelectionTool", - - /** - * @property {String} _cartId id of the current cart - * @private - */ - /** - * @property {String} _cartVisibility visibility level of the current cart - * @private - */ - /** - * @property {String} _cartLabel title of the current cart - * @private - */ - /** - * @property {String} _cartAuthor owner login of the current cart - * @private - */ - /** - * @property {Ext.tree.Panel} _tree The tree panel used to display the profiles/users/groups. - * @private - */ - /** - * @property {Ext.panel.Panel} _mainPanel The main panel - * @private - */ - - constructor: function(config) - { - this.callParent(arguments); - - Ametys.message.MessageBus.on(Ametys.message.Message.MODIFIED, this._onMessageModified, this); - Ametys.message.MessageBus.on(Ametys.message.Message.DELETED, this._onMessageDeleted, this); - Ametys.message.MessageBus.on(Ametys.message.Message.SELECTION_CHANGED, this._onSelectionChanged, this); - }, - - createPanel: function() - { - var store = this._createStore(); - - this._tree = Ext.create('Ext.tree.Panel', { - border: false, - region: 'center', - autoScroll: true, - animate: true, - cls: 'cart-rights-tree', - - store: store, - root: { - text: 'root', - expanded: true, - loaded: true - }, - rootVisible: false, - - selModel: { - mode: 'MULTI' - }, - - listeners: { - selectionchange: {fn: this.sendCurrentSelection, scope: this} - } - }); - - this._mainPanel = Ext.create('Ext.panel.Panel', { - border: false, - - items: [{ - xtype: 'component', - cls: 'cart-rights-no-selection', - html: '', - hidden: true - }, - { - xtype: 'component', - itemId: 'hint-panel', - cls: 'cart-rights-hint', - html: '' - }, - this._tree - ] - }); - - return this._mainPanel; - }, - - /** - * Store creation - * @return {Ext.data.TreeStore} the created store - * @private - */ - _createStore: function() - { - return Ext.create('Ext.data.TreeStore', { - model: 'Ametys.plugins.cart.CartRightsTool.CartRightsEntry', - autoLoad: false, - - proxy: { - type: 'ametys', - plugin: 'cart', - url: 'visibility/get-info.json', - reader: { - type: 'json', - metaProperty: 'info' - } - }, - - // groups have priority over users, then sort on text. - sorters: [{property: 'type'}, {property: 'text'}], - listeners: { - beforeload: {fn: this._onBeforeLoad, scope: this} - } - }); - }, - - /** - * Selected nodes getter - * @return {Ext.data.Model[]} Array of selected records. - */ - _getSelectedNodes: function() - { - return this._tree.getSelectionModel().getSelection(); - }, - - sendCurrentSelection: function() - { - if (this.isOutOfDate()) - { - // Do not change selection if out of date. - return; - } - - // Create the message and target cfg objects for the current selection. - // There may be up to two levels of targets. - // Main targets are the selected profile (read_access / write_access) : target type -> 'cart-profile' - // Subtargets are the selected groups and users : target type -> 'user' / 'group' - - var msgTargets = []; - - if (this._cartId) - { - var selected = this._getSelectedNodes(); - if (selected && selected.length > 0) - { - // Sort array to get priority to nodes of type profile. - Ext.Array.sort(selected, function(nodeA, nodeB) { - return nodeA.get('type') == 'profile' ? -1 : 1; - }); - - // Create subtargets for profile, and subsubtargets for users/groups. - var profileSubtargetsRef = {}, profileTarget, profileSubtarget, id, type, parentId; - - var me = this; - Ext.Array.forEach(selected, function(node) { - id = node.get('storageId'); - type = node.get('type'); - - // The node can be of type profile or user/group. - // User or group are children of profile. - if (type == 'profile') - { - profileTarget = { - type: 'cart-profile', - parameters: { - id: id, - cartId: me._cartId - } - } - - msgTargets.push(profileTarget); - profileSubtargetsRef[id] = profileTarget.subtargets = []; - } - else if (type == 'user' || type == 'group') - { - parentId = node.parentNode.get('storageId'); - profileSubtarget = profileSubtargetsRef[parentId]; - - if (!profileSubtarget) - { - profileTarget = { - type: 'cart-profile', - parameters: { - id: parentId, - cartId: me._cartId - } - } - - msgTargets.push(profileTarget); - profileSubtarget = profileSubtargetsRef[parentId] = profileTarget.subtargets = []; - } - - profileSubtarget.push({ - type: type, - parameters: { - id: id - } - }); - } - }); - } - } - - Ext.create('Ametys.message.Message', { - type: Ametys.message.Message.SELECTION_CHANGED, - targets: msgTargets - }); - }, - - refresh: function() - { - // FIXME tool API -> isRefreshing - // if isRefreshing() return; - - var target = Ametys.message.MessageBus.getCurrentSelectionMessage().getTarget('cart'); - if (target != null) - { - if (target.getParameters().visibility != 'shared') - { - this.setNoSelectionMatchState(""); - } - else if (target.getParameters().authorLogin != Ametys.getAppParameter('user').login) - { - this.setNoSelectionMatchState(""); - } - else - { - this.showRefreshing(); - - this.setInMatchState (target); - this._reloadProfileTree(); - } - } - else - { - this.setNoSelectionMatchState(""); - } - - this.showUpToDate(); - }, - - /** - * Reload the all tree. - * Suspend 'selectionchange' before loading to avoid to send a empty selection message. - * @param {String} nodeId The id of node to select after refresh. Can be null. - * @private - */ - _reloadProfileTree: function (nodeId) - { - this._tree.suspendEvent('selectionchange'); - this._tree.getStore().load({ callback: Ext.bind(this._refreshCb, this, [nodeId], false) }); - }, - - /** - * Callback function called after #refresh is processed. Expands tree and selects the first node in the tree. - * @param {String} nodeId The id of node to select after refresh. Can be null. - * @private - */ - _refreshCb: function (nodeId) - { - this._tree.resumeEvent('selectionchange'); - - // Expand first nodes - this._tree.getRootNode().expandChildren(false, false, function () { - - // Select first node or the given node - var node = nodeId ? this._tree.getRootNode().findChild('storageId', nodeId) : this._tree.getRootNode().firstChild; - this._tree.getSelectionModel().select(node); - - }, this); - - - this.showRefreshed(); - }, - - /** - * This function is called when the selection is empty or do not no match the excepted target. - * @param {String} message The message to display - */ - setNoSelectionMatchState: function (message) - { - this._cartId = null; - - this._updateHintPanel(); - this._updateNoSelectionPanel ('' + message + ''); - this._tree.hide(); - }, - - /** - * This function is called when the selection matches the excepted target. - * @param {Ametys.message.MessageTarget} target The selection target - */ - setInMatchState: function (target) - { - this._cartId = target.getParameters().id; - this._cartVisibility = target.getParameters().visibility; - - var msg = "" + '' + target.getParameters().title + ''; - this._updateHintPanel(msg); - this._updateNoSelectionPanel (); - - this._tree.show(); - }, - - /** - * Updates the text of the hint panel given the current cart data. - * Hides panel if message is empty. - * @param {String} message The message. - * @private - */ - _updateHintPanel: function (message) - { - this._updatePanel(message, 1); - }, - - /** - * Updates the text of the no-selection panel. - * Hides panel if message is empty. - * @param {String} message The message. - * @private - */ - _updateNoSelectionPanel: function (message) - { - this._updatePanel(message, 0); - }, - - /** - * Updates the text of a panel - * Hides panel if message is empty. - * @param {String} message The message. - * @param {Number} index The index of the panel. - * @private - */ - _updatePanel: function (message, index) - { - message = message || ''; - var panel = this.getContentPanel().items.get(index); - panel.update(message); - message != '' ? panel.show() : panel.hide(); - }, - - /** - * Function before loading the store - * Set parameters to be passed to the request. - * @param {Ext.data.Store} store The store - * @param {Ext.data.Operation} operation The object that will be passed to the Proxy to load the store - * @private - */ - _onBeforeLoad: function (store, operation) - { - operation.params = operation.params || {}; - operation.params.cartId = this._cartId; - }, - - /** - * Selection change listener - * Update the state of the tool given the incoming message. - * @param {Ametys.message.Message} message The listened message - */ - _onSelectionChanged: function(message) - { - var target = message.getTarget('cart-profile'); - if (target != null) - { - // Do nothing - return; - } - - var target = message.getTarget('cart'); - if (target == null) - { - // No more target - this.setNoSelectionMatchState(""); - } - else if (this._cartId != target.getParameters().id) - { - // Major out-of-date - this.showOutOfDate(true); - } - }, - - /** - * Listener when a Ametys.message.Message#MODIFIED message was received - * @param {Ametys.message.Message} message The modified message - * @private - */ - _onMessageModified: function (message) - { - var target = message.getTarget('cart-profile'); - if (target != null) - { - var cartId = target.getParameters().cartId; - var profileId = target.getParameters().id; - - if (cartId == this._cartId) - { - // Reload tree - this._reloadProfileTree(profileId); - } - return; - } - - target = message.getTarget('cart'); - if (target != null) - { - var cartId = target.getParameters().id; - - if (cartId == this._cartId) - { - if (target.getParameters().visibility != 'shared') - { - this.setNoSelectionMatchState(""); - } - else if (target.getParameters().authorLogin != Ametys.getAppParameter('user').login) - { - this.setNoSelectionMatchState(""); - } - else - { - this.setInMatchState (target); - if (this._cartVisibility != target.getParameters().visibility) - { - // The visibility change - this._reloadProfileTree(); - } - } - } - } - }, - - /** - * Listener when a Ametys.message.Message#DELETED message was received. - * @param {Ametys.message.Message} message The deletion message - * @private - */ - _onMessageDeleted: function(message) - { - var target = message.getTarget('cart'); - if (target != null) - { - var cartId = target.getParameters().id; - - if (cartId == this._cartId) - { - this.setNoSelectionMatchState(""); - } - } - } -}); Index: main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartRightsTool.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartRightsTool.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartRightsTool.js (working copy) @@ -365,13 +365,15 @@ * Function before loading the store * Set parameters to be passed to the request. * @param {Ext.data.Store} store The store - * @param {Ext.data.Operation} operation The object that will be passed to the Proxy to load the store + * @param {Ext.data.operation.Operation} operation The object that will be passed to the Proxy to load the store * @private */ _onBeforeLoad: function (store, operation) { - operation.params = operation.params || {}; - operation.params.cartId = this._cartId; + operation.setParams(operation.getParams() || {}); + operation.setParams({ + cartId: this._cartId + }); }, /** Index: main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartRightsTool/CartRightsEntry.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartRightsTool/CartRightsEntry.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartRightsTool/CartRightsEntry.js (working copy) @@ -21,7 +21,7 @@ Ext.define('Ametys.plugins.cart.CartRightsTool.CartRightsEntry', { extend: 'Ext.data.Model', - idgen: 'sequential', + identifier: 'sequential', idProperty: 'uniqueId', fields: [ 'type', @@ -50,9 +50,9 @@ switch (node.get('type')) { case 'user': - return "" + " (" + node.get('id') + ")"; + return "" + " (" + node.get('storageId') + ")"; case 'group': - return "" + " (" + node.get('id') + ")"; + return "" + " (" + node.get('storageId') + ")"; } } else @@ -68,7 +68,8 @@ } } - } + }, + depends: ['not-found', 'type', 'storageId', 'fullName', 'login', 'label'] }, // qtip @@ -78,30 +79,27 @@ { name: 'qtitle', type: 'string', - defaultValue: '', - convert: function(value, node) + calculate: function(data) { // Currently, only profile nodes have a qtitle. - return node.get('type') == 'profile' && node.get('text') || ''; + return data.type == 'profile' && data.text || ''; } }, { name: 'cls', - defaultValue: '', - convert: function (value, node) + calculate: function (data) { - return 'tree-node-' + node.get('type'); + return 'tree-node-' + data.type; } }, // Icon { name: 'iconCls', - defaultValue: '', - convert: function (value, node) + calculate: function (data) { - var suffix = node.get('not-found') ? 'error' : node.get('type'); + var suffix = data['not-found'] ? 'error' : data.type; return 'tree-icon-' + suffix; } } Index: main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartTool.i18n.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartTool.i18n.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartTool.i18n.js (working copy) @@ -1,547 +0,0 @@ -/* - - * Copyright 2013 Anyware Services - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * This tool displays the elements of a cart - * @private - */ -Ext.define('Ametys.plugins.cart.tool.CartTool', { - extend: "Ametys.tool.Tool", - - statics: { - /** - * @property {Number} PAGE_SIZE - * @readonly - * @static - * The number of records to display by 'page' - */ - PAGE_SIZE: 10 - }, - - /** - * @property {Ext.grid.Panel} grid The grid panel displaying the carts - * @private - */ - /** - * @property {String} _cartId The id of the cart - * @private - */ - /** - * @property {Ext.data.Store} store The store for cart's elements - * @private - */ - - constructor: function(config) - { - this.callParent(arguments); - - Ametys.message.MessageBus.on(Ametys.message.Message.DELETED, this._onDeleted, this); - Ametys.message.MessageBus.on(Ametys.message.Message.MODIFIED, this._onCartModified, this); - }, - - /** - * Create the carts grid. Grouped by type. - */ - createPanel: function() - { - this.store = this.createStore(); - - this.grid = Ext.create("Ext.grid.Panel", { - store: this.store, - stateful: true, - stateId: this.self.getName() + "$grid", - autoScroll: true, - - columns: [ - {header: "", width: 220, sortable: true, dataIndex: 'title', renderer: Ext.bind(this._renderLabel, this)}, - {header: "", hidden: false, width: 130, sortable: true, dataIndex: 'lastContributor'}, - {header: "", hidden: false, width: 110, sortable: true, dataIndex: 'lastModification', renderer: Ext.util.Format.dateRenderer(Ext.Date.patterns.FriendlyDateTime)}, - {header: "", hidden: false, width: 60, sortable: true, dataIndex: 'workflow-step', renderer: Ametys.cms.content.EditContentsGrid.renderWorkflowStep} - ], - - selModel : { - mode: 'MULTI' - }, - - features: [{ - ftype:'grouping', - groupHeaderTpl: '{name} ({rows.length})', - enableGroupingMenu: false - }], - - viewConfig: { - plugins: [{ - ptype: 'ametysgridviewdragdrop', - dragTextField: 'title', - setAmetysDragInfos: Ext.bind(this.getDragInfo, this), - setAmetysDropZoneInfos: Ext.bind(this.getDropInfo, this) - }] - }, - - - dockedItems: [ - { - xtype: 'toolbar', - dock: 'bottom', - items: ['->', { - xtype: 'tbtext', - text: '', - tpl: Ext.create('Ext.XTemplate', - "", - "", - "", - "", - "", - "", - "", - " {nb} ", - "" - ) - }] - } - ], - - listeners: { - 'selectionchange': Ext.bind(this.sendCurrentSelection, this) - } - }); - - this.grid.on('itemdblclick', Ext.bind(this._openCartElement, this)); - - return this.grid; - }, - - /** - * @private - * This event is thrown by the getDragData to add the 'source' of the drag. - * @param {Object} item The default drag data that will be transmitted. You have to add a 'source' item in it: - * @param {Object} item.source The source (in the relation way) of the drag operation. A Ametys.relation.RelationPoint config. - */ - getDragInfo: function(item) - { - var targets = this._getSelectedTargets(); - - if (targets && targets.length > 0) - { - item.source = { - relationTypes: [Ametys.relation.Relation.REFERENCE], - targets: targets - }; - } - }, - - /** - * @private - * This event is thrown before the beforeDrop event and create the target of the drop operation relation. - * @param {Ext.data.Model[]} targetRecords The target records of the drop operation. - * @param {Object} item The default drag data that will be transmitted. You have to add a 'target' item in it: - * @param {Object} item.target The target (in the relation way) of the drop operation. A Ametys.relation.RelationPoint config. - */ - getDropInfo: function(targetRecords, item) - { - var targets = this._getTargets(targetRecords); - - if (targets.length > 0) - { - item.target = { - relationTypes: [Ametys.relation.Relation.REFERENCE], - targets: targets - }; - } - else - { - item.target = { - relationTypes: [Ametys.relation.Relation.REFERENCE], - targets: { - type: 'cart', - parameters: { - id: this._cartId - } - } - }; - } - }, - - /** - * Returns the CartElement store - * @return {Ext.data.Store} The cart element store - */ - createStore: function() - { - return Ext.create('Ext.data.Store', { - model: 'Ametys.plugins.cart.tool.CartTool.CartElementEntry', - sorters: [{property: 'title', direction:'ASC'}], - proxy: { - type: 'ametys', - plugin: 'cart', - url: 'cart/elements.xml', - reader: { - type: 'xml', - root: 'cart', - record: '> cartElement', - totalProperty: 'total' - } - }, - autoLoad: false, - pageSize: this.self.PAGE_SIZE, - - groupField: 'group', - listeners: { - 'beforeload': {fn: this._onBeforeLoad, scope: this}, - 'load': {fn: this._onLoad, scope: this} - } - - }); - }, - - /** - * Function before loading the store. - * @param {Ext.data.Store} store The store - * @param {Ext.data.Operation} operation The object that will be passed to the Proxy to load the store - * @private - */ - _onBeforeLoad: function (store, operation) - { - operation.params = operation.params || {}; - //Adding the cartId as a HTTP parameter for the store's proxy - operation.params.cartId = this._cartId; - }, - - /** - * Function called after loading the store. - * @param {Ext.data.Store} store The store - * @param {Ext.data.Model[]} records The loaded records - * @private - */ - _onLoad: function (store, records) - { - var tbtext = this.grid.getDockedItems('toolbar[dock="bottom"]')[0].down('tbtext'); - tbtext.update({nb: records.length}); - }, - - /** - * @inheritdoc - * @param {Object} params The parameters - * @param {String} params.id The id of the cart - */ - setParams: function(params) - { - this.callParent(arguments); - - this._cartId = params['id']; - this.refresh(); - }, - - getMBSelectionInteraction: function() - { - return Ametys.tool.Tool.MB_TYPE_ACTIVE; - }, - - /** - * @private - * Convert records to targets - * @param {Ext.data.Model[]} records The record to convert - * @return {Object[]} An array of Ametys.message.MessageTarget configurations. - */ - _getTargets: function(records) - { - var elmtTargets = []; - - Ext.each (records, function (record) { - var type = record.get('type'); - - if (type === 'content') - { - elmtTargets.push({ - type: type, - parameters: { - ids: [record.get('id')] - } - }); - } - else if (type === 'resource') - { - elmtTargets.push({ - type: type, - parameters: { - ids: [record.get('id')] - } - }); - } - }); - - return elmtTargets; - }, - - /** - * @private - * Get the current selected elements as message target configuration - * @return {Object[]} An array of Ametys.message.MessageTarget configurations. - */ - _getSelectedTargets: function() - { - return this._getTargets(this.grid.getSelectionModel().getSelection()); - }, - - sendCurrentSelection: function() - { - var subtargets = this._getSubtargetsByType(); - - /*Ext.each (this.grid.getSelectionModel().getSelection(), function (record) { - elmtTargets.push({ - type: 'cartElement', - parameters: { - id: record.get('id'), - cartElementType: record.get('type') - } - }); - });*/ - - Ext.create("Ametys.message.Message", { - type: Ametys.message.Message.SELECTION_CHANGED, - targets: { - type: 'cart', - parameters: { - id: this._cartId - }, - subtargets: subtargets - } - }); - }, - - /** - * @private - * Get the subtargets configuration to create a message bus, based upon current grid selection - * @return {Object} The configuration to create a subtarget bus message. With 'type' and 'parameters' properties. - */ - _getSubtargetsByType: function () - { - var types = {}; - - Ext.each (this.grid.getSelectionModel().getSelection(), function (record) { - var type = record.get('type'); - if (!types[type]) - { - types[type] = []; - } - - types[type].push(record.get('id')); - }); - - var subtargets = []; - for (var type in types) - { - if (type == 'cartQuery') - { - var queries = types[type]; - for (var i=0; i < queries.length; i++) - { - subtargets.push({ - type: type, - parameters: { - id: queries[i] - } - }); - } - } - else - { - subtargets.push({ - type: type, - parameters: { - ids: types[type] - } - }); - } - - } - return subtargets; - }, - - /** - * Function to render cart element's title in result grid - * @param {String} title The data title - * @param {Object} metaData A collection of metadata about the current cell - * @param {Ext.data.Model} record The record - */ - _renderLabel: function(title, metaData, record) - { - if (record.get('smallIcon')) - { - return '' + title; - } - return title; - }, - - /** - * Reload the store on refresh - */ - refresh: function() - { - this.callParent(arguments); - - this.grid.store.load({callback: Ext.bind(this._updateInfos, this)}); - }, - - /** - * Update tool information - * @private - */ - _updateInfos: function (records, operation, success) - { - this.setInfo ({ - title: Ext.dom.Query.selectValue("label", operation.response), - description: Ext.dom.Query.selectValue("description", operation.response) - }); - - this.showUpToDate(); - - // Save in navigation history - var role = this.getFactory().getRole(); - var toolParams = this.getParams(); - - Ametys.cms.navhistory.HistoryDAO.addEntry({ - id: this.getId(), - objectId: this._cartId, - label: this.getTitle(), - description: this.getDescription(), - iconSmall: this.getSmallIcon(), - iconMedium: this.getMediumIcon(), - iconLarge: this.getLargeIcon(), - type: Ametys.cms.navhistory.HistoryDAO.TOOL_TYPE, - action: function () {Ametys.tool.ToolsManager.openTool(role, toolParams)} - }); - }, - - /** - * Manage CartElement doubleclick - * @param {Ext.view.View} view The view - * @param {Ext.data.Model} record The record that belongs to the item - * @param {HTMLElement} item The item's element - * @param {Number} index The item's index - */ - _openCartElement: function(view, record, item, index) - { - var type = record.get('type'); - - if (type === 'resource') - { - // Download resource file - Ametys.explorer.resources.actions.File.download(record.get('id')); - } - else if (type === 'content') - { - // Open content tool - Ametys.tool.ToolsManager.openTool('uitool-content', {'id': record.get('id')}); - } - else if (type === 'cartQuery') - { - // Open search tool - var description = Ext.JSON.decode(record.get('description')); - - var toolRole = description.toolRole; - var toolParams = description.toolParams || {}; - - Ametys.tool.ToolsManager.openTool(toolRole, toolParams); - } - }, - - /** - * Listener when cart has been modified. - * Will set the tool in "out of date" mode. - * @param {Ametys.message.Message} message The modified message. - * @private - */ - _onCartModified: function(message) - { - var me = this; - var targets = message.getTargets(function (target) {return 'cart' == target.getType() && target.getParameters().id === me._cartId;}); - - if (targets && targets.length > 0) - { - this.showOutOfDate(); - return; - } - - var contentTargets = message.getTargets(function (target) {return 'content' == target.getType()}); - if (contentTargets.length > 0) - { - for (var i=0; i < contentTargets.length; i++) - { - var contentId = contentTargets[i].getParameters().id; - if (this.store.getById(contentId) != null) - { - this.showOutOfDate(); - return; - } - } - } - - var resourceTargets = message.getTargets(function (target) {return 'resource' == target.getType()}); - if (resourceTargets.length > 0) - { - for (var i=0; i < resourceTargets.length; i++) - { - var resourceId = resourceTargets[i].getParameters().id; - if (this.store.getById(resourceId) != null) - { - this.showOutOfDate(); - return; - } - } - } - - }, - - /** - * Listener when cart or cart'elements has been deleted. - * Will close the tool or remove the records if present - * @param {Ametys.message.Message} message The deletion message. - * @private - */ - _onDeleted: function(message) - { - var me = this; - var targets = message.getTargets(function (target) {return 'cart' == target.getType() && target.getParameters().id === me._cartId;}); - - if (targets && targets.length > 0) - { - this.close(); - return; - } - - targets = message.getTargets(function (target) {return 'cartElement' == target.getType() && target.getParameters().cartId === me._cartId;}); - - if (targets && targets.length > 0) - { - var records = []; - for (var i=0; i < targets.length; i++) - { - var record = this.store.getById(targets[i].getParameters().id); - if (record != null) - { - records.push(record); - } - } - this.store.remove(records); - - var tbtext = this.grid.getDockedItems('toolbar[dock="bottom"]')[0].down('tbtext'); - tbtext.update({nb: this.store.getCount()}); - } - } - -}); Index: main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartTool.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartTool.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartTool.js (working copy) @@ -191,7 +191,7 @@ url: 'cart/elements.xml', reader: { type: 'xml', - root: 'cart', + rootProperty: 'cart', record: '> cartElement', totalProperty: 'total' } @@ -211,14 +211,16 @@ /** * Function before loading the store. * @param {Ext.data.Store} store The store - * @param {Ext.data.Operation} operation The object that will be passed to the Proxy to load the store + * @param {Ext.data.operation.Operation} operation The object that will be passed to the Proxy to load the store * @private */ _onBeforeLoad: function (store, operation) { - operation.params = operation.params || {}; + operation.setParams(operation.getParams() || {}); //Adding the cartId as a HTTP parameter for the store's proxy - operation.params.cartId = this._cartId; + operation.setParams({ + cartId: this._cartId + }); }, /** @@ -403,10 +405,8 @@ */ _updateInfos: function (records, operation, success) { - this.setInfo ({ - title: Ext.dom.Query.selectValue("label", operation.response), - description: Ext.dom.Query.selectValue("description", operation.response) - }); + this.setTitle(Ext.dom.Query.selectValue("label", operation.getResponse())); + this.setDescription(Ext.dom.Query.selectValue("description", operation.getResponse())); this.showUpToDate(); @@ -414,7 +414,7 @@ var role = this.getFactory().getRole(); var toolParams = this.getParams(); - Ametys.cms.navhistory.HistoryDAO.addEntry({ + Ametys.navhistory.HistoryDAO.addEntry({ id: this.getId(), objectId: this._cartId, label: this.getTitle(), @@ -422,7 +422,7 @@ iconSmall: this.getSmallIcon(), iconMedium: this.getMediumIcon(), iconLarge: this.getLargeIcon(), - type: Ametys.cms.navhistory.HistoryDAO.TOOL_TYPE, + type: Ametys.navhistory.HistoryDAO.TOOL_TYPE, action: function () {Ametys.tool.ToolsManager.openTool(role, toolParams)} }); }, Index: main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartTool/CartElementEntry.i18n.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartTool/CartElementEntry.i18n.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartTool/CartElementEntry.i18n.js (working copy) @@ -1,44 +0,0 @@ -/* - * Copyright 2013 Anyware Services - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -/** - * This class is the data model for cart entries. - * @private - */ -Ext.define('Ametys.plugins.cart.tool.CartTool.CartElementEntry', { - extend: 'Ext.data.Model', - - fields: [ - {name: 'id', mapping: '@id'}, - {name: 'title', mapping: 'title', sortType: Ext.data.SortTypes.asNonAccentedUCString}, - {name: 'description', mapping: 'description', sortType: Ext.data.SortTypes.asNonAccentedUCString}, - {name: 'group', mapping: 'group'}, - - {name: 'lastModification', mapping: 'lastModification'}, - {name: 'lastContributor', mapping: 'lastContributor'}, - - {name: 'type', mapping: 'type'}, - - {name: 'smallIcon', mapping: 'smallIcon'}, - {name: 'mediumIcon', mapping: 'mediumIcon'}, - {name: 'largeIcon', mapping: 'largeIcon'}, - - {name: 'workflow-step', mapping: 'workflow-step'}, - {name: 'workflowStepId', mapping: 'workflow-step/@id'}, - {name: 'workflowStepIcon', mapping: 'workflow-step/@icon-small'} - ] -}); Index: main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartsTool.i18n.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartsTool.i18n.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartsTool.i18n.js (working copy) @@ -1,318 +0,0 @@ -/* - - * Copyright 2013 Anyware Services - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * This tool displays all carts in READ access for current user - * @private - */ -Ext.define('Ametys.plugins.cart.tool.CartsTool', { - extend: "Ametys.tool.Tool", - - /** - * @property {Ext.grid.Panel} _grid The grid panel displaying the carts - * @private - */ - /** - * @property {Ext.data.Store} _store The cart store - */ - - constructor: function(config) - { - this.callParent(arguments); - - Ametys.message.MessageBus.on(Ametys.message.Message.CREATED, this._onCartCreated, this); - Ametys.message.MessageBus.on(Ametys.message.Message.MODIFIED, this._onCartUpdated, this); - Ametys.message.MessageBus.on(Ametys.message.Message.DELETED, this._onCartDeleted, this); - }, - - getMBSelectionInteraction: function() - { - return Ametys.tool.Tool.MB_TYPE_ACTIVE; - }, - - sendCurrentSelection: function() - { - var cartIds = []; - - var selection = this._grid.getSelectionModel().getSelection(); - for (var i=0; i < selection.length; i++) - { - cartIds.push(selection[i].getId()); - } - - Ext.create("Ametys.message.Message", { - type: Ametys.message.Message.SELECTION_CHANGED, - - targets: { - type: 'cart', - parameters: { ids: cartIds } - } - }); - }, - - setParams: function (params) - { - this.callParent(arguments); - this.refresh(); - }, - - createPanel: function() - { - this._grid = Ext.create("Ext.grid.Panel", { - store: this.createStore(), - stateful: true, - stateId: this.self.getName() + "$grid", - autoScroll: true, - - columns: [ - {header: "", width: 180, sortable: true, dataIndex: 'title', renderer: Ext.bind(this._renderLabel, this)}, - {header: "", hidden: false, width: 180, sortable: true, dataIndex: 'description'}, - {header: "", hidden: true, width: 110, sortable: true, dataIndex: 'authorFullName'}, - {header: "", hidden: true, width: 180, sortable: true, dataIndex: 'visibility', renderer: Ext.bind(this._renderVisibility, this)} - ], - - selModel : { - mode: 'MULTI' - }, - - viewConfig: { - plugins: [{ - ptype: 'ametysgridviewdragdrop', - dragTextField: 'title', - setAmetysDropZoneInfos: Ext.bind(this.getDropInfo, this) - }] - }, - - features: [{ - ftype:'grouping', - - groupHeaderTpl: Ext.create('Ext.XTemplate', - '{name:this.formatName}', - { - formatName: function(name) - { - switch (name) - { - case 0: - return ""; - case 1: - return ""; - case 2: - return ""; - default: - return name; - } - } - } - ) - }], - - listeners: { - itemdblclick: {fn: this._openCart, scope: this}, - selectionchange: {fn: this.sendCurrentSelection, scope: this} - } - }); - - return this._grid; - }, - - refresh: function() - { - this.showRefreshing(); - - this._grid.getStore().load({ - scope: this, - callback: this.showRefreshed - }); - }, - - /** - * Creates the cart store - * @return {Ext.data.Store} The cart store - */ - createStore: function() - { - if (!this._store) - { - this._store = Ext.create('Ext.data.Store', { - model: 'Ametys.plugins.cart.tool.CartsTool.CartEntry', - sorters: [{property: 'title', direction:'ASC'}], - groupField: 'group', - - proxy: { - type: 'ametys', - plugin: 'cart', - url: 'carts/list.xml', - reader: { - type: 'xml', - root: 'carts', - record: '> cart' - } - }, - autoLoad: true - }); - } - - return this._store; - }, - - /** - * @private - * This event is thrown before the beforeDrop event and create the target of the drop operation relation. - * @param {Ext.data.Model[]} targetRecords The target records of the drop operation. - * @param {Object} item The default drag data that will be transmitted. You have to add a 'target' item in it: - * @param {Object} item.target The target (in the relation way) of the drop operation. A Ametys.relation.RelationPoint config. - */ - getDropInfo: function(targetRecords, item) - { - if (targetRecords.length > 0) - { - var targets = []; - - Ext.each (targetRecords, function (record) { - targets.push({ - type: 'cart', - parameters: { - id: record.get('id') - } - }); - }); - - item.target = { - relationTypes: [Ametys.relation.Relation.REFERENCE], - targets: targets - }; - } - }, - - /** - * Function to render cart's title in result grid - * @param {Object} title The data title - * @param {Object} metaData A collection of metadata about the current cell - * @param {Ext.data.Model} record The record - * @private - */ - _renderLabel: function(title, metaData, record) - { - var v = record.get('visibility'); - if (v) - { - if(v === 'public') - { - return '' + title; - } - else if(v === 'private') - { - return '' + title; - } - else if(v === 'shared') - { - return '' + title; - } - } - else - { - return title; - } - }, - - /** - * Function to render cart's visibility in result grid - * @param {Object} value The visibility value - * @param {Object} metaData A collection of metadata about the current cell - * @param {Ext.data.Model} record The record - * @private - */ - _renderVisibility: function(value, metaData, record) - { - switch (value) - { - case 'public': - return ""; - case 'shared': - return ""; - case 'private': - return ""; - } - }, - - /** - * Open the cart - * @param {Ext.view.View} view The view - * @param {Ext.data.Model} record The record that belongs to the item - * @param {HTMLElement} item The item's element - * @param {Number} index The item's index - * @private - */ - _openCart: function(view, record, item, index) - { - var cartId = record.getId(); - Ametys.tool.ToolsManager.openTool('uitool-cart', {id: cartId}); - }, - - /** - * Listener when carts have been created - * Will set the tool in "out of date" mode - * @param {Ametys.message.Message} message The creation message. - * @private - */ - _onCartCreated: function(message) - { - var targets = message.getTargets("cart"); - - if (targets.length > 0) - { - this.showOutOfDate(); - } - }, - - /** - * Listener when carts have been edited - * Will set the tool in "out of date" mode - * @param {Ametys.message.Message} message The edition message. - * @private - */ - _onCartUpdated: function(message) - { - var targets = message.getTargets("cart"); - - if (targets.length > 0) - { - this.showOutOfDate(message.getParameters().major == true); - } - }, - - /** - * Listener when carts have been deleted - * Will remove the records if present - * @param {Ametys.message.Message} message The deletion message. - * @private - */ - _onCartDeleted: function (message) - { - var targets = message.getTargets('cart'); - if (targets.length > 0) - { - var ids = Ext.Array.map(targets, function(target) { - return this._grid.getStore().getById(target.getParameters().id); - }, this); - - this._grid.getStore().remove(ids); - } - } -}); - Index: main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartsTool.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartsTool.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartsTool.js (working copy) @@ -105,7 +105,7 @@ { formatName: function(name) { - switch (name) + switch (parseInt(name)) { case 0: return ""; @@ -159,7 +159,7 @@ url: 'carts/list.xml', reader: { type: 'xml', - root: 'carts', + rootProperty: 'carts', record: '> cart' } }, Index: main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartsTool/CartEntry.i18n.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartsTool/CartEntry.i18n.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartsTool/CartEntry.i18n.js (working copy) @@ -1,49 +0,0 @@ -/* - * Copyright 2013 Anyware Services - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -/** - * This class is the data model for cart entries. - * @private - */ -Ext.define('Ametys.plugins.cart.tool.CartsTool.CartEntry', { - extend: 'Ext.data.Model', - - fields: [ - {name: 'id', mapping: '@id'}, - {name: 'title', mapping: 'title', sortType: Ext.data.SortTypes.asNonAccentedUCString}, - {name: 'description', mapping: 'description', sortType: Ext.data.SortTypes.asNonAccentedUCString}, - {name: 'authorLogin', mapping: 'authorLogin'}, - {name: 'authorFullName', mapping: 'authorFullName', sortType: Ext.data.SortTypes.asNonAccentedUCString}, - {name: 'visibility', mapping: 'visibility'}, - {name: 'group', convert: function (v, record) { - if (record.get('authorLogin') == Ametys.getAppParameter('user').login) - { - return 0; // Personal cart - } - else if (record.get('visibility') == 'shared') - { - return 1; // Shared cart - } - else - { - return 2; // Public cart - } - }}, - {name: 'canRead', type: 'boolean', defaultValue: false}, - {name: 'canWrite', type: 'boolean', defaultValue: false} - ] -}); Index: main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartsTool/CartEntry.js =================================================================== --- main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartsTool/CartEntry.js (revision 31842) +++ main/plugin-cart/resources/js/Ametys/plugins/cart/tool/CartsTool/CartEntry.js (working copy) @@ -29,12 +29,12 @@ {name: 'authorLogin', mapping: 'authorLogin'}, {name: 'authorFullName', mapping: 'authorFullName', sortType: Ext.data.SortTypes.asNonAccentedUCString}, {name: 'visibility', mapping: 'visibility'}, - {name: 'group', convert: function (v, record) { - if (record.get('authorLogin') == Ametys.getAppParameter('user').login) + {name: 'group', type: 'int', calculate: function (data) { + if (data.authorLogin == Ametys.getAppParameter('user').login) { return 0; // Personal cart } - else if (record.get('visibility') == 'shared') + else if (data.visibility == 'shared') { return 1; // Shared cart } Index: main/plugin-cart/src/org/ametys/plugins/cart/Cart.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/Cart.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/Cart.java (working copy) @@ -37,8 +37,8 @@ import org.ametys.plugins.repository.RepositoryConstants; import org.ametys.plugins.repository.UnknownAmetysObjectException; import org.ametys.plugins.repository.jcr.DefaultAmetysObject; -import org.ametys.runtime.util.I18nizableText; -import org.ametys.runtime.util.LoggerFactory; +import org.ametys.core.util.I18nizableText; +import org.ametys.core.util.LoggerFactory; /** * Class representing a cart, backed by a JCR node.
@@ -577,7 +577,7 @@ Node queriesNode = _getOrCreateQueriesNode (); Node queryNode = queriesNode.addNode("query"); - queryNode.setProperty(QUERY_ID_PROPERTY, org.ametys.runtime.util.StringUtils.generateKey()); + queryNode.setProperty(QUERY_ID_PROPERTY, org.ametys.core.util.StringUtils.generateKey()); queryNode.setProperty(QUERY_TITLE_PROPERTY, title); queryNode.setProperty(QUERY_DESCRIPTION_PROPERTY, description); queryNode.setProperty(QUERY_AUTHOR_PROPERTY, author); Index: main/plugin-cart/src/org/ametys/plugins/cart/CartElement.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/CartElement.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/CartElement.java (working copy) @@ -17,7 +17,7 @@ import java.util.Date; -import org.ametys.runtime.util.I18nizableText; +import org.ametys.core.util.I18nizableText; /** * Interface representing the element of a {@link Cart} Index: main/plugin-cart/src/org/ametys/plugins/cart/CartFactory.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/CartFactory.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/CartFactory.java (working copy) @@ -27,7 +27,7 @@ import org.ametys.plugins.repository.AmetysRepositoryException; import org.ametys.plugins.repository.RepositoryConstants; import org.ametys.plugins.repository.jcr.DefaultAmetysObjectFactory; -import org.ametys.runtime.group.GroupsManager; +import org.ametys.core.group.GroupsManager; /** * {@link AmetysObjectFactory} for handling {@link Cart}s. Index: main/plugin-cart/src/org/ametys/plugins/cart/ContentElement.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/ContentElement.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/ContentElement.java (working copy) @@ -19,7 +19,7 @@ import org.ametys.cms.contenttype.ContentTypesHelper; import org.ametys.cms.repository.Content; -import org.ametys.runtime.util.I18nizableText; +import org.ametys.core.util.I18nizableText; /** * Implementation of a {@link CartElement} wrapping a {@link Content} Index: main/plugin-cart/src/org/ametys/plugins/cart/QueryElement.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/QueryElement.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/QueryElement.java (working copy) @@ -18,7 +18,7 @@ import java.util.Calendar; import java.util.Date; -import org.ametys.runtime.util.I18nizableText; +import org.ametys.core.util.I18nizableText; /** * Implementation of a {@link CartElement} wrapping a search query Index: main/plugin-cart/src/org/ametys/plugins/cart/ResourceElement.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/ResourceElement.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/ResourceElement.java (working copy) @@ -18,7 +18,7 @@ import java.util.Date; import org.ametys.plugins.explorer.resources.Resource; -import org.ametys.runtime.util.I18nizableText; +import org.ametys.core.util.I18nizableText; /** * Implementation of a {@link CartElement} wrapping a {@link Resource} Index: main/plugin-cart/src/org/ametys/plugins/cart/actions/AddCartElementAction.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/actions/AddCartElementAction.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/actions/AddCartElementAction.java (working copy) @@ -30,7 +30,7 @@ import org.ametys.plugins.cart.Cart; import org.ametys.plugins.cart.Cart.CartElementType; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.user.CurrentUserProvider; +import org.ametys.core.user.CurrentUserProvider; /** * Add an element to a {@link Cart} Index: main/plugin-cart/src/org/ametys/plugins/cart/actions/CreateCartAction.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/actions/CreateCartAction.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/actions/CreateCartAction.java (working copy) @@ -34,7 +34,7 @@ import org.ametys.plugins.cart.CartHelper; import org.ametys.plugins.repository.AmetysObjectResolver; import org.ametys.plugins.repository.ModifiableTraversableAmetysObject; -import org.ametys.runtime.user.CurrentUserProvider; +import org.ametys.core.user.CurrentUserProvider; /** * Action to add a new {@link Cart} Index: main/plugin-cart/src/org/ametys/plugins/cart/actions/DeleteCartAction.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/actions/DeleteCartAction.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/actions/DeleteCartAction.java (working copy) @@ -33,8 +33,8 @@ import org.ametys.plugins.cart.Cart; import org.ametys.plugins.repository.AmetysObjectResolver; import org.ametys.plugins.repository.UnknownAmetysObjectException; -import org.ametys.runtime.cocoon.JSonReader; -import org.ametys.runtime.user.CurrentUserProvider; +import org.ametys.core.cocoon.JSonReader; +import org.ametys.core.user.CurrentUserProvider; /** * Delete a {@link Cart} Index: main/plugin-cart/src/org/ametys/plugins/cart/actions/DeleteCartElementAction.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/actions/DeleteCartElementAction.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/actions/DeleteCartElementAction.java (working copy) @@ -30,7 +30,7 @@ import org.ametys.plugins.cart.Cart; import org.ametys.plugins.cart.Cart.CartElementType; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.user.CurrentUserProvider; +import org.ametys.core.user.CurrentUserProvider; /** * Delete elements of a {@link Cart} Index: main/plugin-cart/src/org/ametys/plugins/cart/actions/EditCartAction.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/actions/EditCartAction.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/actions/EditCartAction.java (working copy) @@ -30,7 +30,7 @@ import org.ametys.plugins.cart.Cart; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.user.CurrentUserProvider; +import org.ametys.core.user.CurrentUserProvider; /** * Edit a {@link Cart} Index: main/plugin-cart/src/org/ametys/plugins/cart/actions/GetCartInformationAction.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/actions/GetCartInformationAction.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/actions/GetCartInformationAction.java (working copy) @@ -35,10 +35,10 @@ import org.ametys.plugins.cart.Cart; import org.ametys.plugins.repository.AmetysObjectResolver; import org.ametys.plugins.repository.AmetysRepositoryException; -import org.ametys.runtime.cocoon.JSonReader; -import org.ametys.runtime.user.CurrentUserProvider; -import org.ametys.runtime.user.User; -import org.ametys.runtime.user.UsersManager; +import org.ametys.core.cocoon.JSonReader; +import org.ametys.core.user.CurrentUserProvider; +import org.ametys.core.user.User; +import org.ametys.core.user.UsersManager; /** * Get carts information Index: main/plugin-cart/src/org/ametys/plugins/cart/actions/visibility/AssignRightsAction.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/actions/visibility/AssignRightsAction.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/actions/visibility/AssignRightsAction.java (working copy) @@ -34,7 +34,7 @@ import org.ametys.plugins.cart.Cart; import org.ametys.plugins.cart.Cart.CartProfile; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.user.CurrentUserProvider; +import org.ametys.core.user.CurrentUserProvider; /** * Adds users or groups to a {@link Cart} profile Index: main/plugin-cart/src/org/ametys/plugins/cart/actions/visibility/ChangeVisibilityAction.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/actions/visibility/ChangeVisibilityAction.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/actions/visibility/ChangeVisibilityAction.java (working copy) @@ -31,7 +31,7 @@ import org.ametys.plugins.cart.Cart; import org.ametys.plugins.cart.Cart.Visibility; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.user.CurrentUserProvider; +import org.ametys.core.user.CurrentUserProvider; /** * Action populating a map containing information about the visibility of a {@link Cart} Index: main/plugin-cart/src/org/ametys/plugins/cart/actions/visibility/GetCartProfileTreeAction.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/actions/visibility/GetCartProfileTreeAction.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/actions/visibility/GetCartProfileTreeAction.java (working copy) @@ -35,12 +35,12 @@ import org.ametys.plugins.cart.Cart.CartProfile; import org.ametys.plugins.cart.Cart.Visibility; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.cocoon.JSonReader; -import org.ametys.runtime.group.Group; -import org.ametys.runtime.group.GroupsManager; -import org.ametys.runtime.user.CurrentUserProvider; -import org.ametys.runtime.user.User; -import org.ametys.runtime.user.UsersManager; +import org.ametys.core.cocoon.JSonReader; +import org.ametys.core.group.Group; +import org.ametys.core.group.GroupsManager; +import org.ametys.core.user.CurrentUserProvider; +import org.ametys.core.user.User; +import org.ametys.core.user.UsersManager; /** * Action populating a map containing information about the visibility of a {@link Cart} Index: main/plugin-cart/src/org/ametys/plugins/cart/actions/visibility/RemoveAssignmentAction.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/actions/visibility/RemoveAssignmentAction.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/actions/visibility/RemoveAssignmentAction.java (working copy) @@ -35,7 +35,7 @@ import org.ametys.plugins.cart.Cart; import org.ametys.plugins.cart.Cart.CartProfile; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.user.CurrentUserProvider; +import org.ametys.core.user.CurrentUserProvider; /** * This actions delete users or groups to a {@link Cart} profile Index: main/plugin-cart/src/org/ametys/plugins/cart/generators/CartElementDetailsGenerator.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/generators/CartElementDetailsGenerator.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/generators/CartElementDetailsGenerator.java (working copy) @@ -38,13 +38,13 @@ import org.ametys.plugins.cart.QueryElement; import org.ametys.plugins.cart.ResourceElement; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.user.CurrentUserProvider; -import org.ametys.runtime.user.User; -import org.ametys.runtime.user.UsersManager; -import org.ametys.runtime.util.IgnoreRootHandler; -import org.ametys.runtime.util.JSONUtils; -import org.ametys.runtime.util.URLEncoder; -import org.ametys.runtime.util.parameter.ParameterHelper; +import org.ametys.core.user.CurrentUserProvider; +import org.ametys.core.user.User; +import org.ametys.core.user.UsersManager; +import org.ametys.core.util.IgnoreRootHandler; +import org.ametys.core.util.JSONUtils; +import org.ametys.core.util.URLEncoder; +import org.ametys.runtime.parameter.ParameterHelper; /** * SAX elements of a cart Index: main/plugin-cart/src/org/ametys/plugins/cart/generators/CartElementsGenerator.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/generators/CartElementsGenerator.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/generators/CartElementsGenerator.java (working copy) @@ -42,11 +42,11 @@ import org.ametys.plugins.repository.version.VersionAwareAmetysObject; import org.ametys.plugins.workflow.Workflow; import org.ametys.plugins.workflow.store.AmetysStep; -import org.ametys.runtime.user.CurrentUserProvider; -import org.ametys.runtime.user.User; -import org.ametys.runtime.user.UsersManager; -import org.ametys.runtime.util.I18nizableText; -import org.ametys.runtime.util.parameter.ParameterHelper; +import org.ametys.core.user.CurrentUserProvider; +import org.ametys.core.user.User; +import org.ametys.core.user.UsersManager; +import org.ametys.core.util.I18nizableText; +import org.ametys.runtime.parameter.ParameterHelper; import com.opensymphony.workflow.WorkflowException; import com.opensymphony.workflow.spi.Step; Index: main/plugin-cart/src/org/ametys/plugins/cart/generators/CartsGenerator.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/generators/CartsGenerator.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/generators/CartsGenerator.java (working copy) @@ -32,10 +32,10 @@ import org.ametys.plugins.cart.CartHelper; import org.ametys.plugins.repository.AmetysObjectIterable; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.group.GroupsManager; -import org.ametys.runtime.user.CurrentUserProvider; -import org.ametys.runtime.user.User; -import org.ametys.runtime.user.UsersManager; +import org.ametys.core.group.GroupsManager; +import org.ametys.core.user.CurrentUserProvider; +import org.ametys.core.user.User; +import org.ametys.core.user.UsersManager; /** * SAX carts Index: main/plugin-cart/src/org/ametys/plugins/cart/observers/ContentDeletedObserver.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/observers/ContentDeletedObserver.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/observers/ContentDeletedObserver.java (working copy) @@ -26,8 +26,8 @@ import org.ametys.plugins.cart.Cart.CartElementType; import org.ametys.plugins.repository.AmetysObjectIterable; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.observation.Event; -import org.ametys.runtime.observation.Observer; +import org.ametys.core.observation.Event; +import org.ametys.core.observation.Observer; /** * Observes deletion on contents to delete contents from carts Index: main/plugin-cart/src/org/ametys/plugins/cart/observers/ResourceDeletedObserver.java =================================================================== --- main/plugin-cart/src/org/ametys/plugins/cart/observers/ResourceDeletedObserver.java (revision 31842) +++ main/plugin-cart/src/org/ametys/plugins/cart/observers/ResourceDeletedObserver.java (working copy) @@ -26,8 +26,8 @@ import org.ametys.plugins.explorer.ObservationConstants; import org.ametys.plugins.repository.AmetysObjectIterable; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.observation.Event; -import org.ametys.runtime.observation.Observer; +import org.ametys.core.observation.Event; +import org.ametys.core.observation.Observer; /** * Observes deletion on resources to delete resources from carts