BUG 8953 Menu para importar plugins desaparece cuando se importa un archivo...

- Al mostrar el mensaje de error se estaba usando simplemente un formulario normal
- Se cambio el comportamiento cuando existen errores al importar un plugin, se esta redireccionando de nuevo al listado de plugins disponibles y se muestra un mensaje en ExtJS con el error
This commit is contained in:
Julio Cesar Laura
2012-04-19 09:37:10 -04:00
parent 1328dbfec2
commit 6b83af23fe
3 changed files with 47 additions and 46 deletions

View File

@@ -80,8 +80,8 @@ try {
unset($oClass); unset($oClass);
} }
$res = $tar->extract ( $path ); $res = $tar->extract ( $path );
$sContent = file_get_contents($path . $pluginFile); $sContent = file_get_contents($path . $pluginFile);
$chain = preg_quote('extends enterprisePlugin'); $chain = preg_quote('extends enterprisePlugin');
if(strpos($sContent,$chain)){ if(strpos($sContent,$chain)){
@@ -91,7 +91,7 @@ try {
$sContent = str_ireplace('PATH_PLUGINS', "'".$path."'", $sContent); $sContent = str_ireplace('PATH_PLUGINS', "'".$path."'", $sContent);
$sContent = preg_replace("/\\\$oPluginRegistry\s*=\s*&\s*PMPluginRegistry::getSingleton\s*\(\s*\)\s*;/i", null, $sContent); $sContent = preg_replace("/\\\$oPluginRegistry\s*=\s*&\s*PMPluginRegistry::getSingleton\s*\(\s*\)\s*;/i", null, $sContent);
$sContent = preg_replace("/\\\$oPluginRegistry->registerPlugin\s*\(\s*[\"\']" . $sClassName . "[\"\']\s*,\s*__FILE__\s*\)\s*;/i", null, $sContent); $sContent = preg_replace("/\\\$oPluginRegistry->registerPlugin\s*\(\s*[\"\']" . $sClassName . "[\"\']\s*,\s*__FILE__\s*\)\s*;/i", null, $sContent);
//header('Content-Type: text/plain');var_dump($sClassName, $sContent);die; //header('Content-Type: text/plain');var_dump($sClassName, $sContent);die;
file_put_contents($path . $pluginFile, $sContent); file_put_contents($path . $pluginFile, $sContent);
@@ -145,9 +145,9 @@ try {
} }
require_once (PATH_PLUGINS . $pluginFile); require_once (PATH_PLUGINS . $pluginFile);
$oPluginRegistry->registerPlugin($sClassName, PATH_PLUGINS . $sClassName . ".php"); $oPluginRegistry->registerPlugin($sClassName, PATH_PLUGINS . $sClassName . ".php");
$details = $oPluginRegistry->getPluginDetails($pluginFile); $details = $oPluginRegistry->getPluginDetails($pluginFile);
$oPluginRegistry->installPlugin($details->sNamespace); $oPluginRegistry->installPlugin($details->sNamespace);
@@ -157,9 +157,8 @@ try {
G::header("Location: pluginsMain"); G::header("Location: pluginsMain");
die; die;
} }
catch ( Exception $e ){ catch (Exception $e) {
$G_PUBLISH = new Publisher; $_SESSION['__PLUGIN_ERROR__'] = $e->getMessage();
$aMessage['MESSAGE'] = $e->getMessage(); G::header('Location: pluginsMain');
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); die();
G::RenderPage('publishBlank', 'blank');
} }

View File

@@ -23,20 +23,18 @@
* *
*/ */
$oHeadPublisher =& headPublisher::getSingleton(); $headPublisher =& headPublisher::getSingleton();
$headPublisher->addExtJsScript('setup/pluginsMain', false);
$oHeadPublisher->addExtJsScript('setup/pluginsMain', false ); //adding a javascript file .js $translations = G::getTranslations(array(
//$oHeadPublisher->addContent('setup/main'); //adding a html file .html. 'ID_CONFIGURE', 'ID_STATUS', 'ID_DELETE', 'ID_IMPORT', 'ID_SELECT',
'ID_STATUS', 'ID_ACTIVATE', 'ID_DEACTIVATE', 'ID_PLUGINS',
$translations = G::getTranslations(Array( 'ID_SELECT', 'ID_NO_SELECTION_WARNING', 'ID_MSG_REMOVE_PLUGIN',
'ID_CONFIGURE', 'ID_STATUS', 'ID_DELETE', 'ID_IMPORT', 'ID_SELECT', 'ID_TITLE', 'ID_VERSION', 'ID_STATUS', 'ID_TITLE', 'ID_VERSION', 'ID_DESCRIPTION',
'ID_STATUS', 'ID_ACTIVATE', 'ID_DEACTIVATE', 'ID_STATUS', 'ID_PLUGIN_CANT_DELETE', 'ID_XPDL_IMPORT', 'ID_DISABLE', 'ID_ENABLE', 'ID_CONFIRM'
'ID_SELECT', 'ID_NO_SELECTION_WARNING', 'ID_MSG_REMOVE_PLUGIN', ));
'ID_TITLE', 'ID_VERSION', 'ID_STATUS', 'ID_TITLE', 'ID_VERSION', 'ID_DESCRIPTION', $headPublisher->assign('TRANSLATIONS', $translations);
'ID_STATUS', 'ID_PLUGIN_CANT_DELETE', 'ID_XPDL_IMPORT', 'ID_DISABLE', 'ID_ENABLE', 'ID_CONFIRM' if (isset($_SESSION['__PLUGIN_ERROR__'])) {
)); $headPublisher->assign('__PLUGIN_ERROR__', $_SESSION['__PLUGIN_ERROR__']);
$oHeadPublisher->assign('TRANSLATIONS', $translations); unset($_SESSION['__PLUGIN_ERROR__']);
G::RenderPage('publish', 'extJs'); }
G::RenderPage('publish', 'extJs');

View File

@@ -1,6 +1,6 @@
/* /*
* @author: Erik A. Ortiz * @author: Erik A. Ortiz
* Aug 20th, 2010 * Aug 20th, 2010
*/ */
var processesGrid; var processesGrid;
var store; var store;
@@ -31,7 +31,7 @@ Ext.onReady(function(){
url: 'pluginsList' url: 'pluginsList'
}), }),
reader : new Ext.data.JsonReader( { reader : new Ext.data.JsonReader( {
fields : [ fields : [
{name : 'id'}, {name : 'id'},
{name : 'namespace'}, {name : 'namespace'},
@@ -52,18 +52,18 @@ Ext.onReady(function(){
//groupField:'PRO_CATEGORY_LABEL' //groupField:'PRO_CATEGORY_LABEL'
}); });
var expander = new Ext.ux.grid.RowExpander({ var expander = new Ext.ux.grid.RowExpander({
tpl : new Ext.Template( tpl : new Ext.Template(
'<p><b>' + _('ID_DESCRIPTION') + ': </b> {description}</p><br>' '<p><b>' + _('ID_DESCRIPTION') + ': </b> {description}</p><br>'
) )
}); });
var selModel = new Ext.grid.RowSelectionModel({ var selModel = new Ext.grid.RowSelectionModel({
singleSelect : true singleSelect : true
}) })
Grid = new Ext.grid.GridPanel( { Grid = new Ext.grid.GridPanel( {
region: 'center', region: 'center',
layout: 'fit', layout: 'fit',
@@ -87,7 +87,7 @@ Ext.onReady(function(){
defaults: { defaults: {
width: 200, width: 200,
sortable: true sortable: true
}, },
columns: [ columns: [
expander, expander,
{id:'id', dataIndex: 'id', hidden:true, hideable:false}, {id:'id', dataIndex: 'id', hidden:true, hideable:false},
@@ -106,7 +106,7 @@ Ext.onReady(function(){
{header: '', dataIndex: 'sStatusFile', hidden:true, hideable:false} {header: '', dataIndex: 'sStatusFile', hidden:true, hideable:false}
] ]
}), }),
selModel:selModel, selModel:selModel,
store: store, store: store,
@@ -150,8 +150,8 @@ Ext.onReady(function(){
var activator = Ext.getCmp('activator'); var activator = Ext.getCmp('activator');
var setup = Ext.getCmp('setup'); var setup = Ext.getCmp('setup');
activator.setDisabled(false); activator.setDisabled(false);
if( rowSelected.data.status == 1 ){ if( rowSelected.data.status == 1 ){
activator.setIcon('/images/deactivate.png'); activator.setIcon('/images/deactivate.png');
activator.setText(_('ID_DISABLE'));//activator.setText(TRANSLATIONS.ID_DISABLE);//activator.setText('Deactivate'); activator.setText(_('ID_DISABLE'));//activator.setText(TRANSLATIONS.ID_DISABLE);//activator.setText('Deactivate');
} else { } else {
@@ -164,7 +164,7 @@ Ext.onReady(function(){
} else { } else {
setup.setDisabled(true); setup.setDisabled(true);
} }
}); });
} }
} }
@@ -178,6 +178,10 @@ Ext.onReady(function(){
autoScroll: true, autoScroll: true,
items: [Grid] items: [Grid]
}); });
if (typeof(__PLUGIN_ERROR__) !== 'undefined') {
PMExt.notify(_('ID_PLUGINS'), __PLUGIN_ERROR__);
}
}); });
@@ -238,29 +242,29 @@ browseLibrary = function(){
function activeDeactive(){ function activeDeactive(){
var rowSelected = Grid.getSelectionModel().getSelected(); var rowSelected = Grid.getSelectionModel().getSelected();
//var rows = Grid.getSelectionModel().getSelections(); //var rows = Grid.getSelectionModel().getSelections();
if( rowSelected ) { if( rowSelected ) {
var ids = ''; var ids = '';
var status = rowSelected.get('status'); var status = rowSelected.get('status');
var file = rowSelected.get('sFile'); var file = rowSelected.get('sFile');
Ext.Ajax.request({ Ext.Ajax.request({
url : 'pluginsChange?id='+file+'&status='+status , url : 'pluginsChange?id='+file+'&status='+status ,
params : { UIDS : ids }, params : { UIDS : ids },
method: 'GET', method: 'GET',
success: function ( result, request ) { success: function ( result, request ) {
//Ext.MessageBox.alert('Success', 'Data return from the server: '+ result.responseText); //Ext.MessageBox.alert('Success', 'Data return from the server: '+ result.responseText);
parent.parent.location.href = 'main?s='+parent._NODE_SELECTED; parent.parent.location.href = 'main?s='+parent._NODE_SELECTED;
return; return;
store.reload(); store.reload();
plugins = parent.Ext.getCmp('plugins'); plugins = parent.Ext.getCmp('plugins');
plugins.root.reload(); plugins.root.reload();
var activator = Ext.getCmp('activator'); var activator = Ext.getCmp('activator');
activator.setDisabled(true); activator.setDisabled(true);
activator.setText('Status'); activator.setText('Status');
@@ -270,7 +274,7 @@ function activeDeactive(){
Ext.MessageBox.alert('Failed', result.responseText); Ext.MessageBox.alert('Failed', result.responseText);
} }
}); });
//window.location = 'processes_ChangeStatus?PRO_UID='+rowSelected.data.PRO_UID; //window.location = 'processes_ChangeStatus?PRO_UID='+rowSelected.data.PRO_UID;
} else { } else {
Ext.Msg.show({ Ext.Msg.show({
@@ -292,7 +296,7 @@ var configure = function(){
if( rowSelected ) { if( rowSelected ) {
file = rowSelected.get('sFile'); file = rowSelected.get('sFile');
window.location = 'pluginsSetup?id='+file; window.location = 'pluginsSetup?id='+file;
} else { } else {
Ext.Msg.show({ Ext.Msg.show({
title : '', title : '',