Changeset 14513


Ignore:
Timestamp:
Apr 29, 2012, 1:41:34 PM (12 years ago)
Author:
plg
Message:

feature 2626: manage inline errors on form submission

Location:
trunk/admin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/configuration.php

    r14512 r14513  
    222222
    223223  // updating configuration if no error found
    224   if ('sizes' != $page['section'] and count($page['errors']) == 0)
     224  if (!in_array($page['section'], array('sizes', 'watermark')) and count($page['errors']) == 0)
    225225  {
    226226    //echo '<pre>'; print_r($_POST); echo '</pre>';
     
    521521    $template->assign('watermark_files', $watermark_filemap);
    522522
    523     $wm = ImageStdParams::get_watermark();
    524 
    525     $position = 'custom';
    526     if ($wm->xpos == 0 and $wm->ypos == 0)
    527     {
    528       $position = 'topleft';
    529     }
    530     if ($wm->xpos == 100 and $wm->ypos == 0)
    531     {
    532       $position = 'topright';
    533     }
    534     if ($wm->xpos == 50 and $wm->ypos == 50)
    535     {
    536       $position = 'middle';
    537     }
    538     if ($wm->xpos == 0 and $wm->ypos == 100)
    539     {
    540       $position = 'bottomleft';
    541     }
    542     if ($wm->xpos == 100 and $wm->ypos == 100)
    543     {
    544       $position = 'bottomright';
    545     }
    546 
    547     if ($wm->xrepeat != 0)
    548     {
     523    if ($template->get_template_vars('watermark') === null)
     524    {
     525      $wm = ImageStdParams::get_watermark();
     526
    549527      $position = 'custom';
    550     }
     528      if ($wm->xpos == 0 and $wm->ypos == 0)
     529      {
     530        $position = 'topleft';
     531      }
     532      if ($wm->xpos == 100 and $wm->ypos == 0)
     533      {
     534        $position = 'topright';
     535      }
     536      if ($wm->xpos == 50 and $wm->ypos == 50)
     537      {
     538        $position = 'middle';
     539      }
     540      if ($wm->xpos == 0 and $wm->ypos == 100)
     541      {
     542        $position = 'bottomleft';
     543      }
     544      if ($wm->xpos == 100 and $wm->ypos == 100)
     545      {
     546        $position = 'bottomright';
     547      }
     548     
     549      if ($wm->xrepeat != 0)
     550      {
     551        $position = 'custom';
     552      }
    551553   
    552     $template->assign(
    553       'watermark',
    554       array(
    555         'file' => $wm->file,
    556         'minw' => $wm->min_size[0],
    557         'minh' => $wm->min_size[1],
    558         'xpos' => $wm->xpos,
    559         'ypos' => $wm->ypos,
    560         'xrepeat' => $wm->xrepeat,
    561         'opacity' => $wm->opacity,
    562         'position' => $position,
    563         )
    564       );
    565 
    566     $template->append(
    567       'watermark',
    568       array(),
    569       true
    570       );
     554      $template->assign(
     555        'watermark',
     556        array(
     557          'file' => $wm->file,
     558          'minw' => $wm->min_size[0],
     559          'minh' => $wm->min_size[1],
     560          'xpos' => $wm->xpos,
     561          'ypos' => $wm->ypos,
     562          'xrepeat' => $wm->xrepeat,
     563          'opacity' => $wm->opacity,
     564          'position' => $position,
     565          )
     566        );
     567    }
     568   
    571569    break;
    572570  }
  • trunk/admin/include/configuration_watermark_process.inc.php

    r14512 r14513  
    8585
    8686// step 3 - save data
    87 if (count($errors)==0)
     87if (count($errors) == 0)
    8888{
    8989  $watermark = new WatermarkParams();
  • trunk/admin/themes/default/template/configuration.tpl

    r14512 r14513  
    320320
    321321{html_style}{literal}
    322 input[type="text"].dError {border-color:#ff7070; background-color:#FFe5e5;}
    323 .dErrorDesc {background-color:red; color:white; padding:0 5px;border-radius:10px; font-weight:bold;cursor:help;}
    324322.sizeEnable {width:50px;}
    325323.sizeEditForm {margin:0 0 10px 20px;}
     
    490488      <label>
    491489        {'Apply watermark if width is bigger than'|@translate}
    492         <input  size="4" maxlength="4" type="text" name="w[minw]" value="{$watermark.minw}"{if isset($ferrors.watermark.minw)}class="dError"{/if}>
     490        <input  size="4" maxlength="4" type="text" name="w[minw]" value="{$watermark.minw}"{if isset($ferrors.watermark.minw)} class="dError"{/if}>
    493491      </label>
    494492      {'pixels'|@translate}
     
    498496      <label>
    499497        {'Apply watermark if height is bigger than'|@translate}
    500         <input  size="4" maxlength="4" type="text" name="w[minh]" value="{$watermark.minh}"{if isset($ferrors.watermark.minh)}class="dError"{/if}>
     498        <input  size="4" maxlength="4" type="text" name="w[minh]" value="{$watermark.minh}"{if isset($ferrors.watermark.minh)} class="dError"{/if}>
    501499      </label>
    502500      {'pixels'|@translate}
     
    516514      <div id="positionCustomDetails">
    517515        <label>{'X Position'|@translate}
    518           <input size="3" maxlength="3" type="text" name="w[xpos]" value="{$watermark.xpos}"{if isset($ferrors.watermark.xpos)}class="dError"{/if}>%
     516          <input size="3" maxlength="3" type="text" name="w[xpos]" value="{$watermark.xpos}"{if isset($ferrors.watermark.xpos)} class="dError"{/if}>%
     517          {if isset($ferrors.watermark.xpos)}<span class="dErrorDesc" title="{$ferrors.watermark.xpos}">!</span>{/if}
    519518        </label>
    520519
    521520        <br>
    522521        <label>{'Y Position'|@translate}
    523           <input size="3" maxlength="3" type="text" name="w[ypos]" value="{$watermark.ypos}"{if isset($ferrors.watermark.ypos)}class="dError"{/if}>%
     522          <input size="3" maxlength="3" type="text" name="w[ypos]" value="{$watermark.ypos}"{if isset($ferrors.watermark.ypos)} class="dError"{/if}>%
     523          {if isset($ferrors.watermark.ypos)}<span class="dErrorDesc" title="{$ferrors.watermark.ypos}">!</span>{/if}
    524524        </label>
    525525
    526526        <br>
    527527        <label>{'X Repeat'|@translate}
    528           <input size="3" maxlength="3" type="text" name="w[xrepeat]" value="{$watermark.xrepeat}"{if isset($ferrors.watermark.xrepeat)}class="dError"{/if}>
     528          <input size="3" maxlength="3" type="text" name="w[xrepeat]" value="{$watermark.xrepeat}"{if isset($ferrors.watermark.xrepeat)} class="dError"{/if}>
     529          {if isset($ferrors.watermark.xrepeat)}<span class="dErrorDesc" title="{$ferrors.watermark.xrepeat}">!</span>{/if}
    529530        </label>
    530531      </div>
     
    533534    <li>
    534535      <label>{'Opacity'|@translate}</label>
    535       <input size="3" maxlength="3" type="text" name="w[opacity]" value="{$watermark.opacity}"{if isset($ferrors.watermark.opacity)}class="dError"{/if}> %
     536      <input size="3" maxlength="3" type="text" name="w[opacity]" value="{$watermark.opacity}"{if isset($ferrors.watermark.opacity)} class="dError"{/if}> %
     537      {if isset($ferrors.watermark.opacity)}<span class="dErrorDesc" title="{$ferrors.watermark.opacity}">!</span>{/if}
    536538    </li>
    537539  </ul>
  • trunk/admin/themes/default/theme.css

    r14512 r14513  
    11091109  font-weight:normal;
    11101110}
     1111
     1112input[type="text"].dError {border-color:#ff7070; background-color:#FFe5e5;}
     1113.dErrorDesc {background-color:red; color:white; padding:0 5px;border-radius:10px; font-weight:bold;cursor:help;}
Note: See TracChangeset for help on using the changeset viewer.