Commit 2d1a3106b9d1e41e7dbb1e9da911fb01000e3477

Authored by Conrad Vermeulen
1 parent 6d1dcd8e

KTS-3433

"Background task should fetch latest version for Version Notifier and cache ."
Implemented.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8603 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktstandard/AdminVersionPlugin/AdminVersion.inc.php 0 → 100644
  1 +<?php
  2 +
  3 +class AdminVersion
  4 +{
  5 + //const KT_VERSION_URL = 'http://version.knowledgetree.com/kt_versions';
  6 + const KT_VERSION_URL = 'http://ktdms.trunk/plugins/ktstandard/AdminVersionPlugin/test/latestVersion.php';
  7 +
  8 + public static
  9 + function refresh($url = null)
  10 + {
  11 + $aEncoded = array();
  12 + $aVersions = KTUtil::getKTVersions();
  13 +
  14 + foreach ($aVersions as $k => $v)
  15 + {
  16 + $aEncoded[] = sprintf("%s=%s", urlencode($k), urlencode($v));
  17 + }
  18 +
  19 + if (empty($url))
  20 + $sUrl = self::KT_VERSION_URL;
  21 + else
  22 + $sUrl = $url;
  23 + $sUrl .= '?' . implode('&', $aEncoded);
  24 +
  25 + $sIdentifier = KTUtil::getSystemIdentifier();
  26 + $sUrl .= '&' . sprintf("system_identifier=%s", $sIdentifier);
  27 +
  28 + if (!function_exists('curl_init'))
  29 + {
  30 + $stuff = @file_get_contents($sUrl);
  31 + }
  32 + else
  33 + {
  34 + $ch = @curl_init($sUrl);
  35 + if (!$ch)
  36 + {
  37 + return false;
  38 + }
  39 + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  40 + curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  41 + $stuff = curl_exec($ch);
  42 + curl_close($ch);
  43 + }
  44 + if ($stuff === false)
  45 + {
  46 + $stuff = "";
  47 + }
  48 + else
  49 + {
  50 + $stuff = str_replace('\'','"', $stuff);
  51 + $decoded = json_decode($stuff);
  52 + if ($decoded === false)
  53 + {
  54 + return false;
  55 + }
  56 + KTUtil::setSystemSetting('ktadminversion_lastcheck', date('Y-m-d H:i:s'));
  57 + KTUtil::setSystemSetting('ktadminversion_lastvalue', serialize($decoded));
  58 + }
  59 + }
  60 +
  61 + public static
  62 + function isNewVersionAvailable()
  63 + {
  64 + $aVersions = KTUtil::getKTVersions();
  65 +
  66 + $name = array_keys($aVersions);
  67 + $name = $name[0];
  68 + $version = array_values($aVersions);
  69 + $version = $version[0];
  70 +
  71 + $aRemoteVersions = unserialize(KTUtil::getSystemSetting('ktadminversion_lastvalue'));
  72 +
  73 + $aVersions = get_object_vars($aRemoteVersions);
  74 +
  75 + if (!isset($aVersions[$name]))
  76 + {
  77 + return false;
  78 + }
  79 +
  80 + $newVersion = $aRemoteVersions->$name;
  81 + if (version_compare($version, $newVersion) == -1)
  82 + {
  83 + return array('name'=>$name,'version'=>$aRemoteVersions->$name);
  84 + }
  85 +
  86 + return false;
  87 + }
  88 +}
  89 +
  90 +?>
0 \ No newline at end of file 91 \ No newline at end of file
plugins/ktstandard/AdminVersionPlugin/AdminVersionDashlet.php
@@ -6,71 +6,71 @@ @@ -6,71 +6,71 @@
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2008 KnowledgeTree Inc. 7 * Copyright (C) 2008 KnowledgeTree Inc.
8 * Portions copyright The Jam Warehouse Software (Pty) Limited 8 * Portions copyright The Jam Warehouse Software (Pty) Limited
9 - * 9 + *
10 * This program is free software; you can redistribute it and/or modify it under 10 * This program is free software; you can redistribute it and/or modify it under
11 * the terms of the GNU General Public License version 3 as published by the 11 * the terms of the GNU General Public License version 3 as published by the
12 * Free Software Foundation. 12 * Free Software Foundation.
13 - * 13 + *
14 * This program is distributed in the hope that it will be useful, but WITHOUT 14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * details. 17 * details.
18 - * 18 + *
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. 20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 - *  
22 - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, 21 + *
  22 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23 * California 94120-7775, or email info@knowledgetree.com. 23 * California 94120-7775, or email info@knowledgetree.com.
24 - * 24 + *
25 * The interactive user interfaces in modified source and object code versions 25 * The interactive user interfaces in modified source and object code versions
26 * of this program must display Appropriate Legal Notices, as required under 26 * of this program must display Appropriate Legal Notices, as required under
27 * Section 5 of the GNU General Public License version 3. 27 * Section 5 of the GNU General Public License version 3.
28 - * 28 + *
29 * In accordance with Section 7(b) of the GNU General Public License version 3, 29 * In accordance with Section 7(b) of the GNU General Public License version 3,
30 * these Appropriate Legal Notices must retain the display of the "Powered by 30 * these Appropriate Legal Notices must retain the display of the "Powered by
31 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33 - * must display the words "Powered by KnowledgeTree" and retain the original 33 + * must display the words "Powered by KnowledgeTree" and retain the original
34 * copyright notice. 34 * copyright notice.
35 * Contributor( s): ______________________________________ 35 * Contributor( s): ______________________________________
36 * 36 *
37 */ 37 */
38 38
  39 +require_once('AdminVersion.inc.php');
  40 +
39 class AdminVersionDashlet extends KTBaseDashlet { 41 class AdminVersionDashlet extends KTBaseDashlet {
40 - var $oUser;  
41 var $sClass = 'ktError'; 42 var $sClass = 'ktError';
42 - 43 +
43 function AdminVersionDashlet(){ 44 function AdminVersionDashlet(){
44 $this->sTitle = _kt('New Version Available'); 45 $this->sTitle = _kt('New Version Available');
45 } 46 }
46 -  
47 - /*function is_active($oUser) {  
48 - $this->oUser = $oUser;  
49 - return true;  
50 - }  
51 - */  
52 -  
53 - function is_active($oUser) {  
54 - $this->oUser = $oUser;  
55 - return Permission::userIsSystemAdministrator($oUser); 47 +
  48 + function is_active($oUser)
  49 + {
  50 + $this->version = AdminVersion::isNewVersionAvailable();
  51 + return true;
  52 + if ($this->version === false)
  53 + {
  54 + return false;
  55 + }
  56 + return Permission::userIsSystemAdministrator();
56 } 57 }
57 - 58 +
58 function render() { 59 function render() {
59 global $main; 60 global $main;
60 - $main->requireJSResource("plugins/ktstandard/AdminVersionPlugin/js/update.js");  
61 -  
62 - $oPlugin =& $this->oPlugin;  
63 - 61 +
64 $oTemplating =& KTTemplating::getSingleton(); 62 $oTemplating =& KTTemplating::getSingleton();
65 - $oTemplate = $oTemplating->loadTemplate('AdminVersionPlugin/dashlet');  
66 - 63 + $oTemplate = $oTemplating->loadTemplate('dashlet');
  64 +
  65 + $name = $this->version['name'];
  66 + $version = $this->version['version'];
  67 +
67 $aTemplateData = array( 68 $aTemplateData = array(
68 'context' => $this, 69 'context' => $this,
69 - 'url' => $oPlugin->getPagePath('versions'),  
70 - 70 + 'name' => $name,
  71 + 'version' => $version
71 ); 72 );
72 -  
73 - 73 +
74 return $oTemplate->render($aTemplateData); 74 return $oTemplate->render($aTemplateData);
75 } 75 }
76 } 76 }
plugins/ktstandard/AdminVersionPlugin/AdminVersionPage.php deleted
1 -<?php  
2 -/*  
3 - * $Id:$  
4 - *  
5 - * KnowledgeTree Community Edition  
6 - * Document Management Made Simple  
7 - * Copyright (C) 2008 KnowledgeTree Inc.  
8 - * Portions copyright The Jam Warehouse Software (Pty) Limited  
9 - *  
10 - * This program is free software; you can redistribute it and/or modify it under  
11 - * the terms of the GNU General Public License version 3 as published by the  
12 - * Free Software Foundation.  
13 - *  
14 - * This program is distributed in the hope that it will be useful, but WITHOUT  
15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  
16 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more  
17 - * details.  
18 - *  
19 - * You should have received a copy of the GNU General Public License  
20 - * along with this program. If not, see <http://www.gnu.org/licenses/>.  
21 - *  
22 - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,  
23 - * California 94120-7775, or email info@knowledgetree.com.  
24 - *  
25 - * The interactive user interfaces in modified source and object code versions  
26 - * of this program must display Appropriate Legal Notices, as required under  
27 - * Section 5 of the GNU General Public License version 3.  
28 - *  
29 - * In accordance with Section 7(b) of the GNU General Public License version 3,  
30 - * these Appropriate Legal Notices must retain the display of the "Powered by  
31 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the  
32 - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices  
33 - * must display the words "Powered by KnowledgeTree" and retain the original  
34 - * copyright notice.  
35 - * Contributor( s): ______________________________________  
36 - *  
37 - */  
38 -  
39 -  
40 -require_once(KT_LIB_DIR . "/plugins/plugin.inc.php");  
41 -require_once(KT_LIB_DIR . "/plugins/pluginregistry.inc.php");  
42 -require_once(KT_LIB_DIR . "/dashboard/dashlet.inc.php");  
43 -  
44 -define('KT_VERSION_URL', 'http://version.knowledgetree.com/kt_versions');  
45 -  
46 -class AdminVersionPage extends KTStandardDispatcher {  
47 -  
48 - function _checkCache() {  
49 - global $default;  
50 - $iLastCheck = KTUtil::getSystemSetting('ktadminversion_lastcheck');  
51 - if (empty($iLastCheck)) {  
52 - return;  
53 - }  
54 - $sLastValue = KTUtil::getSystemSetting('ktadminversion_lastvalue');  
55 - if (empty($sLastValue)) {  
56 - $now = time();  
57 - $diff = $now - $iLastCheck;  
58 - if ($diff > (24*60*60)) {  
59 - return;  
60 - }  
61 - }  
62 - $now = time();  
63 - $diff = $now - $iLastCheck;  
64 - if ($diff > (24*60*60)) {  
65 - return;  
66 - }  
67 - return $sLastValue;  
68 - }  
69 -  
70 - function do_main() {  
71 - session_write_close();  
72 -  
73 - $sCache = $this->_checkCache();  
74 - if (!is_null($sCache)) {  
75 - $sCachedVersion = $sCache;  
76 -  
77 - $sVName = "";  
78 - $sVNum = "";  
79 -  
80 - $sTrimmer = str_replace('{', '', str_replace('}', '', str_replace('\'', '', $sCachedVersion)));  
81 - $aCachedVersionsTemp = explode(',',$sTrimmer);  
82 -  
83 - for($i=0;$i<count($aCachedVersionsTemp);$i++){  
84 - $aCachedVersionsTemp[$i] = explode(':', $aCachedVersionsTemp[$i]);  
85 - }  
86 - for($i=0;$i<count($aCachedVersionsTemp);$i++){  
87 - $key = trim($aCachedVersionsTemp[$i][0]);  
88 - $value = trim($aCachedVersionsTemp[$i][1]);  
89 - $aCachedVersions[$key] = $value;  
90 - }  
91 -  
92 - $aVersions = KTUtil::getKTVersions();  
93 -  
94 -/*  
95 - echo "<pre>";  
96 - print_r($aCachedVersions);  
97 - echo "</pre>";  
98 - echo "<pre>";  
99 - print_r($aVersions);  
100 - echo "</pre>";  
101 - exit;  
102 -*/  
103 -  
104 - foreach ($aVersions as $k => $v) {  
105 - foreach($aCachedVersions as $j => $l) {  
106 - if (($k == $j) && (version_compare($aVersions[$k], $aCachedVersions[$j]) == -1))  
107 - {  
108 - //save new name and version  
109 - $sVName = $j;  
110 - $sVNum = $l;  
111 - }  
112 - }//end foreach  
113 -  
114 - }//end foreach  
115 -  
116 - if ($sVName != "")  
117 - {  
118 - return "<div id=\"AdminVersion\"><a href=\"http://www.knowledgetree.com/products/whats-new\" target=\"_blank\">".$sVName." version ".$sVNum."</a></div><br>";  
119 - }  
120 - else  
121 - {  
122 - return "";  
123 - }  
124 - }  
125 -  
126 - $sUrl = KT_VERSION_URL;  
127 - $aVersions = KTUtil::getKTVersions();  
128 -  
129 - foreach ($aVersions as $k => $v) {  
130 - $sUrl .= '?' . sprintf("%s=%s", $k, $v);  
131 - }  
132 - $sIdentifier = KTUtil::getSystemIdentifier();  
133 - $sUrl .= '&' . sprintf("system_identifier=%s", $sIdentifier);  
134 -  
135 - if (!function_exists('curl_init')) {  
136 - if (OS_WINDOWS) {  
137 - return "";  
138 - }  
139 -  
140 - $stuff = @file_get_contents($sUrl);  
141 - if ($stuff === false) {  
142 - $stuff = "";  
143 - }  
144 - } else {  
145 -  
146 - $ch = @curl_init($sUrl);  
147 - if (!$ch) {  
148 - return "";  
149 - }  
150 - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
151 - curl_setopt($ch, CURLOPT_TIMEOUT, 10);  
152 - $stuff = curl_exec($ch);  
153 - curl_close($ch);  
154 - if (!$stuff) {  
155 - $stuff = "";  
156 - }  
157 - }  
158 - KTUtil::setSystemSetting('ktadminversion_lastcheck', time());  
159 - KTUtil::setSystemSetting('ktadminversion_lastvalue', (string)$stuff);  
160 -  
161 - $sVName = "";  
162 - $sVNum = "";  
163 -  
164 - $trim_stuff = str_replace('{', '', str_replace('}', '', str_replace('\'', '', $stuff)));  
165 - $aRemoteVersionstemp = explode(',',$trim_stuff);  
166 -  
167 - for($i=0;$i<count($aRemoteVersionstemp);$i++){  
168 - $aRemoteVersionstemp[$i] = explode(':', $aRemoteVersionstemp[$i]);  
169 - }  
170 - for($i=0;$i<count($aRemoteVersionstemp);$i++){  
171 - $key = trim($aRemoteVersionstemp[$i][0]);  
172 - $value = trim($aRemoteVersionstemp[$i][1]);  
173 - $aRemoteVersions[$key] = $value;  
174 - }  
175 -/*  
176 - echo "<pre>";  
177 - print_r($aRemoteVersions);  
178 - echo "</pre>";  
179 - echo "<pre>";  
180 - print_r($aVersions);  
181 - echo "</pre>";  
182 - exit;  
183 -*/  
184 - foreach ($aVersions as $k => $v) {  
185 - foreach($aRemoteVersions as $j => $l) {  
186 - if (($k == $j) && (version_compare($aVersions[$k], $aRemoteVersions[$j]) == -1))  
187 - {  
188 - //save new name and version  
189 - $sVName = $j;  
190 - $sVNum = $l;  
191 - }  
192 - }  
193 - }  
194 -  
195 - if ($sVName != "")  
196 - {  
197 - return "<div id=\"AdminVersion\"><a href=\"http://www.knowledgetree.com/products/whats-new\" target=\"_blank\">".$sVName." version ".$sVNum."</a></div><br>";  
198 - }  
199 - else  
200 - {  
201 - return "";  
202 - }  
203 - }  
204 -  
205 - function handleOutput($sOutput) {  
206 - print $sOutput;  
207 - }  
208 -}  
209 -  
210 -?>  
211 \ No newline at end of file 0 \ No newline at end of file
plugins/ktstandard/AdminVersionPlugin/AdminVersionPlugin.php
@@ -6,63 +6,63 @@ @@ -6,63 +6,63 @@
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2008 KnowledgeTree Inc. 7 * Copyright (C) 2008 KnowledgeTree Inc.
8 * Portions copyright The Jam Warehouse Software (Pty) Limited 8 * Portions copyright The Jam Warehouse Software (Pty) Limited
9 - * 9 + *
10 * This program is free software; you can redistribute it and/or modify it under 10 * This program is free software; you can redistribute it and/or modify it under
11 * the terms of the GNU General Public License version 3 as published by the 11 * the terms of the GNU General Public License version 3 as published by the
12 * Free Software Foundation. 12 * Free Software Foundation.
13 - * 13 + *
14 * This program is distributed in the hope that it will be useful, but WITHOUT 14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * details. 17 * details.
18 - * 18 + *
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. 20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 - *  
22 - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, 21 + *
  22 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23 * California 94120-7775, or email info@knowledgetree.com. 23 * California 94120-7775, or email info@knowledgetree.com.
24 - * 24 + *
25 * The interactive user interfaces in modified source and object code versions 25 * The interactive user interfaces in modified source and object code versions
26 * of this program must display Appropriate Legal Notices, as required under 26 * of this program must display Appropriate Legal Notices, as required under
27 * Section 5 of the GNU General Public License version 3. 27 * Section 5 of the GNU General Public License version 3.
28 - * 28 + *
29 * In accordance with Section 7(b) of the GNU General Public License version 3, 29 * In accordance with Section 7(b) of the GNU General Public License version 3,
30 * these Appropriate Legal Notices must retain the display of the "Powered by 30 * these Appropriate Legal Notices must retain the display of the "Powered by
31 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33 - * must display the words "Powered by KnowledgeTree" and retain the original 33 + * must display the words "Powered by KnowledgeTree" and retain the original
34 * copyright notice. 34 * copyright notice.
35 * Contributor( s): ______________________________________ 35 * Contributor( s): ______________________________________
36 * 36 *
37 */ 37 */
38 - 38 +
39 require_once(KT_LIB_DIR . "/plugins/plugin.inc.php"); 39 require_once(KT_LIB_DIR . "/plugins/plugin.inc.php");
40 require_once(KT_LIB_DIR . "/plugins/pluginregistry.inc.php"); 40 require_once(KT_LIB_DIR . "/plugins/pluginregistry.inc.php");
  41 +require_once(KT_LIB_DIR . "/templating/templating.inc.php");
41 42
42 class AdminVersionPlugin extends KTPlugin 43 class AdminVersionPlugin extends KTPlugin
43 { 44 {
44 var $sNamespace = 'ktstandard.adminversion.plugin'; 45 var $sNamespace = 'ktstandard.adminversion.plugin';
45 var $autoRegister = true; 46 var $autoRegister = true;
46 - 47 +
47 function AdminVersionPlugin($sFilename = null) { 48 function AdminVersionPlugin($sFilename = null) {
48 - 49 +
49 $res = parent::KTPlugin($sFilename); 50 $res = parent::KTPlugin($sFilename);
50 $this->sFriendlyName = _kt('Admin Version Notifier'); 51 $this->sFriendlyName = _kt('Admin Version Notifier');
51 return $res; 52 return $res;
52 - 53 +
53 } 54 }
54 - 55 +
55 function setup() { 56 function setup() {
56 - 57 +
57 $this->registerDashlet('AdminVersionDashlet', 'ktstandard.adminversion.dashlet', 'AdminVersionDashlet.php'); 58 $this->registerDashlet('AdminVersionDashlet', 'ktstandard.adminversion.dashlet', 'AdminVersionDashlet.php');
58 - $this->registerPage('versions', 'AdminVersionPage', 'AdminVersionPage.php');  
59 -  
60 - require_once(KT_LIB_DIR . "/templating/templating.inc.php"); 59 +
61 $oTemplating =& KTTemplating::getSingleton(); 60 $oTemplating =& KTTemplating::getSingleton();
62 $oTemplating->addLocation('AdminVersionDashlet', '/plugins/ktstandard/AdminVersionPlugin/templates'); 61 $oTemplating->addLocation('AdminVersionDashlet', '/plugins/ktstandard/AdminVersionPlugin/templates');
63 } 62 }
64 } 63 }
  64 +
65 $oPluginRegistry =& KTPluginRegistry::getSingleton(); 65 $oPluginRegistry =& KTPluginRegistry::getSingleton();
66 $oPluginRegistry->registerPlugin('AdminVersionPlugin', 'ktstandard.adminversion.plugin', __FILE__); 66 $oPluginRegistry->registerPlugin('AdminVersionPlugin', 'ktstandard.adminversion.plugin', __FILE__);
67 67
68 -?> 68 -?>
  69 +?>
69 \ No newline at end of file 70 \ No newline at end of file
plugins/ktstandard/AdminVersionPlugin/bin/UpdateNewVersion.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id: $
  5 + *
  6 + * KnowledgeTree Community Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2008 KnowledgeTree Inc.
  9 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  10 + *
  11 + * This program is free software; you can redistribute it and/or modify it under
  12 + * the terms of the GNU General Public License version 3 as published by the
  13 + * Free Software Foundation.
  14 + *
  15 + * This program is distributed in the hope that it will be useful, but WITHOUT
  16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18 + * details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  24 + * California 94120-7775, or email info@knowledgetree.com.
  25 + *
  26 + * The interactive user interfaces in modified source and object code versions
  27 + * of this program must display Appropriate Legal Notices, as required under
  28 + * Section 5 of the GNU General Public License version 3.
  29 + *
  30 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  31 + * these Appropriate Legal Notices must retain the display of the "Powered by
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  33 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * copyright notice.
  36 + * Contributor( s): ______________________________________
  37 + *
  38 + */
  39 +
  40 +chdir(dirname(__FILE__));
  41 +require_once(realpath('../../../../config/dmsDefaults.php'));
  42 +require_once('../AdminVersion.inc.php');
  43 +
  44 +AdminVersion::refresh();
  45 +
plugins/ktstandard/AdminVersionPlugin/js/update.js deleted
1 -var currloc = location.pathname.substring(0,location.pathname.lastIndexOf('/')+1);  
2 -var user = '';  
3 -  
4 -function CheckVersion(){  
5 - xmlHttpAdmin=GetXmlHttpAdminObject();  
6 - if (xmlHttpAdmin===null){  
7 - alert ("Browser does not support HTTP Request");  
8 - return;  
9 - }  
10 - var url=VERSIONS_URL;  
11 -  
12 - xmlHttpAdmin.onreadystatechange=adminStateChanged;  
13 - xmlHttpAdmin.open("GET",url,true);  
14 - xmlHttpAdmin.send(null);  
15 -  
16 -}  
17 -  
18 -function adminStateChanged(){  
19 - if (xmlHttpAdmin.readyState==4 || xmlHttpAdmin.readyState=="complete"){  
20 - if(xmlHttpAdmin.responseText != ""){  
21 - document.getElementById("AdminVersionDashlet").style.display = "block";  
22 - document.getElementById("AdminVersionBlock").innerHTML=xmlHttpAdmin.responseText;  
23 - }  
24 - }else{  
25 - //dashlet not shown until new version is returned so this print isn't needed  
26 - //document.getElementById("AdminVersionBlock").innerHTML="Checking Versions";  
27 - }  
28 -}  
29 -  
30 -function GetXmlHttpAdminObject(){  
31 - var objXMLHttpAdmin=null;  
32 - if (window.XMLHttpRequest){  
33 - objXMLHttpAdmin=new XMLHttpRequest();  
34 - }else if (window.ActiveXObject){  
35 - objXMLHttpAdmin=new ActiveXObject("Microsoft.XMLHTTP");  
36 - }  
37 - return objXMLHttpAdmin;  
38 -}  
39 \ No newline at end of file 0 \ No newline at end of file
plugins/ktstandard/AdminVersionPlugin/templates/AdminVersionPlugin/computer_go.png renamed to plugins/ktstandard/AdminVersionPlugin/templates/computer_go.png

777 Bytes

plugins/ktstandard/AdminVersionPlugin/templates/AdminVersionPlugin/dashlet.smarty renamed to plugins/ktstandard/AdminVersionPlugin/templates/dashlet.smarty
1 -{literal}  
2 -  
3 -<style type="text/css">  
4 -#AdminVersionDashlet {  
5 - display: none;  
6 -  
7 -  
8 -}  
9 -#AdminVersionDashlet .action_close{  
10 - display: none;  
11 -}  
12 -  
13 -#AdminHeader { font-weight: bold;  
14 - margin-left: 25px;}  
15 -#AdminVersionBlock {  
16 - background: url(./plugins/ktstandard/AdminVersionPlugin/templates/AdminVersionPlugin/computer_go.png) no-repeat scroll left;  
17 - font-weight: bold;  
18 - padding-left:25px;  
19 -  
20 - background-position: top left;  
21 -  
22 -}  
23 -</style>  
24 -  
25 -{/literal}  
26 -  
27 -<script type="text/javascript">var VERSIONS_URL = "{$url}";</script>  
28 -<script type="text/javascript">CheckVersion();</script>  
29 -<div>  
30 -<div id="AdminHeader">  
31 - The following upgrade is available:  
32 -</div>  
33 -<div id="AdminVersionBlock" name="AdminVersionBlock">  
34 -  
35 -</div>  
36 - 1 +{literal}
  2 +
  3 +<style type="text/css">
  4 +
  5 +#AdminVersionDashlet .action_close {
  6 + display: none;
  7 +}
  8 +#AdminHeader { font-weight: bold;
  9 + margin-left: 25px;}
  10 +#AdminVersionBlock {
  11 + background: url(./plugins/ktstandard/AdminVersionPlugin/templates/AdminVersionPlugin/computer_go.png) no-repeat scroll left;
  12 + font-weight: bold;
  13 + padding-left:25px;
  14 + background-position: top left;
  15 +}
  16 +</style>
  17 +
  18 +{/literal}
  19 +
  20 +<div>
  21 +<div id="AdminHeader">
  22 + The following upgrade is available:
  23 +</div>
  24 +<div id="AdminVersionBlock" name="AdminVersionBlock">
  25 +<div id="AdminVersion"><a href="http://www.knowledgetree.com/products/whats-new" target="_blank">{$name} version {$version}</a></div><br></div>
37 </div> 26 </div>
38 \ No newline at end of file 27 \ No newline at end of file
plugins/ktstandard/AdminVersionPlugin/test/checkVersion.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id: $
  5 + *
  6 + * KnowledgeTree Community Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2008 KnowledgeTree Inc.
  9 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  10 + *
  11 + * This program is free software; you can redistribute it and/or modify it under
  12 + * the terms of the GNU General Public License version 3 as published by the
  13 + * Free Software Foundation.
  14 + *
  15 + * This program is distributed in the hope that it will be useful, but WITHOUT
  16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18 + * details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  24 + * California 94120-7775, or email info@knowledgetree.com.
  25 + *
  26 + * The interactive user interfaces in modified source and object code versions
  27 + * of this program must display Appropriate Legal Notices, as required under
  28 + * Section 5 of the GNU General Public License version 3.
  29 + *
  30 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  31 + * these Appropriate Legal Notices must retain the display of the "Powered by
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  33 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * copyright notice.
  36 + * Contributor( s): ______________________________________
  37 + *
  38 + */
  39 +
  40 +chdir(dirname(__FILE__));
  41 +require_once(realpath('../../../../config/dmsDefaults.php'));
  42 +require_once('../AdminVersion.inc.php');
  43 +
  44 +$version = AdminVersion::isNewVersionAvailable();
  45 +
  46 +if ($version == false)
  47 +print 'No new version available.';
  48 +else
  49 +print_r($version);
  50 +
plugins/ktstandard/AdminVersionPlugin/test/latestVersion.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id: $
  5 + *
  6 + * KnowledgeTree Community Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2008 KnowledgeTree Inc.
  9 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  10 + *
  11 + * This program is free software; you can redistribute it and/or modify it under
  12 + * the terms of the GNU General Public License version 3 as published by the
  13 + * Free Software Foundation.
  14 + *
  15 + * This program is distributed in the hope that it will be useful, but WITHOUT
  16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18 + * details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  24 + * California 94120-7775, or email info@knowledgetree.com.
  25 + *
  26 + * The interactive user interfaces in modified source and object code versions
  27 + * of this program must display Appropriate Legal Notices, as required under
  28 + * Section 5 of the GNU General Public License version 3.
  29 + *
  30 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  31 + * these Appropriate Legal Notices must retain the display of the "Powered by
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  33 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * copyright notice.
  36 + * Contributor( s): ______________________________________
  37 + *
  38 + */
  39 +
  40 +// NOTE: this is a test script. The values are for test purposes only.
  41 +
  42 +$versions = array(
  43 +'Development OSS'=> '3.5'
  44 +);
  45 +
  46 +print json_encode($versions);
  47 +
  48 +?>
0 \ No newline at end of file 49 \ No newline at end of file
sql/mysql/install/data.sql
@@ -932,7 +932,8 @@ INSERT INTO `scheduler_tasks` VALUES @@ -932,7 +932,8 @@ INSERT INTO `scheduler_tasks` VALUES
932 (5,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled'), 932 (5,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled'),
933 (6,'Open Office test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled'), 933 (6,'Open Office test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled'),
934 (7,'Cleanup Temporary Directory','search2/bin/cronCleanup.php','',0,'1min','2007-10-01',NULL,0,'enabled'), 934 (7,'Cleanup Temporary Directory','search2/bin/cronCleanup.php','',0,'1min','2007-10-01',NULL,0,'enabled'),
935 -(8,'Disk Usage and Folder Utilisation Statistics','plugins/housekeeper/bin/UpdateStats.php','',0,'5mins','2007-10-01',NULL,0,'enabled'); 935 +(8,'Disk Usage and Folder Utilisation Statistics','plugins/housekeeper/bin/UpdateStats.php','',0,'5mins','2007-10-01',NULL,0,'enabled'),
  936 +(9,'Check Latest Version','plugins/ktstandard/AdminVersionPlugin/bin/UpdateNewVersion.php','',0,'daily','2007-10-01',NULL,0,'enabled');
936 /*!40000 ALTER TABLE `scheduler_tasks` ENABLE KEYS */; 937 /*!40000 ALTER TABLE `scheduler_tasks` ENABLE KEYS */;
937 UNLOCK TABLES; 938 UNLOCK TABLES;
938 939
@@ -1846,7 +1847,7 @@ UNLOCK TABLES; @@ -1846,7 +1847,7 @@ UNLOCK TABLES;
1846 1847
1847 LOCK TABLES `zseq_scheduler_tasks` WRITE; 1848 LOCK TABLES `zseq_scheduler_tasks` WRITE;
1848 /*!40000 ALTER TABLE `zseq_scheduler_tasks` DISABLE KEYS */; 1849 /*!40000 ALTER TABLE `zseq_scheduler_tasks` DISABLE KEYS */;
1849 -INSERT INTO `zseq_scheduler_tasks` VALUES (7); 1850 +INSERT INTO `zseq_scheduler_tasks` VALUES (9);
1850 /*!40000 ALTER TABLE `zseq_scheduler_tasks` ENABLE KEYS */; 1851 /*!40000 ALTER TABLE `zseq_scheduler_tasks` ENABLE KEYS */;
1851 UNLOCK TABLES; 1852 UNLOCK TABLES;
1852 1853
sql/mysql/upgrade/3.5.2/zdashboard_tasks.sql
1 select @id:=max(id)+1 from scheduler_tasks; 1 select @id:=max(id)+1 from scheduler_tasks;
2 INSERT INTO `scheduler_tasks` VALUES (@id,'Disk Usage and Folder Utilisation Statistics','plugins/housekeeper/bin/UpdateStats.php','',0,'5mins','2007-10-01',NULL,0,'enabled'); 2 INSERT INTO `scheduler_tasks` VALUES (@id,'Disk Usage and Folder Utilisation Statistics','plugins/housekeeper/bin/UpdateStats.php','',0,'5mins','2007-10-01',NULL,0,'enabled');
3 3
  4 +select @id:=max(id)+1 from scheduler_tasks;
  5 +INSERT INTO `scheduler_tasks` VALUES (@id,'Check Latest Version','plugins/ktstandard/AdminVersionPlugin/bin/UpdateNewVersion.php','',0,'daily','2007-10-01',NULL,0,'enabled');
  6 +
4 UPDATE zseq_scheduler_tasks set id=@id; 7 UPDATE zseq_scheduler_tasks set id=@id;
5 \ No newline at end of file 8 \ No newline at end of file