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

View File

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

View File

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