Commit ce586c33823d09cb32b50f8d0e671c88ee8239ae

Authored by kevin_fourie
1 parent 71cd8e03

Merged in from DEV trunk...

------------------------------------------------------------------------
r7700 | kevin_fourie | 2007-11-20 18:53:23 +0200 (Tue, 20 Nov 2007) | 1 line

Fixed Merge error.
------------------------------------------------------------------------
r7702 | kevin_fourie | 2007-11-20 21:31:52 +0200 (Tue, 20 Nov 2007) | 1 line

Fixed merge errors.
------------------------------------------------------------------------
r7703 | megan_w | 2007-11-21 08:53:51 +0200 (Wed, 21 Nov 2007) | 8 lines

KTS-2708
"Refactor plugins registration and loading"
Fixed. Added a helper table for registering all the dashlets, actions, etc. Reduced the number of calls made when loading the plugins.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen


------------------------------------------------------------------------
r7705 | conradverm | 2007-11-21 09:02:38 +0200 (Wed, 21 Nov 2007) | 6 lines

KTS-2713
"Filename is cast to integer in search results"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie
------------------------------------------------------------------------
r7706 | megan_w | 2007-11-21 09:04:40 +0200 (Wed, 21 Nov 2007) | 8 lines

KTS-2708
"Refactor plugins registration and loading"
Updated. Added the upgrade sql.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen


------------------------------------------------------------------------
r7707 | conradverm | 2007-11-21 09:07:22 +0200 (Wed, 21 Nov 2007) | 6 lines

KTS-2714
"Search results via web service return an error because of incorrect reference to workflow and state variables"
Fixed.

Comitted By: Conrad Vermeulen
Reviewed By: Isaac Lundal
------------------------------------------------------------------------
r7710 | jonathan_byrne | 2007-11-21 16:38:51 +0200 (Wed, 21 Nov 2007) | 7 lines

KTS-2301
"Number of characters allowed in a field is not 250 as is mostly specified"

Fixed. Changed database to hold larger comments.

Committed By: Jonathan Byrne
Reviewed By: Kevin Fourie
------------------------------------------------------------------------
r7711 | kevin_fourie | 2007-11-21 18:09:34 +0200 (Wed, 21 Nov 2007) | 7 lines

KTS-2708
"Refactor plugins registration and loading"
Updated. Added the upgrade sql.

Committed by: Kevin Fourie
Reviewed by: Conrad Vermeulen

------------------------------------------------------------------------
r7712 | kevin_fourie | 2007-11-21 18:58:39 +0200 (Wed, 21 Nov 2007) | 7 lines

KTS-2708
"Refactor plugins registration and loading"
Updated. Added upgrade table sql.

Committed by: Kevin Fourie
Reviewed by: Conrad Vermeulen

------------------------------------------------------------------------
r7713 | kevin_fourie | 2007-11-21 19:01:13 +0200 (Wed, 21 Nov 2007) | 7 lines

KTS-2708
"Refactor plugins registration and loading"
Updated. Added the upgrade sql.

Committed by: Kevin Fourie
Reviewed by: Conrad Vermeulen

------------------------------------------------------------------------
r7715 | kevin_fourie | 2007-11-21 19:15:30 +0200 (Wed, 21 Nov 2007) | 7 lines

KTS-2708
"Refactor plugins registration and loading"
Updated. Added the upgrade sql.

Committed by: Kevin Fourie
Reviewed by: Conrad Vermeulen

------------------------------------------------------------------------
r7719 | megan_w | 2007-11-22 08:56:19 +0200 (Thu, 22 Nov 2007) | 8 lines

KTS-2691
"Add the ability to enable / disable tasks within the scheduler"
Fixed.  Tasks can be set as enabled / disabled / system. System tasks can't be disabled.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen


------------------------------------------------------------------------
r7720 | megan_w | 2007-11-22 09:03:23 +0200 (Thu, 22 Nov 2007) | 13 lines

KTS-2691
"Add the ability to enable / disable tasks within the scheduler"
Fixed. Added a status flag to determine if tasks are enabled / disabled / system. Set the indexing tasks as system.

KTS-1346
"Periodic deleted document expunge"
Fixed. Changed the print statements to use the log. Added the expunge script to the scheduler and set as disabled.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen



------------------------------------------------------------------------
r7722 | kevin_fourie | 2007-11-22 14:44:48 +0200 (Thu, 22 Nov 2007) | 4 lines

Database version bump to 3.5.2.

Committed By: Kevin Fourie
Reviewed By: Conrad Vermeulen
------------------------------------------------------------------------
r7724 | kevin_fourie | 2007-11-22 21:12:34 +0200 (Thu, 22 Nov 2007) | 7 lines

KTC-262
"Action Restriction section of a work flow there are extra two extra columns as well as one that says "no name" after you select "Edit Action""

Fixed. Plugins now return their names correctly.

Committed By: Kevin Fourie
Reviewed By: Jonathan Byrne
------------------------------------------------------------------------
r7725 | jonathan_byrne | 2007-11-23 08:06:10 +0200 (Fri, 23 Nov 2007) | 7 lines

KTS-2706
"Fatal error with in the workflow move document action. Fatal error: Call to undefined function: getpatharray() in /srv/www/html/3.4.3/plugins/ktcore/KTWorkflowTriggers.inc.php on line 513"

Fixed. User will be directed to root folder.

Committed By: Jonathan Byrne
Reviewed By: Kevin Fourie
------------------------------------------------------------------------
r7727 | conradverm | 2007-11-23 11:27:36 +0200 (Fri, 23 Nov 2007) | 6 lines

WSA-70
"Provide a mechanism to allow for JSON responses from web service requests"
Implemented.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson
------------------------------------------------------------------------
r7728 | conradverm | 2007-11-23 11:54:21 +0200 (Fri, 23 Nov 2007) | 6 lines

WSA-44
"web service unit tests in php need to be incorporated for search"
Updated. A few tests for search has been incorporated

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@7729 c91229c3-7414-0410-bfa2-8a42b809f60b
bin/expungeall.php
... ... @@ -2,37 +2,37 @@
2 2  
3 3 /**
4 4 *
5   - * $Id:$
  5 + * $Id$
6 6 *
7 7 * KnowledgeTree Open Source Edition
8 8 * Document Management Made Simple
9 9 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
  22 + *
23 23 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
24 24 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 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
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 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.
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 */
38 38  
... ... @@ -45,11 +45,11 @@ require_once(&#39;../ktapi/ktapi.inc.php&#39;);
45 45 * admin=admin
46 46 * password=admin
47 47 * maximum=50
48   - *
  48 + *
49 49 * admin and password is required to expunge documents from the system.
50   - *
  50 + *
51 51 * maximum is the maximum number of documents that should be expunged from the system in one run.
52   - *
  52 + *
53 53 */
54 54  
55 55 $start_time = time();
... ... @@ -63,12 +63,10 @@ $ktapi = new KTAPI();
63 63 $session = $ktapi->start_session($user, $password);
64 64 if (PEAR::isError($session))
65 65 {
66   - print $session->getMessage() . "\n";
  66 + $default->log->debug('Expunge_all task: Can\'t create session: '.$session->getMessage());
67 67 return;
68 68 }
69 69  
70   -print "Expunging documents.\n(Attempting $maximum documents)\n\n";
71   -
72 70 $sql = sprintf("SELECT id FROM documents WHERE status_id=%d LIMIT %d", DELETED, $maximum);
73 71  
74 72 $rows = DBUtil::getResultArray($sql);
... ... @@ -76,13 +74,11 @@ $count = count($rows);
76 74  
77 75 if ($count == 0)
78 76 {
79   - print "Nothing to do.\n";
  77 + $default->log->debug('Expunge_all task: Nothing to do.');
80 78 $session->logout();
81 79 return;
82 80 }
83 81  
84   -print "Rows found: $count\n\n";
85   -
86 82 foreach($rows as $row)
87 83 {
88 84 $id = $row['id'];
... ... @@ -90,11 +86,11 @@ foreach($rows as $row)
90 86 $document = $ktapi->get_document_by_id($id);
91 87 $title = $document->get_title();
92 88  
93   - print "Document ID: $id Name: '$title'\n";
  89 + $default->log->info('Expunge_all task: Document to expunge, ID: '.$id.' Name: '.$title);
94 90 $result = $document->expunge();
95 91 if (PEAR::isError($result))
96 92 {
97   - print $result->getMessage() . "\n";
  93 + $default->log->error('Expunge_all task: document can\'t be expunged: '.$result->getMessage());
98 94 }
99 95 }
100 96  
... ... @@ -102,6 +98,5 @@ $end_time = time();
102 98  
103 99 $diff = $end_time - $start_time;
104 100  
105   -print "\ndone. $diff seconds.\n";
106 101 $session->logout();
107 102 ?>
108 103 \ No newline at end of file
... ...
bin/scheduler.php
... ... @@ -96,7 +96,7 @@ function updateTask($aFieldValues, $iId) {
96 96 function getTaskList() {
97 97 $now = date('Y-m-d H:i:s'); //time();
98 98  
99   - $query = "SELECT * FROM scheduler_tasks WHERE is_complete = 0 AND run_time < '{$now}'";
  99 + $query = "SELECT * FROM scheduler_tasks WHERE is_complete = 0 AND run_time < '{$now}' AND status != 'disabled'";
100 100  
101 101 $result = DBUtil::getResultArray($query);
102 102  
... ...
docs/VERSION.txt
1   -3.5.0
  1 +3.5.2
... ...
plugins/ktcore/KTWorkflowTriggers.inc.php
... ... @@ -514,6 +514,15 @@ class BaseCopyActionTrigger extends KTWorkflowTrigger {
514 514  
515 515 $fFolderId = KTUtil::arrayGet($_REQUEST, 'fFolderId', KTUtil::arrayGet($this->aConfig, 'folder_id', 1));
516 516  
  517 + $oFolder = Folder::get($fFolderId);
  518 + if(PEAR::isError($oFolder))
  519 + {
  520 + $iRoot = 1;
  521 + $oFolder = Folder::get($iRoot);
  522 + $fFolderId = 1;
  523 +
  524 + }
  525 +
517 526 $collection->setOptions($aOptions);
518 527 $collection->setQueryObject(new BrowseQuery($fFolderId, $this->oUser));
519 528 $collection->setColumnOptions('ktcore.columns.singleselection', array(
... ... @@ -527,7 +536,7 @@ class BaseCopyActionTrigger extends KTWorkflowTrigger {
527 536 'folder_link' => $aOptions['result_url'],
528 537 ));
529 538  
530   - $oFolder = Folder::get($fFolderId);
  539 +
531 540 $aBreadcrumbs = array();
532 541 $folder_path_names = $oFolder->getPathArray();
533 542 $folder_path_ids = explode(',', $oFolder->getParentFolderIds());
... ...
plugins/ktcore/scheduler/scheduler.php
1 1 <?php
2 2 /**
3   - * $Id:$
  3 + * $Id:$
4 4 *
5 5 * KnowledgeTree Open Source Edition
6 6 * Document Management Made Simple
7 7 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
8   - *
  8 + *
9 9 * This program is free software; you can redistribute it and/or modify it under
10 10 * the terms of the GNU General Public License version 3 as published by the
11 11 * Free Software Foundation.
12   - *
  12 + *
13 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 16 * details.
17   - *
  17 + *
18 18 * You should have received a copy of the GNU General Public License
19 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20   - *
  20 + *
21 21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22 22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
23   - *
  23 + *
24 24 * The interactive user interfaces in modified source and object code versions
25 25 * of this program must display Appropriate Legal Notices, as required under
26 26 * Section 5 of the GNU General Public License version 3.
27   - *
  27 + *
28 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 29 * these Appropriate Legal Notices must retain the display of the "Powered by
30   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31 31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32   - * must display the words "Powered by KnowledgeTree" and retain the original
33   - * copyright notice.
  32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
34 34 * Contributor( s): ______________________________________
35 35 *
36 36 */
... ... @@ -47,7 +47,8 @@ class Scheduler
47 47 var $aParams = '';
48 48 var $sFreq = 'daily';
49 49 var $iStartTime = '';
50   -
  50 + var $sStatus = 'disabled';
  51 +
51 52 /**
52 53 * Constructor function - set the name of the task
53 54 */
... ... @@ -56,14 +57,14 @@ class Scheduler
56 57 $this->sFreq = 'daily';
57 58 $this->iStartTime = time();
58 59 }
59   -
  60 +
60 61 /**
61 62 * Set the name of the task
62 63 */
63 64 function setTaskName($sName) {
64 65 $this->sName = $sName;
65 66 }
66   -
  67 +
67 68 /**
68 69 * Set the path to the script from the KT base path
69 70 * For example: "/var/tasks/script.php" or "/bin/script.php"
... ... @@ -71,14 +72,14 @@ class Scheduler
71 72 function setScriptPath($sPath) {
72 73 $this->sPath = $sPath;
73 74 }
74   -
  75 +
75 76 /**
76 77 * Add a parameter pair to pass to the script
77 78 */
78 79 function addParameter($param, $value){
79 80 $this->aParams[$param] = $value;
80 81 }
81   -
  82 +
82 83 /**
83 84 * Set the frequency with which the task must be run
84 85 * Frequencies are: daily, weekly, monthly, hourly, half_hourly, quarter_hourly, 10mins, 5mins and once
... ... @@ -86,16 +87,34 @@ class Scheduler
86 87 function setFrequency($sFrequency) {
87 88 $this->sFreq = $sFrequency;
88 89 }
89   -
  90 +
90 91 /**
91   - * Set the time at which the task should first be run or if it is a once off, the time to run it.
  92 + * Set the time at which the task should first be run or if it is a once off, the time to run it.
92 93 * Time should be in datetime format.
93   - * By default the time is set to now.
  94 + * By default the time is set to now.
94 95 */
95 96 function setFirstRunTime($iTime) {
96 97 $this->iStartTime = !empty($iTime) ? $iTime : date('Y-m-d H:i:s');
97 98 }
98   -
  99 +
  100 + /**
  101 + * Set the task as enabled or disabled. If the task is already set as a system task, then ignore.
  102 + */
  103 + function setEnabled($bStatus = FALSE) {
  104 + if($bStatus && $this->sStatus != 'system'){
  105 + $this->sStatus = 'enabled';
  106 + }
  107 + }
  108 +
  109 + /**
  110 + * Set the task as a system task, this cannot be enabled or disabled.
  111 + */
  112 + function setAsSystemTask($bSystem = FALSE) {
  113 + if($bSystem){
  114 + $this->sStatus = 'system';
  115 + }
  116 + }
  117 +
99 118 /**
100 119 * Create a script - write it to the filesystem.
101 120 * Scripts are saved in the KT_DIR."/var/tasks/" directory.
... ... @@ -105,33 +124,33 @@ class Scheduler
105 124 // Path to scripts
106 125 $ktPath = '/var/tasks/';
107 126 $path = KT_DIR.$ktPath;
108   -
  127 +
109 128 if(!is_dir($path)){
110 129 mkdir($path, '0755');
111 130 }
112   -
  131 +
113 132 // Create script file
114 133 $sName = str_replace(' ', '_', $this->sName);
115 134 $sName = str_replace('', "'", $sName);
116 135 $sName = str_replace('', "&", $sName);
117 136 $sFileName = $sName.'_'.mt_rand(1, 999).'.php';
118   -
  137 +
119 138 while(file_exists($path.$sFileName)){
120 139 $sFileName = $sTask.'_'.mt_rand(1, 9999).'.php';
121 140 }
122   -
  141 +
123 142 $fp = fopen($path.$sFileName, 'wb');
124 143 fwrite($fp, $sScript);
125 144 fclose($fp);
126   -
  145 +
127 146 $this->sPath = $ktPath.$sFileName;
128 147 }
129   -
  148 +
130 149 /**
131 150 * Register the task in the scheduler
132 151 */
133 152 function registerTask(){
134   - schedulerUtil::registerTask($this->sName, $this->sPath, $this->aParams, $this->sFreq, $this->iStartTime);
  153 + schedulerUtil::registerTask($this->sName, $this->sPath, $this->aParams, $this->sFreq, $this->iStartTime, $this->sStatus);
135 154 }
136 155 }
137 156 ?>
... ...
plugins/ktcore/scheduler/schedulerDashlet.php
... ... @@ -5,32 +5,32 @@
5 5 * KnowledgeTree Open Source Edition
6 6 * Document Management Made Simple
7 7 * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
8   - *
  8 + *
9 9 * This program is free software; you can redistribute it and/or modify it under
10 10 * the terms of the GNU General Public License version 3 as published by the
11 11 * Free Software Foundation.
12   - *
  12 + *
13 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 16 * details.
17   - *
  17 + *
18 18 * You should have received a copy of the GNU General Public License
19 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20   - *
  20 + *
21 21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22 22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
23   - *
  23 + *
24 24 * The interactive user interfaces in modified source and object code versions
25 25 * of this program must display Appropriate Legal Notices, as required under
26 26 * Section 5 of the GNU General Public License version 3.
27   - *
  27 + *
28 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 29 * these Appropriate Legal Notices must retain the display of the "Powered by
30   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31 31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32   - * must display the words "Powered by KnowledgeTree" and retain the original
33   - * copyright notice.
  32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
34 34 * Contributor( s): ______________________________________
35 35 *
36 36 */
... ... @@ -42,7 +42,7 @@ class schedulerDashlet extends KTBaseDashlet {
42 42 var $oUser;
43 43 var $sClass = "ktError";
44 44 var $aTimes = array();
45   -
  45 +
46 46 function schedulerDashlet() {
47 47 $this->sTitle = _kt('Scheduler');
48 48 }
... ... @@ -55,7 +55,7 @@ class schedulerDashlet extends KTBaseDashlet {
55 55 }
56 56 return false;
57 57 }
58   -
  58 +
59 59 /**
60 60 * Get the last and next run times for the scheduler.
61 61 * @return bool true if scheduler is overdue
... ... @@ -63,26 +63,26 @@ class schedulerDashlet extends KTBaseDashlet {
63 63 function checkOverDue() {
64 64 $this->aTimes = schedulerUtil::checkLastRunTime();
65 65 $sNextRunTime = $this->aTimes['nextruntime'];
66   -
  66 +
67 67 $iNow = time();
68 68 $iNext = strtotime($sNextRunTime);
69   -
  69 +
70 70 if($iNow > $iNext){
71 71 $iDif = $iNow - $iNext;
72   -
  72 +
73 73 // if it hasn't run for a whole day then display dashlet alert.
74 74 if($iDif > 60*60*24) {
75 75 return true;
76 76 }
77 77 }
78   -
  78 +
79 79 return false;
80 80 }
81   -
  81 +
82 82 /**
83 83 * Calculate the time difference in days/hours/minutes
84 84 */
85   - function renderTime($iDif, $iUnit, $iRemainder, $sUnit, $sRemainder) {
  85 + function renderTime($iDif, $iUnit, $iRemainder, $sUnit, $sRemainder) {
86 86 // days
87 87 $iTime = round($iDif / $iUnit, 2);
88 88 $aRemainder = explode('.', $iTime);
... ... @@ -95,48 +95,48 @@ class schedulerDashlet extends KTBaseDashlet {
95 95 $time = floor($iTime).' '.$sUnit.$remainder;
96 96 return $time;
97 97 }
98   -
  98 +
99 99 /**
100 100 * Get the last and next run times for the scheduler
101 101 */
102 102 function getRunTimes() {
103 103 $bDue = FALSE;
104   -
  104 +
105 105 // Check when the scheduler last ran and when the next task run time should be
106 106 $aTimes = $this->aTimes;
107   - $sLastRunTime = $aTimes['lastruntime'];
  107 + $sLastRunTime = $aTimes['lastruntime'];
108 108 $sNextRunTime = $aTimes['nextruntime'];
109   -
  109 +
110 110 // Check if scheduler has missed the last run
111 111 $iNow = time();
112 112 $iNext = strtotime($sNextRunTime);
113   -
  113 +
114 114 if($iNow > $iNext){
115 115 $bDue = TRUE;
116 116 $iDif = $iNow - $iNext;
117 117 }else{
118 118 $iDif = $iNext - $iNow;
119 119 }
120   -
  120 +
121 121 $time = $iDif.' '._kt('seconds'); $remainder = '';
122 122 // Get the difference in easy units of time
123   - if($iDif >= 60*60*24*7){
  123 + if($iDif >= 60*60*24*7){
124 124 // weeks
125 125 $time = ' '.schedulerDashlet::renderTime($iDif, 60*60*24*7, 7, _kt('week(s)'), _kt('day(s)'));
126   - }else if($iDif >= 60*60*24){
127   - // days
  126 + }else if($iDif >= 60*60*24){
  127 + // days
128 128 $time = ' '.schedulerDashlet::renderTime($iDif, 60*60*24, 24, _kt('day(s)'), _kt('hour(s)'));
129   - }else if($iDif >= 60*60){
  129 + }else if($iDif >= 60*60){
130 130 // hours
131 131 $time = ' '.schedulerDashlet::renderTime($iDif, 60*60, 60, _kt('hour(s)'), _kt('minute(s)'));
132   - }else if($iDif >= 60){
  132 + }else if($iDif >= 60){
133 133 // minutes
134 134 $time = ' '.schedulerDashlet::renderTime($iDif, 60, 60, _kt('minute(s)'), _kt('second(s)'));
135 135 }
136   -
  136 +
137 137 return array('lasttime' => $sLastRunTime, 'timedif' => $time, 'due' => $bDue);
138 138 }
139   -
  139 +
140 140 function render() {
141 141 $bWin = false;
142 142 if(OS_WINDOWS){
... ... @@ -146,11 +146,11 @@ class schedulerDashlet extends KTBaseDashlet {
146 146 $sLastTime = $aTimes['lasttime'];
147 147 $sTimeDif = $aTimes['timedif'];
148 148 $bDue = $aTimes['due'];
149   -
150   -
  149 +
  150 +
151 151 $oKTConfig =& KTConfig::getSingleton();
152 152 $rootUrl = $oKTConfig->get("rootUrl");
153   -
  153 +
154 154 if($oKTConfig->get("ui/morphEnabled") == '1') {
155 155 $sImg = $rootUrl.'/skins/kts_'.$oKTConfig->get("ui/morphTo");
156 156 }else{
... ... @@ -158,9 +158,9 @@ class schedulerDashlet extends KTBaseDashlet {
158 158 }
159 159 $sImgPlus = $sImg.'/bullet_toggle_plus.png';
160 160 $sImgMinus = $sImg.'/bullet_toggle_minus.png';
161   -
  161 +
162 162 $sPath = KT_DIR.'/bin/scheduler.php';
163   - $sOnClick = " var cron = document.getElementById('cronguide');
  163 + $sOnClick = " var cron = document.getElementById('cronguide');
164 164 var icon = document.getElementById('scheduler_icon');
165 165 if(cron.style.visibility == 'hidden'){
166 166 cron.style.visibility = 'visible'; cron.style.display = 'block';
... ... @@ -169,9 +169,10 @@ class schedulerDashlet extends KTBaseDashlet {
169 169 cron.style.visibility = 'hidden'; cron.style.display = 'none';
170 170 icon.src = '{$sImgPlus}';
171 171 }";
172   -
  172 +
173 173 $sAdmin = KTUtil::ktLink('admin.php', 'misc/scheduler');
174   -
  174 + $sAdminLink = "<a href='{$sAdmin}'>"._kt('Administration page').'</a>';
  175 +
175 176 $oTemplating =& KTTemplating::getSingleton();
176 177 $oTemplate = $oTemplating->loadTemplate('ktcore/dashlets/scheduler');
177 178  
... ... @@ -181,7 +182,7 @@ class schedulerDashlet extends KTBaseDashlet {
181 182 'isDue' => $bDue,
182 183 'bWin' => $bWin,
183 184 'sPath' => $sPath,
184   - 'sAdmin' => $sAdmin,
  185 + 'sAdminLink' => $sAdminLink,
185 186 'sImg' => $sImgPlus,
186 187 'onClick' => $sOnClick,
187 188 );
... ...
plugins/ktcore/scheduler/schedulerEntity.php
... ... @@ -52,6 +52,7 @@ class schedulerEntity extends KTEntity
52 52 var $iRun_time;
53 53 var $iPrevious_run_time;
54 54 var $iRun_duration;
  55 + var $sStatus;
55 56  
56 57 var $_aFieldToSelect = array(
57 58 'iId' => 'id',
... ... @@ -62,7 +63,8 @@ class schedulerEntity extends KTEntity
62 63 'iFrequency' => 'frequency',
63 64 'iRun_time' => 'run_time',
64 65 'iPrevious_run_time' => 'previous_run_time',
65   - 'iRun_duration' => 'run_duration'
  66 + 'iRun_duration' => 'run_duration',
  67 + 'sStatus' => 'status'
66 68 );
67 69  
68 70 function _table () {
... ... @@ -78,6 +80,7 @@ class schedulerEntity extends KTEntity
78 80 function getParams() { return $this->sScript_params; }
79 81 function getIsComplete() { return $this->bIs_complete; }
80 82 function getFrequency() { return $this->iFrequency; }
  83 + function getStatus() { return $this->sStatus; }
81 84  
82 85 function getFrequencyByLang() {
83 86 $aFrequencies = array(
... ... @@ -117,6 +120,7 @@ class schedulerEntity extends KTEntity
117 120 function setRunTime($sValue) { return $this->iRun_time = date('Y-m-d H:i:s', $sValue); }
118 121 function setPrevious($sValue) { return $this->iPrevious_run_time = date('Y-m-d H:i:s', $sValue); }
119 122 function setRunDuration($sValue) { return $this->iRun_duration = $sValue; }
  123 + function setStatus($sValue) { return $this->sStatus = $sValue; }
120 124  
121 125 function get($iId) {
122 126 return KTEntityUtil::get('schedulerEntity', $iId);
... ... @@ -124,10 +128,11 @@ class schedulerEntity extends KTEntity
124 128  
125 129 function getTasksToRun() {
126 130 $aOptions = array('multi' => true);
127   - $aFields = array('is_complete', 'run_time');
  131 + $aFields = array('is_complete', 'run_time', 'status');
128 132 $aValues = array();
129 133 $aValues[] = array('type' => 'equals', 'value' => '0');
130 134 $aValues[] = array('type' => 'before', 'value' => time());
  135 + $aValues[] = array('type' => 'nequals', 'value' => 'disabled');
131 136  
132 137 return KTEntityUtil::getBy('schedulerEntity', $aFields, $aValues, $aOptions);
133 138 }
... ... @@ -139,9 +144,10 @@ class schedulerEntity extends KTEntity
139 144  
140 145 function getLastRunTime($date) {
141 146 $aOptions = array('multi' => true, 'orderby' => 'previous_run_time DESC');
142   - $aFields = array('previous_run_time');
  147 + $aFields = array('previous_run_time', 'status');
143 148 $aValues = array();
144 149 $aValues[] = array('type' => 'before', 'value' => $date);
  150 + $aValues[] = array('type' => 'nequals', 'value' => 'disabled');
145 151  
146 152 return KTEntityUtil::getBy('schedulerEntity', $aFields, $aValues, $aOptions);
147 153 }
... ... @@ -175,11 +181,40 @@ class schedulerEntity extends KTEntity
175 181 }
176 182  
177 183 /**
  184 + * Display the task name. If the task is disabled then grey it out.
  185 + *
  186 + */
  187 + function getTaskDiv() {
  188 + $sId = $this->getId();
  189 + $sStatus = $this->getStatus();
  190 +
  191 + $sDiv = "<span id='font{$sId}' ";
  192 + $sDiv .= ($sStatus != 'disabled') ? 'class="">' : 'class="descriptiveText">';
  193 + $sDiv .= $this->getTask().'</span>';
  194 + return $sDiv;
  195 + }
  196 +
  197 + function getFreqDiv() {
  198 + $sId = $this->getId();
  199 + $sStatus = $this->getStatus();
  200 + $sFreqs = $this->getFrequencyByLang();
  201 +
  202 + $sLink = "<a href='#' id='freqDrop{$sId}' onclick='javascript: showFrequencyDiv(\"{$sId}\");'";
  203 + $sLink .= ($sStatus == 'disabled') ? 'style="visibility: hidden;" >' : '>';
  204 + $sLink .= "<div id='div{$sId}'>$sFreqs</div></a>";
  205 + return $sLink;
  206 + }
  207 +
  208 + /**
178 209 * Get a link to alter the frequency of a task
179 210 */
180 211 function getAlterFreqLink() {
181 212 $sId = $this->getId();
182   - $sLink = "<a href='#' onclick='javascript: showFrequencyDiv({$sId});'>"._kt('Alter frequency')."</a>";
  213 + $sStatus = $this->getStatus();
  214 +
  215 + $sLink = "<a href='#' id='freqLink{$this->getId()}' onclick='javascript: showFrequencyDiv({$sId});'";
  216 + $sLink .= ($sStatus == 'disabled') ? 'style="visibility: hidden;" >' : '>';
  217 + $sLink .= _kt('Alter frequency')."</a>";
183 218 return $sLink;
184 219 }
185 220  
... ... @@ -188,9 +223,33 @@ class schedulerEntity extends KTEntity
188 223 */
189 224 function getRunNowLink() {
190 225 $sId = $this->getId();
  226 + $sStatus = $this->getStatus();
191 227 $sUrl = KTUtil::ktLink('admin.php', 'misc/scheduler', 'action=updateRunTime');
192   - $sLink = "<a href='#' onclick='javascript: runOnNext(\"{$sId}\", \"{$sUrl}\");'>"._kt('Run on next iteration')."</a>";
  228 +
  229 + $sLink = "<a href='#' id='runnowLink{$this->getId()}' onclick='javascript: runOnNext(\"{$sId}\", \"{$sUrl}\");'";
  230 + $sLink .= ($sStatus == 'disabled') ? 'style="visibility: hidden;" >' : '>';
  231 + $sLink .= _kt('Run on next iteration')."</a>";
  232 + return $sLink;
  233 + }
  234 +
  235 + /**
  236 + * Run the task on the next iteration
  237 + */
  238 + function getStatusLink() {
  239 + $sId = $this->getId();
  240 + $sStatus = $this->getStatus();
  241 + if($sStatus == 'system'){
  242 + return '';
  243 + }
  244 +
  245 + $sDisableText = _kt('Disable task');
  246 + $sEnableText = _kt('Enable task');
  247 +
  248 + $sLinkText = ($sStatus == 'enabled') ? $sDisableText : $sEnableText;
  249 + $sUrl = KTUtil::ktLink('admin.php', 'misc/scheduler', 'action=updateStatus');
  250 + $sLink = "<a id='statusLink{$this->getId()}' href='#'
  251 + onclick='javascript: toggleStatus(\"{$sId}\", \"{$sUrl}\", \"{$sDisableText}\", \"{$sEnableText}\");'>{$sLinkText}</a>";
193 252 return $sLink;
194 253 }
195 254 }
196 255 -?>
  256 +?>
197 257 \ No newline at end of file
... ...
plugins/ktcore/scheduler/schedulerUtil.php
... ... @@ -77,7 +77,7 @@ class schedulerUtil extends KTUtil
77 77 /**
78 78 * Method to register a task in the schedule
79 79 */
80   - function registerTask($sTask, $sUrl, $aParams, $sFreq, $iStartTime = NULL) {
  80 + function registerTask($sTask, $sUrl, $aParams, $sFreq, $iStartTime = NULL, $sStatus = 'disabled') {
81 81 // Run task on next iteration if no start time given
82 82 $iStartTime = (!empty($iStartTime)) ? strtotime($iStartTime) : time();
83 83  
... ... @@ -101,6 +101,7 @@ class schedulerUtil extends KTUtil
101 101 $aTask['run_time'] = $dNextTime;
102 102 $aTask['previous_run_time'] = $dStartTime;
103 103 $aTask['run_duration'] = '0';
  104 + $sTask['status'] = $sStatus;
104 105  
105 106 $oEntity = schedulerEntity::createFromArray($aTask);
106 107 if (PEAR::isError($oEntity)){
... ... @@ -127,6 +128,7 @@ class schedulerUtil extends KTUtil
127 128 $aTask['is_complete'] = '0';
128 129 $aTask['run_time'] = date('Y-m-d H:i:s');
129 130 $aTask['run_duration'] = '0';
  131 + $aTask['status'] = 'enabled';
130 132  
131 133 $oEntity = schedulerEntity::createFromArray($aTask);
132 134 if (PEAR::isError($oEntity)){
... ... @@ -232,6 +234,29 @@ class schedulerUtil extends KTUtil
232 234 }
233 235  
234 236 /**
  237 + * Toggle whether a task is enabled or disabled. If its a system task, then ignore.
  238 + */
  239 + function toggleStatus($id) {
  240 + $oScheduler = schedulerEntity::get($id);
  241 +
  242 + if (PEAR::isError($oScheduler)){
  243 + return _kt('Object can\'t be created');
  244 + }
  245 +
  246 + $sStatus = $oScheduler->getStatus();
  247 +
  248 + if($sStatus == 'system'){
  249 + // ignore
  250 + return $sStatus;
  251 + }
  252 +
  253 + $sNewStatus = ($sStatus == 'enabled') ? 'disabled' : 'enabled';
  254 + $oScheduler->setStatus($sNewStatus);
  255 + $oScheduler->update();
  256 + return $sNewStatus;
  257 + }
  258 +
  259 + /**
235 260 * Check the last run time of the scheduler
236 261 */
237 262 function checkLastRunTime() {
... ...
plugins/ktcore/scheduler/taskScheduler.php
... ... @@ -120,5 +120,13 @@ class manageSchedulerDispatcher extends KTAdminDispatcher
120 120 schedulerUtil::updateRunTime($id, $iNextTime);
121 121 return $iNextTime;
122 122 }
  123 +
  124 + /**
  125 + * Toggle the enable/disable on the task
  126 + */
  127 + function do_updateStatus() {
  128 + $fId = schedulerUtil::arrayGet($_REQUEST, 'fId');
  129 + schedulerUtil::toggleStatus($fId);
  130 + }
123 131 }
124 132 ?>
... ...
plugins/ktstandard/PDFGeneratorAction.php
... ... @@ -2,35 +2,29 @@
2 2 /**
3 3 * $Id$
4 4 *
5   - * KnowledgeTree Open Source Edition
6   - * Document Management Made Simple
7   - * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
  5 + * The contents of this file are subject to the KnowledgeTree Public
  6 + * License Version 1.1.2 ("License"); You may not use this file except in
  7 + * compliance with the License. You may obtain a copy of the License at
  8 + * http://www.knowledgetree.com/KPL
8 9 *
9   - * This program is free software; you can redistribute it and/or modify it under
10   - * the terms of the GNU General Public License version 3 as published by the
11   - * Free Software Foundation.
12   - *
13   - * This program is distributed in the hope that it will be useful, but WITHOUT
14   - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15   - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16   - * details.
17   - *
18   - * You should have received a copy of the GNU General Public License
19   - * along with this program. If not, see <http://www.gnu.org/licenses/>.
20   - *
21   - * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22   - * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  10 + * Software distributed under the License is distributed on an "AS IS"
  11 + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
  12 + * See the License for the specific language governing rights and
  13 + * limitations under the License.
  14 + *
  15 + * All copies of the Covered Code must include on each user interface screen:
  16 + * (i) the "Powered by KnowledgeTree" logo and
  17 + * (ii) the KnowledgeTree copyright notice
  18 + * in the same form as they appear in the distribution. See the License for
  19 + * requirements.
23 20 *
24   - * The interactive user interfaces in modified source and object code versions
25   - * of this program must display Appropriate Legal Notices, as required under
26   - * Section 5 of the GNU General Public License version 3.
  21 + * The Original Code is: KnowledgeTree Open Source
27 22 *
28   - * In accordance with Section 7(b) of the GNU General Public License version 3,
29   - * these Appropriate Legal Notices must retain the display of the "Powered by
30   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31   - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32   - * must display the words "Powered by KnowledgeTree" and retain the original
33   - * copyright notice.
  23 + * The Initial Developer of the Original Code is The Jam Warehouse Software
  24 + * (Pty) Ltd, trading as KnowledgeTree.
  25 + * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
  26 + * (C) 2007 The Jam Warehouse Software (Pty) Ltd;
  27 + * All Rights Reserved.
34 28 * Contributor( s): ______________________________________
35 29 *
36 30 */
... ... @@ -51,8 +45,8 @@ class PDFGeneratorAction extends KTDocumentAction {
51 45 var $sDisplayName = 'Generate PDF';
52 46 // Note: 'asc' below seems to be a catchall for plain text docs.
53 47 // 'htm' and 'html' should work but are not so have been removed for now.
54   - var $aAcceptedMimeTypes = array('doc', 'ods', 'odt', 'ott', 'txt', 'rtf', 'sxw', 'stw',
55   - // 'html', 'htm',
  48 + var $aAcceptedMimeTypes = array('doc', 'ods', 'odt', 'ott', 'txt', 'rtf', 'sxw', 'stw',
  49 + // 'html', 'htm',
56 50 'xml' , 'pdb', 'psw', 'ods', 'ots', 'sxc',
57 51 'stc', 'dif', 'dbf', 'xls', 'xlt', 'slk', 'csv', 'pxl',
58 52 'odp', 'otp', 'sxi', 'sti', 'ppt', 'pot', 'sxd', 'odg',
... ... @@ -62,7 +56,7 @@ class PDFGeneratorAction extends KTDocumentAction {
62 56 // We need to handle Windows differently - as usual ;)
63 57 if (substr( PHP_OS, 0, 3) == 'WIN') {
64 58 $cmdpath = KT_DIR . "/../openoffice/openoffice/program/python.bat";
65   - $cmdpath = str_replace( '/','\\',$cmdpath);
  59 + $cmdpath = str_replace( '/','\\',$cmdpath);
66 60 } else {
67 61 $cmdpath = "../openoffice/program/python";
68 62 }
... ... @@ -75,9 +69,8 @@ class PDFGeneratorAction extends KTDocumentAction {
75 69 return _kt('Generate PDF') . "&nbsp;<a href=\"" . KTUtil::ktLink( 'action.php', 'ktstandard.pdf.generate', array( "fDocumentId" => $this->oDocument->getId(), "action" => "pdfdownload") ) . "\" <img src='resources/mimetypes/pdf.png' alt='PDF' border=0/></a>";
76 70 }
77 71 }
78   - return _kt('Generate PDF');
79 72 }
80   - return '';
  73 + return 'PDF Generator';
81 74 }
82 75  
83 76 function form_main() {
... ... @@ -123,7 +116,7 @@ class PDFGeneratorAction extends KTDocumentAction {
123 116 $this->do_pdfdownload();
124 117 }
125 118 redirect(KTUtil::ktLink( 'action.php', 'ktstandard.pdf.generate', array( "fDocumentId" => $this->oDocument->getId() ) ) );
126   - exit(0);
  119 + exit(0);
127 120 }
128 121  
129 122 function do_main() {
... ... @@ -168,7 +161,7 @@ class PDFGeneratorAction extends KTDocumentAction {
168 161 /**
169 162 * Method for downloading the document as a pdf.
170 163 *
171   - * @return true on success else false
  164 + * @return true on success else false
172 165 */
173 166 function do_pdfdownload() {
174 167  
... ... @@ -188,7 +181,7 @@ class PDFGeneratorAction extends KTDocumentAction {
188 181 if (substr( PHP_OS, 0, 3) == 'WIN') {
189 182  
190 183 $cmd = "\"" . KT_DIR . "/../openoffice/openoffice/program/python.bat\" \"". KT_DIR . "/bin/openoffice/pdfgen.py\" \"" . $sPath . "\" \"" . $sTempFilename . "\"";
191   - $cmd = str_replace( '/','\\',$cmd);
  184 + $cmd = str_replace( '/','\\',$cmd);
192 185  
193 186 // TODO: Check for more errors here
194 187 // SECURTIY: Ensure $sPath and $sTempFilename are safe or they could be used to excecute arbitrary commands!
... ... @@ -211,7 +204,7 @@ class PDFGeneratorAction extends KTDocumentAction {
211 204  
212 205 }
213 206  
214   - // Check the tempfile exists and the python script did not return anything (which would indicate an error)
  207 + // Check the tempfile exists and the python script did not return anything (which would indicate an error)
215 208 if (file_exists($sTempFilename) && $res == '') {
216 209  
217 210 $sUrlEncodedFileName = substr($oDocument->getFileName(), 0, strrpos($oDocument->getFileName(), '.') );
... ... @@ -231,7 +224,7 @@ class PDFGeneratorAction extends KTDocumentAction {
231 224  
232 225 // HTTP/1.0
233 226 // header("Pragma: no-cache"); // Don't send this header! It breaks IE.
234   -
  227 +
235 228 // Get a filelike object and send it to the browser
236 229 $oFile = new KTFSFileLike($sTempFilename);
237 230 KTFileLikeUtil::send_contents($oFile);
... ... @@ -239,23 +232,23 @@ class PDFGeneratorAction extends KTDocumentAction {
239 232 unlink($sTempFilename);
240 233  
241 234 // Create the document transaction
242   - $oDocumentTransaction = new DocumentTransaction($oDocument, 'Document downloaded as PDF', 'ktcore.transactions.download', $aOptions);
  235 + $oDocumentTransaction = & new DocumentTransaction($oDocument, 'Document downloaded as PDF', 'ktcore.transactions.download', $aOptions);
243 236 $oDocumentTransaction->create();
244 237 // Just stop here - the content has already been sent.
245   - exit(0);
  238 + exit(0);
246 239  
247 240 } else {
248 241 // Set the error messsage and redirect to view document
249   - $this->addErrorMessage(_kt('An error occurred generating the PDF - please contact the system administrator. ' . $res));
  242 + $this->addErrorMessage(_kt('An error occurred generating the PDF - please contact the system administrator.<br>' . $res));
250 243 redirect(generateControllerLink('viewDocument',sprintf(_kt('fDocumentId=%d'),$oDocument->getId())));
251   - exit(0);
  244 + exit(0);
252 245 }
253 246  
254 247 } else {
255 248 // Set the error messsage and redirect to view document
256   - $this->addErrorMessage(_kt('An error occurred generating the PDF - please contact the system administrator. The path to the document did not exist.'));
  249 + $this->addErrorMessage(_kt('An error occurred generating the PDF - please contact the system administrator.<br>The path to the document did not exist.'));
257 250 redirect(generateControllerLink('viewDocument',sprintf(_kt('fDocumentId=%d'),$oDocument->getId())));
258   - exit(0);
  251 + exit(0);
259 252 }
260 253  
261 254  
... ...
plugins/rssplugin/RSSDocumentLinkAction.php
1 1 <?php
2 2 /*
3   - * $Id$
4   - *
5   - * KnowledgeTree Open Source Edition
6   - * Document Management Made Simple
7   - * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
8   - *
9   - * This program is free software; you can redistribute it and/or modify it under
10   - * the terms of the GNU General Public License version 3 as published by the
11   - * Free Software Foundation.
12   - *
13   - * This program is distributed in the hope that it will be useful, but WITHOUT
14   - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15   - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16   - * details.
  3 + * The contents of this file are subject to the KnowledgeTree Public
  4 + * License Version 1.1.2 ("License"); You may not use this file except in
  5 + * compliance with the License. You may obtain a copy of the License at
  6 + * http://www.knowledgetree.com/KPL
17 7 *
18   - * You should have received a copy of the GNU General Public License
19   - * along with this program. If not, see <http://www.gnu.org/licenses/>.
20   - *
21   - * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22   - * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  8 + * Software distributed under the License is distributed on an "AS IS"
  9 + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
  10 + * See the License for the specific language governing rights and
  11 + * limitations under the License.
  12 + *
  13 + * All copies of the Covered Code must include on each user interface screen:
  14 + * (i) the "Powered by KnowledgeTree" logo and
  15 + * (ii) the KnowledgeTree copyright notice
  16 + * in the same form as they appear in the distribution. See the License for
  17 + * requirements.
23 18 *
24   - * The interactive user interfaces in modified source and object code versions
25   - * of this program must display Appropriate Legal Notices, as required under
26   - * Section 5 of the GNU General Public License version 3.
  19 + * The Original Code is: KnowledgeTree Open Source
27 20 *
28   - * In accordance with Section 7(b) of the GNU General Public License version 3,
29   - * these Appropriate Legal Notices must retain the display of the "Powered by
30   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31   - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32   - * must display the words "Powered by KnowledgeTree" and retain the original
33   - * copyright notice.
  21 + * The Initial Developer of the Original Code is The Jam Warehouse Software
  22 + * (Pty) Ltd, trading as KnowledgeTree.
  23 + * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
  24 + * (C) 2007 The Jam Warehouse Software (Pty) Ltd;
  25 + * All Rights Reserved.
34 26 * Contributor( s): ______________________________________
35 27 *
36 28 */
... ... @@ -57,7 +49,7 @@ class RSSDocumentLinkAction extends KTDocumentAction {
57 49  
58 50 // get document id
59 51 if(!isset($oDocument)){
60   - return _kt('RSS');
  52 + return 'RSS';
61 53 }
62 54 $iFId = $oDocument->getID();
63 55  
... ...
resources/js/scheduler.js
... ... @@ -28,6 +28,38 @@ var runOnNext = function(fId, sUrl) {
28 28 var transaction = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, "fId="+fId);
29 29 }
30 30  
  31 +//<!-- Enable / disable the task -->
  32 +var toggleStatus = function(fId, sUrl, sDisableText, sEnableText) {
  33 +
  34 + var statusLink = document.getElementById('statusLink'+fId);
  35 + var freqLink = document.getElementById('freqLink'+fId);
  36 + var runnowLink = document.getElementById('runnowLink'+fId);
  37 + var freqDrop = document.getElementById('freqDrop'+fId);
  38 + var fontClass = document.getElementById('font'+fId);
  39 + var freqDiv = document.getElementById('div'+fId);
  40 +
  41 + var callback = {
  42 + success: function(o) {
  43 + if(statusLink.innerHTML == sDisableText){
  44 + statusLink.innerHTML = sEnableText;
  45 + freqLink.style.visibility = "hidden";
  46 + runnowLink.style.visibility = "hidden";
  47 + freqDrop.style.visibility = "hidden";
  48 + fontClass.className = 'descriptiveText';
  49 + freqDiv.style.display = "none";
  50 + }else{
  51 + statusLink.innerHTML = sDisableText;
  52 + freqLink.style.visibility = "visible";
  53 + runnowLink.style.visibility = "visible";
  54 + freqDrop.style.visibility = "visible";
  55 + freqDiv.style.display = "block";
  56 + fontClass.className = '';
  57 + }
  58 + }
  59 + }
  60 + var transaction = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, "fId="+fId);
  61 +}
  62 +
31 63 var showFrequencyDiv = function(fId) {
32 64 var formDiv = document.getElementById('formDiv');
33 65 var fInput = document.getElementById('fId');
... ...
sql/mysql/install/data.sql
No preview for this file type
sql/mysql/install/structure.sql
... ... @@ -1319,6 +1319,7 @@ CREATE TABLE `scheduler_tasks` (
1319 1319 `run_time` datetime default NULL,
1320 1320 `previous_run_time` datetime default NULL,
1321 1321 `run_duration` float default NULL,
  1322 + `status` ENUM('enabled', 'disabled', 'system') NOT NULL DEFAULT 'disabled',
1322 1323 PRIMARY KEY (`id`),
1323 1324 UNIQUE KEY `task` (`task`)
1324 1325 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
... ...
templates/ktcore/dashlets/scheduler.smarty
... ... @@ -5,7 +5,7 @@
5 5 {else}
6 6 <span class="descriptiveText">{i18n}No tasks have been run yet.{/i18n}</span>
7 7 {/if}
8   -&nbsp;<span><a href="{$sAdmin}">Administration page</a></span>
  8 +&nbsp;<span class="descriptiveText">{i18n arg_link=$sAdminLink}This can be configured via the #link#.{/i18n}</span>
9 9  
10 10 <p>
11 11 {if !$lasttime}
... ...
templates/ktcore/scheduler.smarty
... ... @@ -28,15 +28,13 @@
28 28  
29 29 <tr class="{cycle name=rows values=",odd"}">
30 30 <td width='2%'>
31   - {$i++}
  31 + {$i++}
32 32 </td>
33 33 <td>
34   - {$task->getTask()}
  34 + {$task->getTaskDiv()}
35 35 </td>
36   - <td id="tblCol"><a href="#" onclick="javascript: showFrequencyDiv('{$task->getId()}');">
37   - <div id="div{$task->getId()}">
38   - {$task->getFrequencyByLang()}
39   - </div></a>
  36 + <td id="tblCol">
  37 + {$task->getFreqDiv()}
40 38 </td>
41 39 <td>
42 40 <div id="runDiv{$task->getId()}">
... ... @@ -49,11 +47,11 @@
49 47 </div>
50 48 {$task->getPrevious(TRUE)}
51 49 </td>
52   - <td>
  50 + <td width="10%">
53 51 {$task->getRunDuration()}
54 52 </td>
55 53 <td>
56   - {$task->getAlterFreqLink()}&nbsp;&nbsp;{$task->getRunNowLink()}
  54 + {$task->getAlterFreqLink()}&nbsp;&nbsp;{$task->getRunNowLink()}&nbsp;&nbsp;{$task->getStatusLink()}
57 55 </td>
58 56 </tr>
59 57  
... ... @@ -70,7 +68,7 @@
70 68  
71 69 <div id="formDiv" style="display: none; visibility: hidden;">
72 70 <form name="changefreq" id="changefreq" method="post" action="{$sUrl}">
73   -
  71 +
74 72 <select name="frequency" id="frequency">
75 73 {html_options options=$aFrequencies}
76 74 </select>
... ...