aboutsummaryrefslogtreecommitdiff
path: root/views/default/forms/photos/admin/settings.php
blob: ea1e12de83e1df01e53bd314b624769d38569779 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<?php
/**
 * Tidypics admin settings form body
 */

$plugin = elgg_get_plugin_from_id('tidypics');

echo '<div>';
$checked = $plugin->tagging ? 'checked' : false;
echo elgg_view('input/checkbox', array(
	'name' => 'params[tagging]',
	'value' => true,
	'checked' => (bool)$plugin->tagging,
));
echo ' ' . elgg_echo('tidypics:settings:tagging');
echo '</div>';

// Thumbnail sizes
echo '<div>';
echo '<h3>' . elgg_echo('tidypics:settings:heading:sizes') . '</h3>';
echo "<h6>You must edit the css if you change the default sizes</h6>";
$image_sizes = unserialize($plugin->image_sizes);

/*
if(!$image_sizes) {
	$image_sizes = array(); // set default values
	$image_sizes['large_image_width'] = $image_sizes['large_image_height'] = 600;
	$image_sizes['small_image_width'] = $image_sizes['small_image_height'] = 153;
	$image_sizes['thumb_image_width'] = $image_sizes['thumb_image_height'] = 60;
} else {
	$image_sizes = unserialize($image_sizes);
}
 *
 */

$sizes = array('large', 'small', 'tiny');
foreach ($sizes as $size) {
	echo elgg_echo("tidypics:settings:{$size}size");
	echo ' width: ';
	echo elgg_view('input/text', array(
		'name' => "{$size}_thumb_width",
		'value' => $image_sizes["{$size}_image_width"],
		'style' => 'width: 150px;'
	));
	echo ' height: ';
	echo elgg_view('input/text', array(
		'name' => "{$size}_thumb_height",
		'value' => $image_sizes["{$size}_image_height"],
		'style' => 'width: 150px;'
	));
}

$form_body .= 'width: <input style="width: 20%;" type="text" name="large_thumb_width" value=' . "\"{$image_sizes['large_image_width']}\"" . ' class="input-text" />&nbsp;&nbsp;&nbsp;';
$form_body .= 'height: <input style="width: 20%;" type="text" name="large_thumb_height" value=' . "\"{$image_sizes['large_image_height']}\"" . ' class="input-text" /></p>';

$form_body .= "<p>" . elgg_echo('tidypics:settings:smallsize') . "<br />";
$form_body .= 'width and height: <input style="width: 20%;" type="text" name="small_thumb_width" value=' . "\"{$image_sizes['small_image_width']}\"" . ' class="input-text" />&nbsp;&nbsp;&nbsp;';
//$form_body .= 'height: <input style="width: 20%;" type="text" name="small_thumb_height" value=' . "\"{$image_sizes['small_image_height']}\"" . ' class="input-text" /></p>';

$form_body .= "<p>" . elgg_echo('tidypics:settings:thumbsize') . "<br />";
$form_body .= 'width and height: <input style="width: 20%;" type="text" name="thumb_width" value=' . "\"{$image_sizes['thumb_image_width']}\"" . ' class="input-text" />&nbsp;&nbsp;&nbsp;';
//$form_body .= 'height: <input style="width: 20%;" type="text" name="thumb_height" value=' . "\"{$image_sizes['thumb_image_height']}\"" . ' class="input-text" /></p>';
echo '</div>';

echo elgg_view('input/submit', array('value' => elgg_echo("save")));

return true;


// Main settings
echo '<h3>' . elgg_echo('tidypics:settings:heading:main') . '</h3>';

// Tagging
$tagging = $plugin->tagging ? $plugin->tagging : 'enabled';
echo '<div>';
echo elgg_view("input/checkboxes", array(
	'name' => 'tagging',
	'value' => $tagging,
	'options' => array(
		elgg_echo('tidypics:settings:tagging') => 'enabled'
	),
));
echo "</div>";

// Download Link
$download_link = $plugin->download_link;
if (!$download_link) {
	$download_link = "enabled";
}
$form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:download_link') => 'enabled'), 'internalname' => 'download_link', 'value' => $download_link )) . "</p>";

// Ratings
$photo_ratings = $plugin->photo_ratings;
if (!$photo_ratings) {
	$photo_ratings = "disabled";
}
$form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:photo_ratings') => 'enabled'), 'internalname' => 'photo_ratings', 'value' => $photo_ratings )) . "</p>";

// Show EXIF
$exif = $plugin->exif;
if (!$exif) {
	$exif = "disabled";
}
$form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:exif') => 'enabled'), 'internalname' => 'exif', 'value' => $exif )) . "</p>";

// Show View count
$view_count = $plugin->view_count;
if (!$view_count) {
	$view_count = "enabled";
}
$form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . "</p>";

// Use flash uploader
$uploader = $plugin->uploader;
if (!$uploader) {
	$uploader = "enabled";
}
$form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:uploader') => 'enabled'), 'internalname' => 'uploader', 'value' => $uploader )) . "</p>";

// Watermark Text
$form_body .= "<p>" . elgg_echo('tidypics:settings:watermark') . "<br />";
$form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "</p>";

// Max Image Size
$maxfilesize = $plugin->maxfilesize;
if (!$maxfilesize) {
	$maxfilesize = (int)5; // 5 MB
}
$form_body .= "<p>" . elgg_echo('tidypics:settings:maxfilesize') . "<br />";
$form_body .= elgg_view("input/text",array('internalname' => 'params[maxfilesize]', 'value' => $maxfilesize)) . "</p>";

// Quota Size
$quota = $plugin->quota;
if (!$quota) {
	$quota = 0;
}
$form_body .= "<p>" . elgg_echo('tidypics:settings:quota') . "<br />";
$form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "</p>";

// Image Library
if (extension_loaded('imagick')) {
	$img_lib_options['ImageMagickPHP'] = 'imagick PHP extension';
}

$disablefunc = explode(',', ini_get('disable_functions'));
if (is_callable('exec') && !in_array('exec',$disablefunc)) {
	$img_lib_options['ImageMagick'] = 'ImageMagick Cmdline';
}

$img_lib_options['GD'] = 'GD';

$form_body .= '<h3>' . elgg_echo('tidypics:settings:heading:img_lib') . '</h3>';
$image_lib = $plugin->image_lib;
if (!$image_lib) {
	$image_lib = 'GD';
}
$form_body .= '<p>' . elgg_echo('tidypics:settings:image_lib') . ': ';
$form_body .= elgg_view('input/pulldown', array(
		'internalname' => 'params[image_lib]',
		'options_values' => $img_lib_options,
		'value' => $image_lib
));
$form_body .= '<br/>Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.</p>';

if (is_callable('exec') && !in_array('exec', $disablefunc)) {
	// Image Magick Path
	$im_path = $plugin->im_path;
	if(!$im_path) {
		$im_path = "";
	}
	$form_body .= "<p>" . elgg_echo('tidypics:settings:im_path') . "<br />";
	$form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "</p>";
}


// River Image options
$form_body .= '<h3>' . elgg_echo('tidypics:settings:heading:river') . '</h3>';
$img_river_view = $plugin->img_river_view;
if (!$img_river_view) {
	$img_river_view = 'batch';
}
$form_body .= '<p>' . elgg_echo('tidypics:settings:img_river_view') . ': ';
$form_body .= elgg_view('input/pulldown', array(
		'internalname' => 'params[img_river_view]',
		'options_values' => array(
				'all' => 'all',
				'batch' => '1',
				'none' => 'none',
		),
		'value' => $img_river_view
));
$form_body .= '</p>';

// River Album options
$album_river_view = $plugin->album_river_view;
if (!$album_river_view) {
	$album_river_view = 'set';
}
$form_body .= '<p>' . elgg_echo('tidypics:settings:album_river_view') . ': ';
$form_body .= elgg_view('input/pulldown', array(
		'internalname' => 'params[album_river_view]',
		'options_values' => array(
				'cover' => 'cover',
				'set' => 'set',
		),
		'value' => $album_river_view
));
$form_body .= '</p>';

// Thumbnail sizes
$form_body .= '<h3>' . elgg_echo('tidypics:settings:heading:sizes') . '</h3>';
$form_body .= "<h6>You must edit the css if you change the default sizes</h6>";
$image_sizes = $plugin->image_sizes;
if(!$image_sizes) {
	$image_sizes = array(); // set default values
	$image_sizes['large_image_width'] = $image_sizes['large_image_height'] = 600;
	$image_sizes['small_image_width'] = $image_sizes['small_image_height'] = 153;
	$image_sizes['thumb_image_width'] = $image_sizes['thumb_image_height'] = 60;
} else {
	$image_sizes = unserialize($image_sizes);
}
$form_body .= "<p>" . elgg_echo('tidypics:settings:largesize') . "<br />";
$form_body .= 'width: <input style="width: 20%;" type="text" name="large_thumb_width" value=' . "\"{$image_sizes['large_image_width']}\"" . ' class="input-text" />&nbsp;&nbsp;&nbsp;';
$form_body .= 'height: <input style="width: 20%;" type="text" name="large_thumb_height" value=' . "\"{$image_sizes['large_image_height']}\"" . ' class="input-text" /></p>';

$form_body .= "<p>" . elgg_echo('tidypics:settings:smallsize') . "<br />";
$form_body .= 'width and height: <input style="width: 20%;" type="text" name="small_thumb_width" value=' . "\"{$image_sizes['small_image_width']}\"" . ' class="input-text" />&nbsp;&nbsp;&nbsp;';
//$form_body .= 'height: <input style="width: 20%;" type="text" name="small_thumb_height" value=' . "\"{$image_sizes['small_image_height']}\"" . ' class="input-text" /></p>';

$form_body .= "<p>" . elgg_echo('tidypics:settings:thumbsize') . "<br />";
$form_body .= 'width and height: <input style="width: 20%;" type="text" name="thumb_width" value=' . "\"{$image_sizes['thumb_image_width']}\"" . ' class="input-text" />&nbsp;&nbsp;&nbsp;';
//$form_body .= 'height: <input style="width: 20%;" type="text" name="thumb_height" value=' . "\"{$image_sizes['thumb_image_height']}\"" . ' class="input-text" /></p>';


// Group permission override
$form_body .= '<h3>' . elgg_echo('tidypics:settings:heading:groups') . '</h3>';
$grp_perm_override = $plugin->grp_perm_override;
if (!$grp_perm_override) {
	$grp_perm_override = "enabled";
}
$form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:grp_perm_override') => 'enabled'), 'internalname' => 'grp_perm_override', 'value' => $grp_perm_override )) . "</p>";

$form_body .= elgg_view('input/submit', array('value' => elgg_echo("save")));

echo $form_body;