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

Admin-UI type=datestamp and batch=true was producing unexpected results in the batch filter. Now provides an option for setting the current date/time.

This commit is contained in:
Cameron 2021-09-23 12:37:30 -07:00
parent 45bb6c2f35
commit 171cac87b1
6 changed files with 46 additions and 37 deletions

View File

@ -593,7 +593,7 @@ class page_admin_ui extends e_admin_ui
// Options Tab.
'page_datestamp' => array('title'=> LAN_DATE, 'tab' => 1, 'type' => 'datestamp', 'data'=>'int', 'width' => 'auto','writeParms'=>'auto=1&type=datetime'),
'page_datestamp' => array('title'=> LAN_DATE, 'tab' => 1, 'type' => 'datestamp', 'data'=>'int', 'width' => 'auto','writeParms'=>'auto=1&type=datetime', 'batch'=>true),
'page_class' => array('title'=> LAN_VISIBILITY, 'tab' => 1, 'type' => 'userclass', 'data'=>'str', 'inline'=>true, 'width' => 'auto', 'filter' => true, 'batch' => true),
'page_rating_flag' => array('title'=> LAN_RATING, 'tab' => 1, 'type' => 'boolean', 'data'=>'int', 'width' => '5%', 'thclass' => 'center', 'class' => 'center' ),
'page_comment_flag' => array('title'=> LAN_COMMENTS, 'tab' => 1, 'type' => 'boolean', 'data'=>'int', 'width' => '5%', 'thclass' => 'center', 'class' => 'center' ),

View File

@ -461,7 +461,7 @@ class news_admin_ui extends e_admin_ui
// 'news_ping' => array('title' => LAN_PING, 'type' => 'checkbox', 'tab'=>1, 'data'=>false, 'writeParms'=>'value=0', 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_author' => array('title' => LAN_AUTHOR, 'type' => 'method', 'tab'=>2, 'readParms'=>'idField=user_id&nameField=user_name', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_datestamp' => array('title' => LAN_NEWS_32, 'type' => 'datestamp', 'data'=>'int', 'tab'=>2, 'writeParms'=>'type=datetime', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'filter'=>true),
'news_datestamp' => array('title' => LAN_NEWS_32, 'type' => 'datestamp', 'data'=>'int', 'tab'=>2, 'writeParms'=>'type=datetime', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'filter'=>true, 'batch'=>true),
'news_category' => array('title' => NWSLAN_6, 'type' => 'dropdown', 'data'=>'int', 'tab'=>0, 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
'news_start' => array('title' => LAN_START, 'type' => 'datestamp', 'data'=>'int', 'tab'=>2, 'writeParms'=>'type=datetime', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_end' => array('title' => LAN_END, 'type' => 'datestamp', 'data'=>'int', 'tab'=>2, 'writeParms'=>'type=datetime', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),

View File

@ -8126,44 +8126,52 @@ class e_admin_form_ui extends e_form
case 'datestamp':
$tp = e107::getParser();
$dateFilters = array (
'hour' => LAN_UI_FILTER_PAST_HOUR,
'day' => LAN_UI_FILTER_PAST_24_HOURS,
'week' => LAN_UI_FILTER_PAST_WEEK,
'month' => LAN_UI_FILTER_PAST_MONTH,
'month3' => $tp->lanVars(LAN_UI_FILTER_PAST_XMONTHS,3),
'month6' => $tp->lanVars(LAN_UI_FILTER_PAST_XMONTHS,6),
'month9' => $tp->lanVars(LAN_UI_FILTER_PAST_XMONTHS,9),
'year' => LAN_UI_FILTER_PAST_YEAR
);
$dateFiltersFuture = array (
'nhour' => LAN_UI_FILTER_NEXT_HOUR,
'nday' => LAN_UI_FILTER_NEXT_24_HOURS,
'nweek' => LAN_UI_FILTER_NEXT_WEEK,
'nmonth' => LAN_UI_FILTER_NEXT_MONTH,
'nmonth3' => $tp->lanVars(LAN_UI_FILTER_NEXT_XMONTHS,3),
'nmonth6' => $tp->lanVars(LAN_UI_FILTER_NEXT_XMONTHS,6),
'nmonth9' => $tp->lanVars(LAN_UI_FILTER_NEXT_XMONTHS,9),
'nyear' => LAN_UI_FILTER_NEXT_YEAR
);
if($val['filter'] === 'future' )
if($type !== 'batch')
{
$dateFilters = $dateFiltersFuture;
$dateFilters = array (
'hour' => LAN_UI_FILTER_PAST_HOUR,
'day' => LAN_UI_FILTER_PAST_24_HOURS,
'week' => LAN_UI_FILTER_PAST_WEEK,
'month' => LAN_UI_FILTER_PAST_MONTH,
'month3' => $tp->lanVars(LAN_UI_FILTER_PAST_XMONTHS,3),
'month6' => $tp->lanVars(LAN_UI_FILTER_PAST_XMONTHS,6),
'month9' => $tp->lanVars(LAN_UI_FILTER_PAST_XMONTHS,9),
'year' => LAN_UI_FILTER_PAST_YEAR
);
$dateFiltersFuture = array (
'nhour' => LAN_UI_FILTER_NEXT_HOUR,
'nday' => LAN_UI_FILTER_NEXT_24_HOURS,
'nweek' => LAN_UI_FILTER_NEXT_WEEK,
'nmonth' => LAN_UI_FILTER_NEXT_MONTH,
'nmonth3' => $tp->lanVars(LAN_UI_FILTER_NEXT_XMONTHS,3),
'nmonth6' => $tp->lanVars(LAN_UI_FILTER_NEXT_XMONTHS,6),
'nmonth9' => $tp->lanVars(LAN_UI_FILTER_NEXT_XMONTHS,9),
'nyear' => LAN_UI_FILTER_NEXT_YEAR
);
if($val['filter'] === 'future' )
{
$dateFilters = $dateFiltersFuture;
}
if($val['filter'] === 'both')
{
$dateFilters += $dateFiltersFuture;
}
foreach($dateFilters as $k => $name)
{
$option['datestamp__'.$key.'__'.$k] = $name;
}
}
if($val['filter'] === 'both')
else // batch
{
$dateFilters += $dateFiltersFuture;
$time = time();
$option[$key.'__'.$time] = LAN_UI_BATCH_NOW;
}
foreach($dateFilters as $k => $name)
{
$option['datestamp__'.$key.'__'.$k] = $name;
// $option['bool__'.$key.'__0'] = LAN_NO;
// $option[$key.'__'.$k] = $name;
}
break;
case 'userclass':

View File

@ -583,4 +583,5 @@ define("LAN_NAVIGATION", "Navigation");
define("LAN_NAVIGATION_LINKS", "Navigation Links");
define("LAN_PAGINATION", "Pagination");
define("LAN_X_CHARS_REMAINING", "[x] chars. remaining");
define("LAN_UI_BATCH_NOW", "Current Date/Time");

View File

@ -216,7 +216,7 @@ class faq_main_ui extends e_admin_ui
'faq_tags' => array('title'=> LANA_FAQ_TAGS, 'tab' => 1, 'type' => 'tags', 'data' => 'str', 'width' => 'auto', 'inline'=> true, 'help' => LANA_FAQ_TAGS_HELP), // User id
'faq_comment' => array('title'=> LANA_FAQ_COMMENT, 'tab' => 1, 'type' => 'userclass', 'data' => 'int', 'width' => 'auto', 'inline'=> true), // user class who can make comments
'faq_datestamp' => array('title'=> LAN_DATE, 'tab' => 1, 'type' => 'datestamp', 'data'=> 'int','width' => 'auto', 'noedit' => false,'writeParms'=>'type=datetime&auto=1'),
'faq_datestamp' => array('title'=> LAN_DATE, 'tab' => 1, 'type' => 'datestamp', 'data'=> 'int','width' => 'auto', 'noedit' => false,'writeParms'=>'type=datetime&auto=1', 'batch'=>true),
'faq_author' => array('title'=> LAN_AUTHOR, 'tab' => 1, 'type' => 'user', 'data'=> 'int', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'writeParms' => 'currentInit=1', 'filter' => true, 'batch' => true, 'nolist' => true ), // Photo
'faq_author_ip' => array('title'=> LAN_IP, 'tab' => 1, 'type' => 'ip', 'readonly'=>2, 'data'=> 'str', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'writeParms' => 'currentInit=1', 'filter' => true, 'batch' => true, 'nolist' => true ),

View File

@ -90,7 +90,7 @@ class gsitemap_ui extends e_admin_ui
'gsitemap_url' => array ( 'title' => LAN_URL, 'type' => 'url', 'data' => 'safestr', 'width' => 'auto', 'inline' => true, 'help' => '', 'readParms' => array (), 'writeParms' => array ('size'=>'xxlarge'), 'class' => 'left', 'thclass' => 'left',),
'gsitemap_table' => array ( 'title' => 'Table', 'tab'=>1, 'type' => 'text', 'data' => 'safestr', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => array (), 'writeParms' => array (), 'class' => 'left', 'thclass' => 'left', 'batch' => false,),
'gsitemap_table_id' => array ( 'title' => LAN_ID, 'tab'=>1,'type' => 'number', 'data' => 'int', 'width' => '5%', 'readonly' => false, 'help' => '', 'readParms' => array (), 'writeParms' => array (), 'class' => 'left', 'thclass' => 'left',),
'gsitemap_lastmod' => array ( 'title' => GSLAN_27, 'tab'=>1, 'type' => 'datestamp', 'readonly'=>2, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => array (), 'writeParms' => array (), 'class' => 'left', 'thclass' => 'left', 'filter' => false, 'batch' => false,),
'gsitemap_lastmod' => array ( 'title' => GSLAN_27, 'tab'=>1, 'type' => 'datestamp', 'readonly'=>2, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => array (), 'writeParms' => array (), 'class' => 'left', 'thclass' => 'left', 'filter' => false, 'batch' => true,),
'gsitemap_freq' => array ( 'title' => GSLAN_28, 'type' => 'dropdown', 'data' => 'safestr', 'width' => 'auto', 'help' => '', 'readParms' => array (), 'writeParms' => array (), 'class' => 'left', 'thclass' => 'left', 'filter' => false, 'batch' => false,),
'gsitemap_priority' => array ( 'title' => 'Priority', 'type' => 'method', 'data' => 'safestr', 'width' => 'auto', 'help' => '', 'readParms' => array (), 'writeParms' => array (), 'class' => 'left', 'thclass' => 'left', 'filter' => false, 'batch' => false,),
'gsitemap_cat' => array ( 'title' => LAN_CATEGORY, 'tab'=>1, 'type' => 'text', 'data' => 'safestr', 'width' => 'auto', 'batch' => true, 'filter' => true, 'help' => '', 'readParms' => array (), 'writeParms' => array (), 'class' => 'left', 'thclass' => 'left',),