1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-16 20:28:28 +01:00

Partial Fix for Issue #4959 - TODO: unchecked checkboxes are not posted. ie. not saved/updated.

This commit is contained in:
Cameron 2023-03-18 12:31:23 -07:00
parent 4bad7825df
commit 5d18df638a
3 changed files with 68 additions and 47 deletions

View File

@ -275,6 +275,7 @@ class e_menu
$model->setFieldIdName("menu_id");
$model->setDataFields(array('menu_parms'=>'json'));
$model->load($id, true);
$d = $model->get('menu_parms');
@ -289,11 +290,14 @@ class e_menu
}
else
{
$lang = key($value);
$val = $value[$lang];
foreach($value as $lang => $val)
{
$model->setPostedData('menu_parms/'.$key.'/'.$lang, $val);
}
}
}
// file_put_contents(e_LOG."menuParmsAjax.log", print_r($parms,true));
return $model->save();

View File

@ -109,7 +109,7 @@ class banner_ui extends e_admin_ui
protected $fields = array (
'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ),
'banner_id' => array ( 'title' => LAN_ID, 'type' => null, 'data' => 'int', 'width' => '2%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'banner_campaign' => array ( 'title' => BNRLAN_11, 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => array( 'tdClassRight'=>'form-inline'), 'class' => 'left', 'thclass' => 'left', ),
'banner_campaign' => array ( 'title' => BNRLAN_11, 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'inline'=>false, 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => array( 'tdClassRight'=>'form-inline'), 'class' => 'left', 'thclass' => 'left', ),
'banner_clientname' => array ( 'title' => BANNERLAN_22, 'type' => 'method', 'tab'=>1, 'data' => 'str', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'banner_clientlogin' => array ( 'title' => BNRLAN_12, 'type' => 'method', 'tab'=>1, 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
@ -204,7 +204,7 @@ class banner_ui extends e_admin_ui
}
if(!empty($new_data['banner_campaign_sel']))
if(!empty($new_data['banner_campaign_sel']) && empty($new_data['banner_campaign']))
{
$new_data['banner_campaign'] = $new_data['banner_campaign_sel'];
}
@ -214,6 +214,8 @@ class banner_ui extends e_admin_ui
$new_data['banner_image'] = $new_data['banner_image_remote'];
}
// e107::getMessage()->addDebug(print_a($new_data,true));
return $new_data;
}
@ -227,6 +229,20 @@ class banner_ui extends e_admin_ui
// do something
}
public function ListObserver()
{
$this->fields['banner_campaign']['type'] = 'text';
$this->fields['banner_campaign']['inline'] = true;
parent::ListObserver();
}
public function InlineAjaxPage()
{
$this->fields['banner_campaign']['type'] = 'text';
$this->fields['banner_campaign']['inline'] = true;
return parent::InlineAjaxPage();
}
/*
private function menuPageSave()
{

View File

@ -32,7 +32,7 @@ class banner_menu
$fields = array();
$fields['banner_caption'] = array('title'=> LAN_CAPTION, 'type'=>'text', 'multilan'=>true, 'writeParms'=>array('size'=>'xxlarge'));
$fields['banner_campaign'] = array('title'=> BNRLAN_39, 'type'=>'method');
$fields['banner_campaign'] = array('title'=> BNRLAN_39, 'type'=>'method', 'data'=>'array');
$fields['banner_amount'] = array('title'=> BNRLAN_41, 'type'=>'text', 'writeParms'=>array('pattern'=>'[0-9]*'));
$fields['banner_width'] = array('title'=> LAN_WIDTH, 'type'=>'text', 'help'=>"In pixels", 'writeParms'=>array('pattern'=>'[0-9]*'));
$fields['banner_rendertype'] = array('title'=> BNRLAN_43, 'type'=>'dropdown', 'writeParms'=>array('optArray'=>$renderTypes, 'size'=>'xxlarge'));
@ -64,6 +64,7 @@ class banner_menu_form extends e_form
while ($row = $sql -> fetch())
{
$checked = in_array($row['banner_campaign'], $curVal);
// $text .= $this->radio_switch('banner_campaign[]',$row['banner_campaign'],$checked, array('label'=> $row['banner_campaign'],'class'=>'e-save')); // e-save class is required. TODO
$text .= $this->checkbox('banner_campaign[]',$row['banner_campaign'],$checked, array('label'=> $row['banner_campaign'],'class'=>'e-save')); // e-save class is required.
}