diff --git a/workflow/engine/methods/setup/clearCompiled.php b/workflow/engine/methods/setup/clearCompiled.php index d7396c8c9..68a10f706 100755 --- a/workflow/engine/methods/setup/clearCompiled.php +++ b/workflow/engine/methods/setup/clearCompiled.php @@ -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 ''; - } - } -} catch(Exception $e){ - G::SendTemporalMessage($oError->getMessage(), 'error', 'string'); -} \ No newline at end of file +$oHeadPublisher =& headPublisher::getSingleton(); +$oHeadPublisher->addExtJsScript('setup/clearCompiled', true ); //adding a javascript file .js + +G::RenderPage('publish', 'extJs'); diff --git a/workflow/engine/methods/setup/clearCompiledAjax.php b/workflow/engine/methods/setup/clearCompiledAjax.php new file mode 100644 index 000000000..7b7f0bffc --- /dev/null +++ b/workflow/engine/methods/setup/clearCompiledAjax.php @@ -0,0 +1,26 @@ +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); diff --git a/workflow/engine/templates/setup/clearCompiled.js b/workflow/engine/templates/setup/clearCompiled.js new file mode 100644 index 000000000..f103565da --- /dev/null +++ b/workflow/engine/templates/setup/clearCompiled.js @@ -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 : ' ', + 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') + '
'; + } + else { + var message1 = ''; + } + if (response.xmlform) { + var message2 = _('ID_FORMS_METADATA_CACHE') + '
'; + } + else { + var message2 = ''; + } + if (response.smarty) { + var message3 = _('ID_FORMS_HTML_CACHE') + '
'; + } + 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')); + } + }); +} +