Skip to content

Commit

Permalink
feature 3080 : simpler date inputs (one input + fontello + picker sel…
Browse files Browse the repository at this point in the history
…ects)

git-svn-id: http://piwigo.org/svn/trunk@28497 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
mistic100 committed May 17, 2014
1 parent ce8a298 commit 914b6d9
Show file tree
Hide file tree
Showing 26 changed files with 246 additions and 541 deletions.
33 changes: 7 additions & 26 deletions admin/batch_manager_global.php
Expand Up @@ -286,17 +286,14 @@
// 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)
Expand Down Expand Up @@ -567,24 +564,8 @@
}

// 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
Expand Down
31 changes: 11 additions & 20 deletions admin/batch_manager_unit.php
Expand Up @@ -76,23 +76,21 @@
$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;
Expand Down Expand Up @@ -128,15 +126,10 @@

$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(),
)
);
Expand Down Expand Up @@ -232,11 +225,11 @@
// 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 = '
Expand Down Expand Up @@ -267,9 +260,7 @@
'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,
)
));
Expand Down
50 changes: 9 additions & 41 deletions admin/history.php
Expand Up @@ -73,24 +73,14 @@
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']))
Expand Down Expand Up @@ -551,20 +541,12 @@
{
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'];
Expand All @@ -588,35 +570,21 @@
{
// 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'] =
pwg_get_cookie_var('display_thumbnail', 'no_display_thumbnail');
}


$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'],
)
);

Expand Down
53 changes: 8 additions & 45 deletions admin/picture_modify.php
Expand Up @@ -108,23 +108,7 @@
}

//--------------------------------------------------------- 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'];
Expand All @@ -141,13 +125,9 @@
$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
{
Expand Down Expand Up @@ -339,37 +319,20 @@
// 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,
)
);

Expand Down
Binary file removed admin/themes/clear/icon/datepicker.png
Binary file not shown.
6 changes: 6 additions & 0 deletions admin/themes/default/fontello/config.json
Expand Up @@ -144,6 +144,12 @@
"code": 59197,
"src": "fontawesome"
},
{
"uid": "531bc468eecbb8867d822f1c11f1e039",
"css": "calendar",
"code": 59416,
"src": "fontawesome"
},
{
"uid": "0d20938846444af8deb1920dc85a29fb",
"css": "logout",
Expand Down
1 change: 1 addition & 0 deletions admin/themes/default/fontello/css/fontello-codes.css
Expand Up @@ -24,6 +24,7 @@
.icon-cog-alt:before { content: '\26ef'; } /* '⛯' */
.icon-wrench:before { content: '🔧'; } /* '\1f527' */
.icon-basket:before { content: '\e73d'; } /* '' */
.icon-calendar:before { content: '\e818'; } /* '' */
.icon-logout:before { content: '\e81b'; } /* '' */
.icon-clock:before { content: '🕔'; } /* '\1f554' */
.icon-block:before { content: '🚫'; } /* '\1f6ab' */
Expand Down
13 changes: 7 additions & 6 deletions admin/themes/default/fontello/css/fontello-embedded.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions admin/themes/default/fontello/css/fontello-ie7-codes.css
Expand Up @@ -22,6 +22,7 @@
.icon-cog-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '⛯ '); }
.icon-wrench { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '🔧 '); }
.icon-basket { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.icon-calendar { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.icon-logout { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.icon-clock { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '🕔 '); }
.icon-block { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '🚫 '); }
Expand Down
1 change: 1 addition & 0 deletions admin/themes/default/fontello/css/fontello-ie7.css
Expand Up @@ -33,6 +33,7 @@
.icon-cog-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '⛯ '); }
.icon-wrench { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '🔧 '); }
.icon-basket { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.icon-calendar { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.icon-logout { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
.icon-clock { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '🕔 '); }
.icon-block { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '🚫 '); }
Expand Down
13 changes: 7 additions & 6 deletions admin/themes/default/fontello/css/fontello.css
Expand Up @@ -2,11 +2,11 @@

@font-face {
font-family: 'fontello';
src: url('../font/fontello.eot?27476867');
src: url('../font/fontello.eot?27476867#iefix') format('embedded-opentype'),
url('../font/fontello.woff?27476867') format('woff'),
url('../font/fontello.ttf?27476867') format('truetype'),
url('../font/fontello.svg?27476867#fontello') format('svg');
src: url('../font/fontello.eot?87183122');
src: url('../font/fontello.eot?87183122#iefix') format('embedded-opentype'),
url('../font/fontello.woff?87183122') format('woff'),
url('../font/fontello.ttf?87183122') format('truetype'),
url('../font/fontello.svg?87183122#fontello') format('svg');
font-weight: normal;
font-style: normal;
}
Expand All @@ -16,7 +16,7 @@
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'fontello';
src: url('../font/fontello.svg?27476867#fontello') format('svg');
src: url('../font/fontello.svg?87183122#fontello') format('svg');
}
}
*/
Expand Down Expand Up @@ -75,6 +75,7 @@
.icon-cog-alt:before { content: '\26ef'; } /* '⛯' */
.icon-wrench:before { content: '🔧'; } /* '\1f527' */
.icon-basket:before { content: '\e73d'; } /* '' */
.icon-calendar:before { content: '\e818'; } /* '' */
.icon-logout:before { content: '\e81b'; } /* '' */
.icon-clock:before { content: '🕔'; } /* '\1f554' */
.icon-block:before { content: '🚫'; } /* '\1f6ab' */
Expand Down

0 comments on commit 914b6d9

Please sign in to comment.