BUG 6212 Way to Export Skins 2.0
Implemented a way to export Skins in 2.0
This commit is contained in:
@@ -1247,6 +1247,8 @@ $output = $outputHeader.$output;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'tar':
|
||||||
|
G::sendHeaders ( $filename , 'application/x-tar', $download, $downloadFileName ); break;
|
||||||
default :
|
default :
|
||||||
//throw new Exception ( "Unknown type of file '$file'. " );
|
//throw new Exception ( "Unknown type of file '$file'. " );
|
||||||
G::sendHeaders ( $filename , 'application/octet-stream', $download, $downloadFileName ); break;
|
G::sendHeaders ( $filename , 'application/octet-stream', $download, $downloadFileName ); break;
|
||||||
|
|||||||
@@ -1,52 +1,144 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (! isset ( $_REQUEST ['action'] )) {
|
if (!isset($_REQUEST ['action'])) {
|
||||||
$res ['success'] = 'failure';
|
$res ['success'] = 'failure';
|
||||||
$res ['message'] = 'You may request an action';
|
$res ['message'] = 'You may request an action';
|
||||||
print G::json_encode ( $res);
|
print G::json_encode($res);
|
||||||
die ();
|
die ();
|
||||||
}
|
}
|
||||||
if (! function_exists ( $_REQUEST ['action'] )) {
|
if (!function_exists($_REQUEST ['action'])) {
|
||||||
$res ['success'] = 'failure';
|
$res ['success'] = 'failure';
|
||||||
$res ['message'] = 'The requested action doesn\'t exists';
|
$res ['message'] = 'The requested action doesn\'t exists';
|
||||||
print G::json_encode ( $res );
|
print G::json_encode($res);
|
||||||
die ();
|
die ();
|
||||||
}
|
}
|
||||||
|
|
||||||
$functionName = $_REQUEST ['action'];
|
$functionName = $_REQUEST ['action'];
|
||||||
$functionParams = isset ( $_REQUEST ['params'] ) ? $_REQUEST ['params'] : array ();
|
$functionParams = isset($_REQUEST ['params']) ? $_REQUEST ['params'] : array();
|
||||||
|
|
||||||
$functionName ( $functionParams );
|
$functionName($functionParams);
|
||||||
|
|
||||||
function updatePageSize(){
|
function updatePageSize() {
|
||||||
G::LoadClass('configuration');
|
G::LoadClass('configuration');
|
||||||
$c = new Configurations();
|
$c = new Configurations();
|
||||||
$arr['pageSize'] = $_REQUEST['size'];
|
$arr['pageSize'] = $_REQUEST['size'];
|
||||||
$arr['dateSave'] = date('Y-m-d H:i:s');
|
$arr['dateSave'] = date('Y-m-d H:i:s');
|
||||||
$config = Array();
|
$config = Array();
|
||||||
$config[] = $arr;
|
$config[] = $arr;
|
||||||
$c->aConfig = $config;
|
$c->aConfig = $config;
|
||||||
$c->saveConfig('calendarList', 'pageSize','',$_SESSION['USER_LOGGED']);
|
$c->saveConfig('skinsList', 'pageSize', '', $_SESSION['USER_LOGGED']);
|
||||||
echo '{success: true}';
|
echo '{success: true}';
|
||||||
}
|
}
|
||||||
function skinList(){
|
|
||||||
//Get Skin Config files
|
|
||||||
$skinListArray=array();
|
|
||||||
$customSkins=glob(PATH_CUSTOM_SKINS."*/config.xml");
|
|
||||||
$configurationFile = G::ExpandPath( "skinEngine" ).'base'.PATH_SEP.'config.xml';
|
|
||||||
array_unshift($customSkins,$configurationFile);
|
|
||||||
|
|
||||||
//Read and parse each Configuration File
|
function skinList() {
|
||||||
foreach($customSkins as $key => $configInformation){
|
//Get Skin Config files
|
||||||
$xmlConfiguration = file_get_contents ( $configInformation );
|
$skinListArray = array();
|
||||||
$xmlConfigurationObj=G::xmlParser($xmlConfiguration);
|
$customSkins = glob(PATH_CUSTOM_SKINS . "*/config.xml");
|
||||||
$skinInformationArray=$skinFilesArray=$xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['information']['__CONTENT__'];
|
$configurationFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'config.xml';
|
||||||
|
array_unshift($customSkins, $configurationFile);
|
||||||
|
|
||||||
$res=array();
|
//Read and parse each Configuration File
|
||||||
foreach($skinInformationArray as $keyInfo => $infoValue){
|
foreach ($customSkins as $key => $configInformation) {
|
||||||
$res['SKIN_'.strtoupper($keyInfo)]=$infoValue['__VALUE__'];
|
|
||||||
}
|
$folderId = str_replace(G::ExpandPath("skinEngine") . 'base', "", str_replace(PATH_CUSTOM_SKINS, "", str_replace("/config.xml", "", $configInformation)));
|
||||||
$skinListArray['skins'][]=$res;
|
if ($folderId == "")
|
||||||
|
$folderId = "classic";
|
||||||
|
$xmlConfiguration = file_get_contents($configInformation);
|
||||||
|
$xmlConfigurationObj = G::xmlParser($xmlConfiguration);
|
||||||
|
$skinInformationArray = $skinFilesArray = $xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['information']['__CONTENT__'];
|
||||||
|
|
||||||
|
$res = array();
|
||||||
|
$res['SKIN_FOLDER_ID'] = strtolower($folderId);
|
||||||
|
foreach ($skinInformationArray as $keyInfo => $infoValue) {
|
||||||
|
$res['SKIN_' . strtoupper($keyInfo)] = $infoValue['__VALUE__'];
|
||||||
}
|
}
|
||||||
print_r(G::json_encode($skinListArray));
|
$skinListArray['skins'][] = $res;
|
||||||
|
}
|
||||||
|
print_r(G::json_encode($skinListArray));
|
||||||
|
}
|
||||||
|
|
||||||
|
function createSkin($baseSkin='classic') {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function exportSkin($skinToExport) {
|
||||||
|
try {
|
||||||
|
if (!isset($_REQUEST['SKIN_FOLDER_ID'])) {
|
||||||
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_NAME_REUIRED')) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$skinName = $_REQUEST['SKIN_FOLDER_ID'];
|
||||||
|
|
||||||
|
$customSkins = glob(PATH_CUSTOM_SKINS . "*/config.xml");
|
||||||
|
|
||||||
|
$skinFolderBase = PATH_CUSTOM_SKINS . $skinName;
|
||||||
|
$skinFolder = $skinFolderBase . PATH_SEP;
|
||||||
|
$skinTar = PATH_CUSTOM_SKINS . $skinName . '.tar';
|
||||||
|
if (!is_dir($skinFolder)) {
|
||||||
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_DOESNT_EXIST')) );
|
||||||
|
}
|
||||||
|
if (!file_exists($skinFolder . "config.xml")) {
|
||||||
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_CONFIGFILE_DOESNT_EXIST')) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists($skinTar)) {
|
||||||
|
//try to delete
|
||||||
|
if (!unlink($skinTar)) {
|
||||||
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_FOLDER_PERMISSIONS')) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Try to generate tar file
|
||||||
|
|
||||||
|
G::LoadThirdParty('pear/Archive', 'Tar');
|
||||||
|
$tar = new Archive_Tar($skinTar);
|
||||||
|
$tar->_compress = false;
|
||||||
|
|
||||||
|
addTarFolder($tar, $skinFolder, PATH_CUSTOM_SKINS);
|
||||||
|
// $aFiles = $tar->listContent();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$response['success'] = true;
|
||||||
|
$response['message'] = $skinTar;
|
||||||
|
|
||||||
|
|
||||||
|
print_r(G::json_encode($response));
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$response['success'] = false;
|
||||||
|
$response['message'] = $e->getMessage();
|
||||||
|
print_r(G::json_encode($response));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function streamSkin() {
|
||||||
|
$skinTar = $_REQUEST['file'];
|
||||||
|
$bDownload = true;
|
||||||
|
G::streamFile($skinTar, $bDownload, basename($skinTar));
|
||||||
|
@unlink($fileTar);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addTarFolder($tar, $pathBase, $pluginHome) {
|
||||||
|
$aux = explode(PATH_SEP, $pathBase);
|
||||||
|
if ($aux[count($aux) - 2] == '.svn')
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ($handle = opendir($pathBase)) {
|
||||||
|
while (false !== ($file = readdir($handle))) {
|
||||||
|
if (is_file($pathBase . $file)) {
|
||||||
|
//print "file $file \n";
|
||||||
|
$tar->addModify($pathBase . $file, '', $pluginHome);
|
||||||
|
}
|
||||||
|
if (is_dir($pathBase . $file) && $file != '..' && $file != '.') {
|
||||||
|
//print "dir $pathBase$file \n";
|
||||||
|
addTarFolder($tar, $pathBase . $file . PATH_SEP, $pluginHome);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,44 +5,44 @@
|
|||||||
|
|
||||||
//Keyboard Events
|
//Keyboard Events
|
||||||
new Ext.KeyMap(document, [
|
new Ext.KeyMap(document, [
|
||||||
{
|
{
|
||||||
key: Ext.EventObject.F5,
|
key: Ext.EventObject.F5,
|
||||||
fn: function(keycode, e) {
|
fn: function(keycode, e) {
|
||||||
if (! e.ctrlKey) {
|
if (! e.ctrlKey) {
|
||||||
if (Ext.isIE) {
|
if (Ext.isIE) {
|
||||||
// IE6 doesn't allow cancellation of the F5 key, so trick it into
|
// IE6 doesn't allow cancellation of the F5 key, so trick it into
|
||||||
// thinking some other key was pressed (backspace in this case)
|
// thinking some other key was pressed (backspace in this case)
|
||||||
e.browserEvent.keyCode = 8;
|
e.browserEvent.keyCode = 8;
|
||||||
}
|
}
|
||||||
e.stopEvent();
|
e.stopEvent();
|
||||||
document.location = document.location;
|
document.location = document.location;
|
||||||
}else{
|
}else{
|
||||||
Ext.Msg.alert('Refresh', 'You clicked: CTRL-F5');
|
Ext.Msg.alert('Refresh', 'You clicked: CTRL-F5');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
key: Ext.EventObject.DELETE,
|
key: Ext.EventObject.DELETE,
|
||||||
fn: function(k,e){
|
fn: function(k,e){
|
||||||
iGrid = Ext.getCmp('infoGrid');
|
iGrid = Ext.getCmp('infoGrid');
|
||||||
rowSelected = iGrid.getSelectionModel().getSelected();
|
rowSelected = iGrid.getSelectionModel().getSelected();
|
||||||
if (rowSelected){
|
if (rowSelected){
|
||||||
DeleteButtonAction();
|
DeleteButtonAction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: Ext.EventObject.F2,
|
key: Ext.EventObject.F2,
|
||||||
fn: function(k,e){
|
fn: function(k,e){
|
||||||
iGrid = Ext.getCmp('infoGrid');
|
iGrid = Ext.getCmp('infoGrid');
|
||||||
rowSelected = iGrid.getSelectionModel().getSelected();
|
rowSelected = iGrid.getSelectionModel().getSelected();
|
||||||
if (rowSelected){
|
if (rowSelected){
|
||||||
EditCalendarAction();
|
EditCalendarAction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var store;
|
var store;
|
||||||
var cmodel;
|
var cmodel;
|
||||||
@@ -107,7 +107,7 @@ Ext.onReady(function(){
|
|||||||
exportButton = new Ext.Action({
|
exportButton = new Ext.Action({
|
||||||
text: _('ID_EXPORT'),
|
text: _('ID_EXPORT'),
|
||||||
iconCls: 'button_menu_ext ss_sprite ss_basket_go',
|
iconCls: 'button_menu_ext ss_sprite ss_basket_go',
|
||||||
//handler: CopyButtonAction,
|
handler: exportSkin,
|
||||||
disabled: true
|
disabled: true
|
||||||
});
|
});
|
||||||
searchButton = new Ext.Action({
|
searchButton = new Ext.Action({
|
||||||
@@ -149,9 +149,12 @@ Ext.onReady(function(){
|
|||||||
singleSelect: true,
|
singleSelect: true,
|
||||||
listeners:{
|
listeners:{
|
||||||
rowselect: function(sm){
|
rowselect: function(sm){
|
||||||
//exportButton.enable();
|
|
||||||
exportButton.disable();
|
|
||||||
rowSelected = infoGrid.getSelectionModel().getSelected();
|
rowSelected = infoGrid.getSelectionModel().getSelected();
|
||||||
|
if((rowSelected.data.SKIN_FOLDER_ID)&&((rowSelected.data.SKIN_FOLDER_ID!="classic"))){
|
||||||
|
exportButton.enable();
|
||||||
|
}else{
|
||||||
|
exportButton.disable();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
rowdeselect: function(sm){
|
rowdeselect: function(sm){
|
||||||
exportButton.disable();
|
exportButton.disable();
|
||||||
@@ -167,14 +170,38 @@ Ext.onReady(function(){
|
|||||||
root: 'skins',
|
root: 'skins',
|
||||||
totalProperty: 'total_skins',
|
totalProperty: 'total_skins',
|
||||||
fields : [
|
fields : [
|
||||||
{name : 'SKIN_ID'},
|
{
|
||||||
{name : 'SKIN_NAME'},
|
name : 'SKIN_ID'
|
||||||
{name : 'SKIN_DESCRIPTION'},
|
},
|
||||||
{name : 'SKIN_AUTHOR'},
|
|
||||||
{name : 'SKIN_CREATEDATE'},
|
{
|
||||||
{name : 'SKIN_MODIFIEDDATE'},
|
name : 'SKIN_FOLDER_ID'
|
||||||
{name : 'SKIN_STATUS'}
|
},
|
||||||
]
|
|
||||||
|
{
|
||||||
|
name : 'SKIN_NAME'
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name : 'SKIN_DESCRIPTION'
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name : 'SKIN_AUTHOR'
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name : 'SKIN_CREATEDATE'
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name : 'SKIN_MODIFIEDDATE'
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name : 'SKIN_STATUS'
|
||||||
|
}
|
||||||
|
]
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -184,14 +211,51 @@ Ext.onReady(function(){
|
|||||||
sortable: true
|
sortable: true
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
{id:'SKIN_UID', dataIndex: 'SKIN_UID', hidden:true, hideable:false},
|
{
|
||||||
{header: _('ID_NAME'), dataIndex: 'SKIN_NAME', width: 100, align:'left'},
|
id:'SKIN_UID',
|
||||||
{header: _('ID_DESCRIPTION'), dataIndex: 'SKIN_DESCRIPTION', width: 200, align:'left'},
|
dataIndex: 'SKIN_UID',
|
||||||
{header: _('ID_OWNER'), dataIndex: 'SKIN_AUTHOR', width: 69, align:'center'},
|
hidden:true,
|
||||||
{header: _('ID_CREATE'), dataIndex: 'SKIN_CREATEDATE', width: 69, align:'center', renderer: showdate},
|
hideable:false
|
||||||
{header: _('ID_UPDATE_DATE'), dataIndex: 'SKIN_MODIFIEDDATE', width: 69, align:'center', renderer: showdate}
|
},
|
||||||
//{header: _('ID_STATUS'), dataIndex: 'SKIN_STATUS', width: 130, align:'center', renderer: render_status},
|
|
||||||
]
|
{
|
||||||
|
header: _('ID_NAME'),
|
||||||
|
dataIndex: 'SKIN_NAME',
|
||||||
|
width: 100,
|
||||||
|
align:'left'
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
header: _('ID_DESCRIPTION'),
|
||||||
|
dataIndex: 'SKIN_DESCRIPTION',
|
||||||
|
width: 200,
|
||||||
|
align:'left'
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
header: _('ID_OWNER'),
|
||||||
|
dataIndex: 'SKIN_AUTHOR',
|
||||||
|
width: 69,
|
||||||
|
align:'center'
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
header: _('ID_CREATE'),
|
||||||
|
dataIndex: 'SKIN_CREATEDATE',
|
||||||
|
width: 69,
|
||||||
|
align:'center',
|
||||||
|
renderer: showdate
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
header: _('ID_UPDATE_DATE'),
|
||||||
|
dataIndex: 'SKIN_MODIFIEDDATE',
|
||||||
|
width: 69,
|
||||||
|
align:'center',
|
||||||
|
renderer: showdate
|
||||||
|
}
|
||||||
|
//{header: _('ID_STATUS'), dataIndex: 'SKIN_STATUS', width: 130, align:'center', renderer: render_status},
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
storePageSize = new Ext.data.SimpleStore({
|
storePageSize = new Ext.data.SimpleStore({
|
||||||
@@ -226,7 +290,7 @@ Ext.onReady(function(){
|
|||||||
displayInfo: true,
|
displayInfo: true,
|
||||||
displayMsg: _('ID_GRID_PAGE_DISPLAYING_SKIN_MESSAGE') + ' ',
|
displayMsg: _('ID_GRID_PAGE_DISPLAYING_SKIN_MESSAGE') + ' ',
|
||||||
emptyMsg: _('ID_GRID_PAGE_NO_SKIN_MESSAGE')//,
|
emptyMsg: _('ID_GRID_PAGE_NO_SKIN_MESSAGE')//,
|
||||||
//items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]
|
//items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -250,7 +314,9 @@ Ext.onReady(function(){
|
|||||||
store: store,
|
store: store,
|
||||||
cm: cmodel,
|
cm: cmodel,
|
||||||
sm: smodel,
|
sm: smodel,
|
||||||
tbar: [newButton, '-', importButton,exportButton, {xtype: 'tbfill'}, searchText,clearTextButton,searchButton],
|
tbar: [newButton, '-', importButton,exportButton, {
|
||||||
|
xtype: 'tbfill'
|
||||||
|
}, searchText,clearTextButton,searchButton],
|
||||||
bbar: bbarpaging,
|
bbar: bbarpaging,
|
||||||
listeners: {
|
listeners: {
|
||||||
rowdblclick: DoNothing
|
rowdblclick: DoNothing
|
||||||
@@ -262,14 +328,16 @@ Ext.onReady(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
infoGrid.on('rowcontextmenu',
|
infoGrid.on('rowcontextmenu',
|
||||||
function (grid, rowIndex, evt) {
|
function (grid, rowIndex, evt) {
|
||||||
var sm = grid.getSelectionModel();
|
var sm = grid.getSelectionModel();
|
||||||
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
|
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
|
||||||
},
|
},
|
||||||
this
|
this
|
||||||
);
|
);
|
||||||
|
|
||||||
infoGrid.on('contextmenu', function(evt){evt.preventDefault();}, this);
|
infoGrid.on('contextmenu', function(evt){
|
||||||
|
evt.preventDefault();
|
||||||
|
}, this);
|
||||||
infoGrid.addListener('rowcontextmenu',onMessageContextMenu, this);
|
infoGrid.addListener('rowcontextmenu',onMessageContextMenu, this);
|
||||||
infoGrid.store.load();
|
infoGrid.store.load();
|
||||||
|
|
||||||
@@ -277,11 +345,12 @@ Ext.onReady(function(){
|
|||||||
layout: 'fit',
|
layout: 'fit',
|
||||||
autoScroll: false,
|
autoScroll: false,
|
||||||
items: [
|
items: [
|
||||||
infoGrid
|
infoGrid
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//Function format dates
|
//Function format dates
|
||||||
showdate = function (value){
|
showdate = function (value){
|
||||||
return _DF(value);
|
return _DF(value);
|
||||||
@@ -297,6 +366,51 @@ onMessageContextMenu = function (grid, rowIndex, e) {
|
|||||||
//Do Nothing Function
|
//Do Nothing Function
|
||||||
DoNothing = function(){};
|
DoNothing = function(){};
|
||||||
|
|
||||||
|
exportSkin = function(){
|
||||||
|
viewport.getEl().mask(_('ID_SKIN_EXPORTING'));
|
||||||
|
rowSelected = infoGrid.getSelectionModel().getSelected();
|
||||||
|
if((rowSelected.data.SKIN_FOLDER_ID)&&((rowSelected.data.SKIN_FOLDER_ID!="classic"))){
|
||||||
|
Ext.Ajax.request({
|
||||||
|
url: 'skin_Ajax',
|
||||||
|
params: {
|
||||||
|
action: 'exportSkin',
|
||||||
|
SKIN_FOLDER_ID: rowSelected.data.SKIN_FOLDER_ID
|
||||||
|
},
|
||||||
|
success: function(r,o){
|
||||||
|
viewport.getEl().unmask();
|
||||||
|
var resp = Ext.util.JSON.decode(r.responseText);
|
||||||
|
if (resp.success){
|
||||||
|
try {
|
||||||
|
Ext.destroy(Ext.get('downloadIframe'));
|
||||||
|
}
|
||||||
|
catch(e) {}
|
||||||
|
Ext.DomHelper.append(document.body, {
|
||||||
|
tag: 'iframe',
|
||||||
|
id:'downloadIframe',
|
||||||
|
frameBorder: 0,
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
|
css: 'display:none;visibility:hidden;height:0px;',
|
||||||
|
src: 'skin_Ajax?action=streamSkin&file='+resp.message
|
||||||
|
});
|
||||||
|
viewport.getEl().unmask();
|
||||||
|
}else{
|
||||||
|
viewport.getEl().unmask();
|
||||||
|
Ext.Msg.alert('Alert', resp.message);
|
||||||
|
//PMExt.error(_('ID_SKINS'),_('ID_MSG_CANNOT_EXPORT_SKIN'));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
failure: function(r,o){
|
||||||
|
viewport.getEl().unmask();
|
||||||
|
PMExt.error(_('ID_SKINS'),_('ID_MSG_CANNOT_EXPORT_SKIN'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
PMExt.error(_('ID_SKINS'),_('ID_MSG_CANNOT_EXPORT_DEFAULT_SKIN'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Open New Calendar
|
//Open New Calendar
|
||||||
NewCalendarAction = function(){
|
NewCalendarAction = function(){
|
||||||
location.href = 'calendarEdit';
|
location.href = 'calendarEdit';
|
||||||
@@ -310,7 +424,11 @@ GridByDefault = function(){
|
|||||||
|
|
||||||
//Do Search Function
|
//Do Search Function
|
||||||
DoSearch = function(){
|
DoSearch = function(){
|
||||||
infoGrid.store.load({params: {textFilter: searchText.getValue()}});
|
infoGrid.store.load({
|
||||||
|
params: {
|
||||||
|
textFilter: searchText.getValue()
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//Edit Calendar Action
|
//Edit Calendar Action
|
||||||
@@ -327,33 +445,39 @@ DeleteButtonAction = function(){
|
|||||||
viewport.getEl().mask(_('ID_PROCESSING'));
|
viewport.getEl().mask(_('ID_PROCESSING'));
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url: 'calendar_Ajax',
|
url: 'calendar_Ajax',
|
||||||
params: {action: 'canDeleteCalendar', CAL_UID: rowSelected.data.CALENDAR_UID},
|
params: {
|
||||||
|
action: 'canDeleteCalendar',
|
||||||
|
CAL_UID: rowSelected.data.CALENDAR_UID
|
||||||
|
},
|
||||||
success: function(r,o){
|
success: function(r,o){
|
||||||
viewport.getEl().unmask();
|
viewport.getEl().unmask();
|
||||||
var resp = Ext.util.JSON.decode(r.responseText);
|
var resp = Ext.util.JSON.decode(r.responseText);
|
||||||
if (resp.success){
|
if (resp.success){
|
||||||
Ext.Msg.confirm(_('ID_CONFIRM'),_('ID_CONFIRM_DELETE_CALENDAR'),
|
Ext.Msg.confirm(_('ID_CONFIRM'),_('ID_CONFIRM_DELETE_CALENDAR'),
|
||||||
function(btn, text){
|
function(btn, text){
|
||||||
if (btn=='yes'){
|
if (btn=='yes'){
|
||||||
viewport.getEl().mask(_('ID_PROCESSING'));
|
viewport.getEl().mask(_('ID_PROCESSING'));
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url: 'calendar_Ajax',
|
url: 'calendar_Ajax',
|
||||||
params: {action: 'deleteCalendar', CAL_UID: rowSelected.data.CALENDAR_UID},
|
params: {
|
||||||
success: function(r,o){
|
action: 'deleteCalendar',
|
||||||
viewport.getEl().unmask();
|
CAL_UID: rowSelected.data.CALENDAR_UID
|
||||||
editButton.disable();
|
},
|
||||||
deleteButton.disable();
|
success: function(r,o){
|
||||||
copyButton.disable();
|
viewport.getEl().unmask();
|
||||||
DoSearch();
|
editButton.disable();
|
||||||
PMExt.notify(_('ID_CALENDARS'),_('ID_CALENDAR_SUCCESS_DELETE'));
|
deleteButton.disable();
|
||||||
},
|
copyButton.disable();
|
||||||
failure: function(r,o){
|
DoSearch();
|
||||||
viewport.getEl().unmask();
|
PMExt.notify(_('ID_CALENDARS'),_('ID_CALENDAR_SUCCESS_DELETE'));
|
||||||
}
|
},
|
||||||
});
|
failure: function(r,o){
|
||||||
|
viewport.getEl().unmask();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
);
|
||||||
);
|
|
||||||
}else{
|
}else{
|
||||||
PMExt.error(_('ID_CALENDARS'),_('ID_MSG_CANNOT_DELETE_CALENDAR'));
|
PMExt.error(_('ID_CALENDARS'),_('ID_MSG_CANNOT_DELETE_CALENDAR'));
|
||||||
}
|
}
|
||||||
@@ -367,9 +491,17 @@ DeleteButtonAction = function(){
|
|||||||
//Render Status
|
//Render Status
|
||||||
render_status = function(v){
|
render_status = function(v){
|
||||||
switch(v){
|
switch(v){
|
||||||
case 'ACTIVE': return '<font color="green">' + _('ID_ACTIVE') + '</font>'; break;
|
case 'ACTIVE':
|
||||||
case 'INACTIVE': return '<font color="red">' + _('ID_INACTIVE') + '</font>';; break;
|
return '<font color="green">' + _('ID_ACTIVE') + '</font>';
|
||||||
case 'VACATION': return '<font color="blue">' + _('ID_VACATION') + '</font>';; break;
|
break;
|
||||||
|
case 'INACTIVE':
|
||||||
|
return '<font color="red">' + _('ID_INACTIVE') + '</font>';
|
||||||
|
;
|
||||||
|
break;
|
||||||
|
case 'VACATION':
|
||||||
|
return '<font color="blue">' + _('ID_VACATION') + '</font>';
|
||||||
|
;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -385,6 +517,9 @@ CopyButtonAction = function(){
|
|||||||
UpdatePageConfig = function(pageSize){
|
UpdatePageConfig = function(pageSize){
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url: 'calendar_Ajax',
|
url: 'calendar_Ajax',
|
||||||
params: {action:'updatePageSize', size: pageSize}
|
params: {
|
||||||
|
action:'updatePageSize',
|
||||||
|
size: pageSize
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user