templateDocumentBrowseBL.php
5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
require_once("../../../../config/dmsDefaults.php");
KTUtil::extractGPC('fBrowseType', 'fSortBy', 'fSortDirection');
require_once("$default->fileSystemRoot/lib/browse/BrowserFactory.inc");
require_once("$default->fileSystemRoot/lib/browse/Browser.inc");
require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentType.inc");
require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc");
require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
require_once("$default->uiDirectory/documentmanagement/browseUI.inc");
require_once("$default->fileSystemRoot/presentation/Html.inc");
/**
* $Id$
*
* This page very closely follows browseBL.php. This page is ONLY used when a user
* browses for a template document when setting up document linking in folder
* collaboration. This page is launched as a separate window by javascript. The
* user browses for the document that will serve as a template and then selects it.
* This causes this window to close and set the template document value in the
* the parent window.
*
* The main difference between this file and browseBL.php is the way the document
* links are generated. When clicking on a document link, instead of being taken
* to the document, the document values are sent to the parent window and the
* window is closed
*
* Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @version $Revision$
* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
* @package documentmanagement
*/
// only if we have a valid session
if (checkSession()) {
require_once("../../../../phpSniff/phpTimer.class.php");
$timer = new phpTimer();
$timer->start();
// retrieve variables
if (!$fBrowseType) {
// required param not set- internal error or user querystring hacking
// set it to default= folder
$fBrowseType = "folder";
}
// retrieve field to sort by
if (!$fSortBy) {
// no sort field specified- default is document name
$fSortBy = "name";
}
// retrieve sort direction
if (!$fSortDirection) {
$fSortDirection = "asc";
}
// fire up the document browser
$oBrowser = BrowserFactory::create($fBrowseType, $fSortBy, $fSortDirection);
// instantiate my content pattern
$oContent = new PatternCustom();
$aResults = $oBrowser->browse();
require_once("../../../webpageTemplate.inc");
// display the browse results
$oContent->addHtml(renderPage($aResults, $fBrowseType, $fSortBy, $fSortDirection, true));
$sToRender = "<html>\n";
$sToRender .= "<head>\n";
$sToRender .= "<meta http-equiv=\"refresh\" content=\"" . ($default->sessionTimeout+3) . "\">\n";
$sToRender .= "<link rel=\"SHORTCUT ICON\" href=\"$default->graphicsUrl/tree.ico\">\n";
$sToRender .= "<link rel=\"stylesheet\" href=\"$default->uiUrl/stylesheet.php\">\n";
$sToRender .= "</head>\n";
$sToRender .= "<body>\n";
$sToRender .= $oContent->render() . "\n";
$sToRender .= "</body>";
$sToRender .= "</html>\n";
echo $sToRender . "\n\n" . getSendInfoToParentJavaScript();
}
function getSendInfoToParentJavaScript() {
$sToRender = "<script language=\"JavaScript\"><!--\n";
$sToRender .= "function load(documentName, documentID, target) {\n";
$sToRender .= "\tif (target != '') {\n";
//$sToRender .= "\t\ttarget.window.document.MainForm.fTemplateDocument.value = documentName;\n";
//$sToRender .= "\t\ttarget.window.document.MainForm.fTemplateDocumentID.value = documentID;\n";
$sToRender .= "\t\ttarget.window.document.MainForm.fTargetDocumentID.value = documentID;\n";
$sToRender .= "\t\ttarget.window.document.MainForm.fTargetDocument.value = documentName;\n";
$sToRender .= "\t}\n";
$sToRender .= "\telse {\n";
$sToRender .= "\t\twindow.location.href = file;\n";
$sToRender .= "\t}\n";
$sToRender .= "\twindow.close();\n";
$sToRender .= "}\n";
$sToRender .= "//--></script>\n\n";
return $sToRender;
}
/*function renderBrowsePage($oContent) {
global $default;
$sToRender = "<html>\n";
$sToRender .= "<head>\n";
$sToRender .= "<meta http-equiv=\"refresh\" content=\"" . ($default->sessionTimeout+3) . "\">\n";
$sToRender .= "<link rel=\"SHORTCUT ICON\" href=\"$default->graphicsUrl/tree.ico\">\n";
$sToRender .= "<link rel=\"stylesheet\" href=\"$default->uiUrl/stylesheet.php\">\n";
$sToRender .= "</head>\n";
$sToRender .= "<body>\n";
$sToRender .= $oContent->render() . "\n";
$sToRender .= "</body>";
$sToRender .= "</html>\n";
return $sToRender;
}*/
?>