1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-17 12:01:05 +02:00

Fix for User-Extended checkbox field creation.

This commit is contained in:
Cameron
2016-04-02 12:47:27 -07:00
parent 46b2518e82
commit fb3a92ff9e
5 changed files with 36 additions and 7 deletions

View File

@@ -2223,6 +2223,7 @@ class pluginBuilder
$frm = e107::getForm();
$ns = e107::getRender();
$mes = e107::getMessage();
$tp = e107::getParser();
$plugFolders = $fl->get_dirs(e_PLUGIN);
foreach($plugFolders as $dir)
@@ -2243,7 +2244,7 @@ class pluginBuilder
$info .= "<li>".EPL_ADLAN_106."</li>";
$info .= "</ul>";
$mes->addInfo($info);
$mes->addInfo($tp->toHtml($info,true));
$text = $frm->open('createPlugin','get');
$text .= "<table class='table adminform'>

View File

@@ -375,7 +375,7 @@ e107::js('footer-inline', js());
'user_extended_struct_write' => array ( 'title' => 'Write Access', 'type' => 'userclass', 'data' => 'int', 'filter'=>true, 'batch'=>true, 'width' => '10%', 'inline' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'user_extended_struct_signup' => array ( 'title' => 'Signup', 'type' => 'hidden', 'nolist'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'user_extended_struct_order' => array ( 'title' => LAN_ORDER, 'type' => 'hidden', 'nolist'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'options' => array ( 'title' => LAN_OPTIONS, 'type' => null, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', 'readParms'=>'sort=1' ),
'options' => array ( 'title' => LAN_OPTIONS, 'type' => 'method', 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', 'readParms'=>'sort=1' ),
);
protected $fieldpref = array('user_extended_struct_name', 'user_extended_struct_text', 'user_extended_struct_type', 'user_extended_struct_read', 'user_extended_struct_write', 'user_extended_struct_required', 'user_extended_struct_applicable');
@@ -389,6 +389,9 @@ e107::js('footer-inline', js());
public function init()
{
if($this->getAction() == 'edit' || $this->getAction() == 'create')
{
$this->fields['user_extended_struct_type']['title'] = LAN_TYPE;
@@ -765,6 +768,29 @@ e107::js('footer-inline', js());
{
function options($parms, $value, $id, $attributes)
{
if($attributes['mode'] == 'read')
{
$name = $this->getController()->getListModel()->get('user_extended_struct_name');
if(strpos($name, 'plugin_') === 0)
{
$attributes['readParms']['deleteClass'] = e_UC_NOBODY;
}
$text = "<div class='btn-group'>";
$text .= $this->renderValue('options',$value,$attributes, $id);
$text .= "</div>";
return $text;
}
}
// Custom Method/Function
function user_extended_struct_type($curVal,$mode)
{

View File

@@ -3306,7 +3306,8 @@ class e_form
{
//return $this->options($field, $value, $attributes, $id);
// consistent method arguments, fixed in admin cron administration
return $this->options($parms, $value, $id, $attributes); // OLD breaks admin->cron 'options' column
$attributes['type'] = null; // prevent infinite loop.
return $this->options($parms, $value, $id, $attributes);
}
}

View File

@@ -748,6 +748,7 @@ class e107plugin
}
//var_dump($field_attrib, $field_name, $type);
$mes->addDebug("Extended Field: ".print_a($field_attrib,true));
$status = $this->module['ue']->user_extended_add(
$field_name,
@@ -2264,7 +2265,7 @@ class e107plugin
switch ($function)
{
case 'install': // Add all active extended fields
case 'upgrade':
case 'upgrade':
if (!$remove)
{

View File

@@ -506,7 +506,7 @@ class e107_user_extended
break;
}
if($type != EUF_DB_FIELD && $type != EUF_TEXTAREA && $default != '')
if($type != EUF_DB_FIELD && ($type != EUF_TEXTAREA) && ($type != EUF_CHECKBOX) && !empty($default))
{
$default_text = " DEFAULT '".$tp -> toDB($default, true)."'";
}