From 65f6184aec8f6c6e5d053d4cb0e0925b9f536570 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Thu, 9 Feb 2012 10:24:59 -0800 Subject: Using tabs for admin pages. --- views/default/admin/settings/tidypics.php | 78 ++++++++++--- views/default/admin/settings/tidypics/help.php | 57 +++++++++ .../default/admin/settings/tidypics/image_lib.php | 38 ++++++ .../admin/settings/tidypics/server_info.php | 130 +++++++++++++++++++++ views/default/admin/settings/tidypics/settings.php | 20 ++++ views/default/admin/settings/tidypics/stats.php | 63 ++++++++++ .../default/admin/settings/tidypics/thumbnail.php | 52 +++++++++ 7 files changed, 423 insertions(+), 15 deletions(-) create mode 100644 views/default/admin/settings/tidypics/help.php create mode 100644 views/default/admin/settings/tidypics/image_lib.php create mode 100644 views/default/admin/settings/tidypics/server_info.php create mode 100644 views/default/admin/settings/tidypics/settings.php create mode 100644 views/default/admin/settings/tidypics/stats.php create mode 100644 views/default/admin/settings/tidypics/thumbnail.php (limited to 'views/default/admin/settings') 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 '
'; - echo '

'; - echo elgg_view('output/url', array( - 'text' => elgg_echo('tidypics:upgrade'), - 'href' => 'action/photos/admin/upgrade', - 'is_action' => true, - )); - echo '

'; - echo '
'; -} - -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/admin/settings/tidypics/help.php b/views/default/admin/settings/tidypics/help.php new file mode 100644 index 000000000..bf08de284 --- /dev/null +++ b/views/default/admin/settings/tidypics/help.php @@ -0,0 +1,57 @@ + +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 +resizing the image if you are using GD. The easiest way to test this is to set display_errors +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). +

+

+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. +

+HTML; + +echo elgg_view_module('inline', $title, $body); + +$title = 'Question mark images appear'; +$body =<< +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 +not see these warnings. +

+

+Another possible cause is using ImageMagick when your server does not support it or specifying +the wrong path to the ImageMagick executables. +

+HTML; + +echo elgg_view_module('inline', $title, $body); + + +$title = 'Unable to save settings'; +$body =<<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. +

+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 @@ +' . elgg_echo('tidypics:lib_tools:overview') . '

'; +$content .= '

' . elgg_echo('tidypics:lib_tools:testing') . '

'; +$content .= '

'; +$content .= '

'; + +echo elgg_view_module('inline', elgg_echo('tidypics:lib_tools'), $content); + +?> + diff --git a/views/default/admin/settings/tidypics/server_info.php b/views/default/admin/settings/tidypics/server_info.php new file mode 100644 index 000000000..96ccc555f --- /dev/null +++ b/views/default/admin/settings/tidypics/server_info.php @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GD
IMagick
exec()
s
s
GD imagejpeg
GD imagepng
GD imagegif
EXIF
+ +

+ '/mod/tidypics/docs/configure_server.txt', + 'text' => elgg_echo('tidypics:server_configuration_doc') + )); + ?> +

+'; + echo '

'; + echo elgg_view('output/url', array( + 'text' => elgg_echo('tidypics:upgrade'), + 'href' => 'action/photos/admin/upgrade', + 'is_action' => true, + )); + echo '

'; + echo ''; +} + +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/settings/tidypics/stats.php b/views/default/admin/settings/tidypics/stats.php new file mode 100644 index 000000000..25ace77da --- /dev/null +++ b/views/default/admin/settings/tidypics/stats.php @@ -0,0 +1,63 @@ +dbprefix}entities where subtype={$img_type}"; +$total = get_data_row($query); +$num_images = $total->total; +$stats['images'] = $total->total; + +// number of albums +$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; +$stats['albums'] = $total->total; + +$options = array( + 'count' => true, + 'type' => 'object', + 'subtype' => 'image', + 'annotation_name' => 'generic_comment' +); + +// number of comments on photos +$stats['photo_comments'] = elgg_get_annotations($options); + +// number of comments on albums +$options['subtype'] = 'album'; +$stats['album_comments'] = elgg_get_annotations($options); + +// number of views on images +$options['subtype'] = 'image'; +$options['annotation_name'] = 'tp_view'; +$stats['views'] = elgg_get_annotations($options); + +// number of photo tags on images +if (elgg_get_plugin_setting('tagging', 'tidypics') != 'disabled') { + $options['annotation_name'] = 'phototag'; + $stats['tags'] = elgg_get_annotations($options); +} + +$content = ''; + +foreach ($stats as $str => $value) { + $str = elgg_echo("tidypics:stats:$str"); + $value = (int)$value; + + $content .= << + + + +HTML; +} + +$content .= '
$str:$value
'; + +echo elgg_view_module('inline', elgg_echo('tidypics:stats'), $content); \ No newline at end of file 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 @@ +' . elgg_echo('tidypics:thumbnail_tool_blurb') . '

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

+HTML; + +echo elgg_view_module('inline', $title, $body); + +?> + + \ No newline at end of file -- cgit v1.2.3