BUG 6212 Skin Feature complete
New, import, export and delete function ready
This commit is contained in:
@@ -2,21 +2,31 @@
|
|||||||
|
|
||||||
if (!isset($_REQUEST ['action'])) {
|
if (!isset($_REQUEST ['action'])) {
|
||||||
$res ['success'] = false;
|
$res ['success'] = false;
|
||||||
$res ['message'] = 'You may request an action';
|
$res ['error']=$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'] = false;
|
$res ['success'] = false;
|
||||||
$res ['message'] = 'The requested action doesn\'t exists';
|
$res ['error']=$res ['message'] = 'The requested action doesn\'t exists';
|
||||||
|
|
||||||
|
print G::json_encode($res);
|
||||||
|
die ();
|
||||||
|
}
|
||||||
|
$restrictedFunctions=array('copy_skin_folder','addTarFolder');
|
||||||
|
if (in_array($_REQUEST ['action'],$restrictedFunctions)) {
|
||||||
|
$res ['success'] = false;
|
||||||
|
$res ['error']=$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();
|
||||||
|
|
||||||
function updatePageSize() {
|
function updatePageSize() {
|
||||||
G::LoadClass('configuration');
|
G::LoadClass('configuration');
|
||||||
@@ -45,20 +55,99 @@ function skinList() {
|
|||||||
$folderId = "classic";
|
$folderId = "classic";
|
||||||
$xmlConfiguration = file_get_contents($configInformation);
|
$xmlConfiguration = file_get_contents($configInformation);
|
||||||
$xmlConfigurationObj = G::xmlParser($xmlConfiguration);
|
$xmlConfigurationObj = G::xmlParser($xmlConfiguration);
|
||||||
|
if (isset($xmlConfigurationObj->result['skinConfiguration'])) {
|
||||||
$skinInformationArray = $skinFilesArray = $xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['information']['__CONTENT__'];
|
$skinInformationArray = $skinFilesArray = $xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['information']['__CONTENT__'];
|
||||||
|
|
||||||
|
|
||||||
|
$menuOption = array();
|
||||||
|
|
||||||
$res = array();
|
$res = array();
|
||||||
$res['SKIN_FOLDER_ID'] = strtolower($folderId);
|
$res['SKIN_FOLDER_ID'] = strtolower($folderId);
|
||||||
foreach ($skinInformationArray as $keyInfo => $infoValue) {
|
foreach ($skinInformationArray as $keyInfo => $infoValue) {
|
||||||
$res['SKIN_' . strtoupper($keyInfo)] = $infoValue['__VALUE__'];
|
$res['SKIN_' . strtoupper($keyInfo)] = $infoValue['__VALUE__'];
|
||||||
}
|
}
|
||||||
$skinListArray['skins'][] = $res;
|
$skinListArray['skins'][] = $res;
|
||||||
|
$skinMenuArray[] = $menuOption;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
$skinListArray['currentSkin'] = SYS_SKIN;
|
||||||
|
if ((isset($_REQUEST['type'])) && ($_REQUEST['type'] == "menu")) {
|
||||||
|
print_r(G::json_encode($skinMenuArray));
|
||||||
|
} else {
|
||||||
print_r(G::json_encode($skinListArray));
|
print_r(G::json_encode($skinListArray));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function createSkin($baseSkin='classic') {
|
function newSkin($baseSkin='classic') {
|
||||||
|
//G::pr($_REQUEST);
|
||||||
|
$skinBase = $baseSkin != "" ? strtolower($baseSkin) : 'classic';
|
||||||
|
if ((isset($_REQUEST['skinBase'])) && ($_REQUEST['skinBase'] != "")) {
|
||||||
|
$skinBase = strtolower($_REQUEST['skinBase']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!(isset($_REQUEST['skinName']))) {
|
||||||
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_NAME_REQUIRED')) );
|
||||||
|
}
|
||||||
|
if (!(isset($_REQUEST['skinFolder']))) {
|
||||||
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_FOLDER_REQUIRED')) );
|
||||||
|
}
|
||||||
|
//Should validate skin folder name here
|
||||||
|
//if....
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$skinName = $_REQUEST['skinName'];
|
||||||
|
$skinFolder = $_REQUEST['skinFolder'];
|
||||||
|
$skinDescription = isset($_REQUEST['skinDescription']) ? $_REQUEST['skinDescription'] : '';
|
||||||
|
$skinAuthor = isset($_REQUEST['skinAuthor']) ? $_REQUEST['skinAuthor'] : 'ProcessMaker Team';
|
||||||
|
|
||||||
|
if (is_dir(PATH_CUSTOM_SKINS . $skinFolder)) {
|
||||||
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_ALREADY_EXISTS')) );
|
||||||
|
}
|
||||||
|
if (strtolower($skinFolder) == 'classic') {
|
||||||
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_ALREADY_EXISTS')) );
|
||||||
|
}
|
||||||
|
|
||||||
|
//All validations OK then create skin
|
||||||
|
switch ($skinBase) {
|
||||||
|
case 'classic': //Special Copy of this dir + xmlreplace
|
||||||
|
//$configurationFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'config.xml';
|
||||||
|
copy_skin_folder(G::ExpandPath("skinEngine") . 'base' . PATH_SEP, PATH_CUSTOM_SKINS . $skinFolder,array("config.xml","baseCss"));
|
||||||
|
$pathBase=G::ExpandPath("skinEngine") . 'base' . PATH_SEP;
|
||||||
|
break;
|
||||||
|
default: //Commmon copy/paste of a folder + xmlrepalce
|
||||||
|
copy_skin_folder(PATH_CUSTOM_SKINS . $skinBase, PATH_CUSTOM_SKINS . $skinFolder,array("config.xml"));
|
||||||
|
$pathBase=PATH_CUSTOM_SKINS.$skinBase;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//ReBuild config file
|
||||||
|
//TODO: Improve this pre_replace lines
|
||||||
|
$configFileOriginal = $pathBase . PATH_SEP . 'config.xml';
|
||||||
|
$configFileFinal = PATH_CUSTOM_SKINS . $skinFolder . PATH_SEP . 'config.xml';
|
||||||
|
$xmlConfiguration = file_get_contents($configFileOriginal);
|
||||||
|
$xmlConfiguration = preg_replace('/(<id>)(.+?)(<\/id>)/i', '<id>' . G::generateUniqueID() . '</id><!-- $2 -->', $xmlConfiguration);
|
||||||
|
$xmlConfiguration = preg_replace("/(<name>)(.+?)(<\/name>)/i", "<name>" . $skinName . "</name><!-- $2 -->", $xmlConfiguration);
|
||||||
|
$xmlConfiguration = preg_replace("/(<description>)(.+?)(<\/description>)/i", "<description>" . $skinDescription . "</description><!-- $2 -->", $xmlConfiguration);
|
||||||
|
$xmlConfiguration = preg_replace("/(<author>)(.+?)(<\/author>)/i", "<author>" . $skinAuthor . "</author><!-- $2 -->", $xmlConfiguration);
|
||||||
|
$xmlConfiguration = preg_replace("/(<createDate>)(.+?)(<\/createDate>)/i", "<createDate>" . date("Y-m-d") . "</createDate><!-- $2 -->", $xmlConfiguration);
|
||||||
|
$xmlConfiguration = preg_replace("/(<modifiedDate>)(.+?)(<\/modifiedDate>)/i", "<modifiedDate>" . date("Y-m-d H:i:s") . "</modifiedDate><!-- $2 -->", $xmlConfiguration);
|
||||||
|
file_put_contents($configFileFinal, $xmlConfiguration);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$response['success'] = true;
|
||||||
|
$response['message'] = G::LoadTranslation('ID_SKIN_SUCCESS_CREATE');
|
||||||
|
print_r(G::json_encode($response));
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$response['success'] = false;
|
||||||
|
$response['message'] = $e->getMessage();
|
||||||
|
$response['error'] = $e->getMessage();
|
||||||
|
print_r(G::json_encode($response));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function importSkin() {
|
function importSkin() {
|
||||||
@@ -85,22 +174,22 @@ function importSkin() {
|
|||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_FILE_REQUIRED')) );
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_FILE_REQUIRED')) );
|
||||||
}
|
}
|
||||||
if ($up_err == 1 || $up_err == 2) {
|
if ($up_err == 1 || $up_err == 2) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_FILE_SIZE_ERROR')) );
|
throw ( new Exception(G::LoadTranslation('ID_FILE_TOO_BIG')) );
|
||||||
//$errors[$i]='miscfilesize';
|
//$errors[$i]='miscfilesize';
|
||||||
}
|
}
|
||||||
if ($up_err == 3) {
|
if ($up_err == 3) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_FILE_PART_ERROR')) );
|
throw ( new Exception(G::LoadTranslation('ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR')) );
|
||||||
//$errors[$i]='miscfilepart';
|
//$errors[$i]='miscfilepart';
|
||||||
}
|
}
|
||||||
if (!@is_uploaded_file($tmp)) {
|
if (!@is_uploaded_file($tmp)) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_FILE_NOT_UPLOADED')) );
|
throw ( new Exception(G::LoadTranslation('ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR')) );
|
||||||
//$errors[$i]='uploadfile';
|
//$errors[$i]='uploadfile';
|
||||||
}
|
}
|
||||||
$fileInfo = pathinfo($items);
|
$fileInfo = pathinfo($items);
|
||||||
$validType = array('tar', 'gz');
|
$validType = array('tar', 'gz');
|
||||||
|
|
||||||
if (!in_array($fileInfo['extension'], $validType)) {
|
if (!in_array($fileInfo['extension'], $validType)) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_FILE_TYPE_ERROR')) );
|
throw ( new Exception(G::LoadTranslation('ID_FILE_UPLOAD_INCORRECT_EXTENSION')) );
|
||||||
//$errors[$i]='wrongtype';
|
//$errors[$i]='wrongtype';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,16 +244,14 @@ function importSkin() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function exportSkin($skinToExport) {
|
function exportSkin($skinToExport="") {
|
||||||
try {
|
try {
|
||||||
if (!isset($_REQUEST['SKIN_FOLDER_ID'])) {
|
if (!isset($_REQUEST['SKIN_FOLDER_ID'])) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_NAME_REUIRED')) );
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_NAME_REQUIRED')) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$skinName = $_REQUEST['SKIN_FOLDER_ID'];
|
$skinName = $_REQUEST['SKIN_FOLDER_ID'];
|
||||||
|
|
||||||
$customSkins = glob(PATH_CUSTOM_SKINS . "*/config.xml");
|
|
||||||
|
|
||||||
$skinFolderBase = PATH_CUSTOM_SKINS . $skinName;
|
$skinFolderBase = PATH_CUSTOM_SKINS . $skinName;
|
||||||
$skinFolder = $skinFolderBase . PATH_SEP;
|
$skinFolder = $skinFolderBase . PATH_SEP;
|
||||||
$skinTar = PATH_CUSTOM_SKINS . $skinName . '.tar';
|
$skinTar = PATH_CUSTOM_SKINS . $skinName . '.tar';
|
||||||
@@ -172,7 +259,7 @@ function exportSkin($skinToExport) {
|
|||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_DOESNT_EXIST')) );
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_DOESNT_EXIST')) );
|
||||||
}
|
}
|
||||||
if (!file_exists($skinFolder . "config.xml")) {
|
if (!file_exists($skinFolder . "config.xml")) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_CONFIGFILE_DOESNT_EXIST')) );
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_CONFIGURATION_MISSING')) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($skinTar)) {
|
if (file_exists($skinTar)) {
|
||||||
@@ -201,7 +288,28 @@ function exportSkin($skinToExport) {
|
|||||||
print_r(G::json_encode($response));
|
print_r(G::json_encode($response));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function deleteSkin(){
|
||||||
|
try{
|
||||||
|
if(!(isset($_REQUEST['SKIN_FOLDER_ID']))){
|
||||||
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_FOLDER_REQUIRED')) );
|
||||||
|
}
|
||||||
|
if(($_REQUEST['SKIN_FOLDER_ID'])=="classic"){
|
||||||
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_FOLDER_NOT_DELETEABLE')) );
|
||||||
|
}
|
||||||
|
$folderId=$_REQUEST['SKIN_FOLDER_ID'];
|
||||||
|
if(!is_dir(PATH_CUSTOM_SKINS.$folderId)){
|
||||||
|
throw ( new Exception(G::LoadTranslation('ID_SKIN_NOT_EXISTS')) );
|
||||||
|
}
|
||||||
|
//Delete
|
||||||
|
G::rm_dir(PATH_CUSTOM_SKINS.$folderId);
|
||||||
|
$response['success'] = true;
|
||||||
|
$response['message'] = "$folderId deleted";
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$response['success'] = false;
|
||||||
|
$response['error']=$response['message'] = $e->getMessage();
|
||||||
|
print_r(G::json_encode($response));
|
||||||
|
}
|
||||||
|
}
|
||||||
function streamSkin() {
|
function streamSkin() {
|
||||||
$skinTar = $_REQUEST['file'];
|
$skinTar = $_REQUEST['file'];
|
||||||
$bDownload = true;
|
$bDownload = true;
|
||||||
@@ -228,3 +336,29 @@ function addTarFolder($tar, $pathBase, $pluginHome) {
|
|||||||
closedir($handle);
|
closedir($handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copy_skin_folder($path, $dest, $exclude=array()) {
|
||||||
|
$defaultExcluded=array(".","..");
|
||||||
|
$excludedItems=array_merge($defaultExcluded,$exclude);
|
||||||
|
if (is_dir($path)) {
|
||||||
|
@mkdir($dest);
|
||||||
|
$objects = scandir($path);
|
||||||
|
if (sizeof($objects) > 0) {
|
||||||
|
foreach ($objects as $file) {
|
||||||
|
if(in_array($file,$excludedItems))
|
||||||
|
continue;
|
||||||
|
// go on
|
||||||
|
if (is_dir($path . PATH_SEP . $file)) {
|
||||||
|
copy_skin_folder($path . PATH_SEP . $file, $dest . PATH_SEP . $file,$exclude);
|
||||||
|
} else {
|
||||||
|
copy($path . PATH_SEP . $file, $dest . PATH_SEP . $file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} elseif (is_file($path)) {
|
||||||
|
return copy($path, $dest);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ new Ext.KeyMap(document, [
|
|||||||
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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,19 +27,19 @@ new Ext.KeyMap(document, [
|
|||||||
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 && !deleteButton.isDisabled()){
|
||||||
DeleteButtonAction();
|
deleteSkin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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();
|
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
@@ -49,13 +49,9 @@ var cmodel;
|
|||||||
var infoGrid;
|
var infoGrid;
|
||||||
var viewport;
|
var viewport;
|
||||||
var smodel;
|
var smodel;
|
||||||
|
|
||||||
var newButton;
|
var newButton;
|
||||||
var editButton;
|
|
||||||
var deleteButton;
|
var deleteButton;
|
||||||
var copyButton;
|
|
||||||
var searchButton;
|
var searchButton;
|
||||||
|
|
||||||
var searchText;
|
var searchText;
|
||||||
var contextMenu;
|
var contextMenu;
|
||||||
var pageSize;
|
var pageSize;
|
||||||
@@ -70,53 +66,40 @@ Ext.onReady(function(){
|
|||||||
newButton = new Ext.Action({
|
newButton = new Ext.Action({
|
||||||
text: _('ID_NEW'),
|
text: _('ID_NEW'),
|
||||||
iconCls: 'button_menu_ext ss_sprite ss_add',
|
iconCls: 'button_menu_ext ss_sprite ss_add',
|
||||||
disabled: true,
|
disabled: false,
|
||||||
handler: NewCalendarAction
|
handler: newSkin
|
||||||
});
|
});
|
||||||
|
|
||||||
editButton = new Ext.Action({
|
|
||||||
text: _('ID_EDIT'),
|
|
||||||
iconCls: 'button_menu_ext ss_sprite ss_pencil',
|
|
||||||
handler: EditCalendarAction,
|
|
||||||
hidden: true,
|
|
||||||
disabled: true
|
|
||||||
});
|
|
||||||
|
|
||||||
deleteButton = new Ext.Action({
|
deleteButton = new Ext.Action({
|
||||||
text: _('ID_DELETE'),
|
text: _('ID_DELETE'),
|
||||||
iconCls: 'button_menu_ext ss_sprite ss_delete',
|
iconCls: 'button_menu_ext ss_sprite ss_delete',
|
||||||
handler: DeleteButtonAction,
|
handler: deleteSkin,
|
||||||
hidden: true,
|
|
||||||
disabled: true
|
disabled: true
|
||||||
});
|
});
|
||||||
|
|
||||||
copyButton = new Ext.Action({
|
|
||||||
text: _('ID_COPY'),
|
|
||||||
iconCls: 'button_menu_ext ss_sprite ss_calendar_add',
|
|
||||||
handler: CopyButtonAction,
|
|
||||||
hidden: true,
|
|
||||||
disabled: true
|
|
||||||
});
|
|
||||||
|
|
||||||
importButton = new Ext.Action({
|
importButton = new Ext.Action({
|
||||||
text: _('ID_IMPORT'),
|
text: _('ID_IMPORT'),
|
||||||
iconCls: 'button_menu_ext ss_sprite ss_basket_put',
|
iconCls: 'button_menu_ext ss_sprite ss_building_add',
|
||||||
handler: importSkin,
|
handler: importSkin,
|
||||||
disabled: false
|
disabled: false
|
||||||
});
|
});
|
||||||
|
|
||||||
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_building_go',
|
||||||
handler: exportSkin,
|
handler: exportSkin,
|
||||||
disabled: true
|
disabled: true
|
||||||
});
|
});
|
||||||
|
|
||||||
searchButton = new Ext.Action({
|
searchButton = new Ext.Action({
|
||||||
text: _('ID_SEARCH'),
|
text: _('ID_SEARCH'),
|
||||||
handler: DoSearch
|
handler: DoSearch
|
||||||
});
|
});
|
||||||
|
|
||||||
contextMenu = new Ext.menu.Menu({
|
contextMenu = new Ext.menu.Menu({
|
||||||
items: [exportButton]
|
items: [exportButton,deleteButton]
|
||||||
});
|
});
|
||||||
|
|
||||||
searchText = new Ext.form.TextField ({
|
searchText = new Ext.form.TextField ({
|
||||||
@@ -152,16 +135,34 @@ Ext.onReady(function(){
|
|||||||
rowSelected = infoGrid.getSelectionModel().getSelected();
|
rowSelected = infoGrid.getSelectionModel().getSelected();
|
||||||
if((rowSelected.data.SKIN_FOLDER_ID)&&((rowSelected.data.SKIN_FOLDER_ID!="classic"))){
|
if((rowSelected.data.SKIN_FOLDER_ID)&&((rowSelected.data.SKIN_FOLDER_ID!="classic"))){
|
||||||
exportButton.enable();
|
exportButton.enable();
|
||||||
|
deleteButton.enable();
|
||||||
}else{
|
}else{
|
||||||
exportButton.disable();
|
exportButton.disable();
|
||||||
|
deleteButton.disable();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
rowdeselect: function(sm){
|
rowdeselect: function(sm){
|
||||||
exportButton.disable();
|
exportButton.disable();
|
||||||
|
deleteButton.disable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
storeSkins = new Ext.data.JsonStore({
|
||||||
|
root: 'skins',
|
||||||
|
totalProperty: 'totalCount',
|
||||||
|
idProperty: 'SKIN_FOLDER_ID',
|
||||||
|
autoLoad : false,
|
||||||
|
remoteSort: false,
|
||||||
|
fields: [
|
||||||
|
'SKIN_FOLDER_ID',
|
||||||
|
'SKIN_NAME'
|
||||||
|
],
|
||||||
|
proxy: new Ext.data.HttpProxy({
|
||||||
|
url: 'skin_Ajax?action=skinList'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
store = new Ext.data.GroupingStore( {
|
store = new Ext.data.GroupingStore( {
|
||||||
proxy : new Ext.data.HttpProxy({
|
proxy : new Ext.data.HttpProxy({
|
||||||
url: 'skin_Ajax?action=skinList'
|
url: 'skin_Ajax?action=skinList'
|
||||||
@@ -254,7 +255,7 @@ Ext.onReady(function(){
|
|||||||
align:'center',
|
align:'center',
|
||||||
renderer: showdate
|
renderer: showdate
|
||||||
}
|
}
|
||||||
//{header: _('ID_STATUS'), dataIndex: 'SKIN_STATUS', width: 130, align:'center', renderer: render_status},
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -314,7 +315,7 @@ Ext.onReady(function(){
|
|||||||
store: store,
|
store: store,
|
||||||
cm: cmodel,
|
cm: cmodel,
|
||||||
sm: smodel,
|
sm: smodel,
|
||||||
tbar: [newButton, '-', importButton,exportButton, {
|
tbar: [newButton, '-', importButton,exportButton,'-',deleteButton, {
|
||||||
xtype: 'tbfill'
|
xtype: 'tbfill'
|
||||||
}, searchText,clearTextButton,searchButton],
|
}, searchText,clearTextButton,searchButton],
|
||||||
bbar: bbarpaging,
|
bbar: bbarpaging,
|
||||||
@@ -371,6 +372,155 @@ onMessageContextMenu = function (grid, rowIndex, e) {
|
|||||||
|
|
||||||
//Do Nothing Function
|
//Do Nothing Function
|
||||||
DoNothing = function(){};
|
DoNothing = function(){};
|
||||||
|
|
||||||
|
newSkin = function(){
|
||||||
|
newDialog = new Ext.Window( {
|
||||||
|
id: "newDialog",
|
||||||
|
title:_('ID_NEW_SKIN'),
|
||||||
|
autoCreate: true,
|
||||||
|
modal:true,
|
||||||
|
width:400,
|
||||||
|
autoHeight:true,
|
||||||
|
shadow:true,
|
||||||
|
minWidth:100,
|
||||||
|
minHeight:50,
|
||||||
|
proxyDrag: true,
|
||||||
|
resizable: true,
|
||||||
|
keys: {
|
||||||
|
key: 27,
|
||||||
|
fn : function(){
|
||||||
|
newDialog.hide();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
items:[
|
||||||
|
{
|
||||||
|
xtype:'form',
|
||||||
|
autoScroll:true,
|
||||||
|
autoHeight:true,
|
||||||
|
id:"newform",
|
||||||
|
fileUpload:true,
|
||||||
|
labelWidth:100,
|
||||||
|
url:'skin_Ajax',
|
||||||
|
frame:false,
|
||||||
|
items:[
|
||||||
|
{
|
||||||
|
xtype:'textfield',
|
||||||
|
id:'skinName',
|
||||||
|
allowBlank: false,
|
||||||
|
width:200,
|
||||||
|
emptyText: _('ID_SKIN_NAME_REQUIRED'),
|
||||||
|
fieldLabel:_('ID_NAME'),
|
||||||
|
enableKeyEvents:true,
|
||||||
|
vtype:'alphanum',
|
||||||
|
listeners: {
|
||||||
|
keyup:function(a,b,c){
|
||||||
|
|
||||||
|
Ext.getCmp('newform').getForm().findField('skinFolder').setValue(a.getValue().toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype:'textfield',
|
||||||
|
emptyText: _('ID_SKIN_FOLDER_REQUIRED'),
|
||||||
|
id:'skinFolder',
|
||||||
|
fieldLabel:_('ID_SKIN_FOLDER'),
|
||||||
|
width:200,
|
||||||
|
vtype:'alphanum',
|
||||||
|
autoCreate: {
|
||||||
|
tag: 'input',
|
||||||
|
type: 'text',
|
||||||
|
size: '20',
|
||||||
|
autocomplete: 'off',
|
||||||
|
maxlength: '10'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype:'textarea',
|
||||||
|
id:'skinDescription',
|
||||||
|
fieldLabel:_('ID_DESCRIPTION'),
|
||||||
|
width:200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype:'textfield',
|
||||||
|
id:'skinAuthor',
|
||||||
|
emptyText :'ProcessMaker Team',
|
||||||
|
value :'ProcessMaker Team',
|
||||||
|
allowBlank: false,
|
||||||
|
width:200,
|
||||||
|
fieldLabel:_('ID_AUTHOR')
|
||||||
|
},
|
||||||
|
new Ext.form.ComboBox({
|
||||||
|
id:'skinBase',
|
||||||
|
fieldLabel : _('ID_SKIN_BASE'),
|
||||||
|
editable : false,
|
||||||
|
store: storeSkins,
|
||||||
|
valueField :'SKIN_FOLDER_ID',
|
||||||
|
displayField :'SKIN_NAME',
|
||||||
|
submitValue:true,
|
||||||
|
typeAhead : false,
|
||||||
|
triggerAction : 'all',
|
||||||
|
allowBlank: false,
|
||||||
|
selectOnFocus:true,
|
||||||
|
width:200
|
||||||
|
})
|
||||||
|
],
|
||||||
|
buttons:[
|
||||||
|
{
|
||||||
|
text:_('ID_SAVE'),
|
||||||
|
handler: function() {
|
||||||
|
//statusBarMessage( _('ID_UPLOADING_FILE'), true, true );
|
||||||
|
newDialog.getEl().mask(_('ID_SKIN_CREATING'));
|
||||||
|
form = Ext.getCmp("newform").getForm();
|
||||||
|
|
||||||
|
//Ext.getCmp("uploadform").getForm().submit();
|
||||||
|
//console.log(form);
|
||||||
|
//console.log(form.url);
|
||||||
|
Ext.getCmp("newform").getForm().submit({
|
||||||
|
//reset: true,
|
||||||
|
reset: false,
|
||||||
|
success: function(form, action) {
|
||||||
|
|
||||||
|
store.reload();
|
||||||
|
|
||||||
|
Ext.getCmp("newDialog").destroy();
|
||||||
|
PMExt.notify(_('ID_SKINS'),_('ID_SKIN_SUCCESS_CREATE'));
|
||||||
|
},
|
||||||
|
failure: function(form, action) {
|
||||||
|
Ext.getCmp("newDialog").destroy();
|
||||||
|
|
||||||
|
if( !action.result ) {
|
||||||
|
Ext.MessageBox.alert("error", _('ID_ERROR'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Ext.MessageBox.alert("error", action.result.error);
|
||||||
|
|
||||||
|
},
|
||||||
|
scope: Ext.getCmp("newform"),
|
||||||
|
// add some vars to the request, similar to hidden fields
|
||||||
|
params: {
|
||||||
|
action: "newSkin",
|
||||||
|
requestType: "xmlhttprequest"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text:_('ID_CANCEL'),
|
||||||
|
handler: function() {
|
||||||
|
Ext.getCmp("newDialog").destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
});
|
||||||
|
newDialog.on( 'hide', function() {
|
||||||
|
newDialog.destroy(true);
|
||||||
|
} );
|
||||||
|
newDialog.show();
|
||||||
|
}
|
||||||
importSkin = function(){
|
importSkin = function(){
|
||||||
importDialog = new Ext.Window( {
|
importDialog = new Ext.Window( {
|
||||||
id: "importDialog",
|
id: "importDialog",
|
||||||
@@ -399,19 +549,19 @@ importSkin = function(){
|
|||||||
fileUpload:true,
|
fileUpload:true,
|
||||||
labelWidth:90,
|
labelWidth:90,
|
||||||
url:'skin_Ajax',
|
url:'skin_Ajax',
|
||||||
tooltip:"Max File Size <strong>XXX MB</strong><br />Max Post Size<strong>XXX MB</strong><br />",
|
//tooltip:"Max File Size <strong>XXX MB</strong><br />Max Post Size<strong>XXX MB</strong><br />",
|
||||||
frame:false,
|
frame:false,
|
||||||
items:[
|
items:[
|
||||||
{
|
//{
|
||||||
xtype:"displayfield",
|
// xtype:"displayfield",
|
||||||
value:"Max File Size <strong>XXX MB</strong><br />Max Post Size<strong>XXX MB</strong><br />"
|
// value:"Max File Size <strong>XXX MB</strong><br />Max Post Size<strong>XXX MB</strong><br />"
|
||||||
},
|
//},
|
||||||
{
|
{
|
||||||
xtype:"fileuploadfield",
|
xtype:"fileuploadfield",
|
||||||
fieldLabel:"File ",
|
fieldLabel:"File ",
|
||||||
id:"uploadedFile",
|
id:"uploadedFile",
|
||||||
name:"uploadedFile",
|
name:"uploadedFile",
|
||||||
width:100,
|
width:190,
|
||||||
buttonOnly:false
|
buttonOnly:false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -440,6 +590,7 @@ importSkin = function(){
|
|||||||
store.reload();
|
store.reload();
|
||||||
|
|
||||||
Ext.getCmp("importDialog").destroy();
|
Ext.getCmp("importDialog").destroy();
|
||||||
|
PMExt.notify(_('ID_SKINS'),_('ID_SKIN_SUCCESS_IMPORTED'));
|
||||||
},
|
},
|
||||||
failure: function(form, action) {
|
failure: function(form, action) {
|
||||||
Ext.getCmp("importDialog").destroy();
|
Ext.getCmp("importDialog").destroy();
|
||||||
@@ -530,10 +681,6 @@ exportSkin = function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Open New Calendar
|
|
||||||
NewCalendarAction = function(){
|
|
||||||
location.href = 'calendarEdit';
|
|
||||||
};
|
|
||||||
|
|
||||||
//Load Grid By Default
|
//Load Grid By Default
|
||||||
GridByDefault = function(){
|
GridByDefault = function(){
|
||||||
@@ -550,45 +697,25 @@ DoSearch = function(){
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//Edit Calendar Action
|
|
||||||
EditCalendarAction = function(){
|
|
||||||
rowSelected = infoGrid.getSelectionModel().getSelected();
|
|
||||||
if (rowSelected){
|
|
||||||
location.href = 'calendarEdit?id=' + rowSelected.data.CALENDAR_UID;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//Delete Button Action
|
|
||||||
DeleteButtonAction = function(){
|
deleteSkin = function(){
|
||||||
rowSelected = infoGrid.getSelectionModel().getSelected();
|
Ext.Msg.confirm(_('ID_CONFIRM'),_('ID_CONFIRM_DELETE_SKIN'),
|
||||||
viewport.getEl().mask(_('ID_PROCESSING'));
|
|
||||||
Ext.Ajax.request({
|
|
||||||
url: 'calendar_Ajax',
|
|
||||||
params: {
|
|
||||||
action: 'canDeleteCalendar',
|
|
||||||
CAL_UID: rowSelected.data.CALENDAR_UID
|
|
||||||
},
|
|
||||||
success: function(r,o){
|
|
||||||
viewport.getEl().unmask();
|
|
||||||
var resp = Ext.util.JSON.decode(r.responseText);
|
|
||||||
if (resp.success){
|
|
||||||
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: 'skin_Ajax',
|
||||||
params: {
|
params: {
|
||||||
action: 'deleteCalendar',
|
action: 'deleteSkin',
|
||||||
CAL_UID: rowSelected.data.CALENDAR_UID
|
SKIN_FOLDER_ID: rowSelected.data.SKIN_FOLDER_ID
|
||||||
},
|
},
|
||||||
success: function(r,o){
|
success: function(r,o){
|
||||||
viewport.getEl().unmask();
|
viewport.getEl().unmask();
|
||||||
editButton.disable();
|
|
||||||
deleteButton.disable();
|
deleteButton.disable();
|
||||||
copyButton.disable();
|
|
||||||
DoSearch();
|
store.reload();
|
||||||
PMExt.notify(_('ID_CALENDARS'),_('ID_CALENDAR_SUCCESS_DELETE'));
|
PMExt.notify(_('ID_SKINS'),_('ID_SKIN_SUCCESS_DELETE'));
|
||||||
},
|
},
|
||||||
failure: function(r,o){
|
failure: function(r,o){
|
||||||
viewport.getEl().unmask();
|
viewport.getEl().unmask();
|
||||||
@@ -597,40 +724,9 @@ DeleteButtonAction = function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}else{
|
|
||||||
PMExt.error(_('ID_CALENDARS'),_('ID_MSG_CANNOT_DELETE_CALENDAR'));
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
failure: function(r,o){
|
|
||||||
viewport.getEl().unmask();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//Render Status
|
|
||||||
render_status = function(v){
|
|
||||||
switch(v){
|
|
||||||
case 'ACTIVE':
|
|
||||||
return '<font color="green">' + _('ID_ACTIVE') + '</font>';
|
|
||||||
break;
|
|
||||||
case 'INACTIVE':
|
|
||||||
return '<font color="red">' + _('ID_INACTIVE') + '</font>';
|
|
||||||
;
|
|
||||||
break;
|
|
||||||
case 'VACATION':
|
|
||||||
return '<font color="blue">' + _('ID_VACATION') + '</font>';
|
|
||||||
;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//Members Button Action
|
|
||||||
CopyButtonAction = function(){
|
|
||||||
rowSelected = infoGrid.getSelectionModel().getSelected();
|
|
||||||
if (rowSelected){
|
|
||||||
location.href = 'calendarEdit?cp=1&id=' + rowSelected.data.CALENDAR_UID;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//Update Page Size Configuration
|
//Update Page Size Configuration
|
||||||
UpdatePageConfig = function(pageSize){
|
UpdatePageConfig = function(pageSize){
|
||||||
@@ -642,6 +738,7 @@ UpdatePageConfig = function(pageSize){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function changeSkin(newSkin,currentSkin){
|
function changeSkin(newSkin,currentSkin){
|
||||||
currentLocation=top.location.href;
|
currentLocation=top.location.href;
|
||||||
newLocation = currentLocation.replace("/"+currentSkin+"/","/"+newSkin+"/");
|
newLocation = currentLocation.replace("/"+currentSkin+"/","/"+newSkin+"/");
|
||||||
|
|||||||
Reference in New Issue
Block a user