/*
* Copyright 2019 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 controls a ribbon button that will be responsible for a workflow action.
* The button will be enabled only if the workflow action is available for current selection.
* @private
*/
Ext.define('Ametys.plugins.web.content.controller.PasteContentValuesController', {
extend: 'Ametys.plugins.cms.content.controller.PasteContentValuesController',
_checkSource: function (copiedContent, params)
{
if (!this.callParent(arguments))
{
return false;
}
params['source-shared-contents'] = params['source-shared-contents'] || [];
if (copiedContent.getIsShared())
{
params['source-shared-contents'].push({
id: copiedContent.getId(),
title: copiedContent.getTitle(),
description: "'" + copiedContent.getTitle() + "'"
});
return false;
}
return true;
},
_checkTarget: function (copiedContent, target, params)
{
if (!this.callParent(arguments))
{
return false;
}
params['target-shared-contents'] = params['target-shared-contents'] || [];
if (target.getParameters().isShared)
{
params['target-shared-contents'].push({
id: target.getParameters().id,
title: target.getParameters().title,
description: "'" + target.getParameters().title + "'"
});
return false;
}
return true;
},
_updateTooltipDescription: function (description, params)
{
this.callParent(arguments);
var description = this._description;
params['source-shared-contents'] = params['source-shared-contents'] || [];
params['target-shared-contents'] = params['target-shared-contents'] || [];
description = this._handlingMultiple(description, "source-sharedcontent", params['source-shared-contents']);
description = this._handlingMultiple(description, "target-sharedcontent", params['target-shared-contents']);
this.setDescription (description);
}
});