aboutsummaryrefslogtreecommitdiff
path: root/mod/lightpics/views/default/admin
diff options
context:
space:
mode:
Diffstat (limited to 'mod/lightpics/views/default/admin')
-rw-r--r--mod/lightpics/views/default/admin/settings/photos.php71
-rw-r--r--mod/lightpics/views/default/admin/settings/photos/help.php14
-rw-r--r--mod/lightpics/views/default/admin/settings/photos/image_lib.php38
-rw-r--r--mod/lightpics/views/default/admin/settings/photos/server_config.php14
-rw-r--r--mod/lightpics/views/default/admin/settings/photos/server_info.php120
-rw-r--r--mod/lightpics/views/default/admin/settings/photos/settings.php18
-rw-r--r--mod/lightpics/views/default/admin/settings/photos/thumbnail.php54
7 files changed, 329 insertions, 0 deletions
diff --git a/mod/lightpics/views/default/admin/settings/photos.php b/mod/lightpics/views/default/admin/settings/photos.php
new file mode 100644
index 000000000..cc3592f37
--- /dev/null
+++ b/mod/lightpics/views/default/admin/settings/photos.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Admin page
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+$tab = get_input('tab', 'settings');
+
+echo elgg_view('navigation/tabs', array(
+ 'tabs' => array(
+ array(
+ 'text' => elgg_echo('settings'),
+ 'href' => '/admin/settings/photos',
+ 'selected' => ($tab == 'settings'),
+ ),
+ array(
+ 'text' => elgg_echo('tidypics:server_info'),
+ 'href' => '/admin/settings/photos?tab=server_info',
+ 'selected' => ($tab == 'server_info'),
+ ),
+ array(
+ 'text' => elgg_echo('tidypics:server_config'),
+ 'href' => '/admin/settings/photos?tab=server_config',
+ 'selected' => ($tab == 'server_config'),
+ ),
+ array(
+ 'text' => 'ImageMagick',
+ 'href' => '/admin/settings/photos?tab=image_lib',
+ 'selected' => ($tab == 'image_lib'),
+ ),
+ array(
+ 'text' => elgg_echo('tidypics:settings:thumbnail'),
+ 'href' => '/admin/settings/photos?tab=thumbnail',
+ 'selected' => ($tab == 'thumbnail'),
+ ),
+ array(
+ 'text' => elgg_echo('tidypics:settings:help'),
+ 'href' => '/admin/settings/photos?tab=help',
+ 'selected' => ($tab == 'help'),
+ ),
+ )
+));
+
+switch ($tab) {
+ case 'server_info':
+ echo elgg_view('admin/settings/photos/server_info');
+ break;
+
+ case 'server_config':
+ echo elgg_view('admin/settings/photos/server_config');
+ break;
+
+ case 'image_lib':
+ echo elgg_view('admin/settings/photos/image_lib');
+ break;
+
+ case 'thumbnail':
+ echo elgg_view('admin/settings/photos/thumbnail');
+ break;
+
+ case 'help':
+ echo elgg_view('admin/settings/photos/help');
+ break;
+
+ default:
+ case 'settings':
+ echo elgg_view('admin/settings/photos/settings');
+ break;
+}
diff --git a/mod/lightpics/views/default/admin/settings/photos/help.php b/mod/lightpics/views/default/admin/settings/photos/help.php
new file mode 100644
index 000000000..1e5bdd254
--- /dev/null
+++ b/mod/lightpics/views/default/admin/settings/photos/help.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Tidypics Help
+ *
+ */
+
+elgg_load_library('elgg:markdown');
+
+$faq = elgg_get_plugins_path() . 'lightpics/FAQ.txt';
+$text = Markdown(file_get_contents($faq));
+
+$content = "<div class=\"elgg-markdown\">$text</div>";
+
+echo elgg_view_module('inline', elgg_echo('tidypics:settings:help'), $content);
diff --git a/mod/lightpics/views/default/admin/settings/photos/image_lib.php b/mod/lightpics/views/default/admin/settings/photos/image_lib.php
new file mode 100644
index 000000000..6e519b607
--- /dev/null
+++ b/mod/lightpics/views/default/admin/settings/photos/image_lib.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Test the location of ImageMagick
+ */
+
+$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 .= '</p><p>';
+$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', 'ImageMagick', $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/mod/lightpics/views/default/admin/settings/photos/server_config.php b/mod/lightpics/views/default/admin/settings/photos/server_config.php
new file mode 100644
index 000000000..b4fe552ec
--- /dev/null
+++ b/mod/lightpics/views/default/admin/settings/photos/server_config.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Tidypics server configuration
+ *
+ */
+
+elgg_load_library('elgg:markdown');
+
+$faq = elgg_get_plugins_path() . 'lightpics/CONFIG.txt';
+$text = Markdown(file_get_contents($faq));
+
+$content = "<div class=\"elgg-markdown\">$text</div>";
+
+echo elgg_view_module('inline', elgg_echo('tidypics:server_config'), $content);
diff --git a/mod/lightpics/views/default/admin/settings/photos/server_info.php b/mod/lightpics/views/default/admin/settings/photos/server_info.php
new file mode 100644
index 000000000..c100b0de2
--- /dev/null
+++ b/mod/lightpics/views/default/admin/settings/photos/server_info.php
@@ -0,0 +1,120 @@
+<?php
+/**
+ * Tidypics server analysis
+ */
+
+function tp_readable_size($bytes) {
+ if (strpos($bytes, 'M')) {
+ return $bytes . 'B';
+ }
+
+ $size = $bytes / 1024;
+ if ($size < 1024) {
+ $size = number_format($size, 2);
+ $size .= ' KB';
+ } else {
+ $size = $size / 1024;
+ if ($size < 1024) {
+ $size = number_format($size, 2);
+ $size .= ' MB';
+ } else {
+ $size = $size / 1024;
+ $size = number_format($size, 2);
+ $size .= ' GB';
+ }
+ }
+ return $size;
+}
+
+$disablefunc = explode(',', ini_get('disable_functions'));
+$exec_avail = elgg_echo('tidypics:disabled');
+if (is_callable('exec') && !in_array('exec',$disablefunc)) {
+ $exec_avail = elgg_echo('tidypics:enabled');
+}
+
+ob_start();
+
+?>
+<table class="elgg-table-alt">
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:php_version'); ?></td>
+ <td><?php echo phpversion(); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>GD</td>
+ <td><?php echo (extension_loaded('gd')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:gd_desc'); ?></td>
+ </tr>
+ <tr>
+ <td>imagick</td>
+ <td><?php echo (extension_loaded('imagick')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>exec()</td>
+ <td><?php echo $exec_avail; ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:exec_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:memory_limit'); ?></td>
+ <td><?php echo tp_readable_size(ini_get('memory_limit')); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:memory_limit_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:peak_usage'); ?></td>
+ <td><?php if (function_exists('memory_get_peak_usage')) echo tp_readable_size(memory_get_peak_usage()); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:peak_usage_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:upload_max_filesize'); ?></td>
+ <td><?php echo tp_readable_size(ini_get('upload_max_filesize')); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:upload_max_filesize_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:post_max_size'); ?></td>
+ <td><?php echo tp_readable_size(ini_get('post_max_size')); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:post_max_size_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:max_input_time'); ?></td>
+ <td><?php echo ini_get('max_input_time'); ?>s</td>
+ <td><?php echo elgg_echo('tidypics:server_info:max_input_time_desc'); ?></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:max_execution_time'); ?></td>
+ <td><?php echo ini_get('max_execution_time'); ?> s</td>
+ <td><?php echo elgg_echo('tidypics:server_info:max_execution_time_desc'); ?></td>
+ </tr>
+ <tr>
+ <td>GD imagejpeg</td>
+ <td><?php echo (is_callable('imagejpeg')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>GD imagepng</td>
+ <td><?php echo (is_callable('imagepng')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>GD imagegif</td>
+ <td><?php echo (is_callable('imagegif')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>EXIF</td>
+ <td><?php echo (is_callable('exif_read_data')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><?php echo elgg_echo('tidypics:server_info:use_only_cookies'); ?></td>
+ <td><?php echo (ini_get('session.use_only_cookies')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td>
+ <td><?php echo elgg_echo('tidypics:server_info:use_only_cookies_desc'); ?></td>
+ </tr>
+</table>
+
+<?php
+
+$content = ob_get_clean();
+
+echo elgg_view_module('inline', elgg_echo('tidypics:server_info'), $content); \ No newline at end of file
diff --git a/mod/lightpics/views/default/admin/settings/photos/settings.php b/mod/lightpics/views/default/admin/settings/photos/settings.php
new file mode 100644
index 000000000..6ea444392
--- /dev/null
+++ b/mod/lightpics/views/default/admin/settings/photos/settings.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Tidypics 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_form('photos/admin/settings');
diff --git a/mod/lightpics/views/default/admin/settings/photos/thumbnail.php b/mod/lightpics/views/default/admin/settings/photos/thumbnail.php
new file mode 100644
index 000000000..5f9769e91
--- /dev/null
+++ b/mod/lightpics/views/default/admin/settings/photos/thumbnail.php
@@ -0,0 +1,54 @@
+<?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>
+ </p>
+ <p>
+ $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