Commit 3ac5770a361ce5dc4713759bd60a48d4f99e20a9

Authored by Neil Blakey-Milner
1 parent 65c7b895

Remove vestiges of the old permissions and routing system.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4030 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/DependantDocumentInstance.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Represents a dependant document instance as per the database table dependant_document_instance.
6   - * Used to chain documents together in the collaboration process/
7   - *
8   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
9   - *
10   - * This program is free software; you can redistribute it and/or modify
11   - * it under the terms of the GNU General Public License as published by
12   - * the Free Software Foundation; either version 2 of the License, or
13   - * (at your option) any later version.
14   - *
15   - * This program is distributed in the hope that it will be useful,
16   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18   - * GNU General Public License for more details.
19   - *
20   - * You should have received a copy of the GNU General Public License
21   - * along with this program; if not, write to the Free Software
22   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23   - *
24   - * @version $Revision$
25   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
26   - * @package lib.documentmanagement
27   - */
28   -class DependantDocumentInstance extends KTEntity {
29   -
30   - /** primary key value */
31   - var $iId;
32   - /** primary key of user responsible for creating document */
33   - var $iUserID;
34   - /** document title name */
35   - var $sDocumentTitle;
36   - /** primary key of document to use as template */
37   - var $iTemplateDocumentID;
38   - /** parent document to which this document will be linked */
39   - var $iParentDocumentID;
40   -
41   - /**
42   - * Default constructor
43   - *
44   - * @param Name of document field
45   - * @param Document field data type
46   - *
47   - */
48   - function DependantDocumentInstance($sNewDocumentTitle, $iNewUserID, $iNewTemplateDocumentID, $iNewParentDocumentID) {
49   - //object not created yet
50   - global $default;
51   - $this->iId = -1;
52   - $this->sDocumentTitle = $sNewDocumentTitle;
53   - $this->iUserID = $iNewUserID;
54   - $this->iTemplateDocumentID = $iNewTemplateDocumentID;
55   - $this->iParentDocumentID = $iNewParentDocumentID;
56   - }
57   -
58   - /**
59   - * Get the document field's primary key value
60   - *
61   - * @return int document field's primary key value
62   - *
63   - */
64   - function getID() {
65   - return $this->iId;
66   - }
67   -
68   - /**
69   - * Get the primary key of the user responsbile for new document creation
70   - */
71   - function getUserID() {
72   - return $this->iUserID;
73   - }
74   -
75   - /**
76   - * Set the document field's name
77   - *
78   - * @param Document field's new name
79   - *
80   - */
81   - function setDocumentTitle($sNewValue) {
82   - $this->sDocumentTitle = $sNewValue;
83   - }
84   -
85   - /**
86   - * Get the depedant document's title
87   - *
88   - * @return String dependant document's title *
89   - */
90   - function getDocumentTitle() {
91   - return $this->sDocumentTitle;
92   - }
93   -
94   -
95   - /**
96   - * Get the primary key of the template document
97   - *
98   - * @return int Primary key of template document
99   - *
100   - */
101   - function getTemplateDocumentID() {
102   - return $this->iTemplateDocumentID;
103   - }
104   -
105   - /**
106   - * Set the template document's primary key
107   - *
108   - * @param Template document's primary key
109   - *
110   - */
111   - function setHasLookup($sNewValue) {
112   - $this->iTemplateDocumentID = $sNewValue;
113   - }
114   -
115   - function getParentDocumentID() {
116   - return $this->iParentDocumentID;
117   - }
118   -
119   - function _fieldValues () {
120   - return array(
121   - 'document_title' => $this->sDocumentTitle,
122   - 'user_id' => $this->iUserID,
123   - 'template_document_id' => $this->iTemplateDocumentID,
124   - 'parent_document_id' => $this->iParentDocumentID,
125   - );
126   - }
127   -
128   - function _table () {
129   - global $default;
130   - return $default->dependant_document_instance_table;
131   - }
132   -
133   - /**
134   - * Static function.
135   - * Given a dependant_documents primary key it will create a
136   - * DependantDocument object and populate it with the
137   - * corresponding database values
138   - *
139   - * @return DependantDocument populated DependantDocument object on successful query, false otherwise and set $_SESSION["errorMessage"]
140   - */
141   - function & get($iDependantDocumentID) {
142   - global $default;
143   - $sql = $default->db;
144   - $result = $sql->query(array("SELECT * FROM $default->dependant_document_instance_table WHERE id = ?", $iDependantDocumentID));/*ok*/
145   - if ($result) {
146   - if ($sql->next_record()) {
147   - $oDependantDocument = & new DependantDocumentInstance($sql->f("document_title"), $sql->f("user_id"), $sql->f("template_document_id"), $sql->f("parent_document_id"));
148   - $oDependantDocument->iId = $sql->f("id");
149   - return $oDependantDocument;
150   - }
151   - $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->dependant_document_instance_table";
152   - return false;
153   - }
154   - $_SESSION["errorMessage"] = $lang_err_database;
155   - return false;
156   - }
157   -}
158   -
159   -?>
lib/documentmanagement/DependantDocumentTemplate.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Represents a dependant document template as per the database table dependant_document_template.
6   - * Used to chain documents together in the collaboration process.
7   - *
8   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
9   - *
10   - * This program is free software; you can redistribute it and/or modify
11   - * it under the terms of the GNU General Public License as published by
12   - * the Free Software Foundation; either version 2 of the License, or
13   - * (at your option) any later version.
14   - *
15   - * This program is distributed in the hope that it will be useful,
16   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18   - * GNU General Public License for more details.
19   - *
20   - * You should have received a copy of the GNU General Public License
21   - * along with this program; if not, write to the Free Software
22   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23   - *
24   - * @version $Revision$
25   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
26   - * @package lib.documentmanagement
27   - */
28   -class DependantDocumentTemplate extends KTEntity {
29   -
30   - /** primary key value */
31   - var $iId;
32   - /** primary key of user responsible for creating document */
33   - var $iDefaultUserID;
34   - /** document title name */
35   - var $sDocumentTitle;
36   - /** primary key of document to use as template */
37   - var $iTemplateDocumentID;
38   - /** primary key of folder collaboration step that template belongs to */
39   - var $iGroupFolderApprovalLinkID;
40   -
41   - /**
42   - * Default constructor
43   - *
44   - * @param Name of document field
45   - * @param Document field data type
46   - *
47   - */
48   - function DependantDocumentTemplate($sNewDocumentTitle, $iNewDefaultUserID, $iNewGroupFolderApprovalLinkID, $iNewTemplateDocumentID = null) {
49   - //object not created yet
50   - global $default;
51   - $this->iId = -1;
52   - $this->sDocumentTitle = $sNewDocumentTitle;
53   - $this->iDefaultUserID = $iNewDefaultUserID;
54   - $this->iTemplateDocumentID = $iNewTemplateDocumentID;
55   - $this->iGroupFolderApprovalLinkID = $iNewGroupFolderApprovalLinkID;
56   - }
57   -
58   - /**
59   - * Get the document field's primary key value
60   - *
61   - * @return int document field's primary key value
62   - *
63   - */
64   - function getID() {
65   - return $this->iId;
66   - }
67   -
68   - /**
69   - * Get the primary key of the user responsbile for new document creation
70   - */
71   - function getDefaultUserID() {
72   - return $this->iDefaultUserID;
73   - }
74   -
75   - function setDefaultUserID($iNewValue) {
76   - $this->iDefaultUserID = $iNewValue;
77   - }
78   -
79   - /**
80   - * Set the document field's name
81   - *
82   - * @param Document field's new name
83   - *
84   - */
85   - function setDocumentTitle($sNewValue) {
86   - $this->sDocumentTitle = $sNewValue;
87   - }
88   -
89   - /**
90   - * Get the depedant document's title
91   - *
92   - * @return String dependant document's title *
93   - */
94   - function getDocumentTitle() {
95   - return $this->sDocumentTitle;
96   - }
97   -
98   -
99   - /**
100   - * Get the primary key of the template document
101   - *
102   - * @return int Primary key of template document
103   - *
104   - */
105   - function getTemplateDocumentID() {
106   - return $this->iTemplateDocumentID;
107   - }
108   -
109   - /**
110   - * Set the template document's primary key
111   - *
112   - * @param Template document's primary key
113   - *
114   - */
115   - function setTemplateDocumentID($iNewValue) {
116   - $this->iTemplateDocumentID = $iNewValue;
117   - }
118   -
119   - function getGroupFolderApprovalLinkID() {
120   - return $this->iGroupFolderApprovalLinkID;
121   - }
122   -
123   - function setGroupFolderApprovalLinkID($iNewValue) {
124   - $this->iGroupFolderApprovalLinkID = $iNewValue;
125   - }
126   -
127   - function _fieldValues () {
128   - return array(
129   - 'document_title' => $this->sDocumentTitle,
130   - 'default_user_id' => $this->iDefaultUserID,
131   - 'template_document_id' => $this->iTemplateDocumentID,
132   - 'group_folder_approval_link_id' => $this->iGroupFolderApprovalLinkID,
133   - );
134   - }
135   -
136   - function _table () {
137   - global $default;
138   - return $default->dependant_document_template_table;
139   - }
140   -
141   - /**
142   - * Static function.
143   - * Given a dependant_documents primary key it will create a
144   - * DependantDocument object and populate it with the
145   - * corresponding database values
146   - *
147   - * @return DependantDocument populated DependantDocument object on successful query, false otherwise and set $_SESSION["errorMessage"]
148   - */
149   - function & get($iDependantDocumentID) {
150   - global $default;
151   - $sql = $default->db;
152   - $result = $sql->query(array("SELECT * FROM $default->dependant_document_template_table WHERE id = ?", $iDependantDocumentID));/*ok*/
153   - if ($result) {
154   - if ($sql->next_record()) {
155   - $DependantDocumentTemplate = & new DependantDocumentTemplate($sql->f("document_title"), $sql->f("default_user_id"), $sql->f("group_folder_approval_link_id"), $sql->f("template_document_id"));
156   - $DependantDocumentTemplate->iId = $sql->f("id");
157   - /*if (!($sql->f("template_document_id") == null)) {
158   - $DependantDocumentTemplate->setTemplateDocumentID($sql->f("template_document_id"));
159   - }*/
160   - return $DependantDocumentTemplate;
161   - }
162   - return false;
163   - }
164   - return false;
165   - }
166   -
167   - /**
168   - * Static function
169   - * Get a list of DependantDocumentTemplate
170   - *
171   - * @param String Where clause (not required)
172   - *
173   - * @return Array array of DependantDocumentTemplates objects, false otherwise and set $_SESSION["errorMessage"]
174   - */
175   - function getList($sWhereClause = null) {
176   - return KTEntityUtil::getList(DependantDocumentTemplate::_table(), 'DependantDocumentTemplate', $sWhereClause);
177   - }
178   -}
179   -
180   -?>
lib/foldermanagement/FolderCollaboration.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Represents the group_folders_approval_link table in the db used to map out a
6   - * document approval process.
7   - *
8   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
9   - *
10   - * This program is free software; you can redistribute it and/or modify
11   - * it under the terms of the GNU General Public License as published by
12   - * the Free Software Foundation; either version 2 of the License, or
13   - * (at your option) any later version.
14   - *
15   - * This program is distributed in the hope that it will be useful,
16   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18   - * GNU General Public License for more details.
19   - *
20   - * You should have received a copy of the GNU General Public License
21   - * along with this program; if not, write to the Free Software
22   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23   - *
24   - * @version $Revision$
25   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
26   - * @package lib.foldermanagement
27   - */
28   -class FolderCollaboration extends KTEntity {
29   -
30   - /** primary key of current object */
31   - var $iId;
32   - /** primary key of folder */
33   - var $iFolderID;
34   - /** primary key of group from which user can be assigned*/
35   - var $iGroupID;
36   - /** primary key of default user */
37   - var $iUserID;
38   - /** sequence number of this step in the process*/
39   - var $iSequenceNumber;
40   - /** primary key of role use will perform */
41   - var $iRoleID;
42   -
43   - function FolderCollaboration($iNewFolderID, $iNewGroupID, $iNewSequenceNumber, $iNewRoleID, $iNewUserID) {
44   - //object not created in database yet
45   - $this->iId = -1;
46   - $this->iFolderID = $iNewFolderID;
47   - $this->iGroupID = $iNewGroupID;
48   - $this->iSequenceNumber = $iNewSequenceNumber;
49   - $this->iRoleID = $iNewRoleID;
50   - $this->iUserID = $iNewUserID;
51   - }
52   -
53   - function getID() {
54   - return $this->iId;
55   - }
56   -
57   - function getFolderID() {
58   - return $this->iFolderID;
59   - }
60   -
61   - function setFolderID($iNewValue) {
62   - $this->iFolderID = $iNewValue;
63   - }
64   -
65   - function getGroupID() {
66   - return $this->iGroupID;
67   - }
68   -
69   - function setGroupID($iNewValue) {
70   - $this->iGroupID = $iNewValue;
71   - }
72   -
73   - function getSequenceNumber() {
74   - return $this->iSequenceNumber;
75   - }
76   -
77   - function setSequenceNumber($iNewValue) {
78   - $this->iSequenceNumber = $iNewValue;
79   - }
80   -
81   - function getRoleID() {
82   - return $this->iRoleID;
83   - }
84   -
85   - function setRoleID($iNewValue) {
86   - $this->iRoleID = $iNewValue;
87   - }
88   -
89   - function getUserID() {
90   - return $this->iUserID;
91   - }
92   -
93   - function setUserID($iNewValue) {
94   - $this->iUserID = $iNewValue;
95   - }
96   -
97   - function _fieldValues () {
98   - return array(
99   - 'folder_id' => $this->iFolderID,
100   - 'group_id' => $this->iGroupID,
101   - 'precedence' => $this->iSequenceNumber,
102   - 'role_id' => $this->iRoleID,
103   - 'user_id' => $this->iUserID,
104   - );
105   - }
106   -
107   - function _table () {
108   - global $default;
109   - return $default->groups_folders_approval_table;
110   - }
111   -
112   - /**
113   - * Checks whether there is a document which is currently
114   - * going through this folder collaboration process
115   - *
116   - * return boolean true if there is a document currently going through this process, false otherwise
117   - */
118   - function hasDocumentInProcess() {
119   - global $default;
120   - $sQuery = "SELECT FURL.id " ./*ok*/
121   - "FROM $default->groups_folders_approval_table AS GFAL INNER JOIN documents AS D ON GFAL.folder_id = D.folder_id " .
122   - "INNER JOIN $default->folders_user_roles_table AS FURL ON FURL.document_id = D.id " .
123   - "WHERE GFAL.id = ? " .
124   - "AND FURL.active != 0";
125   - $aParams = array($this->iId);
126   - $sql = $default->db;
127   - $sql->query(array($sQuery, $aParams));
128   - return $sql->next_record();
129   -
130   - }
131   -
132   - /**
133   - * Static function.
134   - * Given a web_documents primary key it will create a
135   - * FolderCollaboration object and populate it with the
136   - * corresponding database values
137   - *
138   - * @return FolderCollaboration populated FolderCollaboration object on successful query, false otherwise and set $_SESSION["errorMessage"]
139   - */
140   - function & get($iFolderCollaborationID) {
141   - global $default;
142   - $sql = $default->db;
143   - $result = $sql->query(array("SELECT * FROM $default->groups_folders_approval_table WHERE id = ?", $iFolderCollaborationID));/*ok*/
144   - if ($result) {
145   - if ($sql->next_record()) {
146   - $oFolderCollaboration = & new FolderCollaboration($sql->f("folder_id"), $sql->f("group_id"), $sql->f("precedence"), $sql->f("role_id"), $sql->f("user_id"));
147   - $oFolderCollaboration->iId = $iFolderCollaborationID;
148   - return $oFolderCollaboration;
149   - }
150   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iFolderCollaborationID . " table = $default->groups_folders_approval_table";
151   - return false;
152   - }
153   - $_SESSION["errorMessage"] = $lang_err_database;
154   - return false;
155   - }
156   -
157   -/**
158   - * Static function
159   - * Get a list of folder collaborations
160   - *
161   - * @param String Where clause (not required)
162   - *
163   - * @return Array array of FolderCollaboration objects, false otherwise and set $_SESSION["errorMessage"]
164   - */
165   - function getList($sWhereClause = null) {
166   - return KTEntityUtil::getList(FolderCollaboration::_table(), 'FolderCollaboration', $sWhereClause);
167   - }
168   -
169   - /**
170   - * Checks whether all the FolderCollaboration objects have the default user set
171   - *
172   - * @param array folder collaboration information for a specific document
173   - * @return true if all default users are set, false otherwise
174   - */
175   - function defaultUsersAssigned($aFolderCollaboration) {
176   - $bUsersSet = true;
177   - for ($i=0; $i<count($aFolderCollaboration); $i++) {
178   - $bUsersSet = $bUsersSet && $aFolderCollaboration[$i]->getUserID();
179   - }
180   - return $bUsersSet;
181   - }
182   -}
183   -?>
lib/foldermanagement/FolderUserRole.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Class that represents a link between users, folders and roles as per the
6   - * folders_users_roles_link table.
7   - *
8   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
9   - *
10   - * This program is free software; you can redistribute it and/or modify
11   - * it under the terms of the GNU General Public License as published by
12   - * the Free Software Foundation; either version 2 of the License, or
13   - * (at your option) any later version.
14   - *
15   - * This program is distributed in the hope that it will be useful,
16   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18   - * GNU General Public License for more details.
19   - *
20   - * You should have received a copy of the GNU General Public License
21   - * along with this program; if not, write to the Free Software
22   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23   - *
24   - * @version $Revision$
25   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
26   - * @package lib.foldermanagement
27   - */
28   -class FolderUserRole extends KTEntity {
29   -
30   - var $iId;
31   - var $iUserID;
32   - var $iDocumentID;
33   - var $iGroupFolderApprovalID;
34   - var $dDateTime;
35   - var $bDone;
36   - var $bActive;
37   - var $bDependantDocumentsCreated;
38   -
39   - function FolderUserRole($iNewUserID, $iNewDocumentID, $iNewGroupFolderApprovalID, $bNewDone = false, $bNewActive = false, $bNewDependantDocumentsCreated = false) {
40   - $this->iId = -1;
41   - $this->iUserID = $iNewUserID;
42   - $this->iDocumentID = $iNewDocumentID;
43   - $this->iGroupFolderApprovalID = $iNewGroupFolderApprovalID;
44   - $this->dDateTime = getCurrentDateTime();
45   - $this->bDone = $bNewDone;
46   - $this->bActive = $bNewActive;
47   - $this->bDependantDocumentsCreated = $bNewDependantDocumentsCreated;
48   - }
49   -
50   - function getID() {
51   - return $this->iId;
52   - }
53   -
54   - function getUserID() {
55   - return $this->iUserID;
56   - }
57   -
58   - function setUserID($iNewValue) {
59   - $this->iUserID = $iNewValue;
60   - }
61   -
62   - function getDocumentID() {
63   - return $this->iDocumentID;
64   - }
65   -
66   - function setDocumentID($iNewValue) {
67   - $this->iDocumentID = $iNewValue;
68   - }
69   -
70   - function getGroupFolderApprovalID() {
71   - return $this->iGroupFolderApprovalID;
72   - }
73   -
74   - function setGroupFolderApprovalID($iNewValue) {
75   - $this->iGroupFolderApprovalID = $iNewValue;
76   - }
77   -
78   - function getDateTime() {
79   - return $this->dDateTime;
80   - }
81   -
82   - function setDateTime($dNewValue) {
83   - $this->dDateTime = $dNewValue;
84   - }
85   -
86   - function getDone() {
87   - return $this->bDone;
88   - }
89   -
90   - function setDone($bNewValue) {
91   - $this->bDone = $bNewValue;
92   - }
93   -
94   - function getActive() {
95   - return $this->bActive;
96   - }
97   -
98   - function setActive($bNewValue) {
99   - $this->bActive = $bNewValue;
100   - }
101   -
102   - function setDependantDocumentsCreated($bNewValue) {
103   - $this->bDependantDocumentsCreated = $bNewValue;
104   - }
105   -
106   - function getDependantDocumentsCreated() {
107   - return $this->bDependantDocumentsCreated;
108   -
109   - }
110   -
111   - function _fieldValues () {
112   - return array(
113   - 'user_id' => $this->iUserID,
114   - 'document_id' => $this->iDocumentID,
115   - 'group_folder_approval_id' => $this->iGroupFolderApprovalID,
116   - 'datetime' => $this->dDateTime,
117   - 'done' => $this->bDone,
118   - 'active' => KTUtil::anyToBool($this->bActive),
119   - 'dependant_documents_created' => $this->bDependantDocumentsCreated,
120   - );
121   - }
122   -
123   - function _table () {
124   - global $default;
125   - return $default->folders_user_roles_table;
126   - }
127   -
128   - /**
129   - * Static function.
130   - * Given a folders_users_roles_link primary key it will create a
131   - * FolderUserRole object and populate it with the
132   - * corresponding database values
133   - *
134   - * @return FolderUserRole populated FolderUserRole object on successful query, false otherwise and set $_SESSION["errorMessage"]
135   - */
136   - function & get($iFolderUserRoleID) {
137   - global $default;
138   - $sql = $default->db;
139   - $result = $sql->query(array("SELECT * FROM $default->folders_user_roles_table WHERE id = ?", $iFolderUserRoleID));/*ok*/
140   - if ($result) {
141   - if ($sql->next_record()) {
142   - $oFolderUserRole = & new FolderUserRole($sql->f("user_id"), $sql->f("document_id"), $sql->f("group_folder_approval_id"), $sql->f("done"), $sql->f("active"), $sql->f("dependant_documents_created"));
143   - $oFolderUserRole->iId = $iFolderUserRoleID;
144   - $oFolderUserRole->bDateTime = $sql->f("datetime");
145   -
146   - return $oFolderUserRole;
147   - }
148   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iFolderUserRoleID . " table = $default->folders_user_roles_table";
149   - return false;
150   - }
151   - $_SESSION["errorMessage"] = $lang_err_database;
152   - return false;
153   - }
154   -
155   -/**
156   - * Static function
157   - * Get a list of FolderUserRoles
158   - *
159   - * @param String Where clause (not required)
160   - *
161   - * @return Array array of FolderUserRole objects, false otherwise and set $_SESSION["errorMessage"]
162   - */
163   - function getList($sWhereClause = null) {
164   - return KTEntityUtil::getList(FolderUserRole::_table(), 'FolderUserRole', $sWhereClause);
165   - }
166   -
167   - function & getFromFolderCollaboration($iFolderCollaborationID, $iDocumentID) {
168   - global $default, $lang_err_database;
169   - $sql = $default->db;
170   - $sQuery = "SELECT id FROM $default->folders_user_roles_table WHERE group_folder_approval_id = ? AND document_id = ?";/*ok*/
171   - $aParams = array($iFolderCollaborationID, $iDocumentID);
172   - $sql->query(array($sQuery, $aParams));
173   - if ($sql->next_record()) {
174   - return FolderUserRole::get($sql->f("id"));
175   - }
176   - return false;
177   - }
178   -
179   - /** Creates default folder user roles from
180   - * information obtained at the folder level where folder
181   - * collaboratio is created
182   - */
183   - function createDefaultFolderUserRoles($oDocument) {
184   - global $default;
185   - $sQuery = "SELECT GFAL.id, GFAL.user_id " ./*ok*/
186   - "FROM folders_users_roles_link AS FURL RIGHT OUTER JOIN groups_folders_approval_link AS GFAL ON FURL.group_folder_approval_id = GFAL.id AND group_folder_approval_id = NULL " .
187   - "WHERE GFAL.folder_id = ?";
188   - $aParams = array($oDocument->getFolderID());
189   - $sql = $default->db;
190   - $sql->query(array($sQuery, $aParams));
191   - while ($sql->next_record()) {
192   - $oFolderUserRole = & new FolderUserRole($sql->f("user_id"), $oDocument->getID(), $sql->f("id"));
193   - $oFolderUserRole->create();
194   - }
195   - }
196   -}
197   -?>
lib/groups/GroupFolderApprovalLink.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Represents a group/folder/approval link as per the groups_folders_approval_link.
6   - * Used to set the approval workflow for a document
7   - * The precedence_id determines the order of the workflow.
8   - *
9   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
10   - *
11   - * This program is free software; you can redistribute it and/or modify
12   - * it under the terms of the GNU General Public License as published by
13   - * the Free Software Foundation; either version 2 of the License, or
14   - * (at your option) any later version.
15   - *
16   - * This program is distributed in the hope that it will be useful,
17   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
18   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19   - * GNU General Public License for more details.
20   - *
21   - * You should have received a copy of the GNU General Public License
22   - * along with this program; if not, write to the Free Software
23   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24   - *
25   - * @version $Revision$
26   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
27   - * @package lib.groups
28   - */
29   -class GroupFolderApprovalLink extends KTEntity {
30   -
31   - /** primary key of object */
32   - var $iId;
33   - /** primary key of folder to which role is assigned */
34   - var $iFolderID;
35   - /** primary key of group to which role is assigned */
36   - var $iGroupID;
37   - /** link precedence (1 = highest) */
38   - var $iPrecedence;
39   - /** primary key of role assigned to group */
40   - var $iRoleID;
41   -
42   - function GroupFolderApprovalLink($iNewFolderID, $iNewGroupID, $iNewPrecedence, $iNewRoleID) {
43   - //object not created in database yet
44   - $this->iId = -1;
45   - $this->iFolderID = $iNewFolderID;
46   - $this->iGroupID = $iNewGroupID;
47   - $this->iPrecedence = $iNewPrecedence;
48   - $this->iRoleID = $iNewRoleID;
49   - }
50   -
51   - /**
52   - * Get the object's primary key
53   - *
54   - * @return int object's primary key
55   - *
56   - */
57   - function getID() {
58   - return $this->iId;
59   - }
60   -
61   - /**
62   - * Get the primary key of the folder to which the group is assigned
63   - *
64   - * @return int primary key of folder to which the group is assigned
65   - *
66   - */
67   - function getFolderID() {
68   - return $this->iFolderID;
69   - }
70   -
71   - /**
72   - * Set the primary key of the folder to which the group is assigned
73   - *
74   - * @param int Primary key of folder to which the group is assigned
75   - *
76   - */
77   - function setFolderID($iNewValue) {
78   - $this->iFolderID = $iNewValue;
79   - }
80   -
81   - /**
82   - * Get the primary key of the group to which the role is assigned
83   - *
84   - * @return int primary key of group to which the role is assigned
85   - *
86   - */
87   - function getGroupID() {
88   - return $this->iGroupID;
89   - }
90   -
91   - /**
92   - * Set the primary key of the group to which the role is assigned
93   - *
94   - * @param int Primary key of group to which the role is assigned
95   - *
96   - */
97   - function setGroupID($iNewValue) {
98   - $this->iGroupID = $iNewValue;
99   - }
100   -
101   - /**
102   - * Get the precedence order for the GroupApprovalLink
103   - *
104   - * @return int precedence order for the GroupApprovalLink
105   - *
106   - */
107   - function getPrecedence() {
108   - return $this->iPrecedence;
109   - }
110   -
111   - /**
112   - * Set the precedence order for the GroupApprovalLink
113   - *
114   - * @param int Precedence order for the GroupApprovalLink
115   - *
116   - */
117   - function setPrecedence($iNewValue) {
118   - $this->iPrecedence = $iNewValue;
119   - }
120   -
121   - /**
122   - * Get the primary key of the role assigned to the group
123   - *
124   - * @return int primary key of role assigned to group
125   - *
126   - */
127   - function getRoleID() {
128   - return $this->iRoleID;
129   - }
130   -
131   - /**
132   - * Set the primary key of the role assigned to the group
133   - *
134   - * @param int Primary key of role assigned to the group
135   - *
136   - */
137   - function setRoleID($iNewValue) {
138   - $this->iRoleID = $iNewValue;
139   - }
140   -
141   - function _fieldValues () {
142   - return array(
143   - 'folder_id' => $this->iFolderID,
144   - 'group_id' => $this->iGroupID,
145   - 'precedence' => $this->iPrecedence,
146   - 'role_id' => $this->iRoleID,
147   - );
148   - }
149   -
150   - function _table () {
151   - global $default;
152   - return $default->groups_folders_approval_table;
153   - }
154   -
155   - /**
156   - * Static function.
157   - * Given a web_documents primary key it will create a
158   - * GroupFolderApprovalLink object and populate it with the
159   - * corresponding database values
160   - *
161   - * @return GroupFolderApprovalLink populated GroupFolderApprovalLink object on successful query, false otherwise and set $_SESSION["errorMessage"]
162   - */
163   - function & get($iGroupFolderLinkID) {
164   - global $default;
165   - $sql = $default->db;
166   - $result = $sql->query(array("SELECT * FROM $default->groups_folders_approval_table WHERE id = ?", $iGroupFolderLinkID));/*ok*/
167   - if ($result) {
168   - if ($sql->next_record()) {
169   - $oGroupFolderApprovalLink = & new GroupFolderApprovalLink($sql->f("folder_id"), $sql->f("group_id"), $sql->f("precedence"), $sql->f("role_id"), $sql->f("datetime"));
170   - $oGroupFolderApprovalLink->iId = $iGroupFolderLinkID;
171   - return $oGroupFolderApprovalLink;
172   - }
173   -
174   - return false;
175   - }
176   - $_SESSION["errorMessage"] = $lang_err_database;
177   - return false;
178   - }
179   -
180   -/**
181   - * Static function
182   - * Get a list of groups_folders_approval_link
183   - *
184   - * @param String Where clause (not required)
185   - *
186   - * @return Array array of GroupFolderApprovalLink objects, false otherwise and set $_SESSION["errorMessage"]
187   - */
188   - function getList($sWhereClause = null) {
189   - return KTEntityUtil::getList(GroupFolderApprovalLink::_table(), 'GroupFolderApprovalLink', $sWhereClause);
190   - }
191   -
192   -}
193   -?>
lib/groups/GroupFolderLink.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Represents the group_folders_link table in the db used to represent
6   - * folder access.
7   - *
8   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
9   - *
10   - * This program is free software; you can redistribute it and/or modify
11   - * it under the terms of the GNU General Public License as published by
12   - * the Free Software Foundation; either version 2 of the License, or
13   - * (at your option) any later version.
14   - *
15   - * This program is distributed in the hope that it will be useful,
16   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18   - * GNU General Public License for more details.
19   - *
20   - * You should have received a copy of the GNU General Public License
21   - * along with this program; if not, write to the Free Software
22   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23   - *
24   - * @version $Revision$
25   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
26   - * @package lib.groups
27   - */
28   -class GroupFolderLink extends KTEntity {
29   -
30   - /** primary key of current object */
31   - var $iId;
32   - /** primary key of folder */
33   - var $iFolderID;
34   - /** primary key of group from which user can be assigned */
35   - var $iGroupID;
36   - /** read access */
37   - var $bCanRead;
38   - /** write access */
39   - var $bCanWrite;
40   -
41   - function GroupFolderLink($iNewFolderID, $iNewGroupID, $iNewCanRead, $iNewCanWrite) {
42   - //object not created in database yet
43   - $this->iId = -1;
44   - $this->iFolderID = $iNewFolderID;
45   - $this->iGroupID = $iNewGroupID;
46   - $this->bCanRead = $iNewCanRead;
47   - $this->bCanWrite = $iNewCanWrite;
48   - }
49   -
50   - function getID() {
51   - return $this->iId;
52   - }
53   -
54   - function getFolderID() {
55   - return $this->iFolderID;
56   - }
57   -
58   - function setFolderID($iNewValue) {
59   - $this->iFolderID = $iNewValue;
60   - }
61   -
62   - function getGroupID() {
63   - return $this->iGroupID;
64   - }
65   -
66   - function setGroupID($iNewValue) {
67   - $this->iGroupID = $iNewValue;
68   - }
69   -
70   - function getCanRead() {
71   - return $this->bCanRead;
72   - }
73   -
74   - function setCanRead($bNewValue) {
75   - $this->bCanRead = $bNewValue;
76   - }
77   -
78   - function getCanWrite() {
79   - return $this->bCanWrite;
80   - }
81   -
82   - function setCanWrite($iNewValue) {
83   - $this->bCanWrite = $iNewValue;
84   - }
85   -
86   - function _fieldValues () {
87   - return array(
88   - 'folder_id' => $this->iFolderID,
89   - 'group_id' => $this->iGroupID,
90   - 'can_read' => KTUtil::anyToBool($this->bCanRead),
91   - 'can_write' => KTUtil::anyToBool($this->bCanWrite),
92   - );
93   - }
94   -
95   - function _table () {
96   - global $default;
97   - return $default->groups_folders_table;
98   - }
99   -
100   - /**
101   - * Whether the folder permission exists in the database
102   - */
103   - function exists() {
104   - global $default;
105   - $sql = $default->db;
106   - $sQuery = "SELECT count(*) AS count FROM $default->groups_folders_table WHERE folder_id = ? AND group_id = ?";/*ok*/
107   - $aParams = array($this->iFolderID, $this->iGroupID);
108   - if ($sql->query(array($sQuery, $aParams))) {
109   - $sql->next_record();
110   - return ($sql->f("count") > 0) ? true : false;
111   - } else {
112   - $_SESSION["errorMessage"] = $lang_err_database;
113   - return false;
114   - }
115   - }
116   -
117   - /**
118   - * Static function.
119   - * Given a primary key it will create a FolderAccess object and populate it with the
120   - * corresponding database values
121   - *
122   - * @return FolderAccess populated FolderAccess object on successful query, false otherwise and set $_SESSION["errorMessage"]
123   - */
124   - function & get($iGroupFolderID) {
125   - global $default;
126   - $sql = $default->db;
127   - $result = $sql->query(array("SELECT * FROM $default->groups_folders_table WHERE id = ?", $iGroupFolderID));/*ok*/
128   - if ($result) {
129   - if ($sql->next_record()) {
130   - $oGroupFolderLink = & new GroupFolderLink($sql->f("folder_id"), $sql->f("group_id"), $sql->f("can_read"), $sql->f("can_write"));
131   - $oGroupFolderLink->iId = $iGroupFolderID;
132   - return $oGroupFolderLink;
133   - }
134   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iFolderAccessID . " table = $default->groups_folders_table";
135   - return false;
136   - }
137   - $_SESSION["errorMessage"] = $lang_err_database;
138   - return false;
139   - }
140   -
141   - /**
142   - * Static function
143   - * Get a list of folder collaborations
144   - *
145   - * @param String Where clause (not required)
146   - *
147   - * @return Array array of FolderCollaboration objects, false otherwise and set $_SESSION["errorMessage"]
148   - */
149   - function getList($sWhereClause = null) {
150   - return KTEntityUtil::getList(GroupFolderLink::_table(), 'GroupFolderLink', $sWhereClause);
151   - }
152   -}
153   -?>
presentation/lookAndFeel/knowledgeTree/documentmanagement/checkOutDocumentBL.php
... ... @@ -41,7 +41,6 @@ if (checkSession()) {
41 41 require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentManager.inc");
42 42 require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc");
43 43 require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
44   - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentCollaboration.inc");
45 44  
46 45 require_once("$default->fileSystemRoot/lib/foldermanagement/FolderCollaboration.inc");
47 46 require_once("$default->fileSystemRoot/lib/foldermanagement/FolderUserRole.inc");
... ...
presentation/lookAndFeel/knowledgeTree/documentmanagement/createDependantDocumentBL.php deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Business logic for requesting the creation of a new document that
6   - * will be linked to an existing one.
7   - *
8   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
9   - *
10   - * This program is free software; you can redistribute it and/or modify
11   - * it under the terms of the GNU General Public License as published by
12   - * the Free Software Foundation; either version 2 of the License, or
13   - * (at your option) any later version.
14   - *
15   - * This program is distributed in the hope that it will be useful,
16   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18   - * GNU General Public License for more details.
19   - *
20   - * You should have received a copy of the GNU General Public License
21   - * along with this program; if not, write to the Free Software
22   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23   - *
24   - * @version $Revision$
25   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
26   - * @package documentmanagement
27   - */
28   -
29   -require_once("../../../../config/dmsDefaults.php");
30   -
31   -KTUtil::extractGPC('fDocumentID', 'fDocumentTitle', 'fForStore', 'fTargetDocumentID', 'fTemplateDocument', 'fUnitID', 'fUserID');
32   -
33   -if (checkSession()) {
34   - require_once("createDependantDocumentUI.inc");
35   - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
36   - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
37   - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
38   - require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
39   - require_once("$default->fileSystemRoot/lib/security/Permission.inc");
40   - require_once("$default->fileSystemRoot/lib/email/Email.inc");
41   - require_once("$default->fileSystemRoot/lib/documentmanagement/DependantDocumentInstance.inc");
42   - require_once("$default->fileSystemRoot/presentation/Html.inc");
43   - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc");
44   -
45   - if (isset($fForStore)) {
46   - $oDependantDocument = & new DependantDocumentInstance($fDocumentTitle, $fUserID, $fTargetDocumentID, $fDocumentID);
47   - if ($oDependantDocument->create()) {
48   - $oUser = User::get($fUserID);
49   - if ($oUser->getEmailNotification()) {
50   - //notify the user by email if they wish to be notified by email
51   - $oTemplateDocument = & Document::get($fTargetDocumentID);
52   -
53   -
54   - $sBody = $oUser->getName() . ", a step in the document collaboration process requires you to create a new document. " .
55   - generateLink("/control.php","action=dashboard","Log onto KnowledgeTree") . " and select the relevant link under the 'Dependant Documents' heading on your dashboard when you are ready to upload it. ";
56   - //if we have a template document
57   - if (!($oTemplateDocument === false)) {
58   - $sBody .= "The document entitled " . generateLink("/control.php", "action=viewDocument&fDocumentID=" . $oTemplateDocument->getID(), $oTemplateDocument->getName()) . " " .
59   - "can be used as a template";
60   - }
61   -
62   - $oEmail = & new Email();
63   - $oEmail->send($oUser->getEmail(), "Dependant document creation required", $sBody);
64   - }
65   - //go back to the document page you were viewing
66   - redirect($default->rootUrl . "/control.php?action=viewDocument&fDocumentID=$fDocumentID&fShowSection=linkedDocuments");
67   - } else {
68   - //dependant document creation failed - display an error message
69   - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
70   - $oDocument = Document::get($fDocumentID);
71   -
72   - $oPatternCustom = & new PatternCustom();
73   - $oPatternCustom->setHtml(getPage($oDocument->getFolderID(), $fDocumentID, $fUnitID, $fUserID, $fDocumentTitle, $fTemplateDocument));
74   - $main->setCentralPayload($oPatternCustom);
75   - if ($default->bNN4) {
76   - $main->setOnLoadJavaScript("disable(document.MainForm.fTargetDocument)");
77   - }
78   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentID=$fDocumentID&fForStore=1");
79   - $main->setErrorMessage(_("An error occurred whilst trying to create the dependant document"));
80   - $main->render();
81   - }
82   - } else {
83   - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
84   - //we're browsing, so just display the page
85   - $oDocument = Document::get($fDocumentID);
86   -
87   - $oPatternCustom = & new PatternCustom();
88   - $oPatternCustom->setHtml(getPage($oDocument->getFolderID(), $fDocumentID, $fUnitID, $fUserID, $fDocumentTitle, $fTemplateDocument));
89   - if ($default->bNN4) {
90   - $main->setOnLoadJavaScript("disable(document.MainForm.fTargetDocument)");
91   - }
92   - $main->setCentralPayload($oPatternCustom);
93   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentID=$fDocumentID&fForStore=1");
94   - $main->render();
95   - }
96   -}
97   -?>
presentation/lookAndFeel/knowledgeTree/documentmanagement/createDependantDocumentUI.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * UI functions for requesting the creation of a new document that
6   - * will be linked to an existing one.
7   - *
8   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
9   - *
10   - * This program is free software; you can redistribute it and/or modify
11   - * it under the terms of the GNU General Public License as published by
12   - * the Free Software Foundation; either version 2 of the License, or
13   - * (at your option) any later version.
14   - *
15   - * This program is distributed in the hope that it will be useful,
16   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18   - * GNU General Public License for more details.
19   - *
20   - * You should have received a copy of the GNU General Public License
21   - * along with this program; if not, write to the Free Software
22   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23   - *
24   - * @version $Revision$
25   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
26   - * @package documentmanagement
27   - */
28   -
29   -function getFolderPath($iFolderID) {
30   - global $default;
31   - $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
32   - $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
33   - $sFolderPathLink = displayFolderPathLink(Folder::getFolderPathAsArray($iFolderID), Folder::getFolderPathNamesAsArray($iFolderID), "$default->rootUrl/control.php?action=browse");
34   - return "<table border=\"0\" width = 100%><tr><td bgcolor=\"$sTDBGColour\">$sFolderPathLink</td></tr></table>\n";
35   -}
36   -
37   -function getPage($iFolderID, $iDocumentID, $iUnitID, $iUserID, $sDocumentTitle, $sTemplateDocument) {
38   - global $default;
39   - $sToRender = renderHeading(_("Create a new dependant document"));
40   - $sToRender .= getFolderPath($iFolderID);
41   - $sToRender .= "<table border=\"0\" width=\"100%\">\n";
42   - $sToRender .= "<tr>\n";
43   - $sToRender .= "<td>" . _("Document Title") . "</td><td><input type=\"text\" name=\"fDocumentTitle\" value=\"$sDocumentTitle\" /></td>\n";
44   - $sToRender .= "</tr>\n";
45   - $sToRender .= "<tr>\n";
46   - $sToRender .= "<td>" . _("User's Unit") . "</td><td>" . getUnitDropDown($iDocumentID, $iUnitID) . "</td>\n";
47   - $sToRender .= "</tr>\n";
48   - $sToRender .= "<tr>\n";
49   - $sToRender .= "<td>" . _("User") . "</td><td>" . getUserDropDown($iUnitID, $iUserID) . "</td>\n";
50   - $sToRender .= "</tr>\n";
51   - $sToRender .= "<tr>\n";
52   -
53   - //had a slight problem with netscape 4.7x - it doesn't support disabled. So I had to use
54   - //javascript to set the onFocus attribute to blur
55   - if (!$default->bNN4) {
56   - //for any other browser but netscape 4.7 do this
57   - $sToRender .= "<td>" . _("Template document") . "</td><td><input type=\"text\" DISABLED name=\"fTargetDocument\" value=\"$sTemplateDocument\" /><input type=\"button\" value=\"Browse\" onClick=\"newWindow('$default->rootUrl/control.php?action=templateBrowse','window2')\"></td>\n";
58   - } else {
59   - //for netscape 4.7 do this
60   - $sToRender .= "<td>" . _("Template document") . "</td><td><input type=\"text\" name=\"fTargetDocument\" onblur=\"disable(document.MainForm.fTargetDocument);\" /><input type=\"button\" value=\"Browse\" onClick=\"disable(document.MainForm.fTargetDocument);newWindow('$default->rootUrl/control.php?action=templateBrowse','window2')\"></td>\n";
61   - }
62   - $sToRender .= "</tr>\n";
63   - $sToRender .= "<tr>\n";
64   - $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"" . KTHtml::getDoneButton() . "\" onClick='return validateForm(document.MainForm);' border=\"0\"/></td><td><a href=\"" . $default->rootUrl . "/control.php?action=viewDocument&fDocumentID=$iDocumentID&fShowSection=linkedDocuments\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"/></a></td></tr></table>\n";
65   - $sToRender .= "</tr>\n";
66   - $sToRender .= "</table>\n";
67   - $sToRender .= "<input type=\"hidden\" name=\"fTargetDocumentID\" value=\"-1\" />\n";
68   -
69   - return $sToRender . "\n\n" . getValidationJavaScript() . "\n\n" . getBrowseJavaScript();
70   -}
71   -
72   -function getUserDropDown($iUnitID, $iUserID) {
73   - global $default;
74   - if (!$iUnitID) {
75   - $iUnitID = -1;
76   - }
77   - $oPatternListBox = & new PatternListBox($default->users_table, "Name", "id", "fUserID", "GUL.unit_id = $iUnitID");
78   - $sFromClause = "INNER join $default->users_groups_table AS UGL ON UGL.user_id = ST.id " .
79   - "INNER JOIN groups_units_link AS GUL ON GUL.group_id = UGL.group_id ";
80   - $oPatternListBox->setFromClause($sFromClause);
81   - if (isset($iUserID)) {
82   - $oPatternListBox->setSelectedValue($iUserID);
83   - }
84   - return $oPatternListBox->render();
85   -
86   -
87   -}
88   -
89   -function getUnitDropDown($iDocumentID, $iUnitID) {
90   - global $default;
91   - if (!$iUnitID) {
92   - $iUnitID = -1;
93   - }
94   - $oPatternListBox = & new PatternListBox($default->units_table, "Name", "id", "fUnitID");
95   - $oPatternListBox->setPostBackOnChange(true);
96   - $oPatternListBox->setOnChangeAction("setActionAndSubmit('" . $_SERVER["PHP_SELF"] . "?fDocumentID=$iDocumentID')");
97   - if (isset($iUnitID)) {
98   - $oPatternListBox->setSelectedValue($iUnitID);
99   - }
100   - return $oPatternListBox->render();
101   -}
102   -
103   -function getValidationJavaScript() {
104   - $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n";
105   - $sToRender .= "function validateForm(theForm) {\n";
106   - $sToRender .= "\tif (!(validRequired(theForm.fDocumentTitle,'Document title') && validRequired(theForm.fUserID,'User'))) {\n";
107   - $sToRender .= "\t\treturn false;\n\t}\n";
108   - $sToRender .= "return true;\n}\n";
109   - $sToRender .= "//-->\n</script>\n\n";
110   - return $sToRender;
111   -}
112   -
113   -function getBrowseJavaScript() {
114   - $sToRender = "<script language=\"JavaScript\"><!--\n ";
115   - $sToRender .= "function newWindow(file,window) {\n ";
116   - $sToRender .= "\tmsgWindow=open(file,window,'resizable=yes,scrollbars=yes, width=400,height=600');\n ";
117   - $sToRender .= "\tif (msgWindow.opener == null) msgWindow.opener = self; \n ";
118   - $sToRender .= "}\n";
119   - $sToRender .= "//--></script>\n";
120   - return $sToRender;
121   -}
122   -?>
presentation/lookAndFeel/knowledgeTree/documentmanagement/escalateDependantDocumentBL.php deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Business logic for sending a reminder message to the user that was tasked with
6   - * creating a dependant document.
7   - *
8   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
9   - *
10   - * This program is free software; you can redistribute it and/or modify
11   - * it under the terms of the GNU General Public License as published by
12   - * the Free Software Foundation; either version 2 of the License, or
13   - * (at your option) any later version.
14   - *
15   - * This program is distributed in the hope that it will be useful,
16   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18   - * GNU General Public License for more details.
19   - *
20   - * You should have received a copy of the GNU General Public License
21   - * along with this program; if not, write to the Free Software
22   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23   - *
24   - * @version $Revision$
25   - * @author Michael Joseph, Jam Warehouse (Pty) Ltd, South Africa
26   - * @package documentmanagement
27   - */
28   -
29   -require_once("../../../../config/dmsDefaults.php");
30   -
31   -KTUtil::extractGPC('fInstanceID', 'fReminderMessage', 'fSendMessage', 'fUserID');
32   -
33   -if (checkSession()) {
34   - require_once("escalateDependantDocumentUI.inc");
35   - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
36   - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
37   - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
38   - require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
39   - require_once("$default->fileSystemRoot/lib/security/Permission.inc");
40   - require_once("$default->fileSystemRoot/lib/email/Email.inc");
41   - require_once("$default->fileSystemRoot/lib/documentmanagement/DependantDocumentInstance.inc");
42   - require_once("$default->fileSystemRoot/presentation/Html.inc");
43   - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc");
44   -
45   - $oPatternCustom = & new PatternCustom();
46   - $sTitle = _("Dependant Document Send Escalation Message");
47   - if ($fInstanceID) {
48   - $oDependantDocument = DependantDocumentInstance::get($fInstanceID);
49   - if ($oDependantDocument) {
50   - if ($fSendMessage) {
51   - $oUser = User::get($oDependantDocument->getUserID());
52   - if ($oUser) {
53   - if ($oUser->getEmailNotification()) {
54   - $oTemplateDocument = & Document::get($oDependantDocument->getTemplateDocumentID());
55   -
56   - $sMessage = "<font face=\"arial\" size=\"2\">";
57   - $oOriginatingUser = User::get($_SESSION["userID"]);
58   - $oParentDocument = Document::get($oDependantDocument->getParentDocumentID());
59   - $sMessage = $oUser->getName() . ", you have already received a request to create a new document for the document <br>" . $oParentDocument->getDisplayPath() . ".<br>" .
60   - $oOriginatingUser->getName() . " has sent you a reminder message to create and upload this document :<br>";
61   - if (strlen($fReminderMessage) > 0) {
62   - $sMessage .= "<br>Comments:<br>$fReminderMessage<br><br>";
63   - }
64   - $sMessage .= generateLink("/control.php","action=dashboard","Log onto KnowledgeTree") . " and select the relevant link under the 'Dependant Documents' heading on your dashboard when you are ready to upload it.";
65   - if ($oTemplateDocument) {
66   - $sMessage .= "The document entitled " . generateLink("/control.php", "action=viewDocument&fDocumentID=" . $oTemplateDocument->getID(), $oTemplateDocument->getName()) . " " .
67   - "can be used as a template";
68   - }
69   - $sMessage .= "</font>";
70   -
71   - $oEmail = & new Email();
72   - if ($oEmail->send($oUser->getEmail(), "Dependant document creation reminder message", $sMessage)) {
73   - //go back to the document page you were viewing
74   - redirect(generateControllerUrl("viewDocument", "fDocumentID=" . $oDependantDocument->getParentDocumentID() . "&fShowSection=linkedDocuments"));
75   - } else {
76   - $default->log->error("escalateDependantDocumentBL.php email sending failed");
77   - $oPatternCustom->setHtml(statusPage($sTitle, $sHeading, _("The escalation message could not be sent due to a system error sending the notification."), "viewDocument", "fDocumentID=" . $oDependantDocument->getParentDocumentID() . "&fShowSection=linkedDocuments"));
78   - }
79   - } else {
80   - $default->log->info("escalateDependantDocumentBL.php user id (" . $oUser->getID() . ") doesn't have email notification on =" . arrayToString($oUser));
81   - $oPatternCustom->setHtml(statusPage($sTitle, $sHeading, _("The escalation message could not be sent because the user has disabled notification"), "viewDocument", "fDocumentID=" . $oDependantDocument->getParentDocumentID() . "&fShowSection=linkedDocuments"));
82   - }
83   - } else {
84   - $default->log->info("escalateDependantDocumentBL.php couldn't instantiate user object for id=$fUserID");
85   - $oPatternCustom->setHtml(statusPage($sTitle, "", _("The dependant document user information could not be found."), "viewDocument", "fDocumentID=" . $oDependantDocument->getParentDocumentID() . "&fShowSection=linkedDocuments"));
86   - }
87   - } else {
88   - // display escalation form
89   - $oPatternCustom->setHtml(getPage($oDependantDocument));
90   - }
91   - } else {
92   - //dependant document instantiation failed- generic error (statusPage)
93   - $oPatternCustom->setHtml(statusPage($sTitle, "", _("The dependant document information could not be found."), "browse"));
94   - }
95   - } else {
96   - // error page, no instance id supplied- generic error
97   - $oPatternCustom->setHtml(statusPage($sTitle, "", _("The dependant document information could not be found."), "browse"));
98   - }
99   - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
100   - $main->setCentralPayload($oPatternCustom);
101   - $main->setFormAction($_SERVER["PHP_SELF"]); // . "?fDocumentID=$fInstanceID&fForStore=1");
102   - $main->render();
103   -}
104   -?>
presentation/lookAndFeel/knowledgeTree/documentmanagement/escalateDependantDocumentUI.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * UI functions for sending a reminder message to the user that was tasked with
6   - * creating a dependant document.
7   - *
8   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
9   - *
10   - * This program is free software; you can redistribute it and/or modify
11   - * it under the terms of the GNU General Public License as published by
12   - * the Free Software Foundation; either version 2 of the License, or
13   - * (at your option) any later version.
14   - *
15   - * This program is distributed in the hope that it will be useful,
16   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18   - * GNU General Public License for more details.
19   - *
20   - * You should have received a copy of the GNU General Public License
21   - * along with this program; if not, write to the Free Software
22   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23   - *
24   - * @version $Revision$
25   - * @author Michael Joseph, Jam Warehouse (Pty) Ltd, South Africa
26   - * @package documentmanagement
27   - */
28   -
29   -function getPage($oDependantDocument) {
30   - global $default;
31   - $sToRender = renderHeading(_("Dependant Document Send Escalation Message"));
32   - $oDocument = Document::get($oDependantDocument->getParentDocumentID());
33   - $iFolderID = $oDocument->getFolderID();
34   - $sToRender .= renderFolderPath($iFolderID, generateControllerUrl("browse", "fFolderID=$iFolderID"), false);
35   - $sToRender .= "<table border=\"0\" width=\"100%\">\n";
36   - $sToRender .= "<tr><td colspan=\"2\"><strong>" . _("You have requested that the following document be created:") . "</strong></td></tr>";
37   - $sToRender .= "<tr>\n";
38   - $sToRender .= "<td>" . _("Document title") . "</td><td>" . $oDependantDocument->getDocumentTitle() . "</td>\n";
39   - $sToRender .= "</tr>\n";
40   -
41   - $oUser = User::get($oDependantDocument->getUserID());
42   - $sToRender .= "<tr>\n";
43   - $sToRender .= "<td>User</td><td>" . ($oUser ? $oUser->getName() : "<font color=\"red\">" . _("Error! No user specified") . "</font>") . "</td>\n";
44   - $sToRender .= "</tr>\n";
45   -
46   - $oTemplateDocument = Document::get($oDependantDocument->getTemplateDocumentID());
47   - $sToRender .= "<tr><td>" . _("Template document") . "</td><td>" . ($oTemplateDocument ? $oTemplateDocument->getDisplayPath() : _("No template document")) . "</td></tr>\n";
48   - $sToRender .= "<tr><td>&nbsp;</td></tr>";
49   -
50   - $sToRender .= "<tr><td colspan=\"2\">" . _("To send the user a reminder message, fill in the text box below and click 'Done'") . "</td></tr>";
51   - $sToRender .= "<tr><td>" . _("Reminder Message") . "</td><td><textarea rows=\"5\" cols=\"30\" name=\"fReminderMessage\"></textarea></td></tr>\n";
52   - $sToRender .= "<tr>\n";
53   - $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"" . KTHtml::getDoneButton() . "\" onClick='return validateForm(document.MainForm);' border=\"0\"/></td>";
54   - $sToRender .= "<td>" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID() . "&fShowSection=linkedDocuments", "<img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"/>") . "</td></tr></table>\n";
55   - $sToRender .= "</tr>\n";
56   - $sToRender .= "</table>\n";
57   - $sToRender .= "<input type=\"hidden\" name=\"fSendMessage\" value=\"1\" />\n";
58   - $sToRender .= "<input type=\"hidden\" name=\"fInstanceID\" value=\"" . $oDependantDocument->getID() . "\" />\n";
59   -
60   - return $sToRender . "\n\n" . getValidationJavaScript();
61   -}
62   -
63   -function getValidationJavaScript() {
64   - $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n";
65   - $sToRender .= "function validateForm(theForm) {\n";
66   - $sToRender .= "\tif (!(validRequired(theForm.fReminderMessage,'Reminder message'))) {\n";
67   - $sToRender .= "\t\treturn false;\n\t}\n";
68   - $sToRender .= "return true;\n}\n";
69   - $sToRender .= "//-->\n</script>\n\n";
70   - return $sToRender;
71   -}
72   -?>
presentation/lookAndFeel/knowledgeTree/foldermanagement/addGroupFolderLinkBL.php deleted
1   -<?php
2   -/**
3   - * $Id$
4   - * Business logic for adding folder access
5   - * addFolderAccessUI.inc for presentation information
6   - *
7   - * Expected form variables:
8   - * o $fFolderID - primary key of folder user is currently editing
9   - *
10   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
11   - *
12   - * This program is free software; you can redistribute it and/or modify
13   - * it under the terms of the GNU General Public License as published by
14   - * the Free Software Foundation; either version 2 of the License, or
15   - * (at your option) any later version.
16   - *
17   - * This program is distributed in the hope that it will be useful,
18   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
19   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20   - * GNU General Public License for more details.
21   - *
22   - * You should have received a copy of the GNU General Public License
23   - * along with this program; if not, write to the Free Software
24   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25   - *
26   - * @version $Revision$
27   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
28   - * @package foldermanagement
29   - */
30   -
31   -require_once("../../../../config/dmsDefaults.php");
32   -
33   -KTUtil::extractGPC('fCanRead', 'fCanWrite', 'fFolderID', 'fForStore', 'fGroupID');
34   -
35   -include_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
36   -include_once("$default->fileSystemRoot/lib/security/Permission.inc");
37   -include_once("$default->fileSystemRoot/lib/users/User.inc");
38   -include_once("$default->fileSystemRoot/lib/groups/GroupFolderLink.inc");
39   -include_once("$default->fileSystemRoot/lib/groups/Group.inc");
40   -include_once("$default->fileSystemRoot/presentation/Html.inc");
41   -include_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
42   -include_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
43   -include_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc");
44   -include_once("groupFolderLinkUI.inc");
45   -
46   -if (!checkSession()) {
47   - die();
48   -}
49   -include_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
50   -
51   -$oPatternCustom = & new PatternCustom();
52   -$oPatternCustom->setHtml("");
53   -
54   -if (!isset($fFolderID)) {
55   - //display an error message
56   - $sErrorMessage = _("No folder currently selected");
57   - $oPatternCustom->setHtml(renderErrorPage($sErrorMessage, $fFolderID));
58   - $main->setCentralPayload($oPatternCustom);
59   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1");
60   - $main->setHasRequiredFields(true);
61   - $main->render();
62   - exit(0);
63   -}
64   -
65   -$oFolder = Folder::get($fFolderID);
66   -// if a folder has been selected
67   -if (!Permission::userHasFolderWritePermission($oFolder)) {
68   - $sErrorMessage = _("You do not have permission to edit this folder");
69   - $oPatternCustom->setHtml(renderErrorPage($sErrorMessage, $fFolderID));
70   - $main->setCentralPayload($oPatternCustom);
71   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1");
72   - $main->setHasRequiredFields(true);
73   - $main->render();
74   - exit(0);
75   -}
76   -
77   -// can only add access if the user has folder write permission
78   -if (!isset($fForStore)) {
79   - // display the browse page
80   - $oPatternCustom->setHtml(getAddPage($fFolderID));
81   - $main->setCentralPayload($oPatternCustom);
82   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1");
83   - $main->setHasRequiredFields(true);
84   - $main->render();
85   - exit(0);
86   -}
87   -
88   -$oGroup =& Group::get($fGroupID);
89   -if (!$oGroup) {
90   - $sErrorMessage = _("The given group does not exist");
91   - $oPatternCustom->setHtml(renderErrorPage($sErrorMessage, $fFolderID));
92   - $main->setCentralPayload($oPatternCustom);
93   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1");
94   - $main->setHasRequiredFields(true);
95   - $main->render();
96   - exit(0);
97   -}
98   -
99   -$res = $oFolder->addPermission($oGroup, $fCanRead, $fCanWrite);
100   -
101   -if (PEAR::isError($res)) {
102   - $oPatternCustom->setHtml(renderErrorPage($res->getMessage(), $fFolderID));
103   - $main->setCentralPayload($oPatternCustom);
104   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1");
105   - $main->setHasRequiredFields(true);
106   - $main->render();
107   - exit(0);
108   -}
109   -
110   -controllerRedirect("editFolder", "fFolderID=$fFolderID&fShowSection=folderPermissions");
111   -
112   -?>
presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteDependantDocumentBL.php deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Business logic for deleting a dependant document
6   - *
7   - * Expected variables:
8   - * $fFolderCollaborationID: primary key of folder collaboration to check
9   - * $fFolderID: folder we are currently editing
10   - * $fDependantDocumentTemplateID: primary key of dependant document to be deleted
11   - *
12   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
13   - *
14   - * This program is free software; you can redistribute it and/or modify
15   - * it under the terms of the GNU General Public License as published by
16   - * the Free Software Foundation; either version 2 of the License, or
17   - * (at your option) any later version.
18   - *
19   - * This program is distributed in the hope that it will be useful,
20   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
21   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22   - * GNU General Public License for more details.
23   - *
24   - * You should have received a copy of the GNU General Public License
25   - * along with this program; if not, write to the Free Software
26   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27   - *
28   - * @version $Revision$
29   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
30   - * @package foldermanagement
31   - */
32   -
33   -require_once("../../../../config/dmsDefaults.php");
34   -
35   -KTUtil::extractGPC('fDependantDocumentTemplateID', 'fFolderCollaborationID', 'fFolderID', 'fForDelete');
36   -
37   -if (checkSession()) {
38   - if (isset($fFolderID) && isset($fFolderCollaborationID)) {
39   - require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
40   - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
41   - require_once("$default->fileSystemRoot/lib/users/User.inc");
42   - require_once("$default->fileSystemRoot/lib/documentmanagement/DependantDocumentTemplate.inc");
43   - require_once("$default->fileSystemRoot/presentation/Html.inc");
44   - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
45   - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
46   - require_once("deleteDependantDocumentUI.inc");
47   -
48   - $oFolder = Folder::get($fFolderID);
49   - if (Permission::userHasFolderWritePermission($oFolder)) {
50   - //user has permission to alter folder contents
51   - if (isset($fForDelete)) {
52   - $oDependantDocumentTemplate = DependantDocumentTemplate::get($fDependantDocumentTemplateID);
53   - if ($oDependantDocumentTemplate->delete()) {
54   - controllerRedirect("viewDependantDocument", "fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID");
55   - } else {
56   - $oDependantDocumentTemplate = DependantDocumentTemplate::get($fDependantDocumentTemplateID);
57   - $oUser = User::get($oDependantDocumentTemplate->getDefaultUserId());
58   - $oTemplateDocument = Document::get($oDependantDocumentTemplate->getTemplateDocumentID());
59   -
60   - $oPatternCustom = & new PatternCustom();
61   - $oPatternCustom->setHtml(getPage($fFolderID, $fFolderCollaborationID, $oDependantDocumentTemplate->getDocumentTitle(), $oUser->getName(), (!($oTemplateDocument->getName() === false)) ? $oTemplateDocument->getName() : ""));
62   - $main->setCentralPayload($oPatternCustom);
63   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fDependantDocumentTemplateID=$fDependantDocumentTemplateID&fForDelete=1");
64   - $main->setErrorMessage(_("An error occured while attempting to delete the dependant document"));
65   - $main->render();
66   - }
67   -
68   - } else {
69   - include_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
70   -
71   - $oDependantDocumentTemplate = DependantDocumentTemplate::get($fDependantDocumentTemplateID);
72   - $oUser = User::get($oDependantDocumentTemplate->getDefaultUserId());
73   - $oTemplateDocument = Document::get($oDependantDocumentTemplate->getTemplateDocumentID());
74   -
75   - $oPatternCustom = & new PatternCustom();
76   - $oPatternCustom->setHtml(getPage($fFolderID, $fFolderCollaborationID, $oDependantDocumentTemplate->getDocumentTitle(), $oUser->getName(), (!($oTemplateDocument->getName() === false)) ? $oTemplateDocument->getName() : ""));
77   - $main->setCentralPayload($oPatternCustom);
78   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fDependantDocumentTemplateID=$fDependantDocumentTemplateID&fForDelete=1");
79   - $main->render();
80   -
81   - }
82   -
83   -
84   - }
85   -
86   - }
87   -}
88   -
89   -?>
90   -
presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteDependantDocumentUI.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Presentation logic for deleting a dependant document.
6   - *
7   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
8   - *
9   - * This program is free software; you can redistribute it and/or modify
10   - * it under the terms of the GNU General Public License as published by
11   - * the Free Software Foundation; either version 2 of the License, or
12   - * (at your option) any later version.
13   - *
14   - * This program is distributed in the hope that it will be useful,
15   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17   - * GNU General Public License for more details.
18   - *
19   - * You should have received a copy of the GNU General Public License
20   - * along with this program; if not, write to the Free Software
21   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22   - *
23   - * @version $Revision$
24   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
25   - * @package foldermanagement
26   - */
27   -
28   -function getPage($iFolderID, $iFolderCollaborationID, $sDocumentTitle, $sUserName, $sTemplateDocument) {
29   - global $default;
30   - $sToRender = renderHeading(_("Delete dependant document"));
31   - $sToRender .= "<table border=\"0\" width=\"100%\">\n";
32   - $sToRender .= "<tr>\n";
33   - $sToRender .= "<td>" . _("Document title") . "</td><td>$sDocumentTitle</td>";
34   - $sToRender .= "</tr>\n";
35   - $sToRender .= "<tr>\n";
36   - $sToRender .= "<td>" . _("User") . "</td><td>$sUserName</td>";
37   - $sToRender .= "</tr>\n";
38   - $sToRender .= "<tr>\n";
39   - $sToRender .= "<td>" . _("Template document") . "</td><td>$sTemplateDocument</td>";
40   - $sToRender .= "<tr>\n";
41   - $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"" . KTHtml::getDeleteButton() . "\" border=\"0\"/></td><td><a href=\"" . $default->rootUrl . "/control.php?action=viewDependantDocument&fFolderID=$iFolderID&fFolderCollaborationID=$iFolderCollaborationID\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"/></a></td></tr></table>\n";
42   - $sToRender .= "</table\n";
43   -
44   - return $sToRender;
45   -}
46   -
47   -?>
presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteGroupFolderLinkBL.php deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Business logic for deleting a folder access entry
6   - * addFolderAccessUI.inc for presentation information
7   - *
8   - * Expected form variables:
9   - * o $fFolderID - primary key of folder user is currently editing
10   - * o $fGroupFolderLinkID - primary key of group folder link user to delete
11   - *
12   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
13   - *
14   - * This program is free software; you can redistribute it and/or modify
15   - * it under the terms of the GNU General Public License as published by
16   - * the Free Software Foundation; either version 2 of the License, or
17   - * (at your option) any later version.
18   - *
19   - * This program is distributed in the hope that it will be useful,
20   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
21   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22   - * GNU General Public License for more details.
23   - *
24   - * You should have received a copy of the GNU General Public License
25   - * along with this program; if not, write to the Free Software
26   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27   - *
28   - * @version $Revision$
29   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
30   - * @package foldermanagement
31   - */
32   -
33   -require_once("../../../../config/dmsDefaults.php");
34   -
35   -KTUtil::extractGPC('fFolderID', 'fForDelete', 'fGroupFolderLinkID');
36   -
37   -include_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
38   -include_once("$default->fileSystemRoot/lib/security/Permission.inc");
39   -include_once("$default->fileSystemRoot/lib/groups/GroupFolderLink.inc");
40   -include_once("$default->fileSystemRoot/lib/groups/Group.inc");
41   -include_once("$default->fileSystemRoot/lib/roles/Role.inc");
42   -include_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
43   -include_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
44   -include_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc");
45   -include_once("$default->fileSystemRoot/presentation/Html.inc");
46   -include_once("groupFolderLinkUI.inc");
47   -
48   -if (!checkSession()) {
49   - // Never returns, but just in case...
50   - die();
51   -}
52   -
53   -include_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
54   -
55   -$oPatternCustom = & new PatternCustom();
56   -$oPatternCustom->setHtml("");
57   -
58   -if (!(isset($fFolderID) && isset($fGroupFolderLinkID))) {
59   - $sErrorMessage = _("No folder currently selected");
60   - $main->setCentralPayload($oPatternCustom);
61   - if (isset($sErrorMessage)) {
62   - $main->setErrorMessage($sErrorMessage);
63   - }
64   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fGroupFolderLinkID=$fGroupFolderLinkID&fForDelete=1");
65   - $main->setHasRequiredFields(true);
66   - $main->render();
67   - exit(0);
68   -}
69   -// if a folder has been selected
70   -
71   -$oFolder = Folder::get($fFolderID);
72   -if (!Permission::userHasFolderWritePermission($oFolder)) {
73   - // display an error message
74   - $sErrorMessage = _("You don't have permission to delete this folder access entry.");
75   - $main->setCentralPayload($oPatternCustom);
76   - if (isset($sErrorMessage)) {
77   - $main->setErrorMessage($sErrorMessage);
78   - }
79   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fGroupFolderLinkID=$fGroupFolderLinkID&fForDelete=1");
80   - $main->setHasRequiredFields(true);
81   - $main->render();
82   - exit(0);
83   -}
84   -
85   -if (!isset($fForDelete)) {
86   - $oGroupFolderLink = & GroupFolderLink::get($fGroupFolderLinkID);
87   - $oPatternCustom->setHtml(getDeletePage($oGroupFolderLink, $fFolderID));
88   - $main->setCentralPayload($oPatternCustom);
89   - if (isset($sErrorMessage)) {
90   - $main->setErrorMessage($sErrorMessage);
91   - }
92   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fGroupFolderLinkID=$fGroupFolderLinkID&fForDelete=1");
93   - $main->setHasRequiredFields(true);
94   - $main->render();
95   - exit(0);
96   -}
97   -
98   -$oGroupFolderLink = & GroupFolderLink::get($fGroupFolderLinkID);
99   -if (!$oGroupFolderLink->delete()) {
100   - // otherwise display an error message
101   - $sErrorMessage = _("The folder access entry could not be deleted from the database");
102   - $oGroupFolderLink = & GroupFolderLink::get($fGroupFolderLinkID);
103   - $oPatternCustom->setHtml(getPage($oGroupFolderLink));
104   - $main->setCentralPayload($oPatternCustom);
105   - if (isset($sErrorMessage)) {
106   - $main->setErrorMessage($sErrorMessage);
107   - }
108   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fGroupFolderLinkID=$fGroupFolderLinkID&fForDelete=1");
109   - $main->setHasRequiredFields(true);
110   - $main->render();
111   - exit(0);
112   -}
113   -
114   -$oFolder->updatePermissions();
115   -controllerRedirect("editFolder", "fFolderID=$fFolderID&fShowSection=folderPermissions");
116   -
117   -?>
presentation/lookAndFeel/knowledgeTree/foldermanagement/editGroupFolderLinkBL.php deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Business logic for editing a folder access entry
6   - * groupFolderLinkUI.inc for presentation information
7   - *
8   - * Expected form variables:
9   - * o $fFolderID - primary key of folder user is currently editing
10   - * o $fGroupFolderLinkID - primary key of group folder link user to delete
11   - *
12   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
13   - *
14   - * This program is free software; you can redistribute it and/or modify
15   - * it under the terms of the GNU General Public License as published by
16   - * the Free Software Foundation; either version 2 of the License, or
17   - * (at your option) any later version.
18   - *
19   - * This program is distributed in the hope that it will be useful,
20   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
21   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22   - * GNU General Public License for more details.
23   - *
24   - * You should have received a copy of the GNU General Public License
25   - * along with this program; if not, write to the Free Software
26   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27   - *
28   - * @version $Revision$
29   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
30   - * @package foldermanagement
31   - */
32   -
33   -require_once("../../../../config/dmsDefaults.php");
34   -
35   -KTUtil::extractGPC('fCanRead', 'fCanWrite', 'fFolderID', 'fForStore', 'fGroupFolderLinkID');
36   -
37   -include_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
38   -include_once("$default->fileSystemRoot/lib/security/Permission.inc");
39   -include_once("$default->fileSystemRoot/lib/groups/GroupFolderLink.inc");
40   -include_once("$default->fileSystemRoot/lib/groups/Group.inc");
41   -include_once("$default->fileSystemRoot/lib/roles/Role.inc");
42   -include_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
43   -include_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
44   -include_once("$default->fileSystemRoot/lib/visualpatterns/PatternEditableListFromQuery.inc");
45   -include_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc");
46   -include_once("$default->fileSystemRoot/presentation/Html.inc");
47   -include_once("groupFolderLinkUI.inc");
48   -
49   -if (checkSession()) {
50   - if (isset($fFolderID) && isset($fGroupFolderLinkID)) {
51   - // if a folder has been selected
52   - $oPatternCustom = & new PatternCustom();
53   - $oPatternCustom->setHtml("");
54   -
55   - $oFolder = Folder::get($fFolderID);
56   - if (Permission::userHasFolderWritePermission($oFolder)) {
57   - // can only edit group folder links if the user has folder write permission
58   - if (isset($fForStore)) {
59   - $oGroupFolderLink = & GroupFolderLink::get($fGroupFolderLinkID);
60   - $oGroupFolderLink->setCanRead($fCanRead);
61   - $oGroupFolderLink->setCanWrite($fCanWrite);
62   - if ($oGroupFolderLink->update()) {
63   - // on successful update, redirect to the folder edit page
64   - controllerRedirect("editFolder", "fFolderID=$fFolderID&fShowSection=folderPermissions");
65   - } else {
66   - // otherwise display an error message
67   - $sErrorMessage = _("The folder access entry could not be deleted from the database");
68   - $oGroupFolderLink = & GroupFolderLink::get($fGroupFolderLinkID);
69   - $oPatternCustom->setHtml(getEditPage($oGroupFolderLink, $fFolderID));
70   - }
71   - } else {
72   - $oGroupFolderLink = & GroupFolderLink::get($fGroupFolderLinkID);
73   - $oPatternCustom->setHtml(getEditPage($oGroupFolderLink, $fFolderID));
74   - }
75   - } else {
76   - // display an error message
77   - $sErrorMessage = _("You don't have permission to delete this folder access entry.");
78   - }
79   - } else {
80   - $sErrorMessage = _("No folder currently selected");
81   - }
82   -
83   - include_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
84   - $main->setCentralPayload($oPatternCustom);
85   - if (isset($sErrorMessage)) {
86   - $main->setErrorMessage($sErrorMessage);
87   - }
88   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fGroupFolderLinkID=$fGroupFolderLinkID&fForStore=1");
89   - $main->setHasRequiredFields(true);
90   - $main->render();
91   -}
92   -?>
presentation/lookAndFeel/knowledgeTree/foldermanagement/groupFolderLinkUI.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Presentation information for adding folder access
6   - * Used by addFolderAccessBL.php
7   - *
8   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
9   - *
10   - * This program is free software; you can redistribute it and/or modify
11   - * it under the terms of the GNU General Public License as published by
12   - * the Free Software Foundation; either version 2 of the License, or
13   - * (at your option) any later version.
14   - *
15   - * This program is distributed in the hope that it will be useful,
16   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18   - * GNU General Public License for more details.
19   - *
20   - * You should have received a copy of the GNU General Public License
21   - * along with this program; if not, write to the Free Software
22   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23   - *
24   - * @version $Revision$
25   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
26   - * @package foldermanagement
27   - */
28   -
29   -require_once(KT_LIB_DIR . "/groups/GroupUtil.php");
30   -
31   -function getFolderPath($iFolderID) {
32   - global $default;
33   - $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
34   - $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
35   - $sFolderPathLink = displayFolderPathLink(Folder::getFolderPathAsArray($iFolderID), Folder::getFolderPathNamesAsArray($iFolderID), "$default->rootUrl/control.php?action=browse");
36   - return "<table border=\"0\" width = 100%><tr><td bgcolor=\"$sTDBGColour\">$sFolderPathLink</td></tr></table>\n";
37   -}
38   -
39   -function getDeletePage($oGroupFolderLink, $iFolderID) {
40   - global $default;
41   - $sToRender = renderHeading(_("Delete Folder Access"));
42   - $sToRender .= getFolderPath($iFolderID);
43   - $sToRender .= "<table>\n";
44   - $sToRender .= "<tr>\n";
45   - $sToRender .= "<td>" . _("Group") . "</td><td>" . GroupUtil::getNameForID($oGroupFolderLink->getGroupID()) . "</td>\n";
46   - $sToRender .= "</tr>\n";
47   - $sToRender .= "<tr>\n";
48   - $sToRender .= "<td>" . _("Access Rights") . "</td><td>" . getAccessCheckBoxes(true, $oGroupFolderLink->getCanRead(), $oGroupFolderLink->getCanWrite()) . "</td>\n";
49   - $sToRender .= "</tr>\n";
50   - $sToRender .= "<tr>\n";
51   - $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"" . KTHtml::getDeleteButton() . "\" border=\"0\"/></td><td>" . generateControllerLink("editFolder", "fFolderID=" . $oGroupFolderLink->getFolderID() . "&fShowSection=folderPermissions", "<img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"/>") . "</td></tr></table></td>\n";
52   - $sToRender .= "</tr>\n";
53   - $sToRender .= "</table>\n";
54   -
55   - $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n";
56   - $sToRender .= "function validateForm(theForm) {\n";
57   - $sToRender .= "\t return confirm('" . _("Are you sure you wish to delete this folder access entry?") . "');}\n";
58   - $sToRender .= "//-->\n</script>\n\n";
59   -
60   - return $sToRender;
61   -}
62   -
63   -function getEditPage($oGroupFolderLink, $iFolderID) {
64   - global $default;
65   - $sToRender = renderHeading(_("Edit Folder Access"));
66   - $sToRender .= getFolderPath($iFolderID);
67   - $sToRender .= "<table>\n";
68   - $sToRender .= "<tr>\n";
69   - $sToRender .= "<td>" . _("Group") . "</td><td>" . getGroupDropDown($oGroupFolderLink->getGroupID()) . "</td>\n";
70   - $sToRender .= "</tr>\n";
71   - $sToRender .= "<tr>\n";
72   - $default->log->info("getEditPage: " . arrayToString($oGroupFolderLink));
73   - $sToRender .= "<td>" . _("Access Rights") . "</td><td>" . getAccessCheckBoxes(false, $oGroupFolderLink->getCanRead(), $oGroupFolderLink->getCanWrite()) . "</td>\n";
74   - $sToRender .= "</tr>\n";
75   - $sToRender .= "<tr>\n";
76   - $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"" . KTHtml::getUpdateButton() . "\" border=\"0\"/></td><td>" . generateControllerLink("editFolder", "fFolderID=" . $oGroupFolderLink->getFolderID() . "&fShowSection=folderPermissions", "<img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"/>") . "</td></tr></table></td>\n";
77   - $sToRender .= "</tr>\n";
78   - $sToRender .= "</table>\n";
79   -
80   - $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n";
81   - $sToRender .= "function validateForm(theForm) {\n";
82   - $sToRender .= "\tif (!theForm.fCanRead.checked && !theForm.fCanWrite.checked) {\n";
83   - $sToRender .= "\t\talert('" . _("You must select either read or write access") . "'); return false;\n\t}\n";
84   - $sToRender .= "return true;\n}\n";
85   - $sToRender .= "//-->\n</script>\n\n";
86   -
87   - return $sToRender;
88   -}
89   -
90   -function getAddPage($iFolderID) {
91   - global $default;
92   - $sToRender = renderHeading(_("Add Folder Access"));
93   - $sToRender .= getFolderPath($iFolderID);
94   -
95   - $sToRender .= "<table>\n";
96   - $sToRender .= "<tr>\n";
97   - $sToRender .= "<td>" . _("Group") . "</td><td>" . getGroupDropDown() . "</td>\n";
98   - $sToRender .= "</tr>\n";
99   - $sToRender .= "<tr>\n";
100   - $sToRender .= "<td>" . _("Access Rights") . "</td><td>" . getAccessCheckBoxes(false) . "</td>\n";
101   - $sToRender .= "</tr>\n";
102   - $sToRender .= "<tr>\n";
103   - $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"" . KTHtml::getAddButton() . "\" border=\"0\"/></td><td>" . generateControllerLink("editFolder", "fFolderID=$iFolderID&fShowSection=folderPermissions", "<img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"/>") . "</td></tr></table></td>\n";
104   - $sToRender .= "</tr>\n";
105   - $sToRender .= "</table>\n";
106   -
107   - $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n";
108   - $sToRender .= "function validateForm(theForm) {\n";
109   - $sToRender .= "\tif (!theForm.fCanRead.checked && !theForm.fCanWrite.checked) {\n";
110   - $sToRender .= "\t\talert('" . _("You must select either read or write access") . "'); return false;\n\t}\n";
111   - $sToRender .= "return true;\n}\n";
112   - $sToRender .= "//-->\n</script>\n\n";
113   -
114   - return $sToRender;
115   -}
116   -
117   -function getAccessCheckBoxes($bReadOnly, $bCanRead = false, $bCanWrite = false) {
118   - return "<input name=\"fCanRead\" type=\"checkbox\" " . ($bReadOnly ? "disabled " : "") . ($bCanRead ? "checked " : "") . "/>" . _("Read") . "\n" .
119   - "<input name=\"fCanWrite\" type=\"checkbox\" " . ($bReadOnly ? "disabled " : "") . ($bCanWrite ? "checked " : "") . "/>" . _("Write") . "\n";
120   -}
121   -
122   -function getGroupDropDown($iGroupID = -1) {
123   - global $default;
124   - if (Permission::userIsSystemAdministrator()) {
125   - $oPatternListBox = & new PatternListBox("$default->groups_table", "name", "id", "fGroupID");
126   - } else {
127   - $oPatternListBox = & new PatternListBox("$default->groups_table", "name", "id", "fGroupID", "GUL.unit_id in (" . implode(",", User::getUnitIDs($_SESSION["userID"])) . ")");
128   - $oPatternListBox->setFromClause("INNER JOIN $default->groups_units_table AS GUL ON ST.id = GUL.group_id");
129   - }
130   - $oPatternListBox->setEmptyErrorMessage(_("There are no groups"));
131   - $oPatternListBox->setIncludeDefaultValue(false);
132   - if ($iGroupID != -1) {
133   - $oPatternListBox->setWhereClause("ST.id = $iGroupID");
134   - }
135   - return $oPatternListBox->render();
136   -}
137   -
138   -function renderErrorPage($sErrorMessage, $iFolderID) {
139   - global $default;
140   - return "<p class=\"errorText\">$sErrorMessage</p>\n" .
141   - "<a href=\"$default->rootUrl/control.php?action=editFolder&fFolderID=$iFolderID\"><img src=\"" . KTHtml::getBackButton() . "\" border=\"0\"/></a>\n";
142   -}
143   -?>
presentation/lookAndFeel/knowledgeTree/foldermanagement/viewDependantDocumentsBL.php deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Business logic for linking document creation to a folder collaboration step
6   - *
7   - * Expected variables:
8   - * $fFolderCollaborationID: primary key of folder collaboration to check
9   - * $fFolderID: folder we are currently editing
10   - *
11   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
12   - *
13   - * This program is free software; you can redistribute it and/or modify
14   - * it under the terms of the GNU General Public License as published by
15   - * the Free Software Foundation; either version 2 of the License, or
16   - * (at your option) any later version.
17   - *
18   - * This program is distributed in the hope that it will be useful,
19   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
20   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21   - * GNU General Public License for more details.
22   - *
23   - * You should have received a copy of the GNU General Public License
24   - * along with this program; if not, write to the Free Software
25   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26   - *
27   - * @version $Revision$
28   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
29   - * @package foldermanagement
30   - */
31   -
32   -require_once("../../../../config/dmsDefaults.php");
33   -
34   -KTUtil::extractGPC('fDependantDocumentTemplateID', 'fDocument', 'fDocumentTitle');
35   -KTUtil::extractGPC('fFolderCollaborationID', 'fFolderID', 'fForAdd', 'fForEdit');
36   -KTUtil::extractGPC('fForStore', 'fForUpdate', 'fTargetDocumentID', 'fUnitID', 'fUserID');
37   -
38   -if (checkSession()) {
39   - if (isset($fFolderID) && isset($fFolderCollaborationID)) {
40   -
41   - //folder and collaboration are selected
42   - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc");
43   - require_once("$default->fileSystemRoot/lib/foldermanagement/FolderCollaboration.inc");
44   - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
45   - require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
46   - require_once("$default->fileSystemRoot/lib/users/User.inc");
47   - require_once("$default->fileSystemRoot/lib/documentmanagement/DependantDocumentTemplate.inc");
48   - require_once("$default->fileSystemRoot/presentation/Html.inc");
49   - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc");
50   - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
51   - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
52   - require_once("viewDependantDocumentsUI.inc");
53   -
54   - $oFolder = Folder::get($fFolderID);
55   - if (Permission::userHasFolderWritePermission($oFolder)) {
56   - //user has folder write permission
57   - if (isset($fForStore)) {
58   - $oDependantDocumentTemplate;
59   - if ($fTargetDocumentID == "-1") {
60   - $oDependantDocumentTemplate = & new DependantDocumentTemplate($fDocumentTitle, $fUserID, $fFolderCollaborationID);
61   - } else {
62   - $oDependantDocumentTemplate = & new DependantDocumentTemplate($fDocumentTitle, $fUserID, $fFolderCollaborationID, $fTargetDocumentID);
63   - }
64   - if (!($oDependantDocumentTemplate->create())) {
65   - include_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
66   -
67   - $oPatternCustom = & new PatternCustom();
68   - $oPatternCustom->setHtml(getViewPage($fFolderCollaborationID, $fFolderID));
69   - $main->setCentralPayload($oPatternCustom);
70   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForAdd=1");
71   - $main->setErrorMessage(_("An error occured attempting to store the dependant document"));
72   - $main->render();
73   - } else {
74   - controllerRedirect("viewDependantDocument", "fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID");
75   - }
76   - } else if (isset($fForAdd)) {
77   - //we are adding a new dependant document
78   - $oFolderCollaboration = FolderCollaboration::get($fFolderCollaborationID);
79   - if ($oFolderCollaboration->hasDocumentInProcess()) {
80   - include_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
81   -
82   - $oPatternCustom = & new PatternCustom();
83   - $oPatternCustom->setHtml(getViewPage($fFolderCollaborationID, $fFolderID));
84   - $main->setCentralPayload($oPatternCustom);
85   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForAdd=1");
86   - $main->setErrorMessage(_("You cannot add a new dependant document as there is currently a document in this folder undergoing collaboration"));
87   - $main->render();
88   -
89   - } else {
90   - include_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
91   -
92   - $oPatternCustom = & new PatternCustom();
93   - $oPatternCustom->setHtml(getAddPage($fFolderCollaborationID, $fFolderID, (isset($fUnitID) ? $fUnitID : -1), (isset($fDocumentTitle) ? $fDocumentTitle : ""), (isset($fDocument) ? $fDocument : ""), (isset($fTargetDocumentID) ? $fTargetDocumentID : "") ));
94   - if ($default->bNN4) {
95   - $main->setOnLoadJavaScript("disable(document.MainForm.fTargetDocument)");
96   - }
97   - $main->setCentralPayload($oPatternCustom);
98   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForStore=1");
99   - $main->setHasRequiredFields(true);
100   - $main->render();
101   - }
102   - } else if (isset($fForEdit)) {
103   - $oFolderCollaboration = FolderCollaboration::get($fFolderCollaborationID);
104   - if ($oFolderCollaboration->hasDocumentInProcess()) {
105   - //can't edit if there is a document currently undergoing collaboration
106   - include_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
107   -
108   - $oPatternCustom = & new PatternCustom();
109   - $oPatternCustom->setHtml(getViewPage($fFolderCollaborationID, $fFolderID));
110   - $main->setCentralPayload($oPatternCustom);
111   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForUpdate=1");
112   - $main->setErrorMessage(_("You cannot add a new dependant document as there is currently a document in this folder undergoing collaboration"));
113   - $main->render();
114   -
115   - } else {
116   - include_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
117   -
118   - $oDependantDocumentTemplate = DependantDocumentTemplate::get($fDependantDocumentTemplateID);
119   - if ($oDependantDocumentTemplate->getTemplateDocumentID() >= 1) {
120   - $oDocument = Document::get($oDependantDocumentTemplate->getTemplateDocumentID());
121   - }
122   -
123   - $oPatternCustom = & new PatternCustom();
124   - $oPatternCustom->setHtml(getEditPage($fFolderID, $fDependantDocumentTemplateID, $fFolderCollaborationID, $oDependantDocumentTemplate->getDocumentTitle(), (isset($oDocument) ? $oDocument->getName() : ""), (isset($oDocument) ? $oDependantDocumentTemplate->getTemplateDocumentID() : null), $oDependantDocumentTemplate->getDefaultUserID()));
125   - if ($default->bNN4) {
126   - $main->setOnLoadJavaScript("disable(document.MainForm.fTargetDocument)");
127   - }
128   - $main->setCentralPayload($oPatternCustom);
129   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fDependantDocumentTemplateID=$fDependantDocumentTemplateID&fForUpdate=1");
130   - $main->setHasRequiredFields(true);
131   - $main->render();
132   - }
133   - } else if (isset($fForUpdate)) {
134   - $oDependantDocumentTemplate = DependantDocumentTemplate::get($fDependantDocumentTemplateID);
135   - $oDependantDocumentTemplate->setDefaultUserID($fUserID);
136   - $oDependantDocumentTemplate->setDocumentTitle($fDocumentTitle);
137   - $oDependantDocumentTemplate->setTemplateDocumentID((isset($fTargetDocumentID) ? $fDocument : null));
138   - $oDependantDocumentTemplate->update();
139   -
140   - redirect("$default->rootUrl/control.php?action=viewDependantDocument&fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID");
141   -
142   - } else {
143   - include_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
144   -
145   - $oPatternCustom = & new PatternCustom();
146   - $oPatternCustom->setHtml(getViewPage($fFolderCollaborationID, $fFolderID));
147   - $main->setCentralPayload($oPatternCustom);
148   - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForAdd=1");
149   - $main->render();
150   - }
151   - } else {
152   - //redirect the user back to their start page if they somehow
153   - //got here without the relevant permission
154   - redirect($default->root_url . "/control.php");
155   - }
156   - }
157   -}
158   -?>
presentation/lookAndFeel/knowledgeTree/foldermanagement/viewDependantDocumentsUI.inc deleted
1   -<?php
2   -/**
3   - * $Id$
4   - *
5   - * Dependent documents UI functions.
6   - *
7   - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
8   - *
9   - * This program is free software; you can redistribute it and/or modify
10   - * it under the terms of the GNU General Public License as published by
11   - * the Free Software Foundation; either version 2 of the License, or
12   - * (at your option) any later version.
13   - *
14   - * This program is distributed in the hope that it will be useful,
15   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17   - * GNU General Public License for more details.
18   - *
19   - * You should have received a copy of the GNU General Public License
20   - * along with this program; if not, write to the Free Software
21   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22   - *
23   - * @version $Revision$
24   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
25   - * @package foldermanagement
26   - */
27   -
28   -function getFolderPath($iFolderID) {
29   - global $default;
30   - $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
31   - $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
32   - $sFolderPathLink = displayFolderPathLink(Folder::getFolderPathAsArray($iFolderID), Folder::getFolderPathNamesAsArray($iFolderID), "$default->rootUrl/control.php?action=browse");
33   - return "<table border=\"0\" width = 100%><tr><td bgcolor=\"$sTDBGColour\">$sFolderPathLink</td></tr></table>\n";
34   -}
35   -
36   -function getDocumentLinkFolderCollaborationData($iFolderCollaborationID) {
37   - global $default;
38   - /*ok*/ $sQuery = array("SELECT DDT.id, GFAL.folder_id AS folder_id, U.name AS username, DDT.document_title, D.name AS template_document_name, D.id AS template_document_id, DDT.group_folder_approval_link_id, 'Edit' AS edit, 'Delete' AS del " .
39   - "FROM dependant_document_template AS DDT INNER JOIN groups_folders_approval_link AS GFAL ON DDT.group_folder_approval_link_id = GFAL.id " .
40   - "INNER JOIN users AS U ON U.id = DDT.default_user_id " .
41   - "LEFT OUTER JOIN documents AS D ON D.id = DDT.template_document_id " .
42   - "WHERE DDT.group_folder_approval_link_id = ?", $iFolderCollaborationID);
43   -
44   - //echo $sQuery;
45   - $aColumns = array("document_title", "username", "template_document_name", "edit", "del");
46   - $aColumnHeaders = array(_("Document title"), _("Default creator"), _("Template document"));
47   - $aColumnTypes = array(1,1,3,3,3);
48   - //$aDBColumnArray = array("id","group_folder_approval_link_id","template_document_id");
49   - $aDBColumnArray = array("id","group_folder_approval_link_id","folder_id");
50   - //$aQueryStringVariableNames = array("fDependantDocumentTemplateID", "fFolderCollaborationID", "fTargetDocumentID");
51   - $aQueryStringVariableNames = array("fDependantDocumentTemplateID","fFolderCollaborationID","fFolderID");
52   - $aLinkURLs = array(2=>"$default->rootUrl/control.php?action=viewDocument", 3=>"$default->rootUrl/control.php?action=viewDependantDocument&fForEdit=1", 4=>"$default->rootUrl/control.php?action=deleteDependantDocument");
53   -
54   - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "90%", $aLinkURLs, $aDBColumnArray,$aQueryStringVariableNames);
55   - $oPatternTableSqlQuery->setTableHeading(_("Dependant Documents"));
56   - $oPatternTableSqlQuery->setDisplayColumnHeadings(true);
57   - $oPatternTableSqlQuery->setEmptyTableMessage(_("No dependant documents"));
58   -
59   - return $oPatternTableSqlQuery->render();
60   -
61   -
62   -}
63   -
64   -function getViewPage($iFolderCollaborationID, $iFolderID) {
65   - global $default;
66   - $sToRender = renderHeading(_("Dependant documents"));
67   - $sToRender .= getFolderPath($iFolderID);
68   - $sToRender .= "<table border=\"0\" width=\"100%\">\n";
69   - $sToRender .= "<tr>\n";
70   - $sToRender .= "<td>" . getDocumentLinkFolderCollaborationData($iFolderCollaborationID) . "</td>\n";
71   - $sToRender .= "</tr>\n";
72   - $sToRender .= "<tr>\n";
73   - $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"" . KTHtml::getAddButton() . "\" border=\"0\"/></td><td>" . generateControllerLink("editFolder", "fFolderID=$iFolderID&fShowSection=folderRouting", "<img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"/>") . "</td></tr></table>\n";
74   - $sToRender .= "</tr>\n";
75   - $sToRender .= "</table>\n";
76   -
77   - return $sToRender;
78   -}
79   -
80   -function getEditPage($iFolderID, $iDependantDocumentID, $iFolderCollaborationID, $sDocumentTitle, $sTemplateDocumentName, $iDocumentID, $iUserID) {
81   - global $default;
82   - $iDefaultUserUnitID = User::getUnitID($iUserID);
83   -
84   - $sToRender = renderHeading(_("Dependant documents"));
85   - $sToRender .= getFolderPath($iFolderID);
86   - $sToRender .= "<table border=\"0\" width=\"100%\">\n";
87   - $sToRender .= "<tr>\n";
88   - $sToRender .= "<td>" . _("Document Title") . "</td><td><input type=\"text\" name=\"fDocumentTitle\" value=\"$sDocumentTitle\" /></td>\n";
89   - $sToRender .= "</tr>\n";
90   - $sToRender .= "<tr>\n";
91   - $sToRender .= "<td>" . _("User's Unit") . "</td><td>" . getUnitDropDown($iFolderCollaborationID, $iFolderID, $iDefaultUserUnitID) . "</td>\n";
92   - $sToRender .= "</tr>\n";
93   - $sToRender .= "<tr>\n";
94   - $sToRender .= "<td>" . _("User") . "</td><td>" . getUserDropDown($iDefaultUserUnitID, $iUserID) . "</td>\n";
95   - $sToRender .= "</tr>\n";
96   - $sToRender .= "<tr>\n";
97   -
98   - //had a slight problem with netscape 4.7x - it doesn't support disabled. So I had to use
99   - //javascript to set the onFocus attribute to blur
100   - if (!$default->bNN4) {
101   - //for any other browser but netscape 4.7 do this
102   - $sToRender .= "<td>" . _("Template document") . "</td><td><input type=\"text\" DISABLED name=\"fTargetDocument\" value=\"$sTemplateDocumentName\" /><input type=\"button\" value=\"Browse\" onClick=\"newWindow('" . generateControllerLink("templateBrowse", "") . "','window2')\"></td>\n";
103   - } else {
104   - //for netscape 4.7 do this
105   - $sToRender .= "<td>" . _("Template document") . "</td><td><input type=\"text\" value=\"$sTemplateDocumentName\" name=\"fTargetDocument\" onblur=\"disable(document.MainForm.fTargetDocument);\" /><input type=\"button\" value=\"Browse\" onClick=\"disable(document.MainForm.fTargetDocument);newWindow('http://ktdev/control.php?action=templateBrowse','window2')\"></td>\n";
106   - }
107   - $sToRender .= "</tr>\n";
108   - $sToRender .= "<tr>\n";
109   - $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"" . KTHtml::getUpdateButton() . "\" border=\"0\"/></td><td><a href=\"" . $default->rootUrl . "/control.php?action=viewDependantDocument&fFolderID=$iFolderID&fFolderCollaborationID=$iFolderCollaborationID\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"/></a></td></tr></table>\n";
110   - $sToRender .= "</tr>\n";
111   - $sToRender .= "</table>\n";
112   - $sToRender .= "<input type=\"hidden\" name=\"fTargetDocumentID\" value=\"-1\" />\n";
113   -
114   - return $sToRender . "\n\n" . getValidationJavaScript() . "\n\n" . getBrowseJavaScript();
115   -}
116   -
117   -
118   -function getAddPage($iFolderCollaborationID, $iFolderID, $iUnitID, $sDocumentTitle, $sTemplateDocument, $iDocumentID) {
119   - global $default;
120   - $sToRender = renderHeading(_("Dependant documents"));
121   - $sToRender .= getFolderPath($iFolderID);
122   - $sToRender .= "<table border=\"0\" width=\"100%\">\n";
123   - $sToRender .= "<tr>\n";
124   - $sToRender .= "<td>" . _("Document Title") . "</td><td><input type=\"text\" name=\"fDocumentTitle\" value=\"$sDocumentTitle\" /></td>\n";
125   - $sToRender .= "</tr>\n";
126   - $sToRender .= "<tr>\n";
127   - $sToRender .= "<td>" . _("User's Unit") . "</td><td>" . getUnitDropDown($iFolderCollaborationID, $iFolderID, $iUnitID) . "</td>\n";
128   - $sToRender .= "</tr>\n";
129   - $sToRender .= "<tr>\n";
130   - $sToRender .= "<td>" . _("User") . "</td><td>" . getUserDropDown($iUnitID) . "</td>\n";
131   - $sToRender .= "</tr>\n";
132   - $sToRender .= "<tr>\n";
133   -
134   - //had a slight problem with netscape 4.7x - it doesn't support disabled. So I had to use
135   - //javascript to set the onFocus attribute to blur
136   - if (!$default->bNN4) {
137   - //for any other browser but netscape 4.7 do this
138   - $sToRender .= "<td>" . _("Template document") . "</td><td><input type=\"text\" DISABLED name=\"fTargetDocument\" value=\"$sTemplateDocument\" /><input type=\"button\" value=\"Browse\" onClick=\"newWindow('$default->rootUrl/control.php?action=templateBrowse','window2')\"></td>\n";
139   - } else {
140   - //for netscape 4.7 do this
141   - $sToRender .= "<td>" . _("Template document") . "</td><td><input type=\"text\" name=\"fTargetDocument\" onblur=\"disable(document.MainForm.fTargetDocument);\" /><input type=\"button\" value=\"Browse\" onClick=\"disable(document.MainForm.fTargetDocument);newWindow('$default->rootUrl/control.php?action=templateBrowse','window2')\"></td>\n";
142   - }
143   - $sToRender .= "</tr>\n";
144   - $sToRender .= "<tr>\n";
145   - $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"" . KTHtml::getDoneButton() . "\" border=\"0\"/></td><td><a href=\"" . $default->rootUrl . "/control.php?action=viewDependantDocument&fFolderID=$iFolderID&fFolderCollaborationID=$iFolderCollaborationID\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"/></a></td></tr></table>\n";
146   - $sToRender .= "</tr>\n";
147   - $sToRender .= "</table>\n";
148   - $sToRender .= "<input type=\"hidden\" name=\"fTargetDocumentID\" value=\"-1\" />\n";
149   -
150   - return $sToRender . "\n\n" . getValidationJavaScript() . "\n\n" . getBrowseJavaScript();
151   -}
152   -
153   -function getUserDropDown($iUnitID, $iUserID = null) {
154   - global $default;
155   - $oPatternListBox = & new PatternListBox($default->users_table, "Name", "id", "fUserID", "GUL.unit_id = $iUnitID");
156   - $sFromClause = "INNER join $default->users_groups_table AS UGL ON UGL.user_id = ST.id " .
157   - "INNER JOIN groups_units_link AS GUL ON GUL.group_id = UGL.group_id ";
158   - $oPatternListBox->setFromClause($sFromClause);
159   - if (isset($iUserID)) {
160   - $oPatternListBox->setSelectedValue($iUserID);
161   - }
162   - return $oPatternListBox->render();
163   -
164   -
165   -}
166   -
167   -function getUnitDropDown($iFolderCollaborationID, $iFolderID, $iUnitID = null) {
168   - global $default;
169   - $oPatternListBox = & new PatternListBox($default->units_table, "Name", "id", "fUnitID");
170   - $oPatternListBox->setPostBackOnChange(true);
171   - $oPatternListBox->setOnChangeAction("setActionAndSubmit('" . $_SERVER["PHP_SELF"] . "?fFolderID=$iFolderID&fFolderCollaborationID=$iFolderCollaborationID&fForAdd=1')");
172   - if (isset($iUnitID)) {
173   - $oPatternListBox->setSelectedValue($iUnitID);
174   - }
175   - return $oPatternListBox->render();
176   -}
177   -
178   -function getValidationJavaScript() {
179   - $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n";
180   - $sToRender .= "function validateForm(theForm) {\n";
181   - $sToRender .= "\tif (!(validRequired(theForm.fDocumentTitle,'" . _("Document Title") . "') && validRequired(theForm.fUserID,'" . _("User") . "'))) {\n";
182   - $sToRender .= "\t\treturn false;\n\t}\n";
183   - $sToRender .= "return true;\n}\n";
184   - $sToRender .= "//-->\n</script>\n\n";
185   - return $sToRender;
186   -}
187   -
188   -function getBrowseJavaScript() {
189   - $sToRender = "<script language=\"JavaScript\"><!--\n ";
190   - $sToRender .= "function newWindow(file,window) {\n ";
191   - $sToRender .= "\tmsgWindow=open(file,window,'resizable=yes,scrollbars=yes, width=400,height=600');\n ";
192   - $sToRender .= "\tif (msgWindow.opener == null) msgWindow.opener = self; \n ";
193   - $sToRender .= "}\n";
194   - $sToRender .= "//--></script>\n";
195   - return $sToRender;
196   -}
197   -?>