From d04e3894119ade77bfafd02a29cf368efcdde565 Mon Sep 17 00:00:00 2001 From: plegall Date: Sun, 29 Apr 2012 11:41:34 +0000 Subject: feature 2626: manage inline errors on form submission git-svn-id: http://piwigo.org/svn/trunk@14513 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/configuration.php | 86 +++++++++++----------- .../configuration_watermark_process.inc.php | 2 +- admin/themes/default/template/configuration.tpl | 18 +++-- admin/themes/default/theme.css | 5 +- 4 files changed, 57 insertions(+), 54 deletions(-) (limited to 'admin') diff --git a/admin/configuration.php b/admin/configuration.php index 0fbe113d6..f9e0999e8 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -221,7 +221,7 @@ if (isset($_POST['submit'])) } // updating configuration if no error found - if ('sizes' != $page['section'] and count($page['errors']) == 0) + if (!in_array($page['section'], array('sizes', 'watermark')) and count($page['errors']) == 0) { //echo '
'; print_r($_POST); echo '
'; $result = pwg_query('SELECT param FROM '.CONFIG_TABLE); @@ -520,54 +520,52 @@ switch ($page['section']) } $template->assign('watermark_files', $watermark_filemap); - $wm = ImageStdParams::get_watermark(); - - $position = 'custom'; - if ($wm->xpos == 0 and $wm->ypos == 0) - { - $position = 'topleft'; - } - if ($wm->xpos == 100 and $wm->ypos == 0) - { - $position = 'topright'; - } - if ($wm->xpos == 50 and $wm->ypos == 50) - { - $position = 'middle'; - } - if ($wm->xpos == 0 and $wm->ypos == 100) - { - $position = 'bottomleft'; - } - if ($wm->xpos == 100 and $wm->ypos == 100) + if ($template->get_template_vars('watermark') === null) { - $position = 'bottomright'; - } + $wm = ImageStdParams::get_watermark(); - if ($wm->xrepeat != 0) - { $position = 'custom'; + if ($wm->xpos == 0 and $wm->ypos == 0) + { + $position = 'topleft'; + } + if ($wm->xpos == 100 and $wm->ypos == 0) + { + $position = 'topright'; + } + if ($wm->xpos == 50 and $wm->ypos == 50) + { + $position = 'middle'; + } + if ($wm->xpos == 0 and $wm->ypos == 100) + { + $position = 'bottomleft'; + } + if ($wm->xpos == 100 and $wm->ypos == 100) + { + $position = 'bottomright'; + } + + if ($wm->xrepeat != 0) + { + $position = 'custom'; + } + + $template->assign( + 'watermark', + array( + 'file' => $wm->file, + 'minw' => $wm->min_size[0], + 'minh' => $wm->min_size[1], + 'xpos' => $wm->xpos, + 'ypos' => $wm->ypos, + 'xrepeat' => $wm->xrepeat, + 'opacity' => $wm->opacity, + 'position' => $position, + ) + ); } - $template->assign( - 'watermark', - array( - 'file' => $wm->file, - 'minw' => $wm->min_size[0], - 'minh' => $wm->min_size[1], - 'xpos' => $wm->xpos, - 'ypos' => $wm->ypos, - 'xrepeat' => $wm->xrepeat, - 'opacity' => $wm->opacity, - 'position' => $position, - ) - ); - - $template->append( - 'watermark', - array(), - true - ); break; } } diff --git a/admin/include/configuration_watermark_process.inc.php b/admin/include/configuration_watermark_process.inc.php index d3dcc0f67..2beaa19b1 100644 --- a/admin/include/configuration_watermark_process.inc.php +++ b/admin/include/configuration_watermark_process.inc.php @@ -84,7 +84,7 @@ if ($v <= 0 or $v > 100) } // step 3 - save data -if (count($errors)==0) +if (count($errors) == 0) { $watermark = new WatermarkParams(); $watermark->file = $pwatermark['file']; diff --git a/admin/themes/default/template/configuration.tpl b/admin/themes/default/template/configuration.tpl index 288e9f9ff..86f2dc416 100644 --- a/admin/themes/default/template/configuration.tpl +++ b/admin/themes/default/template/configuration.tpl @@ -319,8 +319,6 @@ jQuery(document).ready(function(){ {/literal}{/footer_script} {html_style}{literal} -input[type="text"].dError {border-color:#ff7070; background-color:#FFe5e5;} -.dErrorDesc {background-color:red; color:white; padding:0 5px;border-radius:10px; font-weight:bold;cursor:help;} .sizeEnable {width:50px;} .sizeEditForm {margin:0 0 10px 20px;} .sizeEdit {display:none;} @@ -489,7 +487,7 @@ jQuery(document).ready(function() {
  • {'pixels'|@translate}
  • @@ -497,7 +495,7 @@ jQuery(document).ready(function() {
  • {'pixels'|@translate}
  • @@ -515,24 +513,28 @@ jQuery(document).ready(function() {


  • - % + % + {if isset($ferrors.watermark.opacity)}!{/if}
  • diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css index bf9013184..f56444877 100644 --- a/admin/themes/default/theme.css +++ b/admin/themes/default/theme.css @@ -1107,4 +1107,7 @@ FORM#categoryOrdering .categoryLi:hover p.albumActions {visibility:visible;} #positionCustomDetails label { font-weight:normal; -} \ No newline at end of file +} + +input[type="text"].dError {border-color:#ff7070; background-color:#FFe5e5;} +.dErrorDesc {background-color:red; color:white; padding:0 5px;border-radius:10px; font-weight:bold;cursor:help;} -- cgit v1.2.3