From 73403645808a81425381f43c25e0ea2c92705312 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 25 Jul 2010 02:01:36 +0000 Subject: first go at brining tidypics up to code standards --- views/default/tidypics/admin/imagelib.php | 88 +++---- views/default/tidypics/admin/settings.php | 36 +-- views/default/tidypics/admin/stats.php | 51 ++-- views/default/tidypics/admin/tidypics.php | 58 ++--- views/default/tidypics/albums.php | 74 +++--- views/default/tidypics/breadcrumbs.php | 33 +-- views/default/tidypics/exif.php | 20 +- views/default/tidypics/forms/edit.php | 145 ++++++----- views/default/tidypics/forms/edit_multi.php | 12 +- views/default/tidypics/forms/settings.php | 336 +++++++++++++------------ views/default/tidypics/forms/setupFlickr.php | 1 - views/default/tidypics/forms/upload.php | 123 ++++----- views/default/tidypics/groupprofile_albums.php | 1 - views/default/tidypics/image_menu.php | 77 +++--- views/default/tidypics/tagging.php | 57 +++-- 15 files changed, 570 insertions(+), 542 deletions(-) (limited to 'views/default/tidypics') diff --git a/views/default/tidypics/admin/imagelib.php b/views/default/tidypics/admin/imagelib.php index b4656afe1..a0d0c19e7 100644 --- a/views/default/tidypics/admin/imagelib.php +++ b/views/default/tidypics/admin/imagelib.php @@ -1,62 +1,62 @@ dbprefix}entities where subtype={$img_type}"; - $total = get_data_row($query); - $num_images = $total->total; - - $img_type = get_subtype_id('object', 'album'); - $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}"; - $total = get_data_row($query); - $num_albums = $total->total; +$img_type = get_subtype_id('object', 'image'); +$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}"; +$total = get_data_row($query); +$num_images = $total->total; - $num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment'); - $num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment'); - - $num_views = count_annotations(0, 'object', 'image', 'tp_view'); - - if (get_plugin_setting('tagging', 'tidypics') != "disabled") - $num_tags = count_annotations(0, 'object', 'image', 'phototag'); +$img_type = get_subtype_id('object', 'album'); +$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}"; +$total = get_data_row($query); +$num_albums = $total->total; + +$num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment'); +$num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment'); + +$num_views = count_annotations(0, 'object', 'image', 'tp_view'); + +if (get_plugin_setting('tagging', 'tidypics') != "disabled") + $num_tags = count_annotations(0, 'object', 'image', 'phototag'); ?>

Overview

-An image library is required by Tidypics to perform various manipulations: resizing on upload, watermarking, rotation, and cropping. -There are three image library options with Tidypics: PHP extension GD, -ImageMagick called via a system call, and the PHP extension -imagick. GD is the most common of the three on hosted servers but suffers -from serious memory usage problems when resizing photos. If you have access to ImageMagick (whether through system calls or the -PHP extension), we recommend that you use that. + An image library is required by Tidypics to perform various manipulations: resizing on upload, watermarking, rotation, and cropping. + There are three image library options with Tidypics: PHP extension GD, + ImageMagick called via a system call, and the PHP extension + imagick. GD is the most common of the three on hosted servers but suffers + from serious memory usage problems when resizing photos. If you have access to ImageMagick (whether through system calls or the + PHP extension), we recommend that you use that.

Testing ImageMagick Commandline

-To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can check our -server analysis page to find out the -configuration of your server. Next, you need to determine the path to ImageMagick on your server. Your hosting service should -be able to provide this to you. You can test if the location is correct below. If successful, it should display the version of -ImageMagick installed on your server. + To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can check our + server analysis page to find out the + configuration of your server. Next, you need to determine the path to ImageMagick on your server. Your hosting service should + be able to provide this to you. You can test if the location is correct below. If successful, it should display the version of + ImageMagick installed on your server.


-
- - +
+ +

\ No newline at end of file diff --git a/views/default/tidypics/admin/settings.php b/views/default/tidypics/admin/settings.php index ce5652c16..bc0befa16 100644 --- a/views/default/tidypics/admin/settings.php +++ b/views/default/tidypics/admin/settings.php @@ -1,26 +1,26 @@ elgg_echo("tidypics:admin:instructions"))); - - global $CONFIG; - $system_url = $CONFIG->wwwroot . 'mod/tidypics/pages/server_analysis.php'; - $upgrade_url = $CONFIG->wwwroot . 'mod/tidypics/actions/upgrade.php'; - $upgrade_url = elgg_add_action_tokens_to_url($upgrade_url); - - $upgrade = false; - if (!get_subtype_class('object', 'image') || !get_subtype_class('object', 'album')) - $upgrade = true; +echo elgg_view('output/longtext', array('value' => elgg_echo("tidypics:admin:instructions"))); + +global $CONFIG; +$system_url = $CONFIG->wwwroot . 'mod/tidypics/pages/server_analysis.php'; +$upgrade_url = $CONFIG->wwwroot . 'mod/tidypics/actions/upgrade.php'; +$upgrade_url = elgg_add_action_tokens_to_url($upgrade_url); + +$upgrade = false; +if (!get_subtype_class('object', 'image') || !get_subtype_class('object', 'album')) { + $upgrade = true; +} ?>

- -Upgrade
- + Upgrade
+ -Run Server Analysis + ?> + Run Server Analysis

\ No newline at end of file +echo elgg_view("tidypics/forms/settings"); diff --git a/views/default/tidypics/admin/stats.php b/views/default/tidypics/admin/stats.php index aea5e75ba..0b088dc2e 100644 --- a/views/default/tidypics/admin/stats.php +++ b/views/default/tidypics/admin/stats.php @@ -1,35 +1,36 @@ dbprefix}entities where subtype={$img_type}"; - $total = get_data_row($query); - $num_images = $total->total; - - $img_type = get_subtype_id('object', 'album'); - $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}"; - $total = get_data_row($query); - $num_albums = $total->total; +$img_type = get_subtype_id('object', 'image'); +$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}"; +$total = get_data_row($query); +$num_images = $total->total; - $num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment'); - $num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment'); - - $num_views = count_annotations(0, 'object', 'image', 'tp_view'); - - if (get_plugin_setting('tagging', 'tidypics') != "disabled") - $num_tags = count_annotations(0, 'object', 'image', 'phototag'); +$img_type = get_subtype_id('object', 'album'); +$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}"; +$total = get_data_row($query); +$num_albums = $total->total; + +$num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment'); +$num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment'); + +$num_views = count_annotations(0, 'object', 'image', 'tp_view'); + +if (get_plugin_setting('tagging', 'tidypics') != "disabled") { + $num_tags = count_annotations(0, 'object', 'image', 'phototag'); +} ?>

-
-Photos:
-Albums:
-Comments on photos:
-Comments on albums:
-Total views:
+
+ Photos:
+ Albums:
+ Comments on photos:
+ Comments on albums:
+ Total views:
-Photo tags:
+ Photo tags:

\ No newline at end of file diff --git a/views/default/tidypics/admin/tidypics.php b/views/default/tidypics/admin/tidypics.php index fa518156c..a46781c2a 100644 --- a/views/default/tidypics/admin/tidypics.php +++ b/views/default/tidypics/admin/tidypics.php @@ -1,32 +1,32 @@
@@ -38,7 +38,7 @@
  • >
  • - + ?>
    diff --git a/views/default/tidypics/albums.php b/views/default/tidypics/albums.php index 42ac15afe..a4b2ee906 100644 --- a/views/default/tidypics/albums.php +++ b/views/default/tidypics/albums.php @@ -1,51 +1,53 @@ '; +echo '
    '; - if ($owner_albums) { - foreach($owner_albums as $album) { +if ($owner_albums) { + foreach ($owner_albums as $album) { - if($album->cover) - $album_cover = '' . $album->title . ''; - else - $album_cover = '' . $album->title . ''; + if ($album->cover) { + $album_cover = '' . $album->title . ''; + } else { + $album_cover = '' . $album->title . ''; + } ?> -
    - -
    time_created);?>
    - + +
    time_created);?>
    + getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")
    "; + } ?> - -
    -username) || empty($owner->username)) { - echo '

    ' . elgg_echo('album:all') . '

    '; - } else { - echo '

    ' . elgg_echo('album:more') . '

    '; - } - + +
    + username) || empty($owner->username)) { + echo '

    ' . elgg_echo('album:all') . '

    '; + } else { + echo '

    ' . elgg_echo('album:more') . '

    '; } - if (can_write_to_container(0, $owner->guid)) { - echo '

    username . '>' . elgg_echo("album:create") . '

    '; - } +} + +if (can_write_to_container(0, $owner->guid)) { + echo '

    username . '>' . elgg_echo("album:create") . '

    '; +} - //close album_widget_container div - echo ""; -?> \ No newline at end of file +//close album_widget_container div +echo ""; diff --git a/views/default/tidypics/breadcrumbs.php b/views/default/tidypics/breadcrumbs.php index c4d347e6e..e9f491b38 100644 --- a/views/default/tidypics/breadcrumbs.php +++ b/views/default/tidypics/breadcrumbs.php @@ -1,22 +1,23 @@ wwwroot . "pg/photos/owned/" . $page_owner->username; - if (get_loggedin_userid() == $page_owner->guid) - $first_level_text = elgg_echo('album:yours'); - else - $first_level_text = sprintf(elgg_echo('album:user'), $page_owner->name); +$first_level_text = ''; +$first_level_link = $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username; +if (get_loggedin_userid() == $page_owner->guid) { + $first_level_text = elgg_echo('album:yours'); +} else { + $first_level_text = sprintf(elgg_echo('album:user'), $page_owner->name); +} ?> title; - $second_level_link = $vars['album']->getURL(); -?> +$second_level_text = ''; +if (isset($vars['album'])) { + $second_level_text = $vars['album']->title; + $second_level_link = $vars['album']->getURL(); + ?> >> - + '; - foreach ($exif as $name => $value) { - echo $name . ': ' . $value . '
    '; - } - echo ''; +$guid = $vars['guid']; + +$exif = tp_exif_formatted($guid); +if ($exif) { + echo '
    '; + foreach ($exif as $name => $value) { + echo $name . ': ' . $value . '
    '; } - + echo '
    '; +} + ?> \ No newline at end of file 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 @@ 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(); ?>
    @@ -48,79 +45,79 @@ "tidypicstitle", "value" => $title,)); ?>

    - + ?>

    - "tidypicsbody","value" => $body,)); ?> + "tidypicsbody","value" => $body,)); ?>

    - + ?>

    - "tidypicsbody","value" => $body,"class" => 'tidypics_caption_input')); ?> + "tidypicsbody","value" => $body,"class" => 'tidypics_caption_input')); ?>

    - +

    "tidypicstags","value" => $tags,)); ?>

    -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) { + + ?>

    - "cover", - 'options' => array(elgg_echo("album:cover")), - )); -?> + "cover", + 'options' => array(elgg_echo("album:cover")), + )); + ?>

    - + ?>

    - +

    - -

    - + +

    + 'access_id','value' => $access_id)); ?> -

    +

    - - - + + + ?>

    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 @@
    @@ -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 @@ 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 = '

    ' . elgg_echo('tidypics:settings:heading:main') . '

    '; + +// Tagging +$tagging = $plugin->tagging; +if (!$tagging) { + $tagging = "enabled"; +} +$form_body .= '

    ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . "

    "; + +// Download Link +$download_link = $plugin->download_link; +if (!$download_link) { + $download_link = "enabled"; +} +$form_body .= '

    ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:download_link') => 'enabled'), 'internalname' => 'download_link', 'value' => $download_link )) . "

    "; + +// Ratings +$photo_ratings = $plugin->photo_ratings; +if (!$photo_ratings) { + $photo_ratings = "disabled"; +} +$form_body .= '

    ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:photo_ratings') => 'enabled'), 'internalname' => 'photo_ratings', 'value' => $photo_ratings )) . "

    "; + +// Show EXIF +$exif = $plugin->exif; +if (!$exif) { + $exif = "disabled"; +} +$form_body .= '

    ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:exif') => 'enabled'), 'internalname' => 'exif', 'value' => $exif )) . "

    "; + +// Show View count +$view_count = $plugin->view_count; +if (!$view_count) { + $view_count = "enabled"; +} +$form_body .= '

    ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . "

    "; + +// Watermark Text +$form_body .= "

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

    "; + +// Max Image Size +$maxfilesize = $plugin->maxfilesize; +if (!$maxfilesize) { + $maxfilesize = (int)5; // 5 MB +} +$form_body .= "

    " . elgg_echo('tidypics:settings:maxfilesize') . "
    "; +$form_body .= elgg_view("input/text",array('internalname' => 'params[maxfilesize]', 'value' => $maxfilesize)) . "

    "; + +// Quota Size +$quota = $plugin->quota; +if (!$quota) { + $quota = 0; +} +$form_body .= "

    " . elgg_echo('tidypics:settings:quota') . "
    "; +$form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "

    "; + +// 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 .= '

    ' . elgg_echo('tidypics:settings:heading:img_lib') . '

    '; +$image_lib = $plugin->image_lib; +if (!$image_lib) { + $image_lib = 'GD'; +} +$form_body .= '

    ' . 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 .= '
    Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.

    '; + +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 = '

    ' . elgg_echo('tidypics:settings:heading:main') . '

    '; - - // Tagging - $tagging = $plugin->tagging; - if(!$tagging) $tagging = "enabled"; - $form_body .= '

    ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . "

    "; - - // Download Link - $download_link = $plugin->download_link; - if(!$download_link) $download_link = "enabled"; - $form_body .= '

    ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:download_link') => 'enabled'), 'internalname' => 'download_link', 'value' => $download_link )) . "

    "; - - // Ratings - $photo_ratings = $plugin->photo_ratings; - if(!$photo_ratings) $photo_ratings = "disabled"; - $form_body .= '

    ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:photo_ratings') => 'enabled'), 'internalname' => 'photo_ratings', 'value' => $photo_ratings )) . "

    "; - - // Show EXIF - $exif = $plugin->exif; - if(!$exif) $exif = "disabled"; - $form_body .= '

    ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:exif') => 'enabled'), 'internalname' => 'exif', 'value' => $exif )) . "

    "; - - // Show View count - $view_count = $plugin->view_count; - if(!$view_count) $view_count = "enabled"; - $form_body .= '

    ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . "

    "; - - // Watermark Text - $form_body .= "

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

    "; - - // Max Image Size - $maxfilesize = $plugin->maxfilesize; - if (!$maxfilesize) $maxfilesize = (int)5; // 5 MB - $form_body .= "

    " . elgg_echo('tidypics:settings:maxfilesize') . "
    "; - $form_body .= elgg_view("input/text",array('internalname' => 'params[maxfilesize]', 'value' => $maxfilesize)) . "

    "; - - // Quota Size - $quota = $plugin->quota; - if (!$quota) $quota = 0; - $form_body .= "

    " . elgg_echo('tidypics:settings:quota') . "
    "; - $form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "

    "; - - // 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 .= '

    ' . elgg_echo('tidypics:settings:heading:img_lib') . '

    '; - $image_lib = $plugin->image_lib; - if (!$image_lib) $image_lib = 'GD'; - $form_body .= '

    ' . 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 .= '
    Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.

    '; - - 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 .= "

    " . elgg_echo('tidypics:settings:im_path') . "
    "; - $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "

    "; - } - - - // River Image options - $form_body .= '

    ' . elgg_echo('tidypics:settings:heading:river') . '

    '; - $img_river_view = $plugin->img_river_view; - if (!$img_river_view) $img_river_view = '1'; - $form_body .= '

    ' . 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 .= '

    '; - - // River Album options - $album_river_view = $plugin->album_river_view; - if (!$album_river_view) $album_river_view = 'set'; - $form_body .= '

    ' . 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 .= '

    '; - - // Thumbnail sizes - $form_body .= '

    ' . elgg_echo('tidypics:settings:heading:sizes') . '

    '; - $form_body .= "
    You must edit the css if you change the default sizes
    "; - $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 .= "

    " . elgg_echo('tidypics:settings:largesize') . "
    "; - $form_body .= 'width:    '; - $form_body .= 'height:

    '; - - $form_body .= "

    " . elgg_echo('tidypics:settings:smallsize') . "
    "; - $form_body .= 'width and height:    '; - //$form_body .= 'height:

    '; - - $form_body .= "

    " . elgg_echo('tidypics:settings:thumbsize') . "
    "; - $form_body .= 'width and height:    '; - //$form_body .= 'height:

    '; - - - // Group permission override - $form_body .= '

    ' . elgg_echo('tidypics:settings:heading:groups') . '

    '; - $grp_perm_override = $plugin->grp_perm_override; - if(!$grp_perm_override) $grp_perm_override = "enabled"; - $form_body .= '

    ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:grp_perm_override') => 'enabled'), 'internalname' => 'grp_perm_override', 'value' => $grp_perm_override )) . "

    "; - - $form_body .= elgg_view('input/submit', array('value' => elgg_echo("save"))); - - echo elgg_view('input/form', array('action' => $action, 'body' => $form_body)); + $form_body .= "

    " . elgg_echo('tidypics:settings:im_path') . "
    "; + $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "

    "; +} + + +// River Image options +$form_body .= '

    ' . elgg_echo('tidypics:settings:heading:river') . '

    '; +$img_river_view = $plugin->img_river_view; +if (!$img_river_view) { + $img_river_view = '1'; +} +$form_body .= '

    ' . 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 .= '

    '; + +// River Album options +$album_river_view = $plugin->album_river_view; +if (!$album_river_view) { + $album_river_view = 'set'; +} +$form_body .= '

    ' . 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 .= '

    '; + +// Thumbnail sizes +$form_body .= '

    ' . elgg_echo('tidypics:settings:heading:sizes') . '

    '; +$form_body .= "
    You must edit the css if you change the default sizes
    "; +$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 .= "

    " . elgg_echo('tidypics:settings:largesize') . "
    "; +$form_body .= 'width:    '; +$form_body .= 'height:

    '; + +$form_body .= "

    " . elgg_echo('tidypics:settings:smallsize') . "
    "; +$form_body .= 'width and height:    '; +//$form_body .= 'height:

    '; + +$form_body .= "

    " . elgg_echo('tidypics:settings:thumbsize') . "
    "; +$form_body .= 'width and height:    '; +//$form_body .= 'height:

    '; + + +// Group permission override +$form_body .= '

    ' . elgg_echo('tidypics:settings:heading:groups') . '

    '; +$grp_perm_override = $plugin->grp_perm_override; +if (!$grp_perm_override) { + $grp_perm_override = "enabled"; +} +$form_body .= '

    ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:grp_perm_override') => 'enabled'), 'internalname' => 'grp_perm_override', 'value' => $grp_perm_override )) . "

    "; + +$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 @@ 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; } +} ?>
    - -

    -
    -
    - -
    - + ?> +

    +
    +
    + +
    +

    -
    +
    ...
      -' . elgg_view("input/file",array('internalname' => "upload_$x")) . ''; - } -?> + } + ?>

    -'; - if ($access_id) - echo ''; -?> + '; + } + if ($access_id) { + echo ''; + } + ?> " onclick="displayProgress();" />

    "{$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',) +); ?>
    \ No newline at end of file diff --git a/views/default/tidypics/groupprofile_albums.php b/views/default/tidypics/groupprofile_albums.php index 7cb89bf1c..85b32425e 100644 --- a/views/default/tidypics/groupprofile_albums.php +++ b/views/default/tidypics/groupprofile_albums.php @@ -15,4 +15,3 @@ if ($vars['entity']->photos_enable != 'no') { echo elgg_view('tidypics/albums', array('num_albums' => 5)); echo '
    '; } -?> \ No newline at end of file diff --git a/views/default/tidypics/image_menu.php b/views/default/tidypics/image_menu.php index 498cfe724..50ada2193 100644 --- a/views/default/tidypics/image_menu.php +++ b/views/default/tidypics/image_menu.php @@ -1,51 +1,50 @@ container_guid); - if ($container instanceof ElggGroup) { - $can_tag = $viewer && $container->isMember($viewer); - } else { - $can_tag = $viewer && $viewer->guid == $owner->guid || user_is_friend($owner->guid, $viewer->guid); - } - - // only owner and friends of owner can tag - if ($can_tag) { +/************************************************************************** + * + * Tidypics Image Menu + * + * This is the menu that appears below an image. Admins can override the + * menu with a different view to provide a look and feel that matches + * their themes. The view can be extended to provide additional controls. + * + **************************************************************************/ + +$image_guid = $vars['image_guid']; +$viewer = $vars['viewer']; +$owner = $vars['owner']; +$anytags = $vars['anytags']; +$album = $vars['album']; + +if (get_plugin_setting('tagging', 'tidypics') != "disabled") { + + $can_tag = false; + + $container = get_entity($album->container_guid); + if ($container instanceof ElggGroup) { + $can_tag = $viewer && $container->isMember($viewer); + } else { + $can_tag = $viewer && $viewer->guid == $owner->guid || user_is_friend($owner->guid, $viewer->guid); + } + + // only owner and friends of owner can tag + if ($can_tag) { ?>
  • guid == $owner->guid) { + } + + // only owner can delete tags + if ($anytags && $viewer && $viewer->guid == $owner->guid) { ?>
  • \ No newline at end of file +} diff --git a/views/default/tidypics/tagging.php b/views/default/tidypics/tagging.php index 251534b80..2993fe71b 100644 --- a/views/default/tidypics/tagging.php +++ b/views/default/tidypics/tagging.php @@ -1,32 +1,32 @@ getPhotoTags(); +// get photo tags +$tag_info = $image->getPhotoTags(); - // defining json text as "" makes sure the tagging javascript code doesn't throw errors if no tags - $photo_tags_json = "\"\""; - if ($tag_info) { - $photo_tags_json = $tag_info['json']; - } - - if ($tag_info) { +// defining json text as "" makes sure the tagging javascript code doesn't throw errors if no tags +$photo_tags_json = "\"\""; +if ($tag_info) { + $photo_tags_json = $tag_info['json']; +} + +if ($tag_info) { ?>

    @@ -34,10 +34,10 @@

    -"; @@ -45,30 +45,30 @@ $content .= ""; $content .= ""; $content .= ""; - + $content .= "
    "; - + $content .= "
    "; - + echo elgg_view('input/form', array('internalid' => 'quicksearch', 'internalname' => 'tidypics_phototag_form', 'class' => 'quicksearch', 'action' => "{$vars['url']}action/tidypics/addtag", 'method' => 'post', 'body' => $content)); } -?> -
    + ?> +

    -guid}' />"; foreach ($tag_info['links'] as $id => $link) { @@ -77,7 +77,7 @@ } $content .= ""; - $content .= ""; + $content .= ""; echo elgg_view('input/form', array('internalname' => 'phototag_deletetag_form', 'action' => "{$vars['url']}action/tidypics/deletetag", 'method' => 'post', 'body' => $content)); @@ -85,5 +85,4 @@ ?>
    $photo_tags_json,) ); -?> \ No newline at end of file +echo elgg_view('tidypics/js/tagging', array('photo_tags_json' => $photo_tags_json,) ); -- cgit v1.2.3