Changeset 14512


Ignore:
Timestamp:
Apr 29, 2012, 9:34:44 AM (8 years ago)
Author:
plg
Message:

feature 2626: new design for the watermark configuration screen (tab in the "config > options")

TODO: the detection of derivatives that need to be updated is not working.

Location:
trunk/admin
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/configuration.php

    r14251 r14512  
    174174      break;
    175175    }
     176    case 'watermark' :
     177    {
     178      include(PHPWG_ROOT_PATH.'admin/include/configuration_watermark_process.inc.php');       
     179      break;
     180    }
    176181    case 'sizes' :
    177182    {
     
    271276$tabsheet->add('main', l10n('Main'), $conf_link.'main');
    272277$tabsheet->add('sizes', l10n('Photo sizes'), $conf_link.'sizes');
     278$tabsheet->add('watermark', l10n('Watermark'), $conf_link.'watermark');
    273279$tabsheet->add('display', l10n('Display'), $conf_link.'display');
    274280$tabsheet->add('comments', l10n('Comments'), $conf_link.'comments');
     
    496502    break;
    497503  }
     504  case 'watermark' :
     505  {
     506    $watermark_files = array();
     507    foreach (glob(PHPWG_ROOT_PATH.'themes/default/watermarks/*.png') as $file)
     508    {
     509      $watermark_files[] = substr($file, strlen(PHPWG_ROOT_PATH));
     510    }
     511    foreach (glob(PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'watermarks/*.png') as $file)
     512    {
     513      $watermark_files[] = substr($file, strlen(PHPWG_ROOT_PATH));
     514    }
     515    $watermark_filemap = array( '' => '---' );
     516    foreach( $watermark_files as $file)
     517    {
     518      $display = basename($file);
     519      $watermark_filemap[$file] = $display;
     520    }
     521    $template->assign('watermark_files', $watermark_filemap);
     522
     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    {
     549      $position = 'custom';
     550    }
     551   
     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      );
     571    break;
     572  }
    498573}
    499574
  • trunk/admin/themes/default/template/configuration.tpl

    r14251 r14512  
    451451{/if}
    452452
     453{if isset($watermark)}
     454
     455{footer_script}{literal}
     456jQuery(document).ready(function() {
     457
     458  if (jQuery("input[name='w[position]']:checked").val() == 'custom') {
     459    jQuery("#positionCustomDetails").show();
     460  }
     461
     462  jQuery("input[name='w[position]']").change(function(){
     463    if (jQuery(this).val() == 'custom') {
     464      jQuery("#positionCustomDetails").show();
     465    }
     466    else {
     467      jQuery("#positionCustomDetails").hide();
     468    }
     469  });
     470});
     471{/literal}{/footer_script}
     472
     473
     474<fieldset id="watermarkConf">
     475  <legend></legend>
     476  <ul>
     477    <li>
     478      <label>{'Select a file'|@translate}</label>
     479      <select name="w[file]" id="wSelect">
     480        {html_options options=$watermark_files selected=$watermark.file}
     481      </select>
     482      <br>{'... or '|@translate}<a href="#" class="addWatermarkOpen" title="{'add a new watermark'|@translate}">{'add a new watermark'|@translate}</a>
     483    </li>
     484
     485{*
     486<p><img id="wImg"></img></p>
     487*}
     488
     489    <li>
     490      <label>
     491        {'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}>
     493      </label>
     494      {'pixels'|@translate}
     495    </li>
     496
     497    <li>
     498      <label>
     499        {'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}>
     501      </label>
     502      {'pixels'|@translate}
     503    </li>
     504
     505    <li>
     506      <label>{'Position'|@translate}</label>
     507      <br>
     508      <div id="watermarkPositionBox">
     509        <label class="right">{'top right corner'|@translate} <input name="w[position]" type="radio" value="topright"{if $watermark.position eq 'topright'} checked="checked"{/if}></label>
     510        <label><input name="w[position]" type="radio" value="topleft"{if $watermark.position eq 'topleft'} checked="checked"{/if}> {'top left corner'|@translate}</label>
     511        <label class="middle"><input name="w[position]" type="radio" value="middle"{if $watermark.position eq 'middle'} checked="checked"{/if}> {'middle'|@translate}</label>
     512        <label class="right">{'bottom right corner'|@translate} <input name="w[position]" type="radio" value="bottomright"{if $watermark.position eq 'bottomright'} checked="checked"{/if}></label>
     513        <label><input name="w[position]" type="radio" value="bottomleft"{if $watermark.position eq 'bottomleft'} checked="checked"{/if}> {'bottom left corner'|@translate}</label>
     514      </div>
     515      <label style="display:block;margin-top:10px;font-weight:normal;"><input name="w[position]" type="radio" value="custom"{if $watermark.position eq 'custom'} checked="checked"{/if}> {'custom'|@translate}</label>
     516      <div id="positionCustomDetails">
     517        <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}>%
     519        </label>
     520
     521        <br>
     522        <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}>%
     524        </label>
     525
     526        <br>
     527        <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}>
     529        </label>
     530      </div>
     531    </li>
     532
     533    <li>
     534      <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    </li>
     537  </ul>
     538</fieldset>
     539
     540{/if} {* end of watermark section *}
     541
    453542{if isset($display)}
    454543<fieldset id="indexDisplayConf">
  • trunk/admin/themes/default/theme.css

    r13592 r14512  
    472472}
    473473
    474 #mainConf, #historyConf, #commentsConf {border:none}
     474#mainConf, #historyConf, #commentsConf, #watermarkConf {border:none}
    475475
    476476#configContent label {
     
    10771077#ftpPage p {text-align:left;margin:1em;}
    10781078#ftpPage fieldset p {margin:0;}
     1079
     1080/* watermark configuration screen */
     1081#watermarkPositionBox {
     1082  border:2px solid #ccc;
     1083  width:500px;
     1084  padding:5px;
     1085  background-color:#e5e5e5;
     1086}
     1087
     1088#watermarkPositionBox label {
     1089  font-weight:normal;
     1090  display:block;
     1091  color:#444;
     1092}
     1093
     1094#watermarkPositionBox label.middle {
     1095  margin:50px;
     1096  text-align:center;
     1097}
     1098
     1099#watermarkPositionBox label.right {
     1100  float:right;
     1101}
     1102
     1103#positionCustomDetails {
     1104  margin-left:20px;
     1105  display:none;
     1106}
     1107
     1108#positionCustomDetails label {
     1109  font-weight:normal;
     1110}
Note: See TracChangeset for help on using the changeset viewer.