/[drupal]/contributions/modules/photos/photos.admin.inc
ViewVC logotype

Contents of /contributions/modules/photos/photos.admin.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.8 - (show annotations) (download) (as text)
Sat Dec 20 05:49:59 2008 UTC (11 months ago) by eastcn
Branch: MAIN
CVS Tags: DRUPAL-6--1-4-BETA3, HEAD
Changes since 1.7: +15 -1 lines
File MIME type: text/x-php
*** empty log message ***
1 <?php
2 // $Id: photos.admin.inc,v 1.7 2008/10/09 06:49:14 eastcn Exp $
3 function photos_admin_settings() {
4 $form['one'] = array(
5 '#title' => t('Basic settings'),
6 '#weight' => -4,
7 '#type' => 'fieldset',
8 '#collapsible' => TRUE,
9 );
10 $form['two'] = array(
11 '#title' => t('Advanced Settings'),
12 '#weight' => -3,
13 '#type' => 'fieldset',
14 '#collapsible' => TRUE,
15 );
16 $form['photos_swfu'] = array(
17 '#title' => t('Photos swfu'),
18 '#weight' => -2,
19 '#type' => 'fieldset',
20 '#collapsible' => TRUE,
21 );
22 $form['one']['photos_num'] = array(
23 '#type' => 'select',
24 '#title' => t('Number of upload'),
25 '#default_value' => variable_get('photos_num', 5),
26 '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)),
27 '#description' => t('Maxium amount allowed for one upload'),
28 );
29 $form['one']['photos_pnum'] = array(
30 '#type' => 'textfield',
31 '#title' => t('Number of albums'),
32 '#default_value' => variable_get('photos_pnum', 20),
33 '#description' => t('The number of albums a user allowed to create. Administrater is not limited.'),
34 );
35 $form['one']['photos_t_w'] = array(
36 '#type'=> 'textfield',
37 '#title' => t('Thumbnail size'),
38 '#default_value' => variable_get('photos_t_w', '100x100'),
39 '#description' => t('This photos module creates 2 formats of thumbnails, and saves original image. Please set size'),
40 '#size' => '10',
41 );
42 $form['one']['photos_t_s'] = array(
43 '#type' => 'select',
44 '#title' => t('Thumbnail format'),
45 '#default_value' => variable_get('photos_t_s', 'crop'),
46 '#options' => array('scale' => 'scale','crop' => 'crop'),
47 '#description' => t('scale: Keep ratio for resizing, crop: Fix size, aligned by a border.'),
48 );
49 $form['one']['photos_t_ww'] = array(
50 '#type'=> 'textfield',
51 '#title' => t('Medium image size'),
52 '#default_value' => variable_get('photos_t_ww', '640x480'),
53 '#description' => t('This photos module creates 2 formats of thumbnails, and saves original image. Please set size'),
54 '#size' => '10',
55 );
56 $form['one']['photos_t_ss'] = array(
57 '#type' => 'select',
58 '#title' => t('Medium image format'),
59 '#default_value' => variable_get('photos_t_ss', 'scale'),
60 '#options' => array('scale' => 'scale','crop' => 'crop'),
61 '#description' => t('scale: Keep ratio for resizing, crop: Fix size, aligned by a border.'),
62 );
63 $form['one']['photos_path'] = array(
64 '#type'=> 'textfield',
65 '#title' => t('Path of saving'),
66 '#default_value' => variable_get('photos_path', 'photos/image_%uid'),
67 '#description' => t('The path where the files should be saved, may save by user id or user name or time, e.g.: photos/%uid or photos/%username or image/%Y/%m/%d. Available variables: %uid, %username, %Y, %m, %d.'),
68 '#size' => '40',
69 '#required' => TRUE,
70 );
71
72 $form['one']['photos_open_orig'] = array(
73 '#type' => 'radios',
74 '#title' => t('Open original Images in a new window?'),
75 '#default_value' => variable_get('photos_open_orig', 0),
76 '#description' => t('If this option is enabled, the original images will be opened in a new browser window instead of being displayed inside the site'),
77 '#options' => array(t('Disabled'), t('Enabled')),
78 );
79
80 $form['two']['photos_privacy'] = array(
81 '#type' => 'radios',
82 '#title' => t('privacy settings'),
83 '#default_value' => variable_get('photos_privacy', 0),
84 '#description' => t('This option is enabled, users will be able to album set to confidentiality'),
85 '#options' => array(t('Enabled'), t('Disabled')),
86 '#disabled' => (module_exists('photos_access') ? false: true)
87 );
88
89 $form['two']['photos_upzip'] = array(
90 '#type' => 'radios',
91 '#title' => t('zip compressed upload'),
92 '#default_value' => variable_get('photos_upzip', 0),
93 '#description' => t('Will be allowed to upload images compressed into a zip, extract the necessary support to open php'),
94 '#options' => array(t('Disabled'), t('Enabled')),
95 );
96 $form['two']['photos_rname'] = array(
97 '#type' => 'radios',
98 '#title' => t('Rename image'),
99 '#default_value' => variable_get('photos_rname', 0),
100 '#description' => t('Rename uploaded image by random numbers, to solve problems with non-ASCII filenames such as Chinese.'),
101 '#options' => array(t('Disabled'), t('Enabled')),
102 );
103 $form['two']['photos_exif'] = array(
104 '#type' => 'radios',
105 '#title' => t('Show exif information'),
106 '#default_value' => variable_get('photos_exif', 0),
107 '#description' => t('When the image is available exif information, automatically read and display. Open this option, you must load the php exif.'),
108 '#options' => array(t('Disabled'), t('Enabled')),
109 );
110 if(variable_get('comment_photos', COMMENT_NODE_READ_WRITE) == 2){
111 $commenttrue = true;
112 }
113 $form['two']['photos_comment'] = array(
114 '#type' => 'radios',
115 '#title' => t('Comment setting'),
116 '#default_value' => variable_get('photos_comment', 0),
117 '#description' => t('Open for the photo comments, you must first type of content in the overall set of options open comments.'),
118 '#options' => array(t('Disabled'), t('Enabled')),
119 '#disabled' => ($commenttrue ? false: true)
120 );
121 $form['two']['photos_vote'] = array(
122 '#type' => 'radios',
123 '#title' => t('Images vote'),
124 '#default_value' => variable_get('photos_vote', 0),
125 '#description' => t('For the image to increase the voting feature, you must first install the votingapi.module.'),
126 '#options' => array(t('Disabled'), t('Enabled')),
127 '#disabled' => (module_exists('votingapi') ? false: true)
128 );
129 $form['two']['photos_image_count'] = array(
130 '#type' => 'radios',
131 '#title' => t('Count image views'),
132 '#default_value' => variable_get('photos_image_count', 0),
133 '#description' => t('Increment a counter each time image is viewed.'),
134 '#options' => array( t('Enabled'), t('Disabled'))
135 );
136 $swfurl = drupal_get_path(module,photos).'/flash_gallery/gallery.swf';
137 $form['two']['photos_flash'] = array(
138 '#type' => 'radios',
139 '#title' => t('FLASH slide show'),
140 '#default_value' => variable_get('photos_flash', 0),
141 '#description' => t('Please download <a href="@url">dfgallery</a>, and save to flash_gallery under , e.g: @swfurl',array('@url' => url('http://www.dezinerfolio.com/2007/06/07/dfgallery/'), '@swfurl' => $swfurl)),
142 '#options' => array(t('Disabled'), t('Enabled')),
143 '#disabled' => (file_exists($swfurl) ? false: true)
144 );
145 $form['two']['photos_flash_zoom'] = array(
146 '#type'=> 'textfield',
147 '#title' => t('Flash width and height'),
148 '#default_value' => variable_get('photos_flash_zoom', '500x450'),
149 '#description' => t('The width and length of flash, e.g: 500x450.'),
150 '#size' => '20',
151 '#disabled' => (file_exists($swfurl) ? false: true)
152 );
153
154 $form['two']['photos_flash_show'] = array(
155 '#type' => 'radios',
156 '#title' => t('FLASH show image size'),
157 '#default_value' => variable_get('photos_flash_show', 0),
158 '#options' => array(t('Medium image size'), t('Original Size')),
159 '#disabled' => (file_exists($swfurl) ? false: true)
160 );
161 $form['photos_swfu']['photos_swfu_num'] = array(
162 '#type' => 'select',
163 '#title' => t('Number of upload'),
164 '#default_value' => variable_get('photos_swfu_num', 100),
165 '#options' => drupal_map_assoc(array(1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100)),
166 '#description' => t('Maxium amount allowed for one upload'),
167 '#disabled' => (module_exists('photos_swfu') ? false: true)
168 );
169 return system_settings_form($form);
170 }
171
172 function photos_admin_update(&$form_state){
173 $form['photos_update'] = array(
174 '#type' => 'checkbox',
175 '#title' => t('Thumbnail-size bulk update'),
176 '#description' => t('Normally, you do not need to update it.'),
177 );
178 $form['submit'] = array(
179 '#type' => 'submit',
180 '#value' => t('Confirm'),
181 );
182 $form['#validate'][] = 'photos_admin_update_validate';
183 return $form;
184 }
185
186 function photos_admin_update_validate($form, & $form_state){
187 if($form_state['values']['photos_update']){
188 $result = db_query('SELECT f.filepath FROM {files} f INNER JOIN {x_image} i ON f.fid = i.fid');
189 $i = 0;
190 while ($a = db_fetch_object($result)) {
191 $t = end(explode('/', $a->filepath));
192 $path = str_replace($t,'',$a->filepath);
193 _photos_image_crop($a->filepath, $path);
194 $i++;
195 };
196 if($i){
197 drupal_set_message(t('Update the %num images.', array('%num' => $i)));
198 }
199 }
200 }

  ViewVC Help
Powered by ViewVC 1.1.2