Index: ivy.xml =================================================================== --- ivy.xml (revision 32045) +++ ivy.xml (working copy) @@ -43,6 +43,6 @@ - + Index: main/plugin-queries-directory/plugin.xml =================================================================== --- main/plugin-queries-directory/plugin.xml (revision 32045) +++ main/plugin-queries-directory/plugin.xml (working copy) @@ -42,13 +42,13 @@ + point="org.ametys.core.ui.MessageTargetFactoriesManager" + class="org.ametys.core.ui.StaticClientSideElement"> query - js/Ametys/plugins/queriesdirectory/QueriesDAO.i18n.js + js/Ametys/plugins/queriesdirectory/QueriesDAO.js js/Ametys/plugins/queriesdirectory/QueryMessageTargetFactory.js @@ -58,17 +58,17 @@ + point="org.ametys.core.ui.StaticFileImportsManager" + class="org.ametys.core.ui.StaticFileImportsClientSideElement"> js/Ametys/plugins/queriesdirectory/model/QueryFactory.js js/Ametys/plugins/queriesdirectory/model/AbstractQuery.js - js/Ametys/plugins/queriesdirectory/model/SimpleQuery.i18n.js - js/Ametys/plugins/queriesdirectory/model/AdvancedQuery.i18n.js - js/Ametys/plugins/queriesdirectory/model/SqlQuery.i18n.js - js/Ametys/plugins/queriesdirectory/model/ScriptQuery.i18n.js - js/Ametys/plugins/queriesdirectory/actions/QueriesActions.i18n.js - js/Ametys/plugins/queriesdirectory/helper/CreateOrEditQuery.i18n.js + js/Ametys/plugins/queriesdirectory/model/SimpleQuery.js + js/Ametys/plugins/queriesdirectory/model/AdvancedQuery.js + js/Ametys/plugins/queriesdirectory/model/SqlQuery.js + js/Ametys/plugins/queriesdirectory/model/ScriptQuery.js + js/Ametys/plugins/queriesdirectory/actions/QueriesActions.js + js/Ametys/plugins/queriesdirectory/helper/CreateOrEditQuery.js @@ -76,7 +76,7 @@ - @@ -86,10 +86,13 @@ + point="org.ametys.core.ui.StaticFileImportsManager" + class="org.ametys.core.ui.StaticFileImportsClientSideElement"> - js/Ametys/plugins/queriesdirectory/QuerySearchExtensions.i18n.js + js/Ametys/plugins/cms/search/SearchToolExtensions.js + js/Ametys/plugins/cms/search/SqlSearchToolExtensions.js + js/Ametys/plugins/cms/search/ScriptToolExtensions.js + js/Ametys/plugins/queriesdirectory/QuerySearchExtensions.js QueriesDirectory_Rights_SaveQuery @@ -99,8 +102,8 @@ + point="org.ametys.core.ui.RibbonTabsManager" + class="org.ametys.core.ui.StaticClientSideElement"> ^query$ @@ -112,8 +115,8 @@ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.queriesdirectory.actions.QueriesActions.executeQuery ^query$ @@ -134,14 +137,13 @@ img/actions/execute_48.png - js/Ametys/plugins/queriesdirectory/actions/QueriesActions.i18n.js js/Ametys/plugins/queriesdirectory/controllers/QueryController.js QueriesDirectory_Rights_Tool|QueriesDirectory_Rights_Admin + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.queriesdirectory.actions.QueriesActions.openQuery ^query$ @@ -162,14 +164,13 @@ img/actions/edit_48.png - js/Ametys/plugins/queriesdirectory/actions/QueriesActions.i18n.js js/Ametys/plugins/queriesdirectory/controllers/QueryController.js QueriesDirectory_Rights_Tool|QueriesDirectory_Rights_Admin + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.queriesdirectory.actions.QueriesActions.editQuery ^query$ @@ -194,15 +195,14 @@ PLUGINS_QUERIESDIRECTORY_DESCRIPTION_NOWRITEACCESS - js/Ametys/plugins/queriesdirectory/actions/QueriesActions.i18n.js js/Ametys/plugins/queriesdirectory/controllers/QueryController.js QueriesDirectory_Rights_Tool|QueriesDirectory_Rights_Admin + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.queriesdirectory.actions.QueriesActions.deleteQuery ^query$ @@ -226,15 +226,14 @@ PLUGINS_QUERIESDIRECTORY_DESCRIPTION_NOWRITEACCESS - js/Ametys/plugins/queriesdirectory/actions/QueriesActions.i18n.js js/Ametys/plugins/queriesdirectory/controllers/QueryController.js QueriesDirectory_Rights_Tool|QueriesDirectory_Rights_Admin + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> PLUGINS_QUERIESDIRECTORY_QUERY_IDENTIFIER_DESCRIPTION @@ -252,7 +251,7 @@ - @@ -261,7 +260,7 @@ - @@ -271,8 +270,8 @@ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.SimpleMenu"> uitool-queries @@ -287,7 +286,7 @@ Ametys.plugins.queriesdirectory.tool.QueriesTool @@ -301,9 +300,9 @@ l - js/Ametys/plugins/queriesdirectory/tool/QueriesTool/QueryEntry.i18n.js - js/Ametys/plugins/queriesdirectory/helper/ChooseQuery.i18n.js - js/Ametys/plugins/queriesdirectory/tool/QueriesTool.i18n.js + js/Ametys/plugins/queriesdirectory/tool/QueriesTool/QueryEntry.js + js/Ametys/plugins/queriesdirectory/helper/ChooseQuery.js + js/Ametys/plugins/queriesdirectory/tool/QueriesTool.js @@ -316,8 +315,8 @@ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> uitool-query-rights ^query$ @@ -348,8 +347,8 @@ + point="org.ametys.core.ui.UIToolsFactoriesManager" + class="org.ametys.core.ui.StaticClientSideElement"> uitool-query-rights Ametys.plugins.queriesdirectory.tool.QueryRightsTool @@ -367,7 +366,7 @@ r - js/Ametys/plugins/queriesdirectory/tool/QueryRightsTool.i18n.js + js/Ametys/plugins/queriesdirectory/tool/QueryRightsTool.js js/Ametys/plugins/queriesdirectory/tool/QueryRightsTool/QueryRightsEntry.js @@ -376,8 +375,8 @@ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.queriesdirectory.actions.QueryRightsActions.changeVisibility ^query$ @@ -403,13 +402,13 @@ js/Ametys/plugins/queriesdirectory/controllers/QueryController.js - js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.i18n.js + js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.js + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.queriesdirectory.actions.QueryRightsActions.changeVisibility ^query$ @@ -435,13 +434,13 @@ js/Ametys/plugins/queriesdirectory/controllers/QueryController.js - js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.i18n.js + js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.js + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.queriesdirectory.actions.QueryRightsActions.changeVisibility ^query$ @@ -467,13 +466,13 @@ js/Ametys/plugins/queriesdirectory/controllers/QueryController.js - js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.i18n.js + js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.js + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.SimpleMenu"> ^query$ false @@ -516,16 +515,16 @@ + point="org.ametys.core.ui.RibbonTabsManager" + class="org.ametys.core.ui.StaticClientSideElement"> ^uitool-query-rights$ + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.queriesdirectory.actions.QueryRightsActions.addUsers ^query-profile$ @@ -540,15 +539,14 @@ img/users/add_48.png - js/Ametys/runtime/uihelper/SelectUser.i18n.js - js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.i18n.js + js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.js QueriesDirectory_Rights_Tool|QueriesDirectory_Rights_Admin + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.queriesdirectory.actions.QueryRightsActions.addGroups ^query-profile$ @@ -563,15 +561,14 @@ img/groups/add_48.png - js/Ametys/runtime/uihelper/SelectGroup.i18n.js - js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.i18n.js + js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.js QueriesDirectory_Rights_Tool|QueriesDirectory_Rights_Admin + point="org.ametys.core.ui.RibbonControlsManager" + class="org.ametys.core.ui.StaticClientSideElement"> Ametys.plugins.queriesdirectory.actions.QueryRightsActions.removeAssignment ^query-profile$ @@ -587,7 +584,7 @@ img/rights/remove_48.png - js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.i18n.js + js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.js QueriesDirectory_Rights_Tool|QueriesDirectory_Rights_Admin Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/QueriesDAO.i18n.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/QueriesDAO.i18n.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/QueriesDAO.i18n.js (working copy) @@ -1,240 +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 queries DAO - * @private - */ -Ext.define('Ametys.plugins.queriesdirectory.QueriesDAO', { - singleton: true, - - /** - * Retrieve queries from the cache, or by doing a server request. - * @param {String/String[]} queryIds Query identifiers - * @param {Function} callback The callback function called after retrieving the queries. Has the following parameters: - * @param {Object[]} callback.queryData An array of retrieved query data. Can be empty. - * @param {String[]} callback.unknownQueries Array of unknown query ids among the requested list. - * @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 queries are reported. - * @private - */ - getQueries: function(queryIds, callback, scope, displayErrors) - { - this._initCache(); - - queryIds = Ext.isArray(queryIds) ? queryIds : [queryIds]; - - var resolved = {}, unresolved = [], query; - - Ext.Array.each(queryIds, function(id) { - query = this._getFromCache(id); - if (query) - { - resolved[id] = query; - } - else if (!Ext.Array.contains(this._resolving, id)) - { - this._resolving.push(id); - unresolved.push(id); - } - }, this); - - if (unresolved.length > 0) - { - this._sendGetQueryRequest(queryIds, callback, scope, displayErrors); - } - else - { - callback.call(scope || window, Ext.Object.getValues(resolved), []); - } - }, - - /** - * @private - * Send request to server to retrieve queries. - * @param {String[]} ids The id of queries to retrieve - * @param {Function} callback The callback function to be called after server process - * @param {Object[]} callback.queryData An array of retrieved query data. Can be empty. - * @param {String[]} callback.unknownQueries Array of unknown query 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 queries - */ - _sendGetQueryRequest: function(ids, callback, scope, displayErrors) - { - var params = { - ids: ids || [] - }; - - Ametys.data.ServerComm.send({ - plugin: 'queries-directory', - url: 'query/list.json', - parameters: params, - priority: Ametys.data.ServerComm.PRIORITY_MAJOR, - waitMessage: true, - errorMessage: { - msg: "", - category: this.self.getName() - }, - responseType: 'text', - callback: { - handler: this._sendGetQueryRequestCb, - scope: this, - arguments: { - callback: callback, - scope: scope, - displayErrors: displayErrors || false - } - } - }); - }, - - /** - * Callback function called after #_sendGetQueryRequest is processed - * @param {Object} response The response object. - * @param {Object} params The callback arguments (see {@link #_sendGetQueryRequest documentation) - * @private - */ - _sendGetQueryRequestCb: 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 queriesData = result.queries || []; - var unknownQueries = result.unknownQueries || []; - - // Populate cache. - Ext.Array.forEach(queriesData, function(queryData) { - this._addToCache(queryData.id, queryData); - }, this); - - Ext.Array.forEach(unknownQueries, function(id) { - this._addToCache(unknownQueries.id, { - id: unknownQueries.id, - unknown: true - }); - }, this); - - if (displayErrors && unknownQueries.length > 0) - { - Ametys.log.ErrorDialog.display({ - title: "", - text: "", - details: unknownQueries.join(", "), - category: this.self.getName() - }); - } - - // Execute callback with the retrieved queries - callback.call(scope, queriesData, unknownQueries); - }, - - /** - * @property {Object} _cache The DAO cache. Keys are query id, Values are an object representing the query 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 query that are currently being resolved on the server. - * Used to avoid making several requests for the same query in a short period of time. - * @private - */ - _resolving: null, - - /** - * Update a query 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 query are modified. - * @param {String} queryId the query id - * @param {Object} dataToUpdate The properties to update for this query. - */ - localUpdate: function(queryId, dataToUpdate) - { - this._initCache(); - - var query = this._getFromCache(queryId); - if (query) - { - Ext.apply(query, dataToUpdate); - this._addToCache(queryId, query); - } - }, - - /** - * Remove a query in the cache. - * This must be used to invalidate an entry in the cache. - * Typically it must be done when a query have just been removed on the server. - * @param {String} queryId the query id - */ - localRemove: function(queryId) - { - this._initCache(); - - delete this._cache[queryId]; - delete this._cacheExpirations[queryId]; - delete this._resolving[queryId]; - - }, - - /** - * 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(queryId, queryData) - { - this._cache[queryId] = queryData; - this._cacheExpirations[queryId] = Ext.Date.add(new Date(), Ext.Date.MINUTE, 15); - - Ext.Array.remove(this._resolving, queryId); - }, - - /** - * Internal method to retrieve an entry in the cache. - * @private - */ - _getFromCache: function(queryId) - { - if (this._cacheExpirations[queryId] && new Date() <= this._cacheExpirations[queryId]) - { - return this._cache[queryId]; - } - else - { - this.localRemove(queryId); - return null; - } - } -}); Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/QuerySearchExtensions.i18n.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/QuerySearchExtensions.i18n.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/QuerySearchExtensions.i18n.js (working copy) @@ -1,85 +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. - */ -/** - * Extensions for search tools - * @private - */ -Ext.define('Ametys.plugins.queriesdirectory.QuerySearchExtensions', { - singleton: true, - - /** - * Add the search extensions for queries - */ - addSearchExtension: function () - { - var items = this._getItemsByType(Ametys.plugins.queriesdirectory.model.SimpleQuery.QUERY_TYPE); - Ametys.plugins.cms.search.SearchToolExtensions.registerAdditionalButton(items); - - items = this._getItemsByType(Ametys.plugins.queriesdirectory.model.SqlQuery.QUERY_TYPE); - Ametys.plugins.cms.search.SqlSearchToolExtensions.registerAdditionalButton(items); - - items = this._getItemsByType(Ametys.plugins.queriesdirectory.model.ScriptQuery.QUERY_TYPE); - Ametys.plugins.cms.search.ScriptToolExtensions.registerAdditionalButton(items); - }, - - /** - * Get items by query type - * @private - */ - _getItemsByType: function (type) - { - return { - icon: Ametys.getPluginResourcesPrefix('queries-directory') + '/img/actions/save_16.png', - // text: "", - tooltip: { - title: "", - text: "", - image: Ametys.getPluginResourcesPrefix('queries-directory') + '/img/actions/save_48.png', - inribbon: false - }, - - menu: { - items: [{ - icon: Ametys.getPluginResourcesPrefix('queries-directory') + '/img/actions/save_16.png', - text: "", - handler: Ext.bind(Ametys.plugins.queriesdirectory.actions.QueriesActions.saveQuery, null, [type], 1), - scope: Ametys.plugins.queriesdirectory.actions.QueriesActions, - tooltip: { - title: "", - text: "", - image: Ametys.getPluginResourcesPrefix('queries-directory') + '/img/actions/save_48.png', - inribbon: false - } - },{ - - icon: Ametys.getPluginResourcesPrefix('queries-directory') + '/img/actions/save_16.png', - text: "", - handler: Ext.bind(Ametys.plugins.queriesdirectory.actions.QueriesActions.saveAsQuery, null, [type], 1), - scope: Ametys.plugins.queriesdirectory.actions.QueriesActions, - tooltip: { - title: "", - text: "", - image: Ametys.getPluginResourcesPrefix('queries-directory') + '/img/actions/save_48.png', - inribbon: false - } - }] - } - }; - } -}); - -Ametys.plugins.queriesdirectory.QuerySearchExtensions.addSearchExtension(); - Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/actions/QueriesActions.i18n.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/actions/QueriesActions.i18n.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/actions/QueriesActions.i18n.js (working copy) @@ -1,305 +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 queries - * @private - */ -Ext.define('Ametys.plugins.queriesdirectory.actions.QueriesActions', { - singleton: true, - - /** - * Save the query a new query - * @param {Ext.button.Button} button The button calling this function - * @param {String} type The type of query - */ - saveQuery: function (button, type) - { - var toolId = button.toolId || button.parentMenu.ownerButton.toolId; - var tool = Ametys.tool.ToolsManager.getTool(toolId); - - if (tool.getCurrentSearchParameters) - { - var content = Ext.JSON.encode({ - toolRole: tool.getFactory().getRole(), - toolParams: tool.getCurrentSearchParameters(), - exportParams: tool.getSearchParametersForExport(), - exportXMLUrl: tool.getExportXMLUrl(), - exportXMLUrlPlugin: tool.getExportXMLUrlPlugin() - }); - - if (tool.isAdvancedMode && tool.isAdvancedMode()) - { - type = Ametys.plugins.queriesdirectory.model.AdvancedQuery.QUERY_TYPE; - } - - Ametys.plugins.queriesdirectory.helper.CreateOrEditQuery.act('new', type, {content: content}, function () { - if (Ametys.tool.ToolsManager.getTool('uitool-queries') == null) - { - Ametys.tool.ToolsManager.openTool('uitool-queries', {}); - } - }); - } - }, - - /** - * Edit an existing query - * @param {Ext.button.Button} button The button calling this function - * @param {String} type The type of query - */ - saveAsQuery: function (button, type) - { - var toolId = button.toolId || button.parentMenu.ownerButton.toolId; - var tool = Ametys.tool.ToolsManager.getTool(toolId); - if (tool.getCurrentSearchParameters) - { - var content = Ext.JSON.encode({ - toolRole: tool.getFactory().getRole(), - toolParams: tool.getCurrentSearchParameters(), - exportParams: tool.getSearchParametersForExport(), - exportXMLUrl: tool.getExportXMLUrl(), - exportXMLUrlPlugin: tool.getExportXMLUrlPlugin() - }); - - if (tool.isAdvancedMode && tool.isAdvancedMode()) - { - type = Ametys.plugins.queriesdirectory.model.AdvancedQuery.QUERY_TYPE; - } - - Ametys.plugins.queriesdirectory.helper.ChooseQuery.act({ - icon: Ametys.getPluginResourcesPrefix('queries-directory') + '/img/actions/save_16.png', - title: "", - helpMessage: "", - params: {content: content}, - type: type, - callback: Ext.bind (Ametys.plugins.queriesdirectory.actions.QueriesActions._saveAsQueryCb, Ametys.plugins.queriesdirectory.actions.QueriesActions, [tool, type], true) - }); - } - }, - - /** - * This action edits the selected query - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - editQuery: function(controller) - { - var targets = controller.getMatchingTargets(); - - if (targets.length > 0) - { - Ametys.plugins.queriesdirectory.helper.CreateOrEditQuery.act("edit", targets[0].getParameters().type, targets[0].getParameters()); - } - }, - - /** - * Delete the selected queries - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - deleteQuery: function(controller) - { - var targets = controller.getMatchingTargets(); - - if (targets.length > 0) - { - Ametys.Msg.confirm("", - "", - function(btn) { - if(btn == 'yes') - { - this._doDelete(targets); - } - - }, - this); - } - - }, - - /** - * This action execute the selected query - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - executeQuery: function(controller) - { - var targets = controller.getMatchingTargets(); - - if (targets.length > 0) - { - var params = targets[0].getParameters(); - var query = Ametys.plugins.queriesdirectory.model.QueryFactory.create(params.type, params.content, params.title); - query.execute(); - } - - }, - - /** - * This action open and execute the selected query - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - openQuery: function(controller) - { - var targets = controller.getMatchingTargets(); - - if (targets.length > 0) - { - var params = targets[0].getParameters(); - var query = Ametys.plugins.queriesdirectory.model.QueryFactory.create(params.type, params.content, params.title); - query.open(); - } - }, - - /** - * Callback function invoked after the #deleteQuery confirm box is validated - * @param {Ametys.message.MessageTarget[]} targets The queries 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: "queries-directory", - url: "query/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 {HTMLElement} response The XML response. - * @param {Array} args The callback arguments. - * @private - */ - _deleteCb: function (response, args) - { - 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: "query", - parameters: {ids: result.deletedQueries} - } - }); - - var notallowedQueries = result.notallowedQueries; - if (notallowedQueries.length > 0) - { - Ametys.Msg.show({ - title: "", - msg: "" + notallowedQueries.join(','), - buttons: Ext.Msg.OK, - icon: Ext.Msg.ERROR - }); - } - - } - }, - - /** - * Update the query - * @param {String} queryId The query id - * @param {Object} tool The search tool - * @param {String} type The type of query - * @private - */ - _saveAsQueryCb: function (queryId, tool, type) - { - var content = Ext.JSON.encode({ - toolRole: tool.getFactory().getRole(), - toolParams: tool.getCurrentSearchParameters(), - exportParams: tool.getSearchParametersForExport(), - exportXMLUrl: tool.getExportXMLUrl(), - exportXMLUrlPlugin: tool.getExportXMLUrlPlugin() - }); - - if (tool.isAdvancedMode && tool.isAdvancedMode()) - { - type = Ametys.plugins.queriesdirectory.model.AdvancedQuery.QUERY_TYPE; - } - - var params = { - id: queryId, - content: content, - type: type - }; - - Ametys.data.ServerComm.send({ - plugin: 'queries-directory', - url: 'query/saveas', - parameters: params, - priority: Ametys.data.ServerComm.PRIORITY_MAJOR, - waitMessage: true, - errorMessage: true, - callback: { - handler: this._updateContentQueryCb, - scope: this, - arguments: params - } - }); - }, - - /** - * Function called after updating query - * @param {HTMLElement} response The XML response. - * @param {Object} params The callback arguments. - * @private - */ - _updateContentQueryCb: 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 - }); - return; - } - - var id = Ext.dom.Query.selectValue("> ActionResult > id", response); - - Ext.create("Ametys.message.Message", { - type: Ametys.message.Message.MODIFIED, - targets: { - type: "query", - parameters: { - id: id - } - } - }); - } - -}); - Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/actions/QueriesActions.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/actions/QueriesActions.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/actions/QueriesActions.js (working copy) @@ -28,7 +28,7 @@ */ saveQuery: function (button, type) { - var toolId = button.toolId || button.parentMenu.ownerButton.toolId; + var toolId = button.toolId || button.parentMenu.ownerCmp.toolId; var tool = Ametys.tool.ToolsManager.getTool(toolId); if (tool.getCurrentSearchParameters) @@ -62,7 +62,7 @@ */ saveAsQuery: function (button, type) { - var toolId = button.toolId || button.parentMenu.ownerButton.toolId; + var toolId = button.toolId || button.parentMenu.ownerCmp.toolId; var tool = Ametys.tool.ToolsManager.getTool(toolId); if (tool.getCurrentSearchParameters) { Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.i18n.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.i18n.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.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 query visibility. - * @private - */ -Ext.define('Ametys.plugins.queriesdirectory.actions.QueryRightsActions', { - singleton: true, - - /** - * Change the visibility of a query. - * @param {Ametys.ribbon.element.ui.ButtonController} controller The controller calling this function - */ - changeVisibility: function(controller) - { - var queryTarget = controller.getMatchingTargets()[0]; - var queryId = queryTarget.getParameters().id; - var visibility = controller.getInitialConfig('visibility'); - - if (queryTarget && visibility && visibility != queryTarget.getParameters().visibility) - { - var params = { - queryId: queryId, - visibility: visibility - }; - - Ametys.data.ServerComm.send({ - plugin: 'queries-directory', - 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.queriesdirectory.QueriesDAO.localUpdate(args.queryId, { - visibility: args.visibility - }); - - Ext.create('Ametys.message.Message', { - type: Ametys.message.Message.MODIFIED, - targets: { - type: 'query', - parameters: { - id: args.queryId - } - } - }); - } - }, - - // --------------- Add users ----------------------// - - /** - * Add users to a query 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 query 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 query 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 query profile target retrieved from the controller - * @private - */ - _add: function (entries, type, profileTarget) - { - var url = type == 'users' ? 'profile/add-users' : 'profile/add-groups'; - - var params = { - queryId: profileTarget.getParameters().queryId, - profileId: profileTarget.getParameters().id, - ids: Ext.Object.getKeys(entries) - } - - Ametys.data.ServerComm.send({ - plugin: 'queries-directory', - 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: 'query-profile', - parameters: { - id: args.profileId, - queryId: args.queryId - } - }] - }); - } - }, - - // --------------- Remove ----------------------// - - /** - * Remove the assignment for the selected users/groups for the current query 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 = { - queryId: profileTarget.getParameters().queryId, - profileId: profileTarget.getParameters().id, - userIds: userIds, - groupIds: groupIds - } - - if (userIds.length > 0 || groupIds.length > 0) - { - Ametys.data.ServerComm.send({ - plugin: 'queries-directory', - 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: 'query-profile', - parameters: { - id: args.profileId, - queryId: args.queryId - } - }] - }); - } - } -}); Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/actions/QueryRightsActions.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-queries-directory/resources/js/Ametys/plugins/queriesdirectory/helper/ChooseQuery.i18n.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/helper/ChooseQuery.i18n.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/helper/ChooseQuery.i18n.js (working copy) @@ -1,265 +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 query in WRITE access from a combo list - * @private - */ -Ext.define('Ametys.plugins.queriesdirectory.helper.ChooseQuery', { - singleton: true, - - /** - * @property {String} The id of the last selected query. - * @private - */ - _lastSelectedQueryId: 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 query - */ - - constructor: function() - { - this.callParent(arguments); - Ametys.message.MessageBus.on(Ametys.message.Message.SELECTION_CHANGED, this._onSelectionChanged, this); - }, - - /** - * Open the dialog box to choose a query in WRITE access - * @param {Object} config The configuration options: - * @param {String} config.type The type of the query - * @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 query selection - */ - act: function(config) - { - this._cbFn = config.callback; - this._type = config.type; - this._params = config.params || {}; - - 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('queries-directory') + "/img/query_16.png", - - cls: 'ametys-dialogbox query', - width: 430, - layout: { - type: 'vbox', - align: 'stretch' - }, - - items : [{ - xtype: 'component', - cls: 'text', - html: helpMessage || "" - }, - { - xtype: 'combobox', - fieldLabel : "", - labelWidth: 60, - labelAlign: 'right', - labelSeparator: '', - name :'query', - - 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-query', - 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('queries-directory') + "/img/query_16.png"); - this._box.setTitle(title || ""); - this._box.items.getAt(0).update(helpMessage || ""); - } - return true; - }, - - /** - * Function to create a new query - */ - _createQuery: function () - { - this._box.hide(); - Ametys.plugins.queriesdirectory.helper.CreateOrEditQuery.act('new', this._type, this._params); - }, - - /** - * Creates the query store - * @return {Ext.data.Store} The query store - * @private - */ - _createStore: function() - { - - return Ext.create('Ext.data.Store', { - model: 'Ametys.plugins.queriesdirectory.tool.QueriesTool.QueryEntry', - sortOnLoad: true, - sorters: [{property: 'title', direction:'ASC'}], - - proxy: { - type: 'ametys', - plugin: 'queries-directory', - url: 'queries/list.xml', - extraParams: {profile: 'write_access'}, - reader: { - type: 'xml', - root: 'queries', - record: '> query' - } - }, - autoLoad: true - }); - }, - - /** - * @private - * Initialize fields - */ - _initForm: function () - { - if (!this._clickEventRegistered) - { - var action = this._box.items.getAt(3); - action.mon(action.getEl(), 'click', this._createQuery, this, {delegate: 'a.action'}); - this._clickEventRegistered = true; - } - - this._store.load({callback: this._onLoadQueries, scope: this}); - - }, - - /** - * Callback function called after queries are loaded - * @private - */ - _onLoadQueries: 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._lastSelectedQueryId); - } - - }, - - /** - * The ok button handler. Will call the callback when query 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 query id. - * @param {Ametys.message.Message} message The selection message. - * @private - */ - _onSelectionChanged: function (message) - { - var target = message.getTarget('query'); - if (target != null) - { - this._lastSelectedQueryId = target.getParameters().id; - } - } - -}); - Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/helper/ChooseQuery.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/helper/ChooseQuery.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/helper/ChooseQuery.js (working copy) @@ -184,7 +184,7 @@ extraParams: {profile: 'write_access'}, reader: { type: 'xml', - root: 'queries', + rootProperty: 'queries', record: '> query' } }, Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/helper/CreateOrEditQuery.i18n.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/helper/CreateOrEditQuery.i18n.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/helper/CreateOrEditQuery.i18n.js (working copy) @@ -1,258 +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 QUERY. - * @private - */ -Ext.define('Ametys.plugins.queriesdirectory.helper.CreateOrEditQuery', { - 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 query, "edit" to edit a query - * @param {String} type The type of the query - * @param {Object} params The query parameters. Can be null for creation. - * @param {String} params.id The id of query to edit. Can not be null if mode is 'edit'. - * @param {String} params.title The query title - * @param {String} params.description The query description - * @param {Function} callback The callback on successful creation/modification of the query. The arguments are: - * @param {Function} callback.id The query of the created or modified query - */ - act: function (mode, type, params, callback) - { - this._mode = mode; - this._type = type; - this._cbFn = callback; - this._params = params || {}; - - if (!this._delayedInitialize()) - { - return false; - } - - this._box.setTitle(mode == 'edit' ? "" : ""); - this._box.setIcon(mode == 'edit' ? Ametys.getPluginResourcesPrefix('queries-directory') + "/img/actions/edit_16.png" : Ametys.getPluginResourcesPrefix('queries-directory') + "/img/queries_16.png"); - - this._box.show(); - this._initForm(params); - }, - - /** - * @private - * Initialize the dialog box. - */ - _delayedInitialize: function () - { - if (!this._initialized) - { - 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('queries-directory') + "/img/queries_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 this._initialized; - }, - - /** - * @private - * Initialize the box form - * @param {Object} params The query 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 content = Ext.JSON.decode(this._params.content); - var toolRole = content.toolRole; - - var params = { - title: form.findField('title').getValue(), - description: form.findField('description').getValue(), - id: this._params.id || null, - type: this._type - } - - Ext.applyIf(params, this._params); - - var url = this._mode == 'edit' ? 'query/update' : 'query/create'; - - Ametys.data.ServerComm.send({ - plugin: 'queries-directory', - url: url, - parameters: params, - priority: Ametys.data.ServerComm.PRIORITY_MAJOR, - waitMessage: true, - errorMessage: true, - callback: { - handler: this._onCreated, - scope: this, - arguments: params - } - }); - }, - - /** - * Sends the corresponding message on the bus on successful query creation/modification - * @param {Object} response The server response - * @param {Object} params The callback arguments - * @private - */ - _onCreated: function(response, params) - { - var errorMsg = this._mode == 'edit' ? "" : ""; - if (Ametys.data.ServerComm.handleBadResponse(errorMsg, response, 'Ametys.plugins.queriesdirectory.helper.CreateOrEditQuery')) - { - 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 queryId = Ext.dom.Query.selectValue('ActionResult > id', response); - - if (messageType == Ametys.message.Message.MODIFIED) - { - Ametys.plugins.queriesdirectory.QueriesDAO.localUpdate(queryId, { - title: params.title, - description: params.description - }); - } - - Ext.create("Ametys.message.Message", { - type: messageType, - targets: { - type: 'query', - parameters: { - id: queryId - } - } - }); - } - - if (Ext.isFunction(this._cbFn)) - { - this._cbFn(); - } - } - -}); - Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/model/AdvancedQuery.i18n.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/model/AdvancedQuery.i18n.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/model/AdvancedQuery.i18n.js (working copy) @@ -1,73 +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. - */ - -/** - * This class is the advanced query model. - * @private - */ -Ext.define('Ametys.plugins.queriesdirectory.model.AdvancedQuery', { - extend: 'Ametys.plugins.queriesdirectory.model.AbstractQuery', - - statics: - { - /** - * @property {String} QUERY_TYPE=advanced The type of query - */ - QUERY_TYPE: 'advanced' - }, - - /** - * @inheritdoc - */ - getTypeLabel: function () - { - return ""; - }, - - /** - * @inheritdoc - */ - open : function() - { - var content = Ext.JSON.decode(this.content); - - var toolRole = content.toolRole; - var toolParams = content.toolParams || {}; - toolParams.expanded = true; - toolParams.advancedMode = true; - toolParams.readOnly = this.readOnly; - - Ametys.tool.ToolsManager.openTool(toolRole, toolParams); - }, - - /** - * @inheritdoc - */ - execute : function() - { - var content = Ext.JSON.decode(this.content); - - var toolRole = content.toolRole; - var toolParams = content.toolParams || {}; - toolParams.advancedMode = true; - toolParams.startSearchAtOpening = true; - toolParams.readOnly = this.readOnly; - - Ametys.tool.ToolsManager.openTool(toolRole, toolParams); - } -}); - -Ametys.plugins.queriesdirectory.model.QueryFactory.registerQuery (Ametys.plugins.queriesdirectory.model.AdvancedQuery.QUERY_TYPE, Ametys.plugins.queriesdirectory.model.AdvancedQuery); \ No newline at end of file Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/model/ScriptQuery.i18n.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/model/ScriptQuery.i18n.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/model/ScriptQuery.i18n.js (working copy) @@ -1,80 +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. - */ - -/** - * This class is the script query model. - * @private - */ -Ext.define('Ametys.plugins.queriesdirectory.model.ScriptQuery', { - extend: 'Ametys.plugins.queriesdirectory.model.AbstractQuery', - - statics: - { - /** - * @property {String} QUERY_TYPE=script The type of query - */ - QUERY_TYPE: 'script' - }, - - /** - * @inheritdoc - */ - getTypeLabel: function () - { - return ""; - }, - - /** - * @inheritdoc - */ - open : function() - { - var content = Ext.JSON.decode(this.content); - - var toolRole = content.toolRole; - var toolParams = content.toolParams || {}; - toolParams.expanded = true; - toolParams.readOnly = this.readOnly; - - if (this.title) - { - toolParams.title = this.title; - } - - Ametys.tool.ToolsManager.openTool(toolRole, toolParams); - }, - - /** - * @inheritdoc - */ - execute : function() - { - var content = Ext.JSON.decode(this.content); - - var toolRole = content.toolRole; - var toolParams = content.toolParams || {}; - toolParams.readOnly = this.readOnly; - - if (this.title) - { - toolParams.title = this.title; - } - - Ametys.tool.ToolsManager.openTool(toolRole, toolParams); - } -}); - -Ametys.plugins.queriesdirectory.model.QueryFactory.registerQuery (Ametys.plugins.queriesdirectory.model.ScriptQuery.QUERY_TYPE, Ametys.plugins.queriesdirectory.model.ScriptQuery); \ No newline at end of file Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/model/SimpleQuery.i18n.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/model/SimpleQuery.i18n.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/model/SimpleQuery.i18n.js (working copy) @@ -1,71 +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. - */ - -/** - * This class is the simple query model. - * @private - */ -Ext.define('Ametys.plugins.queriesdirectory.model.SimpleQuery', { - extend: 'Ametys.plugins.queriesdirectory.model.AbstractQuery', - - statics: - { - /** - * @property {String} QUERY_TYPE=simple The type of query - */ - QUERY_TYPE: 'simple' - }, - - /** - * @inheritdoc - */ - getTypeLabel: function () - { - return ""; - }, - - /** - * @inheritdoc - */ - open : function() - { - var content = Ext.JSON.decode(this.content); - - var toolRole = content.toolRole; - var toolParams = content.toolParams || {}; - toolParams.expanded = true; - toolParams.readOnly = this.readOnly; - - Ametys.tool.ToolsManager.openTool(toolRole, toolParams); - }, - - /** - * @inheritdoc - */ - execute : function() - { - var content = Ext.JSON.decode(this.content); - - var toolRole = content.toolRole; - var toolParams = content.toolParams || {}; - toolParams.startSearchAtOpening = true; - toolParams.readOnly = this.readOnly; - - Ametys.tool.ToolsManager.openTool(toolRole, toolParams); - } -}); - -Ametys.plugins.queriesdirectory.model.QueryFactory.registerQuery (Ametys.plugins.queriesdirectory.model.SimpleQuery.QUERY_TYPE, Ametys.plugins.queriesdirectory.model.SimpleQuery); Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/model/SqlQuery.i18n.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/model/SqlQuery.i18n.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/model/SqlQuery.i18n.js (working copy) @@ -1,70 +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. - */ - -/** - * This class is the sql query model. - * @private - */ -Ext.define('Ametys.plugins.queriesdirectory.model.SqlQuery', { - extend: 'Ametys.plugins.queriesdirectory.model.AbstractQuery', - - statics : - { - /** - * @property {String} QUERY_TYPE=simple The type of query - */ - QUERY_TYPE: 'sql' - }, - - /** - * @inheritdoc - */ - getTypeLabel: function () - { - return ""; - }, - - /** - * @inheritdoc - */ - open : function() - { - var content = Ext.JSON.decode(this.content); - - var toolRole = content.toolRole; - var toolParams = content.toolParams || {}; - toolParams.expanded = true; - toolParams.readOnly = this.readOnly; - - Ametys.tool.ToolsManager.openTool(toolRole, toolParams); - }, - - /** - * @inheritdoc - */ - execute : function() - { - var content = Ext.JSON.decode(this.content); - - var toolRole = content.toolRole; - var toolParams = content.toolParams || {}; - toolParams.readOnly = this.readOnly; - - Ametys.tool.ToolsManager.openTool(toolRole, toolParams); - } -}); - -Ametys.plugins.queriesdirectory.model.QueryFactory.registerQuery (Ametys.plugins.queriesdirectory.model.SqlQuery.QUERY_TYPE, Ametys.plugins.queriesdirectory.model.SqlQuery); \ No newline at end of file Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueriesTool.i18n.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueriesTool.i18n.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueriesTool.i18n.js (working copy) @@ -1,309 +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. - */ - -/** - * This tool displays all queries in READ access for current user - * @private - */ -Ext.define('Ametys.plugins.queriesdirectory.tool.QueriesTool', { - extend: "Ametys.tool.Tool", - - /** - * @property {Ext.grid.Panel} _grid The grid panel displaying the queries - * @private - */ - /** - * @property {Ext.data.Store} _store The queries store - */ - - constructor: function(config) - { - this.callParent(arguments); - - Ametys.message.MessageBus.on(Ametys.message.Message.CREATED, this._onQueryCreated, this); - Ametys.message.MessageBus.on(Ametys.message.Message.MODIFIED, this._onQueryUpdated, this); - Ametys.message.MessageBus.on(Ametys.message.Message.DELETED, this._onQueryDeleted, this); - }, - - getMBSelectionInteraction: function() - { - return Ametys.tool.Tool.MB_TYPE_ACTIVE; - }, - - sendCurrentSelection: function() - { - var queryIds = []; - - var selection = this.grid.getSelectionModel().getSelection(); - for (var i=0; i < selection.length; i++) - { - queryIds.push(selection[i].getId()); - } - - Ext.create("Ametys.message.Message", { - type: Ametys.message.Message.SELECTION_CHANGED, - targets: { - type: 'query', - parameters: { ids: queryIds } - } - }); - }, - - setParams: function (params) - { - this.callParent(arguments); - this.refresh(); - }, - - 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: 170, sortable: true, dataIndex: 'title', renderer: Ext.bind(this._renderTitle, this)}, - {header: "", width: 50, sortable: true, dataIndex: 'type', renderer: Ext.bind(this._renderType, this)}, - {header: "", hidden: true, width: 180, sortable: true, dataIndex: 'description'}, - {header: "", hidden: false, width: 110, sortable: true, dataIndex: 'authorFullName'}, - {header: "", hidden: false, width: 110, sortable: true, dataIndex: 'lastModificationDate', renderer: Ext.util.Format.dateRenderer(Ext.Date.patterns.FriendlyDateTime)}, - {header: "", hidden: true, width: 100, sortable: true, dataIndex: 'visibility', renderer: Ext.bind(this._renderVisibility, this)} - ], - - selModel : { - mode: 'MULTI' - }, - - 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 ""; - case 3: - return ""; - default: - return name; - } - } - } - ) - }], - - listeners: { - selectionchange: Ext.bind(this.sendCurrentSelection, this), - itemdblclick: {fn: this._executeQuery, scope: this} - } - }); - - return this.grid; - }, - - /** - * Listener on double-click. Executes the query. - * @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 - */ - _executeQuery: function(view, record, item, index) - { - var type = record.get('type'); - var content = record.get('content'); - var title = record.get('title'); - - var readOnly = !record.get('canWrite'); - - var query = Ametys.plugins.queriesdirectory.model.QueryFactory.create(type, content, title, readOnly); - query.execute(); - }, - - /** - * Creates the queries directory store - * @return {Ext.data.Store} The query store - */ - createStore: function() - { - this._store = Ext.create('Ext.data.Store', { - model: 'Ametys.plugins.queriesdirectory.tool.QueriesTool.QueryEntry', - sorters: [{property: 'title', direction:'ASC'}], - groupField: 'group', - - proxy: { - type: 'ametys', - plugin: 'queries-directory', - url: 'queries/list.xml', - reader: { - type: 'xml', - root: 'queries', - record: '> query' - } - }, - autoLoad: true - }); - - return this._store; - }, - - refresh: function() - { - this.showRefreshing(); - - this.grid.getStore().load({ - scope: this, - callback: this.showRefreshed - }); - }, - - /** - * Function to render query'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 - */ - _renderTitle: 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 query'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 ""; - } - }, - - /** - * Function to render query's type in result grid - * @param {Object} value The type value - * @param {Object} metaData A collection of metadata about the current cell - * @param {Ext.data.Model} record The record - * @private - */ - _renderType: function(value, metaData, record) - { - try - { - var query = Ametys.plugins.queriesdirectory.model.QueryFactory.create(value, {}); - return query.getTypeLabel(); - } - catch (e) - { - return value; - } - }, - - /** - * Listener when queries have been created - * Will set the tool in "out of date" mode - * @param {Ametys.message.Message} message The creation message. - * @private - */ - _onQueryCreated: function(message) - { - var targets = message.getTargets("query"); - - if (targets.length > 0) - { - this.showOutOfDate(); - } - }, - - /** - * Listener when queries have been edited - * Will set the tool in "out of date" mode - * @param {Ametys.message.Message} message The edition message. - * @private - */ - _onQueryUpdated: function(message) - { - var targets = message.getTargets("query"); - - if (targets.length > 0) - { - this.showOutOfDate(message.getParameters().major == true); - } - }, - - /** - * Listener when queries have been deleted - * Will remove the records if present - * @param {Ametys.message.Message} message The deletion message. - * @private - */ - _onQueryDeleted: function (message) - { - var targets = message.getTargets('query'); - 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); - } - } - -}); \ No newline at end of file Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueriesTool.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueriesTool.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueriesTool.js (working copy) @@ -100,7 +100,7 @@ { formatName: function(name) { - switch (name) + switch (parseInt(name)) { case 0: return ""; @@ -164,7 +164,7 @@ url: 'queries/list.xml', reader: { type: 'xml', - root: 'queries', + rootProperty: 'queries', record: '> query' } }, Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueriesTool/QueryEntry.i18n.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueriesTool/QueryEntry.i18n.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueriesTool/QueryEntry.i18n.js (working copy) @@ -1,58 +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 query entries. - * @private - */ -Ext.define('Ametys.plugins.queriesdirectory.tool.QueriesTool.QueryEntry', { - extend: 'Ext.data.Model', - - fields: [ - {name: 'id', mapping: '@id'}, - {name: 'type', mapping: 'type', type: 'string', sortType: Ext.data.SortTypes.asNonAccentedUCString}, - {name: 'title', mapping: 'title', type: 'string', sortType: Ext.data.SortTypes.asNonAccentedUCString}, - {name: 'visibility', mapping: 'visibility'}, - {name: 'isAdministrator', mapping: 'isAdministrator', type: 'boolean'}, - {name: 'id', mapping: '@id'}, - {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 if (record.get('visibility') == 'public') - { - return 2; // Public cart - } - else if (record.get('isAdministrator')) - { - return 3; // Other queries with admin rights - } - }}, - {name: 'lastModificationDate', mapping: 'lastModificationDate', type:'date', dateFormat:'c'}, - {name: 'description', mapping: 'description', type:' string', sortType: Ext.data.SortTypes.asNonAccentedUCString}, - {name: 'content', mapping: 'content', type: 'string', sortType: Ext.data.SortTypes.asNonAccentedUCString}, - {name: 'authorLogin', mapping: 'authorLogin'}, - {name: 'authorFullName', mapping: 'authorFullName', type: 'string', sortType: Ext.data.SortTypes.asNonAccentedUCString}, - {name: 'canRead', type: 'boolean'}, - {name: 'canWrite', type: 'boolean'} - ] -}); Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueriesTool/QueryEntry.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueriesTool/QueryEntry.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueriesTool/QueryEntry.js (working copy) @@ -29,26 +29,26 @@ {name: 'visibility', mapping: 'visibility'}, {name: 'isAdministrator', mapping: 'isAdministrator', type: 'boolean'}, {name: 'id', mapping: '@id'}, - {name: 'group', convert: function (v, record) { - if (record.get('authorLogin') == Ametys.getAppParameter('user').login) + {name: 'group', 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 } - else if (record.get('visibility') == 'public') + else if (data.visibility == 'public') { return 2; // Public cart } - else if (record.get('isAdministrator')) + else if (data.isAdministrator) { return 3; // Other queries with admin rights } }}, {name: 'lastModificationDate', mapping: 'lastModificationDate', type:'date', dateFormat:'c'}, - {name: 'description', mapping: 'description', type:' string', sortType: Ext.data.SortTypes.asNonAccentedUCString}, + {name: 'description', mapping: 'description', type:'string', sortType: Ext.data.SortTypes.asNonAccentedUCString}, {name: 'content', mapping: 'content', type: 'string', sortType: Ext.data.SortTypes.asNonAccentedUCString}, {name: 'authorLogin', mapping: 'authorLogin'}, {name: 'authorFullName', mapping: 'authorFullName', type: 'string', sortType: Ext.data.SortTypes.asNonAccentedUCString}, Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueryRightsTool.i18n.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueryRightsTool.i18n.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueryRightsTool.i18n.js (working copy) @@ -1,477 +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 query. - * A contributor can add or remove users and groups in the read-only or read-write profiles. - * @private - */ -Ext.define('Ametys.plugins.queriesdirectory.tool.QueryRightsTool', { - extend: "Ametys.tool.SelectionTool", - - /** - * @property {String} _queryId id of the current query - * @private - */ - /** - * @property {String} _queryVisibility visibility level of the current query - * @private - */ - /** - * @property {String} _queryLabel title of the current query - * @private - */ - /** - * @property {String} _queryAuthor owner login of the current query - * @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: 'query-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: 'query-rights-no-selection', - html: '', - hidden: true - }, - { - xtype: 'component', - itemId: 'hint-panel', - cls: 'query-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.queriesdirectory.QueryRightsTool.QueryRightsEntry', - autoLoad: false, - - proxy: { - type: 'ametys', - plugin: 'queries-directory', - 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 -> 'query-profile' - // Subtargets are the selected groups and users : target type -> 'user' / 'group' - - var msgTargets = []; - - if (this._queryId) - { - 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: 'query-profile', - parameters: { - id: id, - queryId: me._queryId - } - } - - 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: 'query-profile', - parameters: { - id: parentId, - queryId: me._queryId - } - } - - 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 - }); - }, - - setParams: function (params) - { - this.callParent(arguments); - this.refresh(); - }, - - refresh: function() - { - // FIXME tool API -> isRefreshing - // if isRefreshing() return; - - var target = Ametys.message.MessageBus.getCurrentSelectionMessage().getTarget('query'); - 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._queryId = 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._queryId = target.getParameters().id; - this._queryVisibility = 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 query 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.queryId = this._queryId; - }, - - /** - * 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('query-profile'); - if (target != null) - { - // Do nothing - return; - } - - var target = message.getTarget('query'); - if (target == null) - { - // No more target - this.setNoSelectionMatchState(""); - } - else if (this._queryId != 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('query-profile'); - if (target != null) - { - var queryId = target.getParameters().queryId; - var profileId = target.getParameters().id; - - if (queryId == this._queryId) - { - // Reload tree - this._reloadProfileTree(profileId); - } - return; - } - - target = message.getTarget('query'); - if (target != null) - { - var queryId = target.getParameters().id; - - if (queryId == this._queryId) - { - if (target.getParameters().visibility != 'shared') - { - this.setNoSelectionMatchState(""); - } - else if (target.getParameters().authorLogin != Ametys.getAppParameter('user').login) - { - this.setNoSelectionMatchState(""); - } - else - { - this.setInMatchState (target); - if (this._queryVisibility != 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('query'); - if (target != null) - { - var queryId = target.getParameters().id; - - if (queryId == this._queryId) - { - this.setNoSelectionMatchState(""); - } - } - } -}); Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueryRightsTool.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueryRightsTool.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueryRightsTool.js (working copy) @@ -371,13 +371,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.queryId = this._queryId; + operation.setParams(operation.getParams() || {}); + operation.setParams(Ext.apply(operation.getParams(), { + queryId: this._queryId + })); }, /** Index: main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueryRightsTool/QueryRightsEntry.js =================================================================== --- main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueryRightsTool/QueryRightsEntry.js (revision 32045) +++ main/plugin-queries-directory/resources/js/Ametys/plugins/queriesdirectory/tool/QueryRightsTool/QueryRightsEntry.js (working copy) @@ -21,7 +21,7 @@ Ext.define('Ametys.plugins.queriesdirectory.QueryRightsTool.QueryRightsEntry', { 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-queries-directory/src/org/ametys/plugins/queriesdirectory/Query.java =================================================================== --- main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/Query.java (revision 32045) +++ main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/Query.java (working copy) @@ -31,8 +31,8 @@ import org.ametys.plugins.repository.AmetysRepositoryException; import org.ametys.plugins.repository.RepositoryConstants; import org.ametys.plugins.repository.jcr.DefaultAmetysObject; -import org.ametys.runtime.right.RightsManager.RightResult; -import org.ametys.runtime.util.I18nizableText; +import org.ametys.core.right.RightsManager.RightResult; +import org.ametys.core.util.I18nizableText; /** * Class representing a query, backed by a JCR node.
Index: main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/QueryFactory.java =================================================================== --- main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/QueryFactory.java (revision 32045) +++ main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/QueryFactory.java (working copy) @@ -25,7 +25,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; /** Index: main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/CreateQueryAction.java =================================================================== --- main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/CreateQueryAction.java (revision 32045) +++ main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/CreateQueryAction.java (working copy) @@ -26,7 +26,7 @@ import org.ametys.plugins.queriesdirectory.QueryFactory; import org.ametys.plugins.repository.AmetysObjectResolver; import org.ametys.plugins.repository.ModifiableTraversableAmetysObject; -import org.ametys.runtime.user.CurrentUserProvider; +import org.ametys.core.user.CurrentUserProvider; import org.apache.avalon.framework.parameters.Parameters; import org.apache.avalon.framework.service.ServiceException; import org.apache.avalon.framework.service.ServiceManager; Index: main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/DeleteQueryAction.java =================================================================== --- main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/DeleteQueryAction.java (revision 32045) +++ main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/DeleteQueryAction.java (working copy) @@ -33,8 +33,8 @@ import org.ametys.plugins.queriesdirectory.Query; 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; /** * Action to delete queries Index: main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/EditQueryAction.java =================================================================== --- main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/EditQueryAction.java (revision 32045) +++ main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/EditQueryAction.java (working copy) @@ -29,7 +29,7 @@ import org.ametys.plugins.queriesdirectory.Query; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.user.CurrentUserProvider; +import org.ametys.core.user.CurrentUserProvider; /** * Edit a {@link Query} Index: main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/GetQueryInformationAction.java =================================================================== --- main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/GetQueryInformationAction.java (revision 32045) +++ main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/GetQueryInformationAction.java (working copy) @@ -35,13 +35,13 @@ import org.ametys.plugins.queriesdirectory.Query; import org.ametys.plugins.repository.AmetysObjectResolver; import org.ametys.plugins.repository.AmetysRepositoryException; -import org.ametys.runtime.cocoon.JSonReader; -import org.ametys.runtime.right.RightsManager; -import org.ametys.runtime.right.RightsManager.RightResult; -import org.ametys.runtime.user.CurrentUserProvider; -import org.ametys.runtime.user.User; -import org.ametys.runtime.user.UsersManager; -import org.ametys.runtime.util.parameter.ParameterHelper; +import org.ametys.core.cocoon.JSonReader; +import org.ametys.core.right.RightsManager; +import org.ametys.core.right.RightsManager.RightResult; +import org.ametys.core.user.CurrentUserProvider; +import org.ametys.core.user.User; +import org.ametys.core.user.UsersManager; +import org.ametys.runtime.parameter.ParameterHelper; /** * Get queries information Index: main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/SaveAsQueryAction.java =================================================================== --- main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/SaveAsQueryAction.java (revision 32045) +++ main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/SaveAsQueryAction.java (working copy) @@ -29,7 +29,7 @@ import org.ametys.plugins.queriesdirectory.Query; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.user.CurrentUserProvider; +import org.ametys.core.user.CurrentUserProvider; /** * Edit a {@link Query} Index: main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/visibility/AssignRightsAction.java =================================================================== --- main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/visibility/AssignRightsAction.java (revision 32045) +++ main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/visibility/AssignRightsAction.java (working copy) @@ -34,7 +34,7 @@ import org.ametys.plugins.queriesdirectory.Query; import org.ametys.plugins.queriesdirectory.Query.QueryProfile; 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 Query} profile Index: main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/visibility/ChangeVisibilityAction.java =================================================================== --- main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/visibility/ChangeVisibilityAction.java (revision 32045) +++ main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/visibility/ChangeVisibilityAction.java (working copy) @@ -31,7 +31,7 @@ import org.ametys.plugins.queriesdirectory.Query; import org.ametys.plugins.queriesdirectory.Query.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 Query} Index: main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/visibility/GetQueryProfileTreeAction.java =================================================================== --- main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/visibility/GetQueryProfileTreeAction.java (revision 32045) +++ main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/visibility/GetQueryProfileTreeAction.java (working copy) @@ -35,12 +35,12 @@ import org.ametys.plugins.queriesdirectory.Query.QueryProfile; import org.ametys.plugins.queriesdirectory.Query.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 Query} Index: main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/visibility/RemoveAssignmentAction.java =================================================================== --- main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/visibility/RemoveAssignmentAction.java (revision 32045) +++ main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/actions/visibility/RemoveAssignmentAction.java (working copy) @@ -35,7 +35,7 @@ import org.ametys.plugins.queriesdirectory.Query; import org.ametys.plugins.queriesdirectory.Query.QueryProfile; 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 Query} profile Index: main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/generators/QueriesGenerator.java =================================================================== --- main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/generators/QueriesGenerator.java (revision 32045) +++ main/plugin-queries-directory/src/org/ametys/plugins/queriesdirectory/generators/QueriesGenerator.java (working copy) @@ -32,13 +32,13 @@ import org.ametys.plugins.queriesdirectory.QueryHelper; import org.ametys.plugins.repository.AmetysObjectIterable; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.group.GroupsManager; -import org.ametys.runtime.right.RightsManager; -import org.ametys.runtime.right.RightsManager.RightResult; -import org.ametys.runtime.user.CurrentUserProvider; -import org.ametys.runtime.user.User; -import org.ametys.runtime.user.UsersManager; -import org.ametys.runtime.util.parameter.ParameterHelper; +import org.ametys.core.group.GroupsManager; +import org.ametys.core.right.RightsManager; +import org.ametys.core.right.RightsManager.RightResult; +import org.ametys.core.user.CurrentUserProvider; +import org.ametys.core.user.User; +import org.ametys.core.user.UsersManager; +import org.ametys.runtime.parameter.ParameterHelper; /** * SAX queries Index: main/workspace-query/src/org/ametys/workspaces/query/GetQueryParametersAction.java =================================================================== --- main/workspace-query/src/org/ametys/workspaces/query/GetQueryParametersAction.java (revision 32045) +++ main/workspace-query/src/org/ametys/workspaces/query/GetQueryParametersAction.java (working copy) @@ -34,9 +34,9 @@ import org.ametys.plugins.queriesdirectory.Query; import org.ametys.plugins.queriesdirectory.Query.Visibility; import org.ametys.plugins.repository.AmetysObjectResolver; -import org.ametys.runtime.RuntimeConstants; import org.ametys.runtime.authentication.AccessDeniedException; -import org.ametys.runtime.util.JSONUtils; +import org.ametys.core.authentication.Authentication; +import org.ametys.core.util.JSONUtils; /** * Get query parameters from query @@ -66,7 +66,7 @@ Map result = new HashMap(); Request request = ObjectModelHelper.getRequest(objectModel); - request.setAttribute(RuntimeConstants.INTERNAL_ALLOWED_REQUEST_ATTR, true); + request.setAttribute(Authentication.INTERNAL_ALLOWED_REQUEST_ATTR, true); String queryId = request.getParameter("queryId"); String xslt = parameters.getParameter("xslt", "");