diff options
author | Cash Costello <cash.costello@gmail.com> | 2010-07-25 02:01:36 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2010-07-25 02:01:36 +0000 |
commit | 73403645808a81425381f43c25e0ea2c92705312 (patch) | |
tree | 83fb73e9a122054f6f4c2e1c44e399572ee13e28 /views/default/tidypics/forms | |
parent | 791ec4925346cb38ecca9a2f2574b012ab64a88a (diff) | |
download | elgg-73403645808a81425381f43c25e0ea2c92705312.tar.gz elgg-73403645808a81425381f43c25e0ea2c92705312.tar.bz2 |
first go at brining tidypics up to code standards
Diffstat (limited to 'views/default/tidypics/forms')
-rw-r--r-- | views/default/tidypics/forms/edit.php | 145 | ||||
-rw-r--r-- | views/default/tidypics/forms/edit_multi.php | 12 | ||||
-rw-r--r-- | views/default/tidypics/forms/settings.php | 336 | ||||
-rw-r--r-- | views/default/tidypics/forms/setupFlickr.php | 1 | ||||
-rw-r--r-- | views/default/tidypics/forms/upload.php | 123 |
5 files changed, 322 insertions, 295 deletions
diff --git a/views/default/tidypics/forms/edit.php b/views/default/tidypics/forms/edit.php index 1758d14f4..74d8e85ec 100644 --- a/views/default/tidypics/forms/edit.php +++ b/views/default/tidypics/forms/edit.php @@ -1,45 +1,42 @@ <?php - /** - * Tidypics images edit/add form - * This form is used to: - * - create albums - * - edit albums - * - edit images - */ - - //set stuff if we are editing existing album or image - if (isset($vars['entity'])) { - $action = "tidypics/edit"; - $title = $vars['entity']->title; - $body = $vars['entity']->description; - $tags = $vars['entity']->tags; - $access_id = $vars['entity']->access_id; - $subtype = $vars['subtype']; +/** + * Tidypics images edit/add form + * This form is used to: + * - create albums + * - edit albums + * - edit images + */ + +//set stuff if we are editing existing album or image +if (isset($vars['entity'])) { + $action = "tidypics/edit"; + $title = $vars['entity']->title; + $body = $vars['entity']->description; + $tags = $vars['entity']->tags; + $access_id = $vars['entity']->access_id; + $subtype = $vars['subtype']; // if nothing is sent, create new, but only new albums are sent here // new images are sent to upload.php - } else { - $action = "tidypics/addalbum"; - $tags = ""; - $title = ""; - $body = ""; - if (defined('ACCESS_DEFAULT')) - $access_id = ACCESS_DEFAULT; - else - $access_id = 1; // logged_in by default - $subtype = 'album'; - - $title = $_SESSION['tidypicstitle']; - $body = $_SESSION['tidypicsbody']; - $tags = $_SESSION['tidypicstags']; - - unset($_SESSION['tidypicstitle']); - unset($_SESSION['tidypicsbody']); - unset($_SESSION['tidypicstags']); - } - - // group or individual - $container_guid = page_owner(); +} else { + $action = "tidypics/addalbum"; + $tags = ""; + $title = ""; + $body = ""; + $access_id = ACCESS_DEFAULT; + $subtype = 'album'; + + $title = $_SESSION['tidypicstitle']; + $body = $_SESSION['tidypicsbody']; + $tags = $_SESSION['tidypicstags']; + + unset($_SESSION['tidypicstitle']); + unset($_SESSION['tidypicsbody']); + unset($_SESSION['tidypicstags']); +} + +// group or individual +$container_guid = page_owner(); ?> <div class="contentWrapper"> @@ -48,79 +45,79 @@ <label><?php echo elgg_echo('album:title'); ?></label> <?php echo elgg_view("input/text", array("internalname" => "tidypicstitle", "value" => $title,)); ?> </p> -<?php + <?php if ($subtype == 'album') { -?> + ?> <p> <label><?php echo elgg_echo('album:desc'); ?></label> - <?php echo elgg_view("input/longtext",array("internalname" => "tidypicsbody","value" => $body,)); ?> + <?php echo elgg_view("input/longtext",array("internalname" => "tidypicsbody","value" => $body,)); ?> </p> -<?php + <?php } else { -?> + ?> <p> <label><?php echo elgg_echo('caption'); ?></label> - <?php echo elgg_view("input/longtext",array("internalname" => "tidypicsbody","value" => $body,"class" => 'tidypics_caption_input')); ?> + <?php echo elgg_view("input/longtext",array("internalname" => "tidypicsbody","value" => $body,"class" => 'tidypics_caption_input')); ?> </p> -<?php - } -?> + <?php + } + ?> <p> <label><?php echo elgg_echo("tags"); ?></label> <?php echo elgg_view("input/tags", array( "internalname" => "tidypicstags","value" => $tags,)); ?> </p> -<?php + <?php if ($subtype == 'image') { $container_guid = $vars['entity']->container_guid; - + // should this image be the cover for the album - only ask for non-cover photos // determine if it is already the cover $img_guid = $vars['entity']->guid; $album = get_entity($container_guid); $cover_guid = $album->cover; - - if ($cover_guid != $img_guid) { - -?> + + if ($cover_guid != $img_guid) { + + ?> <p> -<?php echo elgg_view('input/checkboxes', array('internalname' => "cover", - 'options' => array(elgg_echo("album:cover")), - )); -?> + <?php echo elgg_view('input/checkboxes', array('internalname' => "cover", + 'options' => array(elgg_echo("album:cover")), + )); + ?> </p> -<?php + <?php } - + } else { // album so display access control $categories = elgg_view('categories',$vars); if (!empty($categories)) { -?> + ?> <p> - <?php echo $categories; ?> + <?php echo $categories; ?> </p> -<?php - } -?> - <p> - <label><?php echo elgg_echo('access'); ?></label> + <?php + } + ?> + <p> + <label><?php echo elgg_echo('access'); ?></label> <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id)); ?> - </p> + </p> -<?php + <?php } - - if (isset($vars['entity'])) { -?> - <input type="hidden" name="guid" value="<?php echo $vars['entity']->getGUID(); ?>" /> -<?php + + if (isset($vars['entity'])) { + ?> + <input type="hidden" name="guid" value="<?php echo $vars['entity']->getGUID(); ?>" /> + <?php } echo elgg_view('input/securitytoken'); -?> + ?> <input type="hidden" name="container_guid" value="<?php echo $container_guid; ?>" /> <input type="hidden" name="subtype" value="<?php echo $subtype; ?>" /> <p><input type="submit" name="submit" value="<?php echo elgg_echo('save'); ?>" /></p> diff --git a/views/default/tidypics/forms/edit_multi.php b/views/default/tidypics/forms/edit_multi.php index 4031b7968..c16c8eea9 100644 --- a/views/default/tidypics/forms/edit_multi.php +++ b/views/default/tidypics/forms/edit_multi.php @@ -1,7 +1,7 @@ <?php - /** - * form for mass editing all uploaded images - */ +/** + * form for mass editing all uploaded images + */ ?> <div class="contentWrapper"> <form action="<?php echo $vars['url']; ?>action/tidypics/edit_multi" method="post"> @@ -11,9 +11,11 @@ // make sure one of the images becomes the cover if there isn't one already $album_entity = get_entity($vars['album_guid']); - if (!$album_entity->cover) $no_cover = true; + if (!$album_entity->cover) { + $no_cover = true; + } - foreach ($file_array as $key => $file_guid){ + foreach ($file_array as $key => $file_guid) { $entity = get_entity($file_guid); $guid = $entity->guid; $body = $entity->description; diff --git a/views/default/tidypics/forms/settings.php b/views/default/tidypics/forms/settings.php index 0729b536b..e7d05adcc 100644 --- a/views/default/tidypics/forms/settings.php +++ b/views/default/tidypics/forms/settings.php @@ -1,158 +1,182 @@ <?php - /** - * Tidypics admin settings form - */ - - - - $action = $vars['url'] . 'action/tidypics/settings'; - - $plugin = find_plugin_settings('tidypics'); - - - // bootstrap the plugin version here for now - if (!$plugin->version) { - set_plugin_setting('version', 1.62, 'tidypics'); +/** + * Tidypics admin settings form + */ + + + +$action = $vars['url'] . 'action/tidypics/settings'; + +$plugin = find_plugin_settings('tidypics'); + + +// bootstrap the plugin version here for now +if (!$plugin->version) { + set_plugin_setting('version', 1.62, 'tidypics'); +} + + +// Main settings +$form_body = '<h3>' . elgg_echo('tidypics:settings:heading:main') . '</h3>'; + +// Tagging +$tagging = $plugin->tagging; +if (!$tagging) { + $tagging = "enabled"; +} +$form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . "</p>"; + +// 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>"; + +// 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 = "/usr/bin/"; } - - - // Main settings - $form_body = '<h3>' . elgg_echo('tidypics:settings:heading:main') . '</h3>'; - - // Tagging - $tagging = $plugin->tagging; - if(!$tagging) $tagging = "enabled"; - $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . "</p>"; - - // 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>"; - - // 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 = "/usr/bin/"; - $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 = '1'; - $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', - '1' => '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" /> '; - $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" /> '; - //$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" /> '; - //$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 elgg_view('input/form', array('action' => $action, 'body' => $form_body)); + $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 = '1'; +} +$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', + '1' => '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" /> '; +$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" /> '; +//$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" /> '; +//$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 elgg_view('input/form', array('action' => $action, 'body' => $form_body)); diff --git a/views/default/tidypics/forms/setupFlickr.php b/views/default/tidypics/forms/setupFlickr.php index 8c31d0883..3a9c76d11 100644 --- a/views/default/tidypics/forms/setupFlickr.php +++ b/views/default/tidypics/forms/setupFlickr.php @@ -39,4 +39,3 @@ $form_body .= elgg_view('input/submit', array('value' => elgg_echo("save"))); flickr_menu(); echo elgg_view('input/form', array('action' => $action, 'body' => $form_body)); -?>
\ No newline at end of file diff --git a/views/default/tidypics/forms/upload.php b/views/default/tidypics/forms/upload.php index 6e755612c..691d9701b 100644 --- a/views/default/tidypics/forms/upload.php +++ b/views/default/tidypics/forms/upload.php @@ -1,78 +1,83 @@ <?php - global $CONFIG; - - //this is for image uploads only. Image edits are handled by edit.php form - - $container_guid = get_input('container_guid'); - $album = get_entity($vars['album']); - $access_id = $album->access_id; +global $CONFIG; - $maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics'); - if (!$maxfilesize) - $maxfilesize = 5; - - $quota = get_plugin_setting('quota','tidypics'); - if ($quota) { - $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size"); - $image_repo_size = (int)$image_repo_size_md->value; - $image_repo_size = $image_repo_size / 1024 / 1024; - $quote_percentage = round(100 * ($image_repo_size / $quota)); - // for small quotas, so one decimal place - if ($quota < 10) { - $image_repo_size = sprintf('%.1f', $image_repo_size); - } else { - $image_repo_size = round($image_repo_size); - } - if ($image_repo_size > $quota) { - $image_repo_size = $quota; - } +//this is for image uploads only. Image edits are handled by edit.php form + +$container_guid = get_input('container_guid'); +$album = get_entity($vars['album']); +$access_id = $album->access_id; + +$maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics'); +if (!$maxfilesize) { + $maxfilesize = 5; +} + +$quota = get_plugin_setting('quota','tidypics'); +if ($quota) { + $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size"); + $image_repo_size = (int)$image_repo_size_md->value; + $image_repo_size = $image_repo_size / 1024 / 1024; + $quote_percentage = round(100 * ($image_repo_size / $quota)); + // for small quotas, so one decimal place + if ($quota < 10) { + $image_repo_size = sprintf('%.1f', $image_repo_size); + } else { + $image_repo_size = round($image_repo_size); + } + if ($image_repo_size > $quota) { + $image_repo_size = $quota; } +} ?> <div id="tidypics_ref"></div> <div class="contentWrapper"> -<?php + <?php ob_start(); -?> -<p style="line-height:1.6em;"> - <label><?php echo elgg_echo("images:upload"); ?></label><br /> - <i><?php echo elgg_echo("tidypics:settings:maxfilesize") . ' ' . $maxfilesize; ?></i><br /> -<?php - if ($quota) { -?> - <i><?php echo elgg_echo("tidypics:quota") . ' ' . $image_repo_size . '/' . $quota . " MB ({$quote_percentage}%)"; ?></i><br /> -<?php - } -?> + ?> + <p style="line-height:1.6em;"> + <label><?php echo elgg_echo("images:upload"); ?></label><br /> + <i><?php echo elgg_echo("tidypics:settings:maxfilesize") . ' ' . $maxfilesize; ?></i><br /> + <?php + if ($quota) { + ?> + <i><?php echo elgg_echo("tidypics:quota") . ' ' . $image_repo_size . '/' . $quota . " MB ({$quote_percentage}%)"; ?></i><br /> + <?php + } + ?> <div class="tidypics_popup"> - <?php echo elgg_echo("tidypics:uploading:images"); ?><br /> + <?php echo elgg_echo("tidypics:uploading:images"); ?><br /> <div style="margin:20px 0px 20px 80px;"><img id="progress" alt="..." border="0" src="<?php echo $vars['url'].'mod/tidypics/graphics/loader.gif' ?>" /></div> </div> <ol id="tidypics_image_upload_list"> -<?php + <?php for ($x = 0; $x < 10; $x++) { echo '<li>' . elgg_view("input/file",array('internalname' => "upload_$x")) . '</li>'; - } -?> + } + ?> </ol> </p> <p> -<?php - if ($container_guid) - echo '<input type="hidden" name="container_guid" value="' . $container_guid . '" />'; - if ($access_id) - echo '<input type="hidden" name="access_id" value="' . $access_id . '" />'; -?> + <?php + if ($container_guid) { + echo '<input type="hidden" name="container_guid" value="' . $container_guid . '" />'; + } + if ($access_id) { + echo '<input type="hidden" name="access_id" value="' . $access_id . '" />'; + } + ?> <input type="submit" value="<?php echo elgg_echo("save"); ?>" onclick="displayProgress();" /> </p> <?php - $form_body = ob_get_clean(); - - echo elgg_view('input/form', array( 'action' => "{$vars['url']}action/tidypics/upload", - 'body' => $form_body, - 'internalid' => 'tidypicsUpload', - 'enctype' => 'multipart/form-data', - 'method' => 'post',)); +$form_body = ob_get_clean(); + +echo elgg_view('input/form', array( + 'action' => "{$vars['url']}action/tidypics/upload", + 'body' => $form_body, + 'internalid' => 'tidypicsUpload', + 'enctype' => 'multipart/form-data', + 'method' => 'post',) +); ?> </div> <script type="text/javascript"> @@ -81,11 +86,11 @@ { offsetY = 60; offsetX = 120; - + divWidth = $('#tidypics_ref').width(); imgOffset = $('#tidypics_ref').offset(); imgWidth = $('#tidypics_ref').width(); - + _top = imgOffset.top + offsetY; _left = imgOffset.left + offsetX; @@ -93,7 +98,7 @@ "top": _top + "px", "left": _left + "px" }); - - setTimeout('document.images["progress"].src = "<?php echo $vars['url'].'mod/tidypics/graphics/loader.gif' ?>"', 200); + + setTimeout('document.images["progress"].src = "<?php echo $vars['url'].'mod/tidypics/graphics/loader.gif' ?>"', 200); } </script>
\ No newline at end of file |