Changeset 14228


Ignore:
Timestamp:
Apr 19, 2012, 10:49:43 PM (12 years ago)
Author:
rvelices
Message:

added a button to restore multiple size default sizes ...

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/configuration.php

    r14221 r14228  
    249249  load_conf_from_db();
    250250}
     251elseif (isset($_POST['restore_settings']))
     252{
     253  ImageStdParams::set_and_save( ImageStdParams::get_default_sizes() );
     254  pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param = \'disabled_derivatives\'');
     255  clear_derivative_cache();
     256}
    251257
    252258//----------------------------------------------------- template initialization
  • trunk/admin/themes/default/template/configuration.tpl

    r14221 r14228  
    3131{/literal}{/footer_script}
    3232
    33 <div class="titrePage">
    34   <h2>{'Piwigo configuration'|@translate} {$TABSHEET_TITLE}</h2>
    35 </div>
     33<h2>{'Piwigo configuration'|@translate} {$TABSHEET_TITLE}</h2>
    3634
    3735{if !isset($default)}
     
    315313    jQuery(".sizeDetails").show();
    316314    jQuery(this).css("visibility", "hidden");
     315                return false;
    317316  });
    318317
     
    320319{/literal}{/footer_script}
    321320
    322 {html_head}{literal}
    323 <style type="text/css">
     321{html_style}{literal}
    324322input[type="text"].dError {border-color:#ff7070; background-color:#FFe5e5;}
    325323.dErrorDesc {background-color:red; color:white; padding:0 5px;border-radius:10px; font-weight:bold;cursor:help;}
     
    331329.sizeDetails {display:none;margin-left:10px;}
    332330.sizeEditOpen {margin-left:10px;}
    333 </style>
    334 {/literal}{/html_head}
     331{/literal}{/html_style}
    335332
    336333<fieldset id="sizesConf">
     
    644641
    645642{if !isset($default)}
    646   <p class="formButtons">
    647     <input class="submit" type="submit" name="submit" value="{'Save Settings'|@translate}">
    648   </p>
     643        <p class="formButtons">
     644                <input type="submit" name="submit" value="{'Save Settings'|@translate}">
     645{if isset($sizes)}
     646                <input type="submit" name="restore_settings" value="{'Restore'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');">
     647{/if}
     648        </p>
    649649</form>
    650650{/if}
  • trunk/include/derivative_std_params.inc.php

    r13736 r14228  
    113113    else
    114114    {
    115       self::make_default();
     115      self::$watermark = new WatermarkParams();
     116      self::$type_map = self::get_default_sizes();
    116117    }
    117118    self::build_maps();
     
    142143  }
    143144
    144   private static function make_default()
    145   {
    146     self::$watermark = new WatermarkParams();
    147     self::$type_map[IMG_SQUARE] = new DerivativeParams( SizingParams::square(120,120) );
    148     self::$type_map[IMG_THUMB] = new DerivativeParams( SizingParams::classic(144,144) );
    149     self::$type_map[IMG_XXSMALL] = new DerivativeParams( SizingParams::classic(240,240) );
    150     self::$type_map[IMG_XSMALL] = new DerivativeParams( SizingParams::classic(432,324) );
    151     self::$type_map[IMG_SMALL] = new DerivativeParams( SizingParams::classic(576,432) );
    152     self::$type_map[IMG_MEDIUM] = new DerivativeParams( SizingParams::classic(792,594) );
    153     self::$type_map[IMG_LARGE] = new DerivativeParams( SizingParams::classic(1008,756) );
    154     self::$type_map[IMG_XLARGE] = new DerivativeParams( SizingParams::classic(1224,918) );
    155     self::$type_map[IMG_XXLARGE] = new DerivativeParams( SizingParams::classic(1656,1242) );
     145  static function get_default_sizes()
     146  {
     147    $arr = array(
     148      IMG_SQUARE => new DerivativeParams( SizingParams::square(120,120) ),
     149      IMG_THUMB => new DerivativeParams( SizingParams::classic(144,144) ),
     150      IMG_XXSMALL => new DerivativeParams( SizingParams::classic(240,240) ),
     151      IMG_XSMALL => new DerivativeParams( SizingParams::classic(432,324) ),
     152      IMG_SMALL => new DerivativeParams( SizingParams::classic(576,432) ),
     153      IMG_MEDIUM => new DerivativeParams( SizingParams::classic(792,594) ),
     154      IMG_LARGE => new DerivativeParams( SizingParams::classic(1008,756) ),
     155      IMG_XLARGE => new DerivativeParams( SizingParams::classic(1224,918) ),
     156      IMG_XXLARGE => new DerivativeParams( SizingParams::classic(1656,1242) ),
     157    );
     158    foreach($arr as $params)
     159    {
     160      $params->last_mod_time = time();
     161    }
     162    return $arr;
    156163  }
    157164
Note: See TracChangeset for help on using the changeset viewer.