From 4c7525b50de30182f7a03f2b5282ff321c7d66e0 Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Thu, 2 Aug 2012 02:11:22 +0000 Subject: [PATCH] Quick fix for handling array data and converting to comma separated data including filtering list results. (Admin-UI) --- e107_admin/image.php | 10 ++++++---- e107_admin/users.php | 10 ++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/e107_admin/image.php b/e107_admin/image.php index 8964a13bb..8461e45e3 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -350,7 +350,9 @@ class media_form_ui extends e_admin_form_ui function media_category($curVal,$mode) // not really necessary since we can use 'dropdown' - but just an example of a custom function. { + $curVal = explode(",",$curVal); + if($mode == 'read') { return $this->getController()->getMediaCategory($curVal); @@ -409,7 +411,7 @@ class media_admin_ui extends e_admin_ui 'checkboxes' => array('title'=> '', 'type' => null, 'data'=> null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), 'media_id' => array('title'=> LAN_ID, 'type' => 'number', 'data'=> 'int', 'width' =>'5%', 'forced'=> TRUE, 'nolist'=>TRUE), 'media_url' => array('title'=> 'Preview', 'type' => 'image', 'data'=> 'str', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>TRUE, 'writeParms'=>'thumb=180&thumb_urlraw=0&thumb_aw=180', 'width' => '110px'), - 'media_category' => array('title'=> LAN_CATEGORY, 'type' => 'method', 'data'=> 'str', 'width' => 'auto', 'filter' => true, 'batch' => true,'writeParms'=>'multiple=1'), + 'media_category' => array('title'=> LAN_CATEGORY, 'type' => 'method', 'data'=> 'comma', 'width' => 'auto', 'filter' => true, 'batch' => true,'writeParms'=>'multiple=1'), // Upload should be managed completely separately via upload-handler. // 'media_upload' => array('title'=> "Upload File", 'type' => 'upload', 'data'=> false, 'readParms' => 'hidden', 'writeParms' => 'disable_button=1', 'width' => '10%', 'nolist' => true), @@ -1093,10 +1095,10 @@ class media_admin_ui extends e_admin_ui public function beforeUpdate($new_data, $old_data, $id) { // return data to be merged with posted model data - $new_data['media_category'] = implode(",",$new_data['media_category']); - print_a($new_data); + // $new_data['media_category'] = implode(",",$new_data['media_category']); + $this->fields['media_category']['data'] = 'str'; //XXX Quick fix for 'comma' incompatibility in Db-Update routines. return $new_data; - return $this->observeUploaded($new_data); + // return $this->observeUploaded($new_data); } public function mediaData($sc_path) diff --git a/e107_admin/users.php b/e107_admin/users.php index 5121adc49..d074a0b79 100644 --- a/e107_admin/users.php +++ b/e107_admin/users.php @@ -689,7 +689,7 @@ class users_admin_ui extends e_admin_ui 'user_email' => array('title' => LAN_USER_08, 'type' => 'text', 'width' => 'auto'), 'user_hideemail' => array('title' => LAN_USER_10, 'type' => 'boolean', 'width' => 'auto', 'thclass'=>'center', 'class'=>'center', 'filter'=>true, 'batch'=>true, 'readParms'=>'trueonly=1'), 'user_xup' => array('title' => 'Xup', 'type' => 'text', 'width' => 'auto'), - 'user_class' => array('title' => LAN_USER_12, 'type' => 'method' , 'data' =>'text', 'filter'=>true, 'batch'=>true), + 'user_class' => array('title' => LAN_USER_12, 'type' => 'method' , 'data' =>'comma', 'filter'=>true, 'batch'=>true), 'user_join' => array('title' => LAN_USER_14, 'type' => 'datestamp', 'width' => 'auto', 'writeParms'=>'readonly=1'), 'user_lastvisit' => array('title' => LAN_USER_15, 'type' => 'datestamp', 'width' => 'auto'), 'user_currentvisit' => array('title' => LAN_USER_16, 'type' => 'datestamp', 'width' => 'auto'), @@ -1089,7 +1089,13 @@ class users_admin_form_ui extends e_admin_form_ui return $list; } - return $list[$curval]; + $tmp = explode(",",$curval); + $text = array(); + foreach($tmp as $v) + { + $text[] = $list[$v]; + } + return implode("
",$text); // $list[$curval]; }