summaryrefslogtreecommitdiff
path: root/modules/greydragon
diff options
context:
space:
mode:
authorTristan Zur <tzur@webserver.ccwn.org>2015-06-10 20:55:53 +0200
committerTristan Zur <tzur@webserver.ccwn.org>2015-06-10 20:55:53 +0200
commit406abd7c4df1ace2cd3e4e17159e8941a2e8c0c4 (patch)
treea324be16021f44f2fd6d55e609f47024e945b1db /modules/greydragon
Initial import
Diffstat (limited to 'modules/greydragon')
-rw-r--r--modules/greydragon/changelog.txt11
-rw-r--r--modules/greydragon/css/gd_common.css59
-rw-r--r--modules/greydragon/images/blue-grad.pngbin0 -> 337 bytes
-rw-r--r--modules/greydragon/module.info9
-rw-r--r--modules/greydragon/views/gd_admin_include.html.php180
5 files changed, 259 insertions, 0 deletions
diff --git a/modules/greydragon/changelog.txt b/modules/greydragon/changelog.txt
new file mode 100644
index 0000000..ae8baf9
--- /dev/null
+++ b/modules/greydragon/changelog.txt
@@ -0,0 +1,11 @@
+GreyDragon Shared Module Changelog
+
+version 1.3:
+- Added check to detect situation when CURL is not installed to disable Auto Update feature
+- Improved CURL logic to properly handle redirects
+
+version 1.2:
+- Fixed issue with some installations not taking relative path for CSS
+
+version 1.1:
+- Initial release \ No newline at end of file
diff --git a/modules/greydragon/css/gd_common.css b/modules/greydragon/css/gd_common.css
new file mode 100644
index 0000000..32b780b
--- /dev/null
+++ b/modules/greydragon/css/gd_common.css
@@ -0,0 +1,59 @@
+/**
+ * Gallery 3 Grey Dragon Common Module
+ * Copyright (C) 2012 Serguei Dosyukov
+ *
+ * CSS rules for admin section
+ */
+
+body { min-width: 1200px; }
+
+#g-content { font-size: 1em; margin-bottom: 0; width: auto; padding-left: 1em; padding-right: 1em; }
+#g-content ul { margin-bottom: 0; }
+
+#g-content h3 { color: #d54e21; border-bottom: #a2bdbf 1px solid; margin-top: 0.3em; margin-bottom: 0.3em; }
+#g-content p { color: #333; }
+#g-content table { margin-bottom: 0; }
+
+#g-content input { display: inline; float: left; margin-right: 0.8em; color: #555555; border: 1px solid #ccc; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
+#g-content textarea { height: 6em; color: #555555; border: 1px solid #ccc; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
+#g-content select { display: inline; float: left; margin-right: 0.8em; width: 50.6%; color: #555555; border: 1px solid #ccc; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
+
+#g-content input[type='checkbox'] { border: none; }
+#g-content input[type='text'] { width: 50%; }
+
+#g-content input.submit { display: inline-block; min-width: 100px; padding: 4px 10px 4px; font-size: 13px; line-height: 18px; color:#333333; text-align: center; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); background-color: #fafafa; background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), color-stop(25%, #ffffff), to(#e6e6e6)); background-image: -webkit-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); background-image: -moz-linear-gradient(top, #ffffff, #ffffff 25%, #e6e6e6); background-image: -ms-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); background-image: -o-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); background-image: linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); background-repeat: no-repeat; filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0); border: 1px solid #ccc; border-bottom-color: #bbb; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05); cursor: pointer; *margin-left: .3em; }
+#g-content input.submit:first-child { *margin-left: 0; }
+#g-content input.submit:hover { color: #333333; text-decoration: none; background-color: #e6e6e6; background-position: 0 -15px; -webkit-transition: background-position 0.1s linear; -moz-transition: background-position 0.1s linear; -ms-transition: background-position 0.1s linear; -o-transition: background-position 0.1s linear; transition: background-position 0.1s linear; }
+
+#g-content input.g-error { padding-left: 30px; border: none; }
+#g-content input.g-success { background-color: transparent; }
+#g-content input.g-warning { background-color: transparent; border: none; }
+
+#g-content p.g-error { padding-left: 30px; border: none; margin-bottom: 0; background-image: none; }
+
+#gd-admin-header { padding: 7px 0; margin: 4px 0 0 0; background-color: #fbfbfb; background-image: -moz-linear-gradient(top, #ffffff, #f5f5f5); background-image:- ms-linear-gradient(top, #ffffff, #f5f5f5); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f5f5f5)); background-image: -webkit-linear-gradient(top, #ffffff, #f5f5f5); background-image: -o-linear-gradient(top, #ffffff, #f5f5f5); background-image: linear-gradient(top, #ffffff, #f5f5f5); background-repeat: repeat-x; filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f5f5f5', GradientType=0); border: 1px solid #ddd; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: inset 0 1px 0 #ffffff; -moz-box-shadow: inset 0 1px 0 #ffffff; box-shadow: inset 0 1px 0 #ffffff; display: inline-block; width: 100%; }
+#gd-admin-header .divider{padding:0 5px;color:#999999;}
+#gd-admin-header .active a{color:#333333;}
+
+#gd-admin-version,
+#gd-admin-version-2 { margin-top: 4px; padding: 7px 14px; background-color: rgb(217, 237, 247); border: 1px solid #bce8f1; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: inset 0 1px 0 #ffffff; -moz-box-shadow: inset 0 1px 0 #ffffff; box-shadow: inset 0 1px 0 #ffffff; }
+
+#gd-admin-title { float: left; padding-left: 10px; color: #333v42; font-weight: bold; font-size: 1.4em; text-shadow: #deeefa 0 1px 0; display: inline-block; }
+#gd-admin-hlinks { float: right; padding-right: 10px; }
+#gd-admin-hlinks li { list-style-type: none; float: left; color: #618299; display: inline; text-shadow: 0 1px 0 #ffffff; }
+#gd-admin-hlinks a { line-height: 1.6em; }
+#gd-admin-hlinks a[disabled="disabled"], #gd-admin-hlinks a[disabled="disabled"]:hover { text-decoration: none; cursor: default; }
+
+#g-autoupdate-config { display: none; border: 1px solid #ddd; border-top: none; width: 45%; height: 2.5em; margin-left: 54%; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: inset 0 1px 0 #ffffff; -moz-box-shadow: inset 0 1px 0 #ffffff; box-shadow: inset 0 1px 0 #ffffff; }
+#g-autoupdate-config.visible { min-height: 30px; display: inline-block; }
+#g-autoupdate-config ul { float: right; margin: 6px 10px;}
+#g-autoupdate-config li { float: left; display: inline; line-height: 1.5em; }
+
+#g-admin-container { margin-top: 14px; font-size: 0.9em; line-height: 1.6em; }
+#g-admin-container .column1 { float: left; width: 53%; min-width: 610px; }
+#g-admin-container .column2 { float: right; width: 46%; min-width: 529px; }
+
+#g-admin-container fieldset { position: relative; border-top-left-radius: 0.4em; border-top-right-radius: 0.4em; overflow: hidden; }
+#g-admin-container legend { position: absolute; left: 0; width: 100%; padding: 0.4em 0.8em; background: url(../images/blue-grad.png) #d5e6f2 repeat-x left top; border-bottom: #dfdfdf 1px solid; }
+#g-admin-container fieldset ul { margin-top: 34px; }
+
diff --git a/modules/greydragon/images/blue-grad.png b/modules/greydragon/images/blue-grad.png
new file mode 100644
index 0000000..868a657
--- /dev/null
+++ b/modules/greydragon/images/blue-grad.png
Binary files differ
diff --git a/modules/greydragon/module.info b/modules/greydragon/module.info
new file mode 100644
index 0000000..4a65e8c
--- /dev/null
+++ b/modules/greydragon/module.info
@@ -0,0 +1,9 @@
+name = "GreyDragon Shared"
+description = "Shared content for modules from GreyDragon. Need to be activated.<br />Version 1.3 | By <a href=http://blog.dragonsoft.us>Serguei Dosyukov</a>"
+version = 13
+author_name = "Serguei Dosyukov"
+author_url = "http://blog.dragonsoft.us/gallery-3/"
+info_url = ""
+discuss_url = ""
+
+
diff --git a/modules/greydragon/views/gd_admin_include.html.php b/modules/greydragon/views/gd_admin_include.html.php
new file mode 100644
index 0000000..73962cb
--- /dev/null
+++ b/modules/greydragon/views/gd_admin_include.html.php
@@ -0,0 +1,180 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Grey Dragon Theme - a custom theme for Gallery 3
+ * This theme was designed and built by Serguei Dosyukov, whose blog you will find at http://blog.dragonsoft.us
+ * Copyright (C) 2012 Serguei Dosyukov
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program; if not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+?>
+<style>
+ @import "<?= url::file("modules/greydragon/css/gd_common.css"); ?>";
+</style>
+
+<script>
+ $(document).ready( function() {
+ $('form').submit( function() { $('input[type=submit]', this).attr('disabled', 'disabled'); });
+
+ var objAutoUpdate = $('#g-autoupdate-config');
+ var objAutoHidden = $('input[name="g_auto_delay"]');
+ var objAutoEdit = $('#g-auto-delay-edit');
+    function showSidebar(){ objAutoEdit.val(objAutoHidden.val()); objAutoUpdate.slideDown('fast', function() { objAutoUpdate.addClass('visible'); }); };
+    function hideSidebar(){ objAutoHidden.val(objAutoEdit.val()); objAutoUpdate.slideUp('fast', function() { objAutoUpdate.removeClass('visible'); }); };
+
+ objAutoEdit.keyup( function() { objAutoHidden.val($(this).val()); });
+ objAutoEdit.keydown(function(event) {
+ // Allow: backspace, delete, tab and escape
+ if ( event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 ||
+ // Allow: Ctrl+A
+ (event.keyCode == 65 && event.ctrlKey === true) ||
+ // Allow: home, end, left, right
+ (event.keyCode >= 35 && event.keyCode <= 39)) {
+ // let it happen, don't do anything
+ return;
+ } else {
+ // Ensure that it is a number and stop the keypress
+ if ((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105 )) {
+ event.preventDefault();
+ }
+ }
+ });
+    $('.g-link-autoupdate').click(function(e){ e.preventDefault(); if ( objAutoUpdate.hasClass('visible') ){ hideSidebar(); } else { showSidebar(); }});
+ });
+</script>
+
+<?
+
+function isCurlInstalled() {
+ if (in_array('curl', get_loaded_extensions())) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+// -1 - cannot get version info
+// 0 - current
+// + - newer is avaialble, version is returned
+function checkVersionInfo($downloadid, $version) {
+ if (!isset($downloadid)):
+ return -1;
+ endif;
+
+ try {
+ $call = "http://blog.dragonsoft.us/downloadversion/" . $downloadid;
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $call);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
+ curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
+ $output=curl_exec($ch);
+ $json = json_decode($output);
+
+ if ($json->id == $downloadid):
+ $newversion = $json->version;
+ if ($json->version > $version):
+ return $json->version;
+ else:
+ return 0;
+ endif;
+ else:
+ return -1;
+ endif;
+ } catch (Exception $e) {
+ return -1;
+ }
+}
+
+if ($is_module):
+ $admin_info = new ArrayObject(parse_ini_file(MODPATH . $name . "/module.info"), ArrayObject::ARRAY_AS_PROPS);
+ $version = number_format($admin_info->version / 10, 1, '.', '');
+ $lastupdate = module::get_var($name, "last_update", time());
+ $checkInDays = module::get_var($name, "auto_delay", 30);
+else:
+ $admin_info = new ArrayObject(parse_ini_file(THEMEPATH . $name . "/theme.info"), ArrayObject::ARRAY_AS_PROPS);
+ $version = $admin_info->version;
+ $lastupdate = module::get_var("th_" . $name, "last_update", time());
+ $checkInDays = module::get_var("th_" . $name, "auto_delay", 30);
+endif;
+
+if (isCurlInstalled() && ($checkInDays > 0) && ((time() - $lastupdate) > ($checkInDays * 24 * 60 * 60))): // Check version every N days
+ $admin_info2 = new ArrayObject(parse_ini_file(MODPATH . "greydragon/module.info"), ArrayObject::ARRAY_AS_PROPS);
+ $version2 = number_format($admin_info2->version / 10, 1, '.', '');
+
+ $versionCheck = checkVersionInfo($downloadid, $version);
+ $versionCheck2 = checkVersionInfo(15, $version2);
+
+ if (($versionCheck == 0) && ($versionCheck2 == 0)):
+ if ($is_module):
+ module::set_var($name, "last_update", time());
+ else:
+ module::set_var("th_" . $name, "last_update", time());
+ endif;
+ endif;
+else:
+ $versionCheck = 0;
+ $versionCheck2 = 0;
+endif;
+?>
+
+<div id="gd-admin-header">
+ <div id="gd-admin-title"><?= t($admin_info->name) ?> - <?= $version ?></div>
+ <div id="gd-admin-hlinks">
+ <ul style="float: right;"><li><a href="http://blog.dragonsoft.us/gallery-3/" target="_blank"><?= t("Home") ?></a>&nbsp;|&nbsp;</li>
+ <? if (isset($admin_info->discuss_url)): ?>
+ <li><a href="<?= $admin_info->discuss_url; ?>" target="_blank"><?= t("Support") ?></a>&nbsp;|&nbsp;</li>
+ <? endif; ?>
+ <? if (isset($admin_info->info_url)): ?>
+ <li><a href="<?= $admin_info->info_url; ?>" target="_blank"><?= t("Download") ?></a>&nbsp;|&nbsp;</li>
+ <? endif; ?>
+ <? if (isset($admin_info->vote)): ?>
+ <li><a href="<?= $admin_info->vote; ?>" target="_blank"><?= t("Vote") ?></a>&nbsp;|&nbsp;</li>
+ <? endif; ?>
+ <li><a href="http://twitter.com/greydragon_th" target="_blank" title="<?= t("Follow Us on Twitter") ?>"><?= t("Follow Us") ?></a>&nbsp;|&nbsp;</li>
+ <li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9MWBSVJMWMJEU" target="_blank" ><?= t("Coffee Fund") ?></a>&nbsp;|&nbsp;</li>
+ <li><a href="#" class="g-link-autoupdate" <?= (isCurlInstalled())? null : "disabled=\"disabled\""; ?> ><?= t("Auto Update"); ?></a></li>
+ </ul>
+ </div>
+</div>
+<div id="g-autoupdate-config">
+ <ul><li><?= t("Check every"); ?>&nbsp;&nbsp;</li>
+ <li><input id="g-auto-delay-edit" type="text" size="2" value="30"></li>
+ <li><?=t("days (set to 0 to disable)"); ?></li>
+<? if (($versionCheck == 0) && ($versionCheck2 == 0)): ?>
+ <li>&nbsp;&nbsp;|&nbsp;&nbsp;<?= t("Last check:"); ?>&nbsp;<?= date("Y-m-d H:i:s", $lastupdate); ?></li>
+<? endif; ?>
+ </ul>
+</div>
+
+<? if ($versionCheck == -1): ?>
+ <div id="gd-admin-version"><?= t("Version check is incomplete. No version information has been found."); ?> <?= $versionCheck; ?> : <?= $downloadid; ?></div>
+<? elseif ($versionCheck == 0): ?>
+<? else: ?>
+ <div id="gd-admin-version"><?= t("Newer version") ?> <?= $versionCheck; ?> <?= t("is available. Click Download link for more info.") ?></div>
+<? endif; ?>
+<? if (($versionCheck2 == -1) || ($versionCheck2 == 0)): ?>
+<? else: ?>
+ <div id="gd-admin-version-2"><?= t("Newer version") ?> <?= $versionCheck2; ?> <?= t("of GreyDragon Shared Module is available. Click") . ' <a href="http://codex.gallery2.org/Gallery3:Modules:greydragon" target="_blank">' . t("here") . '</a> ' . t("for more info.") ?></div>
+<? endif; ?>
+<div id="g-admin-container">
+<? if (isset($help)): ?>
+ <div class="column1">
+ <?= $form ?>
+ </div>
+ <div class="column2">
+ <?= $help ?>
+ </div>
+<? else: ?>
+ <?= $form ?>
+<? endif; ?>
+</div>