/*
* Copyright 2015 Anyware Services
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Singleton class to handle import actions on artisteer skins and models.
* @private
*/
Ext.define('Ametys.plugins.artisteer.ImportActions', {
singleton : true,
/**
* Action called by the controller to import a new Artisteer skin
*/
importSkin: function ()
{
Ametys.plugins.web.skin.helper.ImportSkinUI.open({
url: Ametys.getPluginDirectPrefix("artisteer") + "/administrator/skin/upload",
icon: Ametys.getPluginResourcesPrefix("artisteer") + '/img/administrator/artisteer_16.png',
title: "{{i18n PLUGINS_ARTISTEER_ADMINISTRATOR_IMPORT_DIALOG_CAPTION}}",
helpMsg: "{{i18n PLUGINS_ARTISTEER_ADMINISTRATOR_IMPORT_DIALOG_HINT}}",
importErrorMsg: "{{i18n PLUGINS_ARTISTEER_ADMINISTRATOR_IMPORT_DIALOG_FILE_ERROR_DESC}}",
importFn: Ametys.plugins.web.skin.SkinActions._doImport,
existFn: Ametys.plugins.web.skin.SkinDAO.skinExists
});
},
/**
* Action called by the controller to import a new Artisteer model from a zip file
*/
importModel: function ()
{
Ametys.plugins.web.skin.helper.ImportSkinUI.open({
url: Ametys.getPluginDirectPrefix("artisteer") + '/administrator/model/upload',
icon: Ametys.getPluginResourcesPrefix("artisteer") + '/img/administrator/artisteer_16.png',
title: "{{i18n PLUGINS_ARTISTEER_ADMINISTRATOR_IMPORT_MODEL_DIALOG_CAPTION}}",
helpMsg: "{{i18n PLUGINS_ARTISTEER_ADMINISTRATOR_IMPORT_MODEL_DIALOG_HINT}}",
existFn: Ametys.plugins.skinfactory.model.SkinModelDAO.modelExists,
existConfirmTitle: "{{i18n plugin.skinfactory:PLUGINS_SKINFACTORY_SKIN_MODEL_IMPORT_TEST_EXIST_ALERT}}",
existConfirmDesc: "{{i18n plugin.skinfactory:PLUGINS_SKINFACTORY_SKIN_MODEL_IMPORT_TEST_EXIST_ALERT_DESC}}",
importFn: Ametys.plugins.skinfactory.model.SkinModelActions._doImport,
importErrorMsg: "{{i18n PLUGINS_ARTISTEER_ADMINISTRATOR_IMPORT_MODEL_DIALOG_FILE_ERROR_DESC}}",
});
},
});