1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-14 01:22:13 +02:00

Fixes #418 and various inline edit issues

This commit is contained in:
SecretR 2013-08-31 16:42:23 +03:00
parent 9464a40e70
commit 3ad911ef2b
3 changed files with 14 additions and 11 deletions

View File

@ -75,7 +75,7 @@ class comments_admin_ui extends e_admin_ui
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'comment_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE),
'comment_blocked' => array('title'=> LAN_STATUS, 'type' => 'method', 'inline'=>true, 'data'=> 'int', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'width' => 'auto'), // Photo
'comment_blocked' => array('title'=> LAN_STATUS, 'type' => 'method', 'inline'=>true, /*'writeParms' => array("approved","blocked","pending"), */'data'=> 'int', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'width' => 'auto'), // Photo
'comment_type' => array('title'=> LAN_TYPE, 'type' => 'method', 'width' => '10%', 'filter'=>TRUE),
@ -144,7 +144,7 @@ class comments_admin_form_ui extends e_admin_form_ui
{
$frm = e107::getForm();
$blocked = array("approved","blocked", "pending");
$blocked = array("approved", "blocked", "pending");
if($mode == 'filter' || $mode == 'batch' || $mode == 'inline') // Custom Filter List for release_type
{

View File

@ -380,7 +380,7 @@ class news_admin_ui extends e_admin_ui
'news_start' => array('title' => "Start", 'type' => 'datestamp', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y'),
'news_end' => array('title' => "End", 'type' => 'datestamp', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y'),
'news_class' => array('title' => LAN_VISIBILITY, 'type' => 'userclasses', 'data' => 'int', 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
'news_class' => array('title' => LAN_VISIBILITY, 'type' => 'userclasses', 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
'news_render_type' => array('title' => LAN_TEMPLATE, 'type' => 'comma', 'width' => 'auto', 'thclass' => 'center', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
'news_sticky' => array('title' => LAN_NEWS_28, 'type' => 'boolean', 'data' => 'int' , 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false, 'batch'=>true, 'filter'=>true),
'news_allow_comments' => array('title' => NWSLAN_15, 'type' => 'boolean', 'data' => 'int', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false,'batch'=>true, 'filter'=>true,'readParms'=>'reverse=1','writeParms'=>'reverse=1'),

View File

@ -2470,7 +2470,8 @@ class e_form
$opts = $wparms['__options'];
unset($wparms['__options']);
$_value = $value;
if(vartrue($opts['multiple']) || vartrue($attributes['type']) == 'comma')
{
$ret = array();
@ -2494,8 +2495,9 @@ class e_form
if(!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) // avoid bad markup, better solution coming up
{
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
$source = str_replace('"',"'",json_encode($wparms));
$value = "<a class='e-tip e-editable editable-click' data-name='".$field."' data-source=\"".$source."\" title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='select' data-pk='".$id."' data-url='".e_SELF."?mode=&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>".$value."</a>";
// SecretR - force object, fix number of bugs
$source = str_replace('"',"'",json_encode($wparms, JSON_FORCE_OBJECT));
$value = "<a class='e-tip e-editable editable-click' data-name='".$field."' data-value='{$_value}' data-source=\"".$source."\" title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='select' data-pk='".$id."' data-url='".e_SELF."?mode=&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>".$value."</a>";
}
// return ;
@ -2686,10 +2688,10 @@ class e_form
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
$array = e107::getUserClass()->uc_required_class_list(); //XXX Ugly looking (non-standard) function naming - TODO discuss name change.
$source = str_replace('"',"'",json_encode($array));
$source = str_replace('"',"'",json_encode($array, JSON_FORCE_OBJECT));
//NOTE Leading ',' required on $value; so it picks up existing value.
$value = "<a class='e-tip e-editable editable-click' data-placement='left' data-value=',".$value."' data-name='".$field."' data-source=\"".$source."\" title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='select' data-pk='".$id."' data-url='".e_SELF."?mode={$mode}&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>".$dispvalue."</a>";
$value = "<a class='e-tip e-editable editable-click' data-placement='left' data-value='".$value."' data-name='".$field."' data-source=\"".$source."\" title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='select' data-pk='".$id."' data-url='".e_SELF."?mode={$mode}&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>".$dispvalue."</a>";
}
else
@ -2714,7 +2716,7 @@ class e_form
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
$array = e107::getUserClass()->uc_required_class_list('classes'); //XXX Ugly looking (non-standard) function naming - TODO discuss name change.
$source = str_replace('"',"'",json_encode($array));
$source = str_replace('"',"'",json_encode($array, JSON_FORCE_OBJECT));
//NOTE Leading ',' required on $value; so it picks up existing value.
$value = "<a class='e-tip e-editable editable-click' data-placement='left' data-value=',".$value."' data-name='".$field."' data-source=\"".$source."\" title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='checklist' data-pk='".$id."' data-url='".e_SELF."?mode={$mode}&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>".$dispvalue."</a>";
@ -2817,6 +2819,7 @@ class e_form
case 'method': // Custom Function
$method = $attributes['field']; // prevents table alias in method names. ie. u.my_method.
$_value = $value;
$value = call_user_func_array(array($this, $method), array($value, 'read', $parms));
// Inline Editing.
@ -2824,8 +2827,8 @@ class e_form
{
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
$methodParms = call_user_func_array(array($this, $method), array($value, 'inline', $parms));
$source = str_replace('"',"'",json_encode($methodParms));
$value = "<a class='e-tip e-editable editable-click' data-type='select' data-name='".$field."' data-source=\"".$source."\" title=\"".LAN_EDIT." ".$attributes['title']."\" data-pk='".$id."' data-url='".e_SELF."?mode=&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>".$value."</a>";
$source = str_replace('"',"'",json_encode($methodParms, JSON_FORCE_OBJECT));
$value = "<a class='e-tip e-editable editable-click' data-type='select' data-value='".$_value."' data-name='".$field."' data-source=\"".$source."\" title=\"".LAN_EDIT." ".$attributes['title']."\" data-pk='".$id."' data-url='".e_SELF."?mode=&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>".$value."</a>";
}
break;