BUG 8856 Migrate the Clear cache Interface from master branch SOLVED.

- Migrate the Clear cache Interface from master branch.
- Clear cache Interface ExtJS migrated from the master branch.
This commit is contained in:
Hector Cortez
2012-03-28 09:41:42 -04:00
parent dd1a960d37
commit 9cd2aa97a0
3 changed files with 133 additions and 19 deletions

View File

@@ -23,22 +23,7 @@
*
*/
try{
if( isset($_GET['result']) && $_GET['result'] == 'done') {
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('view', 'setup/clearCompiledResult');
G::RenderPage('publish', 'blank');
} else {
if( isset($_GET['result']) && $_GET['result'] == 'confirm' ){
if( defined('PATH_C') ){
G::rm_dir(PATH_C);
G::SendTemporalMessage('ID_CLEAR_CACHE_MSG1', 'tmp-info', 'label','','100%');
G::header('location: clearCompiled?result=done');
}
} else {
echo '<script>parent.parent.msgBox("'.G::LoadTranslation('ID_CLEAR_CACHE_CONFIRM1').'", "confirm", function(){location.href = "clearCompiled?result=confirm"}, function(){history.back()});</script>';
}
}
} catch(Exception $e){
G::SendTemporalMessage($oError->getMessage(), 'error', 'string');
}
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('setup/clearCompiled', true ); //adding a javascript file .js
G::RenderPage('publish', 'extJs');

View File

@@ -0,0 +1,26 @@
<?php
try {
if ( (isset($_POST['javascriptCache'])) || (isset($_POST['metadataCache'])) || (isset($_POST['htmlCache']))) {
if ((isset($_POST['javascriptCache'])) && (@chdir(PATH_C.'/ExtJs/'))) {
G::rm_dir(PATH_C.'/ExtJs/');
$response->javascript = true;
}
if ((isset($_POST['metadataCache'])) && (@chdir(PATH_C.'/xmlform/'))) {
G::rm_dir(PATH_C.'/xmlform/');
$response->xmlform = true;
}
if((isset($_POST['htmlCache'])) && (@chdir(PATH_C.'/smarty/'))) {
G::rm_dir(PATH_C.'/smarty/');
$response->smarty = true;
}
$response->success = true;
//$response->path = $path;
}else{
$response->success = false;
}
}
catch ( Exception $e ) {
$response->success = false;
}
echo G::json_encode($response);

View File

@@ -0,0 +1,103 @@
Ext.onReady(function() {
cacheFields = new Ext.form.FieldSet({
title : _('ID_CLEAR_CACHE'),
items : [
{
xtype : 'checkbox',
name : 'javascriptCache',
fieldLabel : 'Terms of Use',
hideLabel : true,
id : 'javascriptCache',
style : 'margin-top:15px',
boxLabel : _('ID_JAVASCRIPT_CACHE')
},
{
xtype : 'checkbox',
name : 'metadataCache',
fieldLabel : 'Terms of Use',
hideLabel : true,
id : 'metadataCache',
style : 'margin-top:15px',
boxLabel : _('ID_FORMS_METADATA_CACHE')
},
{
xtype : 'checkbox',
name : 'htmlCache',
fieldLabel : 'Terms of Use',
hideLabel : true,
id : 'htmlCache',
style : 'margin-top:15px',
boxLabel : _('ID_FORMS_HTML_CACHE')
}
],
buttons : [{
text : _('ID_CLEAR'),
handler : clearCache
}]
});
var frm = new Ext.FormPanel( {
title : '&nbsp',
id : 'frmCache',
width : 400,
labelWidth : 150,
labelAlign : 'right',
autoScroll : true,
bodyStyle : 'padding:2px',
waitMsgTarget : true,
frame : true,
defaults : {
allowBlank : false,
resizable : true,
msgTarget : 'side',
align : 'center'
},
items : [ cacheFields ]
});
//render to process-panel
// frm.render('processes-panel');
frm.render(document.body);
});
function clearCache () {
Ext.getCmp('frmCache').getForm().submit( {
url : 'clearCompiledAjax',
waitMsg : _('ID_SAVING_PROCESS'),
timeout : 36000,
success : function(obj, resp) {
response = Ext.decode(resp.response.responseText);
if (response.javascript) {
var message1 = _('ID_JAVASCRIPT_CACHE') + '<br />';
}
else {
var message1 = '';
}
if (response.xmlform) {
var message2 = _('ID_FORMS_METADATA_CACHE') + '<br />';
}
else {
var message2 = '';
}
if (response.smarty) {
var message3 = _('ID_FORMS_HTML_CACHE') + '<br />';
}
else {
var message3 = '';
}
parent.PMExt.notify(_('ID_CLEAR_CACHE'), message1 + message2 + message3 + _('ID_HAS_BEEN_DELETED'));
},
failure : function(obj, resp) {
Ext.Msg.alert( _('ID_ERROR'), _('ID_SELECT_ONE_OPTION'));
}
});
}