From a1f08342c8b8502197159a9fd78e48e6cead4ea0 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 31 Jul 2010 19:22:47 +0000 Subject: improved the upgrade system and moved albums to use an ordered list for images --- views/default/object/album.php | 25 ++++++------------------- views/default/object/image.php | 30 ++++++++---------------------- views/default/tidypics/admin/settings.php | 3 +-- views/default/tidypics/admin/upgrade.php | 30 ++++++++++++++++++++++++++++++ views/default/tidypics/forms/settings.php | 6 ------ 5 files changed, 45 insertions(+), 49 deletions(-) create mode 100644 views/default/tidypics/admin/upgrade.php (limited to 'views') 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") { ' . autop($desc) . ''; - $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 '
' . elgg_echo('image:none') . '
'; - $num_images = 0; - } + $offset = (int)get_input('offset', 0); + echo $album->viewImages(8, $offset); + // echo '
' . elgg_echo('image:none') . '
'; + // $num_images = 0; + //} ?>
@@ -137,7 +124,7 @@ if (get_context() == "search") { } ?> name; ?>
-
+ getSize(); ?>
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 = '« ' . elgg_echo('image:back') . ''; + if ($back_guid != 0) { + $text = elgg_echo('image:back'); + $back = "« $text"; } - if (sizeof($_SESSION['image_sort']) > $current + 1) { - $next = '' . elgg_echo('image:next') . ' »'; + if ($next_guid != 0) { + $text = elgg_echo('image:next'); + $next = "$text »"; } ?> 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 wwwroot . 'mod/tidypics/pages/server_analysis.php'; +$url = "{$vars['url']}mod/tidypics/pages/server_analysis.php"; $text = elgg_echo('tidypics:settings:server:analysis'); echo "$text"; 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 @@ +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 '
'; \ 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 = '

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

'; -- cgit v1.2.3