Ignore:
Timestamp:
Dec 23, 2010, 11:22:51 AM (13 years ago)
Author:
plg
Message:

feature 2083 added: implement method pwg.images.addSimple in core

makes admin/include/function_upload.inc.php not dependant from include/ws_functions.inc.php (moves functions file_path_for_type and ready_for_upload_message)

cleaner method to initialize the upload settings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/photos_add.php

    r8227 r8249  
    4444// +-----------------------------------------------------------------------+
    4545
    46 // automatic fill of configuration parameters
    47 $upload_form_config = array(
    48   'websize_resize' => array(
    49     'default' => true,
    50     'can_be_null' => false,
    51     ),
    52  
    53   'websize_maxwidth' => array(
    54     'default' => 800,
    55     'min' => 100,
    56     'max' => 1600,
    57     'pattern' => '/^\d+$/',
    58     'can_be_null' => true,
    59     'error_message' => l10n('The websize maximum width must be a number between %d and %d'),
    60     ),
    61  
    62   'websize_maxheight' => array(
    63     'default' => 600,
    64     'min' => 100,
    65     'max' => 1200,
    66     'pattern' => '/^\d+$/',
    67     'can_be_null' => true,
    68     'error_message' => l10n('The websize maximum height must be a number between %d and %d'),
    69     ),
    70  
    71   'websize_quality' => array(
    72     'default' => 95,
    73     'min' => 50,
    74     'max' => 100,
    75     'pattern' => '/^\d+$/',
    76     'can_be_null' => false,
    77     'error_message' => l10n('The websize image quality must be a number between %d and %d'),
    78     ),
    79  
    80   'thumb_maxwidth' => array(
    81     'default' => 128,
    82     'min' => 50,
    83     'max' => 300,
    84     'pattern' => '/^\d+$/',
    85     'can_be_null' => false,
    86     'error_message' => l10n('The thumbnail maximum width must be a number between %d and %d'),
    87     ),
    88  
    89   'thumb_maxheight' => array(
    90     'default' => 96,
    91     'min' => 50,
    92     'max' => 300,
    93     'pattern' => '/^\d+$/',
    94     'can_be_null' => false,
    95     'error_message' => l10n('The thumbnail maximum height must be a number between %d and %d'),
    96     ),
    97  
    98   'thumb_quality' => array(
    99     'default' => 95,
    100     'min' => 50,
    101     'max' => 100,
    102     'pattern' => '/^\d+$/',
    103     'can_be_null' => false,
    104     'error_message' => l10n('The thumbnail image quality must be a number between %d and %d'),
    105     ),
    106  
    107   'hd_keep' => array(
    108     'default' => true,
    109     'can_be_null' => false,
    110     ),
    111  
    112   'hd_resize' => array(
    113     'default' => false,
    114     'can_be_null' => false,
    115     ),
    116  
    117   'hd_maxwidth' => array(
    118     'default' => 2000,
    119     'min' => 500,
    120     'max' => 20000,
    121     'pattern' => '/^\d+$/',
    122     'can_be_null' => false,
    123     'error_message' => l10n('The high definition maximum width must be a number between %d and %d'),
    124     ),
    125  
    126   'hd_maxheight' => array(
    127     'default' => 2000,
    128     'min' => 500,
    129     'max' => 20000,
    130     'pattern' => '/^\d+$/',
    131     'can_be_null' => false,
    132     'error_message' => l10n('The high definition maximum height must be a number between %d and %d'),
    133     ),
    134  
    135   'hd_quality' => array(
    136     'default' => 95,
    137     'min' => 50,
    138     'max' => 100,
    139     'pattern' => '/^\d+$/',
    140     'can_be_null' => false,
    141     'error_message' => l10n('The high definition image quality must be a number between %d and %d'),
    142     ),
    143   );
     46prepare_upload_configuration();
    14447
    145 $inserts = array();
    146 
    147 foreach ($upload_form_config as $param_shortname => $param)
    148 {
    149   $param_name = 'upload_form_'.$param_shortname;
    150  
    151   if (!isset($conf[$param_name]))
    152   {
    153     $param_value = boolean_to_string($param['default']);
    154    
    155     array_push(
    156       $inserts,
    157       array(
    158         'param' => $param_name,
    159         'value' => $param_value,
    160         )
    161       );
    162     $conf[$param_name] = $param_value;
    163   }
    164 }
    165 
    166 if (count($inserts) > 0)
    167 {
    168   mass_inserts(
    169     CONFIG_TABLE,
    170     array_keys($inserts[0]),
    171     $inserts
    172     );
    173 }
     48$upload_form_config = get_upload_form_config();
    17449
    17550// +-----------------------------------------------------------------------+
     
    239114  );
    240115
    241 // $template->append(
    242 //   'head_elements',
    243 //   '<link rel="stylesheet" type="text/css" href="'.UPLOAD_FORM_PATH.'upload.css">'."\n"
    244 //   );
    245 
    246116// +-----------------------------------------------------------------------+
    247117// |                             Load the tab                              |
Note: See TracChangeset for help on using the changeset viewer.