aboutsummaryrefslogtreecommitdiff
path: root/views/default
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2012-02-09 10:24:59 -0800
committerBrett Profitt <brett.profitt@gmail.com>2012-02-09 10:24:59 -0800
commit65f6184aec8f6c6e5d053d4cb0e0925b9f536570 (patch)
treed043143aec596595303bd83f32c97ce9681e8d6f /views/default
parent4e593af0c167b0ec48799f569dced56058e5e8aa (diff)
downloadelgg-65f6184aec8f6c6e5d053d4cb0e0925b9f536570.tar.gz
elgg-65f6184aec8f6c6e5d053d4cb0e0925b9f536570.tar.bz2
Using tabs for admin pages.
Diffstat (limited to 'views/default')
-rw-r--r--views/default/admin/settings/tidypics.php78
-rw-r--r--views/default/admin/settings/tidypics/help.php (renamed from views/default/tidypics/admin/help.php)43
-rw-r--r--views/default/admin/settings/tidypics/image_lib.php38
-rw-r--r--views/default/admin/settings/tidypics/server_info.php (renamed from views/default/admin/administer_utilities/tidypics_tools.php)38
-rw-r--r--views/default/admin/settings/tidypics/settings.php20
-rw-r--r--views/default/admin/settings/tidypics/stats.php (renamed from views/default/admin/statistics/tidypics.php)0
-rw-r--r--views/default/admin/settings/tidypics/thumbnail.php52
-rw-r--r--views/default/tidypics/admin/settings.php25
-rw-r--r--views/default/tidypics/admin/thumbnails.php33
-rw-r--r--views/default/tidypics/admin/tidypics.php63
-rw-r--r--views/default/tidypics/admin/upgrade.php35
11 files changed, 208 insertions, 217 deletions
diff --git a/views/default/admin/settings/tidypics.php b/views/default/admin/settings/tidypics.php
index 2e7d79942..7b1764fed 100644
--- a/views/default/admin/settings/tidypics.php
+++ b/views/default/admin/settings/tidypics.php
@@ -6,18 +6,66 @@
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
*/
-if (tidypics_is_upgrade_available()) {
- echo '<div class="elgg-admin-notices">';
- echo '<p>';
- echo elgg_view('output/url', array(
- 'text' => elgg_echo('tidypics:upgrade'),
- 'href' => 'action/photos/admin/upgrade',
- 'is_action' => true,
- ));
- echo '</p>';
- echo '</div>';
-}
-
-echo elgg_view('output/longtext', array('value' => elgg_echo('tidypics:admin:instructions')));
-
-echo elgg_view_form('photos/admin/settings');
+$tab = get_input('tab', 'settings');
+
+echo elgg_view('navigation/tabs', array(
+ 'tabs' => array(
+ array(
+ 'text' => elgg_echo('settings'),
+ 'href' => '/admin/settings/tidypics',
+ 'selected' => ($tab == 'settings'),
+ ),
+ array(
+ 'text' => elgg_echo('tidypics:server_info'),
+ 'href' => '/admin/settings/tidypics?tab=server_info',
+ 'selected' => ($tab == 'server_info'),
+ ),
+ array(
+ 'text' => elgg_echo('tidypics:stats'),
+ 'href' => '/admin/settings/tidypics?tab=stats',
+ 'selected' => ($tab == 'stats'),
+ ),
+ array(
+ 'text' => elgg_echo('tidypics:settings:image_lib'),
+ 'href' => '/admin/settings/tidypics?tab=image_lib',
+ 'selected' => ($tab == 'image_lib'),
+ ),
+ array(
+ 'text' => elgg_echo('tidypics:settings:thumbnail'),
+ 'href' => '/admin/settings/tidypics?tab=thumbnail',
+ 'selected' => ($tab == 'thumbnail'),
+ ),
+ array(
+ 'text' => elgg_echo('tidypics:settings:help'),
+ 'href' => '/admin/settings/tidypics?tab=help',
+ 'selected' => ($tab == 'help'),
+ ),
+ )
+));
+
+switch ($tab) {
+ case 'server_info':
+ echo elgg_view('admin/settings/tidypics/server_info');
+ break;
+
+ case 'stats':
+ echo elgg_view('admin/settings/tidypics/stats');
+ break;
+
+ case 'image_lib':
+ echo elgg_view('admin/settings/tidypics/image_lib');
+ break;
+
+ case 'thumbnail':
+ echo elgg_view('admin/settings/tidypics/thumbnail');
+ break;
+
+ case 'help':
+ echo elgg_view('admin/settings/tidypics/help');
+ break;
+
+ default:
+ case 'settings':
+ echo elgg_view('admin/settings/tidypics/settings');
+ break;
+} \ No newline at end of file
diff --git a/views/default/tidypics/admin/help.php b/views/default/admin/settings/tidypics/help.php
index b939a74a8..bf08de284 100644
--- a/views/default/tidypics/admin/help.php
+++ b/views/default/admin/settings/tidypics/help.php
@@ -1,5 +1,13 @@
-<br />
-<h3>White screen when uploading images</h3>
+<?php
+/**
+ * Tidypics Help
+ *
+ * @todo This would be hard to localize cleanly.
+ */
+
+$title = 'White screen when uploading images';
+
+$body = <<<HTML
<p>
Tidypics tries to calculate the maximum size of an image that your server will support. If it
guesses incorrectly and someone uploads a photo that is too large, the script may crash when
@@ -7,26 +15,43 @@ resizing the image if you are using GD. The easiest way to test this is to set d
to 1 in your .htaccess file and upload large images. If this causes a problem, a php memory error
should display on the screen. You can increased your php memory limit (see the docs directory).
A better option is to use ImageMagick if your server supports it (again see the docs directory).
-</p><p>
+</p>
+<p>
If it is not a memory issue, you should see some other error appear. Once you have fixed the error,
-change display_error back to 0.
+change display_error back to 0.
</p>
-<h3>Question mark images appear</h3>
+HTML;
+
+echo elgg_view_module('inline', $title, $body);
+
+$title = 'Question mark images appear';
+$body =<<<HTML
<p>
If you see question mark images when you look at your albums, this means the resizing of the images
failed. This could be due to the memory limits as described above. There are other causes. Tidypics
tries to detect these problems and write the cause to the error log. You should check your server
error log right after an upload that results in a question mark for these error messages. The messages
-will begin with "Tidypics warning:". It is possible if you have turned off php warnings that you will
+will begin with "Tidypics warning:". It is possible if you have turned off php warnings that you will
not see these warnings.
-</p><p>
+</p>
+<p>
Another possible cause is using ImageMagick when your server does not support it or specifying
the wrong path to the ImageMagick executables.
</p>
-<h3>Unable to save settings</h3>
+HTML;
+
+echo elgg_view_module('inline', $title, $body);
+
+
+$title = 'Unable to save settings';
+$body =<<<HTML
<p>If you are unable to settings, there are two possible causes. First,
Apache can be configured to block pages that use file paths as Tidypics
does when setting the location of the ImageMagick executable. In this case,
leave that field blank. Second, there is some bad code in the Izaps video
plugin that can prevent the settings from being saved. Try disabling that plugin.
-</p> \ No newline at end of file
+</p>
+HTML;
+
+echo elgg_view_module('inline', $title, $body);
+
diff --git a/views/default/admin/settings/tidypics/image_lib.php b/views/default/admin/settings/tidypics/image_lib.php
new file mode 100644
index 000000000..44a7eb847
--- /dev/null
+++ b/views/default/admin/settings/tidypics/image_lib.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Tidypics image library tools
+ */
+
+$content = '<p>' . elgg_echo('tidypics:lib_tools:overview') . '</p>';
+$content .= '<p>' . elgg_echo('tidypics:lib_tools:testing') . '</p>';
+$content .= '<p><label>' . elgg_echo('tidypics:settings:im_path');
+$content .= elgg_view('input/text', array(
+ 'name' => 'im_location'
+));
+$content .= elgg_view('input/submit', array(
+ 'value' => elgg_echo('submit'),
+ 'id' => 'tidypics-im-test'
+));
+$content .= '</p>';
+$content .= '<p id="tidypics-im-results"></p>';
+
+echo elgg_view_module('inline', elgg_echo('tidypics:lib_tools'), $content);
+
+?>
+<script type="text/javascript">
+ $(function() {
+ $('#tidypics-im-test').click(function() {
+ var loc = $('input[name=im_location]').val();
+ $("#tidypics-im-results").html("");
+ $.ajax({
+ type: "GET",
+ url: elgg.normalize_url('mod/tidypics/actions/photos/admin/imtest.php'),
+ data: {location: loc},
+ cache: false,
+ success: function(html){
+ $("#tidypics-im-results").html(html);
+ }
+ });
+ });
+ });
+</script>
diff --git a/views/default/admin/administer_utilities/tidypics_tools.php b/views/default/admin/settings/tidypics/server_info.php
index 1df664be8..96ccc555f 100644
--- a/views/default/admin/administer_utilities/tidypics_tools.php
+++ b/views/default/admin/settings/tidypics/server_info.php
@@ -5,7 +5,6 @@
$title = elgg_echo('admin:administer_utilities:tidypics_tools');
-// server info
function tp_readable_size($bytes) {
if (strpos($bytes, 'M')) {
return $bytes . 'B';
@@ -128,39 +127,4 @@ ob_start();
$content = ob_get_clean();
-echo elgg_view_module('inline', elgg_echo('tidypics:server_info'), $content);
-
-// image library tools
-$content = '<p>' . elgg_echo('tidypics:lib_tools:overview') . '</p>';
-$content .= '<p>' . elgg_echo('tidypics:lib_tools:testing') . '</p>';
-$content .= '<p><label>' . elgg_echo('tidypics:settings:im_path');
-$content .= elgg_view('input/text', array(
- 'name' => 'im_location'
-));
-$content .= elgg_view('input/submit', array(
- 'value' => elgg_echo('submit'),
- 'id' => 'tidypics-im-test'
-));
-$content .= '</p>';
-$content .= '<p id="tidypics-im-results"></p>';
-
-echo elgg_view_module('inline', elgg_echo('tidypics:lib_tools'), $content);
-
-?>
-<script type="text/javascript">
- $(function() {
- $('#tidypics-im-test').click(function() {
- var loc = $('input[name=im_location]').val();
- $("#tidypics-im-results").html("");
- $.ajax({
- type: "GET",
- url: elgg.normalize_url('mod/tidypics/actions/admin/imtest.php'),
- data: {location: loc},
- cache: false,
- success: function(html){
- $("#tidypics-im-results").html(html);
- }
- });
- });
- });
-</script>
+echo elgg_view_module('inline', elgg_echo('tidypics:server_info'), $content); \ No newline at end of file
diff --git a/views/default/admin/settings/tidypics/settings.php b/views/default/admin/settings/tidypics/settings.php
new file mode 100644
index 000000000..3645e749a
--- /dev/null
+++ b/views/default/admin/settings/tidypics/settings.php
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Tidypics main settings
+ */
+
+if (tidypics_is_upgrade_available()) {
+ echo '<div class="elgg-admin-notices">';
+ echo '<p>';
+ echo elgg_view('output/url', array(
+ 'text' => elgg_echo('tidypics:upgrade'),
+ 'href' => 'action/photos/admin/upgrade',
+ 'is_action' => true,
+ ));
+ echo '</p>';
+ echo '</div>';
+}
+
+echo elgg_view('output/longtext', array('value' => elgg_echo('tidypics:admin:instructions')));
+
+echo elgg_view_form('photos/admin/settings'); \ No newline at end of file
diff --git a/views/default/admin/statistics/tidypics.php b/views/default/admin/settings/tidypics/stats.php
index 25ace77da..25ace77da 100644
--- a/views/default/admin/statistics/tidypics.php
+++ b/views/default/admin/settings/tidypics/stats.php
diff --git a/views/default/admin/settings/tidypics/thumbnail.php b/views/default/admin/settings/tidypics/thumbnail.php
new file mode 100644
index 000000000..502b5739e
--- /dev/null
+++ b/views/default/admin/settings/tidypics/thumbnail.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Tidypics thumbnail creation tool
+ */
+
+$title = elgg_echo('tidypics:settings:thumbnail');
+$body = '<p>' . elgg_echo('tidypics:thumbnail_tool_blurb') . '</p>';
+$im_id = elgg_echo('tidypics:settings:im_id');
+$input = elgg_view('input/text', array(
+ 'name' => 'image_id'
+));
+$submit = elgg_view('input/submit', array(
+ 'value' => elgg_echo('submit'),
+ 'id' => 'elgg-tidypics-im-test'
+));
+
+$body .=<<<HTML
+ <p>
+ <label>$im_id $input</label>
+ $submit
+ <div id="elgg-tidypics-im-results"></div>
+ </p>
+HTML;
+
+echo elgg_view_module('inline', $title, $body);
+
+?>
+
+<script type="text/javascript">
+ $(function() {
+ $('#elgg-tidypics-im-test').click(function() {
+ var image_id = $('input[name=image_id]').val();
+ $("#elgg-tidypics-im-results").html('<div class="elgg-ajax-loader"></div>');
+ elgg.action('photos/admin/create_thumbnails', {
+ format: 'JSON',
+ data: {guid: image_id},
+ cache: false,
+ success: function(result) {
+ // error
+ if (result.status < 0) {
+ var html = '';
+ } else {
+ var html = '<img class="elgg-photo tidypics-photo" src="'
+ + result.output.thumbnail_src + '" alt="' + result.output.title
+ + '" />';
+ }
+ $("#elgg-tidypics-im-results").html(html);
+ }
+ });
+ });
+ });
+</script> \ No newline at end of file
diff --git a/views/default/tidypics/admin/settings.php b/views/default/tidypics/admin/settings.php
deleted file mode 100644
index aff6acc8d..000000000
--- a/views/default/tidypics/admin/settings.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-/**
- * Tidypics admin settings tab
- *
- * @todo deprecated
- */
-
-$form_body = elgg_view('forms/tidypics/admin/settings', $vars);
-
-$server_analysis_link = elgg_view('output/url', array(
- 'href' => "{$vars['url']}mod/tidypics/pages/server_analysis.php",
- 'text' => elgg_echo('tidypics:settings:server:analysis'),
-));
-
-echo elgg_view('output/longtext', array('value' => elgg_echo('tidypics:admin:instructions')));
-
-echo '<p>';
-echo elgg_view('tidypics/admin/upgrade');
-echo $server_analysis_link;
-echo '</p>';
-
-echo elgg_view('input/form', array(
- 'body' => $form_body,
- 'action' => $vars['url'] . 'action/tidypics/admin/settings',
-));
diff --git a/views/default/tidypics/admin/thumbnails.php b/views/default/tidypics/admin/thumbnails.php
deleted file mode 100644
index 5884b9dc3..000000000
--- a/views/default/tidypics/admin/thumbnails.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<br />
-<h3>Overview</h3>
-<p>
-This page allows you to create thumbnails for images when the thumbnail creation failed during upload.
-You may experience problems with thumbnail creation if your image library is not configured properly or
-if there is not enough memory for the GD library to load and resize an image. If your users have
-experienced problems with thumbnail creation and you have corrected your configuration, you can try to redo the
-thumbnails. Find the unique identifier of the photo (it is the number near the end of the url when viewing
-a photo) and enter it below.
-</p>
-<h3>Thumbnail Creation</h3>
-<p>
-<b><?php echo elgg_echo('tidypics:settings:im_id'); ?></b>:
-<input name="image_id" type="text" />
-<input type="submit" value="Submit" onclick="TestThumbnailCreation();" />
-</p>
-<div id="im_results"></div>
-<script type="text/javascript">
-function TestThumbnailCreation()
-{
- var image_id = $('input[name=image_id]').val();
- $("#im_results").html("");
- $.ajax({
- type: "GET",
- url: "<?php echo $CONFIG->wwwroot . 'mod/tidypics/actions/admin/create_thumbnails.php'; ?>",
- data: {guid: image_id},
- cache: false,
- success: function(html){
- $("#im_results").html(html);
- }
- });
-}
-</script> \ No newline at end of file
diff --git a/views/default/tidypics/admin/tidypics.php b/views/default/tidypics/admin/tidypics.php
deleted file mode 100644
index 479eb86e2..000000000
--- a/views/default/tidypics/admin/tidypics.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-/**
- * @todo deprecated
- */
-
-global $CONFIG;
-
-$tab = $vars['tab'];
-
-$settingsselect = '';
-$statsselect = '';
-$imagelibselect = '';
-$thumbnailselect = '';
-$helpselect = '';
-switch($tab) {
- case 'settings':
- $settingsselect = 'class="selected"';
- break;
- case 'stats':
- $statsselect = 'class="selected"';
- break;
- case 'imagelib':
- $imagelibselect = 'class="selected"';
- break;
- case 'thumbnail':
- $thumbnailselect = 'class="selected"';
- break;
- case 'help':
- $helpselect = 'class="selected"';
- break;
-}
-
-?>
-<div class="contentWrapper">
- <div id="elgg_horizontal_tabbed_nav">
- <ul>
- <li <?php echo $settingsselect; ?>><a href="<?php echo $CONFIG->wwwroot . 'pg/photos/admin/?tab=settings'; ?>"><?php echo elgg_echo('tidypics:settings'); ?></a></li>
- <li <?php echo $statsselect; ?>><a href="<?php echo $CONFIG->wwwroot . 'pg/photos/admin/?tab=stats'; ?>"><?php echo elgg_echo('tidypics:stats'); ?></a></li>
- <li <?php echo $imagelibselect; ?>><a href="<?php echo $CONFIG->wwwroot . 'pg/photos/admin/?tab=imagelib'; ?>"><?php echo elgg_echo('tidypics:settings:image_lib'); ?></a></li>
- <li <?php echo $thumbnailselect; ?>><a href="<?php echo $CONFIG->wwwroot . 'pg/photos/admin/?tab=thumbnail'; ?>"><?php echo elgg_echo('tidypics:settings:thumbnail'); ?></a></li>
- <li <?php echo $helpselect; ?>><a href="<?php echo $CONFIG->wwwroot . 'pg/photos/admin/?tab=help'; ?>"><?php echo elgg_echo('tidypics:settings:help'); ?></a></li>
- </ul>
- </div>
- <?php
- switch($tab) {
- case 'settings':
- echo elgg_view("tidypics/admin/settings");
- break;
- case 'stats':
- echo elgg_view("tidypics/admin/stats");
- break;
- case 'imagelib':
- echo elgg_view("tidypics/admin/imagelib");
- break;
- case 'thumbnail':
- echo elgg_view("tidypics/admin/thumbnails");
- break;
- case 'help':
- echo elgg_view("tidypics/admin/help");
- break;
- }
- ?>
-</div>
diff --git a/views/default/tidypics/admin/upgrade.php b/views/default/tidypics/admin/upgrade.php
deleted file mode 100644
index bb0a12467..000000000
--- a/views/default/tidypics/admin/upgrade.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-// sets $version based on code
-require_once "{$CONFIG->pluginspath}tidypics/version.php";
-
-$upgrade_url = "{$vars['url']}action/tidypics/admin/upgrade";
-
-// 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 initial version for new install
- set_plugin_setting('version', $version, 'tidypics');
- $local_version = $version;
- }
-} elseif ($local_version == '1.62') {
- // special work around to handle old upgrade system
- $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' => elgg_echo('tidypics:upgrade'),
- 'href' => $upgrade_url,
- 'is_action' => TRUE)
-);
-
-echo '<br />';