Merge pull request #876 from marcoAntonioNina/BUG-7817

BUG 7817 Se puede ver todos los skins que tiene el servidor... SOLVED
This commit is contained in:
julceslauhub
2012-10-29 06:39:48 -07:00
6 changed files with 114 additions and 13 deletions

View File

@@ -942,6 +942,7 @@ class System
}
$customSkins = array_merge( $baseSkins, $customSkins );
$global = G::LoadTranslation('ID_GLOBAL');
//Read and parse each Configuration File
foreach ($customSkins as $key => $configInformation) {
@@ -962,8 +963,24 @@ class System
foreach ($skinInformationArray as $keyInfo => $infoValue) {
$res['SKIN_' . strtoupper( $keyInfo )] = $infoValue['__VALUE__'];
}
$res['SKIN_CREATEDATE'] = (isset($res['SKIN_CREATEDATE'])) ? $res['SKIN_CREATEDATE']: '';
$res['SKIN_MODIFIEDDATE'] = (isset($res['SKIN_MODIFIEDDATE'])) ? $res['SKIN_MODIFIEDDATE']: '';
$res['SKIN_WORKSPACE'] = (isset($res['SKIN_WORKSPACE'])) ? ( ($res['SKIN_WORKSPACE'] != '')? $res['SKIN_WORKSPACE'] : $global): $global;
$skinListArray['skins'][] = $res;
$swWS = true;
if ($res['SKIN_WORKSPACE'] != $global) {
$workspace = explode("|", $res['SKIN_WORKSPACE']);
$swWS = false;
foreach ($workspace as $key => $value) {
if ($value == SYS_SYS) {
$swWS = true;
break;
}
}
}
if ($swWS) {
$skinListArray['skins'][] = $res;
}
}
}

View File

@@ -17,7 +17,12 @@ class Admin extends Controller
{
require_once PATH_CONTROLLERS . 'main.php';
G::loadClass( 'system' );
$skinsList = System::getSkingList();
$skinsList = System::getSkingList();
foreach ($skinsList['skins'] as $key => $value) {
if ($value['SKIN_WORKSPACE'] != 'Global') {
unset( $skinsList['skins'][$key] );
}
}
$skins = array ();
$timeZonesList = System::getAllTimeZones();
$timeZonesList = array_keys( $timeZonesList );

View File

@@ -56,6 +56,7 @@ function skinList ()
if ($skinList['currentSkin'] == $value['SKIN_FOLDER_ID']) {
$value['SKIN_STATUS'] = $wildcard . G::LoadTranslation( 'ID_ACTIVE' );
$value['SKIN_NAME'] = $wildcard . $value['SKIN_NAME'];
$value['SKIN_WORKSPACE'] = $wildcard . $value['SKIN_WORKSPACE'];
$value['SKIN_DESCRIPTION'] = $wildcard . $value['SKIN_DESCRIPTION'];
$value['SKIN_AUTHOR'] = $wildcard . $value['SKIN_AUTHOR'];
$value['SKIN_CREATEDATE'] = $wildcard . $value['SKIN_CREATEDATE'];
@@ -126,14 +127,26 @@ function newSkin ($baseSkin = 'classic')
$configFileOriginal = $pathBase . PATH_SEP . 'config.xml';
$configFileFinal = PATH_CUSTOM_SKINS . $skinFolder . PATH_SEP . 'config.xml';
$xmlConfiguration = file_get_contents( $configFileOriginal );
$workspace = ($_REQUEST['workspace'] == 'global') ? '' : SYS_SYS;
$xmlConfigurationObj = G::xmlParser( $xmlConfiguration );
$skinInformationArray = $skinFilesArray = $xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['information']['__CONTENT__'];
$xmlConfiguration = preg_replace( '/(<id>)(.+?)(<\/id>)/i', '<id>' . G::generateUniqueID() . '</id><!-- $2 -->', $xmlConfiguration );
$xmlConfiguration = preg_replace( "/(<name>)(.+?)(<\/name>)/i", "<name>" . $skinName . "</name><!-- $2 -->", $xmlConfiguration );
if (isset( $skinInformationArray['workspace'] )) {
$workspace = ($skinInformationArray['workspace'] != '') ? ($skinInformationArray['workspace']."|".$workspace) : $workspace;
$xmlConfiguration = preg_replace( "/(<workspace>)(.+?)(<\/modifiedDate>)/i", "<workspace>" . $workspace . "</workspace><!-- $2 -->", $xmlConfiguration );
$xmlConfiguration = preg_replace( "/(<name>)(.+?)(<\/name>)/i", "<name>" . $skinName . "</name><!-- $2 -->", $xmlConfiguration );
} else {
$xmlConfiguration = preg_replace( "/(<name>)(.+?)(<\/name>)/i", "<name>" . $skinName . "</name><!-- $2 -->
<workspace>" . $workspace . "</workspace>", $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 H:i:s" ) . "</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 );
file_put_contents( $configFileFinal, $xmlConfiguration );
$response['success'] = true;
$response['message'] = G::LoadTranslation( 'ID_SKIN_SUCCESS_CREATE' );
print_r( G::json_encode( $response ) );
@@ -226,6 +239,24 @@ function importSkin ()
if (! $res) {
throw (new Exception( G::LoadTranslation( 'ID_SKIN_ERROR_EXTRACTING' ) ));
}
$configFileOriginal = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml';
$configFileFinal = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml';
$xmlConfiguration = file_get_contents( $configFileOriginal );
$workspace = ($_REQUEST['workspace'] == 'global') ? '' : SYS_SYS;
$xmlConfigurationObj = G::xmlParser( $xmlConfiguration );
$skinInformationArray = $skinFilesArray = $xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['information']['__CONTENT__'];
if (isset( $skinInformationArray['workspace'] )) {
$workspace = ($skinInformationArray['workspace'] != '') ? ($skinInformationArray['workspace']."|".$workspace) : $workspace;
$xmlConfiguration = preg_replace( "/(<workspace>)(.+?)(<\/modifiedDate>)/i", "<workspace>" . $workspace . "</workspace><!-- $2 -->", $xmlConfiguration );
} else {
$xmlConfiguration = preg_replace( "/(<name>)(.+?)(<\/name>)/i", "<name>".$skinName."</name><!-- $2 -->
<workspace>" . $workspace . "</workspace>", $xmlConfiguration );
}
file_put_contents( $configFileFinal, $xmlConfiguration );
//Delete Temporal
@unlink( PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename );

View File

@@ -183,6 +183,10 @@ Ext.onReady(function(){
name : 'SKIN_NAME'
},
{
name : 'SKIN_WORKSPACE'
},
{
name : 'SKIN_DESCRIPTION'
},
@@ -227,6 +231,14 @@ Ext.onReady(function(){
renderer: selectedSkinChecked
},
{
header: _('ID_ROOT_FOLDER'),
dataIndex: 'SKIN_WORKSPACE',
width: 80,
align:'left',
renderer: nameWorkspace
},
{
header: _('ID_DESCRIPTION'),
dataIndex: 'SKIN_DESCRIPTION',
@@ -403,6 +415,16 @@ selectedSkinChecked = function (value){
}
return value;
};
nameWorkspace = function (value){
if(value[0]=='@'){
str = value.substring(1);
return '<b><i>' + ((value == _('ID_GLOBAL')) ? value : _('ID_WORKSPACE')) + '</i></b>';
}
if (value != _('ID_GLOBAL')) {
value = _('ID_WORKSPACE');
}
return value;
};
//Funtion Handles Context Menu Opening
@@ -505,7 +527,20 @@ newSkin = function(){
allowBlank: false,
selectOnFocus:true,
width:200
})
}),
{
xtype: 'radio',
name: 'workspace',
inputValue: 'global',
checked: true,
boxLabel: _('ID_ALL_WORKSPACES')
},
{
xtype: 'radio',
name: 'workspace',
inputValue: 'current',
boxLabel: _('ID_CURRENT_WORKSPACE')
}
],
buttons:[
{
@@ -612,7 +647,20 @@ importSkin = function(){
fieldLabel: _('ID_OVERWRITE'),
name: "overwrite_files",
checked: true
}
},
{
xtype: 'radio',
name: 'workspace',
inputValue: 'global',
checked: true,
boxLabel: _('ID_ALL_WORKSPACES')
},
{
xtype: 'radio',
name: 'workspace',
inputValue: 'current',
boxLabel: _('ID_CURRENT_WORKSPACE')
}
],
buttons:[
{