1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 21:57:51 +02:00

Fixes #1045 - Plugin Builder now functions correctly in generating admin_config.php for plugins which use only preferences (no plugin tables).

This commit is contained in:
Cameron
2015-06-15 23:27:36 -07:00
parent c98f6a2fdf
commit 705e04dbda

View File

@@ -2339,20 +2339,25 @@ class pluginBuilder
$text .= $this->pluginXml(); $text .= $this->pluginXml();
$text .= "</div>"; $text .= "</div>";
foreach($ret['tables'] as $key=>$table) if(!empty($ret['tables']))
{ {
$text .= "<div class='tab-pane' id='".$table."'>\n"; foreach($ret['tables'] as $key=>$table)
$fields = $dv->getFields($ret['data'][$key]); {
$text .= $this->form($table,$fields); $text .= "<div class='tab-pane' id='".$table."'>\n";
$text .= "</div>"; $fields = $dv->getFields($ret['data'][$key]);
$text .= $this->form($table,$fields);
$text .= "</div>";
}
} }
$text .= "<div class='tab-pane' id='preferences'>\n"; $text .= "<div class='tab-pane' id='preferences'>\n";
$text .= $this->prefs(); $text .= $this->prefs();
$text .= "</div>"; $text .= "</div>";
if(empty($ret['tables']))
{
$text .= $frm->hidden($this->pluginName.'_ui[mode]','main');
$text .= $frm->hidden($this->pluginName.'_ui[pluginName]', $this->pluginName);
}
$text .= "</div>"; $text .= "</div>";
@@ -3283,15 +3288,16 @@ class ".$thePlugin."_adminArea extends e_admin_dispatcher
unset($_POST['newplugin']); unset($_POST['newplugin']);
foreach($_POST as $table => $vars) // LOOP Through Tables. foreach($_POST as $table => $vars) // LOOP Through Tables.
{ {
if(vartrue($vars['mode']) && $vars['mode'] != 'exclude') if(vartrue($vars['mode']) && $vars['mode'] != 'exclude')
{ {
$text .= " $text .= "
'".$vars['mode']."' => array( '".$vars['mode']."' => array(
'controller' => '".$vars['table']."_ui', 'controller' => '".$table."',
'path' => null, 'path' => null,
'ui' => '".$vars['table']."_form_ui', 'ui' => '".str_replace("_ui", "_form_ui", $table)."',
'uipath' => null 'uipath' => null
), ),
@@ -3316,7 +3322,7 @@ $text .= "
"; ";
foreach($_POST as $table => $vars) // LOOP Through Tables. foreach($_POST as $table => $vars) // LOOP Through Tables.
{ {
if(vartrue($vars['mode']) && $vars['mode'] != 'exclude') if(vartrue($vars['mode']) && $vars['mode'] != 'exclude' && !empty($vars['table']))
{ {
$text .= " $text .= "
'".$vars['mode']."/list' => array('caption'=> LAN_MANAGE, 'perm' => 'P'), '".$vars['mode']."/list' => array('caption'=> LAN_MANAGE, 'perm' => 'P'),
@@ -3446,6 +3452,7 @@ class ".$table." extends e_admin_ui
if($_POST['pluginPrefs'] && ($vars['mode']=='main')) if($_POST['pluginPrefs'] && ($vars['mode']=='main'))
{ {
$text .= " $text .= "
// protected \$preftabs = array('General', 'Other' );
protected \$prefs = array(\n"; protected \$prefs = array(\n";
foreach($_POST['pluginPrefs'] as $k=>$val) foreach($_POST['pluginPrefs'] as $k=>$val)
@@ -3455,7 +3462,7 @@ if($_POST['pluginPrefs'] && ($vars['mode']=='main'))
$index = $val['index']; $index = $val['index'];
$type = vartrue($val['type'],'text'); $type = vartrue($val['type'],'text');
$text .= "\t\t\t'".$index."'\t\t=> array('title'=> '".ucfirst($index)."', 'type'=>'".$type."', 'data' => 'str','help'=>'Help Text goes here'),\n"; $text .= "\t\t\t'".$index."'\t\t=> array('title'=> '".ucfirst($index)."', 'tab'=>0, 'type'=>'".$type."', 'data' => 'str', 'help'=>'Help Text goes here'),\n";
} }
} }
@@ -3539,7 +3546,7 @@ $text .= "
class ".$vars['table']."_form_ui extends e_admin_form_ui class ".str_replace("_ui", "_form_ui", $table)." extends e_admin_form_ui
{ {
"; ";