diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/default/object/album.php | 25 | ||||
-rw-r--r-- | views/default/object/image.php | 30 | ||||
-rw-r--r-- | views/default/tidypics/admin/settings.php | 3 | ||||
-rw-r--r-- | views/default/tidypics/admin/upgrade.php | 30 | ||||
-rw-r--r-- | views/default/tidypics/forms/settings.php | 6 |
5 files changed, 45 insertions, 49 deletions
diff --git a/views/default/object/album.php b/views/default/object/album.php index 0db0d3e49..b87bef444 100644 --- a/views/default/object/album.php +++ b/views/default/object/album.php @@ -106,24 +106,11 @@ if (get_context() == "search") { <?php echo '<div id="tidypics_desc">' . autop($desc) . '</div>'; - $images = get_entities("object", "image", $album_guid, '', 999); - - //build array for back | next links - $_SESSION['image_sort'] = array(); - - if (is_array($images)) { - foreach ($images as $image) { - array_push($_SESSION['image_sort'], $image->guid); - } - - // display the simple image views. Uses 'object/image' view - echo list_entities("object", "image", $album_guid, 24, false); - - $num_images = count($images); - } else { - echo '<div class="tidypics_info">' . elgg_echo('image:none') . '</div>'; - $num_images = 0; - } + $offset = (int)get_input('offset', 0); + echo $album->viewImages(8, $offset); + // echo '<div class="tidypics_info">' . elgg_echo('image:none') . '</div>'; + // $num_images = 0; + //} ?> <div class="clearfloat"></div> @@ -137,7 +124,7 @@ if (get_context() == "search") { } ?> <?php echo elgg_echo('album:by');?> <b><a href="<?php echo $vars['url'] ;?>pg/profile/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a></b> <?php echo $friendlytime; ?><br> - <?php echo elgg_echo('image:total');?> <b><?php echo $num_images; ?></b><br> + <?php echo elgg_echo('image:total');?> <b><?php echo $album->getSize(); ?></b><br> <?php $categories = elgg_view('categories/view',$vars); if (!empty($categories)) { diff --git a/views/default/object/image.php b/views/default/object/image.php index cd53120de..da3e257a1 100644 --- a/views/default/object/image.php +++ b/views/default/object/image.php @@ -94,32 +94,18 @@ if (get_context() == "search") { // Build back and next links $back = ''; $next = ''; - $album = get_entity($image->container_guid); + $back_guid = $album->getPreviousImageGuid($image->guid); + $next_guid = $album->getNextImageGuid($image->guid); - $current = array_search($image_guid, $_SESSION['image_sort']); - - if (!$current) { // means we are no longer using the correct album array - - //rebuild the array - $count = get_entities("object","image", $album->guid, '', 999); - $_SESSION['image_sort'] = array(); - - foreach ($count as $img) { - array_push($_SESSION['image_sort'], $img->guid); - } - - if ($_SESSION['image_sort']) { - $current = array_search($image_guid, $_SESSION['image_sort']); - } - } - - if ($current != 0) { - $back = '<a href="' .$vars['url'] . 'pg/photos/view/' . $_SESSION['image_sort'][$current-1] . '">« ' . elgg_echo('image:back') . '</a>'; + if ($back_guid != 0) { + $text = elgg_echo('image:back'); + $back = "<a href=\"{$vars['url']}pg/photos/view/$back_guid\">« $text</a>"; } - if (sizeof($_SESSION['image_sort']) > $current + 1) { - $next = '<a href="' . $vars['url'] . 'pg/photos/view/' . $_SESSION['image_sort'][$current+1] . '">' . elgg_echo('image:next') . ' »</a>'; + if ($next_guid != 0) { + $text = elgg_echo('image:next'); + $next = "<a href=\"{$vars['url']}pg/photos/view/$next_guid\">$text »</a>"; } ?> diff --git a/views/default/tidypics/admin/settings.php b/views/default/tidypics/admin/settings.php index 60c34b64e..6dace1830 100644 --- a/views/default/tidypics/admin/settings.php +++ b/views/default/tidypics/admin/settings.php @@ -7,8 +7,7 @@ echo elgg_view('output/longtext', array('value' => elgg_echo("tidypics:admin:ins <?php echo elgg_view('tidypics/admin/upgrade'); -global $CONFIG; -$url = $CONFIG->wwwroot . 'mod/tidypics/pages/server_analysis.php'; +$url = "{$vars['url']}mod/tidypics/pages/server_analysis.php"; $text = elgg_echo('tidypics:settings:server:analysis'); echo "<a href=\"$url\">$text</a>"; diff --git a/views/default/tidypics/admin/upgrade.php b/views/default/tidypics/admin/upgrade.php new file mode 100644 index 000000000..5a21aa136 --- /dev/null +++ b/views/default/tidypics/admin/upgrade.php @@ -0,0 +1,30 @@ +<?php + +require_once "{$CONFIG->pluginspath}tidypics/version.php"; + +$upgrade_url = "{$vars['url']}action/tidypics/admin/upgrade"; +//$upgrade_url = elgg_add_action_tokens_to_url($upgrade_url); + +// determine whether an upgrade is required +$local_version = get_plugin_setting('version', 'tidypics'); +if ($local_version === FALSE) { + // no version set so either new install or really old one + if (!get_subtype_class('object', 'image') || !get_subtype_class('object', 'album')) { + $local_version = 0; + } else { + set_plugin_setting('version', $local_version, 'tidypics'); + $local_version = $version; + } +} elseif ($local_version == '1.62') { + $local_version = 2010010101; + set_plugin_setting('version', $local_version, 'tidypics'); +} +if ($local_version == $version) { + // no upgrade required + return TRUE; +} + +echo elgg_view('output/url', array( 'text' => 'Upgrade', + 'href' => $upgrade_url, + 'is_action' => TRUE)); +echo '<br />';
\ No newline at end of file diff --git a/views/default/tidypics/forms/settings.php b/views/default/tidypics/forms/settings.php index e7d05adcc..c102b044e 100644 --- a/views/default/tidypics/forms/settings.php +++ b/views/default/tidypics/forms/settings.php @@ -10,12 +10,6 @@ $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>'; |