From 914b6d96d2cae67507ef848a7a229fd5319d7968 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sat, 17 May 2014 22:04:36 +0000 Subject: [PATCH] feature 3080 : simpler date inputs (one input + fontello + picker selects) git-svn-id: http://piwigo.org/svn/trunk@28497 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/batch_manager_global.php | 33 +-- admin/batch_manager_unit.php | 31 +-- admin/history.php | 50 +---- admin/picture_modify.php | 53 +---- admin/themes/clear/icon/datepicker.png | Bin 912 -> 0 bytes admin/themes/default/fontello/config.json | 6 + .../default/fontello/css/fontello-codes.css | 1 + .../fontello/css/fontello-embedded.css | 13 +- .../fontello/css/fontello-ie7-codes.css | 1 + .../default/fontello/css/fontello-ie7.css | 1 + .../themes/default/fontello/css/fontello.css | 13 +- admin/themes/default/fontello/demo.html | 31 ++- .../themes/default/fontello/font/fontello.eot | Bin 21572 -> 22152 bytes .../themes/default/fontello/font/fontello.svg | 109 +++++----- .../themes/default/fontello/font/fontello.ttf | Bin 21404 -> 21984 bytes .../default/fontello/font/fontello.woff | Bin 13968 -> 14312 bytes admin/themes/default/icon/datepicker.png | Bin 517 -> 0 bytes admin/themes/default/js/datepicker.js | 61 ++++++ .../default/template/batch_manager_global.tpl | 27 +-- .../default/template/batch_manager_unit.tpl | 56 ++---- admin/themes/default/template/history.tpl | 45 ++--- .../template/include/datepicker.inc.tpl | 13 +- .../default/template/picture_modify.tpl | 26 +-- themes/default/js/datepicker.js | 188 ------------------ .../template/include/datepicker.inc.tpl | 18 -- themes/default/template/search.tpl | 11 - 26 files changed, 246 insertions(+), 541 deletions(-) delete mode 100644 admin/themes/clear/icon/datepicker.png delete mode 100644 admin/themes/default/icon/datepicker.png create mode 100644 admin/themes/default/js/datepicker.js delete mode 100644 themes/default/js/datepicker.js delete mode 100644 themes/default/template/include/datepicker.inc.tpl diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php index 3268ea278..1d72e2e2d 100644 --- a/admin/batch_manager_global.php +++ b/admin/batch_manager_global.php @@ -286,17 +286,14 @@ DELETE // date_creation if ('date_creation' == $action) { - $date_creation = sprintf( - '%u-%u-%u', - $_POST['date_creation_year'], - $_POST['date_creation_month'], - $_POST['date_creation_day'] - ); - - if (isset($_POST['remove_date_creation'])) + if (isset($_POST['remove_date_creation']) || empty($_POST['date_creation'])) { $date_creation = null; } + else + { + $date_creation = $_POST['date_creation'].' 00:00:00'; + } $datas = array(); foreach ($collection as $image_id) @@ -567,24 +564,8 @@ if (count($page['cat_elements_id']) > 0) } // creation date -$day = -empty($_POST['date_creation_day']) ? date('j') : $_POST['date_creation_day']; - -$month = -empty($_POST['date_creation_month']) ? date('n') : $_POST['date_creation_month']; - -$year = -empty($_POST['date_creation_year']) ? date('Y') : $_POST['date_creation_year']; - -$month_list = $lang['month']; -$month_list[0]='------------'; -ksort($month_list); -$template->assign( array( - 'month_list' => $month_list, - 'DATE_CREATION_DAY' => (int)$day, - 'DATE_CREATION_MONTH'=> (int)$month, - 'DATE_CREATION_YEAR' => (int)$year, - ) +$template->assign('DATE_CREATION', + empty($_POST['date_creation']) ? date('y-n-j') : $_POST['date_creation'] ); // image level options diff --git a/admin/batch_manager_unit.php b/admin/batch_manager_unit.php index 0531c866c..068182050 100644 --- a/admin/batch_manager_unit.php +++ b/admin/batch_manager_unit.php @@ -76,23 +76,21 @@ SELECT id, date_creation $data['comment'] = strip_tags(@$_POST['description-'.$row['id']]); } - if (isset($_POST['date_creation_action-'.$row['id']])) + if (!empty($_POST['date_creation-'.$row['id']])) { - if ('set' == $_POST['date_creation_action-'.$row['id']]) + if (!empty($row['date_creation'])) { - $data['date_creation'] = - $_POST['date_creation_year-'.$row['id']] - .'-'.$_POST['date_creation_month-'.$row['id']] - .'-'.$_POST['date_creation_day-'.$row['id']]; + list(, $time) = explode(' ', $row['date_creation']); } - else if ('unset' == $_POST['date_creation_action-'.$row['id']]) + else { - $data['date_creation'] = ''; + $time = '00:00:00'; } + $data['date_creation'] = $_POST['date_creation-'.$row['id']].' '.$time; } else { - $data['date_creation'] = $row['date_creation']; + $data['date_creation'] = null; } $datas[] = $data; @@ -128,15 +126,10 @@ $template->set_filenames( $base_url = PHPWG_ROOT_PATH.'admin.php'; -$month_list = $lang['month']; -$month_list[0]='------------'; -ksort($month_list); - $template->assign( array( 'U_ELEMENTS_PAGE' => $base_url.get_query_string_diff(array('display','start')), - 'F_ACTION'=>$base_url.get_query_string_diff(array()), - 'month_list' => $month_list, + 'F_ACTION' => $base_url.get_query_string_diff(array()), 'level_options' => get_privacy_level_options(), ) ); @@ -232,11 +225,11 @@ SELECT * // creation date if (!empty($row['date_creation'])) { - list($year,$month,$day) = explode('-', $row['date_creation']); + list($date) = explode(' ', $row['date_creation']); } else { - list($year,$month,$day) = array('',0,0); + $date = ''; } $query = ' @@ -267,9 +260,7 @@ SELECT 'AUTHOR' => htmlspecialchars(@$row['author']), 'LEVEL' => !empty($row['level'])?$row['level']:'0', 'DESCRIPTION' => htmlspecialchars(@$row['comment']), - 'DATE_CREATION_YEAR' => $year, - 'DATE_CREATION_MONTH' => (int)$month, - 'DATE_CREATION_DAY' => (int)$day, + 'DATE_CREATION' => $date, 'TAGS' => $tag_selection, ) )); diff --git a/admin/history.php b/admin/history.php index aaf0159c5..29f59b6b2 100644 --- a/admin/history.php +++ b/admin/history.php @@ -73,24 +73,14 @@ $search = array(); if (isset($_POST['submit'])) { // dates - if (!empty($_POST['start_year'])) + if (!empty($_POST['start'])) { - $search['fields']['date-after'] = sprintf( - '%d-%02d-%02d', - $_POST['start_year'], - $_POST['start_month'], - $_POST['start_day'] - ); + $search['fields']['date-after'] = $_POST['start']; } - if (!empty($_POST['end_year'])) + if (!empty($_POST['end'])) { - $search['fields']['date-before'] = sprintf( - '%d-%02d-%02d', - $_POST['end_year'], - $_POST['end_month'], - $_POST['end_day'] - ); + $search['fields']['date-before'] = $_POST['end']; } if (empty($_POST['types'])) @@ -551,20 +541,12 @@ if (isset($page['search'])) { if (isset($page['search']['fields']['date-after'])) { - $tokens = explode('-', $page['search']['fields']['date-after']); - - $form['start_year'] = (int)$tokens[0]; - $form['start_month'] = (int)$tokens[1]; - $form['start_day'] = (int)$tokens[2]; + $form['start'] = $page['search']['fields']['date-after']; } if (isset($page['search']['fields']['date-before'])) { - $tokens = explode('-', $page['search']['fields']['date-before']); - - $form['end_year'] = (int)$tokens[0]; - $form['end_month'] = (int)$tokens[1]; - $form['end_day'] = (int)$tokens[2]; + $form['end'] = $page['search']['fields']['date-before']; } $form['types'] = $page['search']['fields']['types']; @@ -588,9 +570,7 @@ else { // by default, at page load, we want the selected date to be the current // date - $form['start_year'] = $form['end_year'] = date('Y'); - $form['start_month'] = $form['end_month'] = date('n'); - $form['start_day'] = $form['end_day'] = date('j'); + $form['start'] = $form['end'] = date('Y-n-j'); $form['types'] = $types; // Hoverbox by default $form['display_thumbnail'] = @@ -598,25 +578,13 @@ else } -$month_list = $lang['month']; -$month_list[0]='------------'; -ksort($month_list); - $template->assign( array( 'IMAGE_ID' => @$form['image_id'], 'FILENAME' => @$form['filename'], 'IP' => @$form['ip'], - - 'month_list' => $month_list, - - 'START_DAY_SELECTED' => @$form['start_day'], - 'START_MONTH_SELECTED' => @$form['start_month'], - 'START_YEAR' => @$form['start_year'], - - 'END_DAY_SELECTED' => @$form['end_day'], - 'END_MONTH_SELECTED' => @$form['end_month'], - 'END_YEAR' => @$form['end_year'], + 'START' => @$form['start'], + 'END' => @$form['end'], ) ); diff --git a/admin/picture_modify.php b/admin/picture_modify.php index dc7d56211..d476c560f 100644 --- a/admin/picture_modify.php +++ b/admin/picture_modify.php @@ -108,23 +108,7 @@ if (isset($_GET['sync_metadata'])) } //--------------------------------------------------------- update informations - -// first, we verify whether there is a mistake on the given creation date -if (isset($_POST['date_creation_action']) - and 'set' == $_POST['date_creation_action']) -{ - if (!is_numeric($_POST['date_creation_year']) - or !checkdate( - $_POST['date_creation_month'], - $_POST['date_creation_day'], - $_POST['date_creation_year']) - ) - { - $page['errors'][] = l10n('wrong date'); - } -} - -if (isset($_POST['submit']) and count($page['errors']) == 0) +if (isset($_POST['submit'])) { $data = array(); $data['id'] = $_GET['image_id']; @@ -141,13 +125,9 @@ if (isset($_POST['submit']) and count($page['errors']) == 0) $data['comment'] = strip_tags(@$_POST['description']); } - if (!empty($_POST['date_creation_year'])) + if (!empty($_POST['date_creation'])) { - $data['date_creation'] = - $_POST['date_creation_year'] - .'-'.$_POST['date_creation_month'] - .'-'.$_POST['date_creation_day'] - .' '.$_POST['date_creation_time']; + $data['date_creation'] = $_POST['date_creation'].' '.$_POST['date_creation_time']; } else { @@ -339,37 +319,20 @@ $template->assign( // creation date unset($day, $month, $year); -if (isset($_POST['date_creation_action']) - and 'set' == $_POST['date_creation_action']) +if (!empty($row['date_creation'])) { - foreach (array('day', 'month', 'year', 'time') as $varname) - { - $$varname = $_POST['date_creation_'.$varname]; - } -} -else if (isset($row['date_creation']) and !empty($row['date_creation'])) -{ - list($year, $month, $day) = explode('-', substr($row['date_creation'],0,10)); - $time = substr($row['date_creation'],11); + list($date, $time) = explode(' ', $row['date_creation']); } else { - list($year, $month, $day) = array('', 0, 0); + $date = ''; $time = '00:00:00'; } - -$month_list = $lang['month']; -$month_list[0]='------------'; -ksort($month_list); - $template->assign( array( - 'DATE_CREATION_DAY_VALUE' => (int)$day, - 'DATE_CREATION_MONTH_VALUE' => (int)$month, - 'DATE_CREATION_YEAR_VALUE' => $year, - 'DATE_CREATION_TIME_VALUE' => $time, - 'month_list' => $month_list, + 'DATE_CREATION' => $date, + 'DATE_CREATION_TIME' => $time, ) ); diff --git a/admin/themes/clear/icon/datepicker.png b/admin/themes/clear/icon/datepicker.png deleted file mode 100644 index 68c5256a6e3d497266edbbde7cb35510e31aa429..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 912 zcmV;B18@9^P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igP& z76=)mKlYjc00R(7L_t(I%WaZBXq{yg#((GizWb*}x!#1T1Q$_^Z8h4ah^Q3A2oBQ8 zA!8O-A!H9(GIeor6S_Dg(8<-oLS3Xv8*Tm!Vo8)pYNFWOn%wVu&v_hjZyLb^FYn=; z=Y2Tu^Be>C>C?&S0$nD;OhAA_gB#?65E9@zu7yybO!3|28ynx)7wzCWn9Q(lAKCVUBeF;iD^M4y-U#7?g$zj-&h9TcYms^u+5l$Hr-N##BDl z<@c{|sNUN}28E$yMisII5W+&>!m=<=C3a@S4(@MQ_stJ1of#olefwwkHx7RN#T;xP zn@KW&5+DnXT;##HxU>1?XGC4|_ud0iqs^c9zDHINE+Rw@Q3bdFjFK0p4vJS^kQF7Q zBuj~836A}vFGCWo=U$d1B0}M!aHq(wX3n&J-g;QR`tc|G7vFxz+U>Slt(G;LP0F%V zQ52R^!ps09$s$7TZaHVFs#3q-x5L9j>RY!Slx5ifkeOkFDTeugghA~;m_f+QD9Z9! z62Kng%_OnDzHT>f-n9Mw{gdA2<|e&f&raiqc{-t%PR`!m9*c{MT)%#u>FH^Xj*eJb zTH@-}t88p+@PCm`6AZ*;baa&EV?*OG*pQQp0K_s7Y}$%u$l zRh12MgK7(3bUthmxjYi{%OP4NPIe-5A8 - - - - - +