CMS
Version 3.9
document_picker.inc
Go to the documentation of this file.
1
<?php
2
/**************************************************************
3
4
Copyright (c) 2010 Sonjara, Inc
5
6
Permission is hereby granted, free of charge, to any person
7
obtaining a copy of this software and associated documentation
8
files (the "Software"), to deal in the Software without
9
restriction, including without limitation the rights to use,
10
copy, modify, merge, publish, distribute, sublicense, and/or sell
11
copies of the Software, and to permit persons to whom the
12
Software is furnished to do so, subject to the following
13
conditions:
14
15
The above copyright notice and this permission notice shall be
16
included in all copies or substantial portions of the Software.
17
18
Except as contained in this notice, the name(s) of the above
19
copyright holders shall not be used in advertising or otherwise
20
to promote the sale, use or other dealings in this Software
21
without prior written authorization.
22
23
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
25
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30
OTHER DEALINGS IN THE SOFTWARE.
31
32
*****************************************************************/
33
34
Fakoli::usingFeature
(
"tree"
);
35
require_once
"include/link_picker_tabs.inc"
;
36
37
$editor
= $_GET[
"Editor"
];
38
$document_library_id
= checkNumeric($_GET[
"document_library_id"
]);
39
40
$libraries
= Query::create(
DocumentLibrary
,
"ORDER BY name"
)->execute();
41
42
if
(!
$document_library_id
&& count(
$libraries
) > 0)
43
{
44
$document_library_id
=
$libraries
[0]->document_library_id;
45
}
46
47
$script
.= <<<ENDSCRIPT
48
<script type=
"text/javascript"
>
49
function
insertLink(url)
50
{
51
window.opener.theEditors[
'$editor'
].formatSelection(
"<a href=\""
+ url +
"\">"
);
52
}
53
54
function
showLibrary(
id
)
55
{
56
document.location.href=
"/document_picker?Editor=$editor&document_library_id="
+
id
;
57
}
58
59
function
documentSelected()
60
{
61
document.id(
'linkButton'
).disabled =
false
;
62
}
63
64
function
linkToDocument()
65
{
66
id
= document.id(
'files_value'
).value;
67
insertLink(
"/action/document/download?document_id="
+
id
);
68
window.close();
69
}
70
71
</script>
72
ENDSCRIPT;
73
74
$tabs
=
linkPickerTabs
(
"Editor=$editor"
);
75
$tabs
->page =
"/document_picker"
;
76
77
$tabs
->writeHTML();
78
79
$library
=
new
DocumentLibrary
();
80
if
(
$document_library_id
)
$library
->load(
$document_library_id
);
81
82
$docMgr
=
new
DocumentManager
(
$library
);
83
84
?>
85
<div
style
=
"border: solid 1px #666; background: url(/fakoli/images/table-header.png); width: 100%;padding: 2px 0px"
>
86
<strong>&
nbsp
;
Document
Library: </strong>
87
<select name=
"document_library_id"
onchange=
"showLibrary(this.value)"
>
88
<?
89
foreach
(
$libraries
as
$library
)
90
{
91
option(
$library
->document_library_id,
$library
->name,
$document_library_id
);
92
}
93
?>
94
</select>
95
</div>
96
<div
style
=
"clear: left"
>
97
<?
98
$docMgr
->drawSelectView(
"documentSelected"
,
"linkToDocument"
,
"100%"
, 240);
99
?>
100
<br/>
101
<button
id
=
"linkButton"
onclick=
"linkToDocument()"
disabled=
"disabled"
class
=
"button"
>Link
to
Document
</button>
102
<br/>
103
</div>
nbsp
& nbsp
Definition:
index.inc:49
style
$helpTree style
Definition:
tree.inc:46
Document
This class maps the publication table.
Definition:
document.inc:43
DocumentLibrary
Definition:
document_library.inc:42
DocumentManager
The DocumentManager class provides the core API and management functions for uploading documents and ...
Definition:
document_manager.inc:71
Fakoli\usingFeature
static usingFeature()
Uses the specified framework feature(s).
Definition:
core.inc:388
id
$validator id
Definition:
create_folder.inc:50
to
$forumRequest to
Definition:
forum_request_form.inc:51
$libraries
$libraries
Definition:
document_picker.inc:40
$docMgr
$docMgr
Definition:
document_picker.inc:50
$library
if(! $document_library_id &&count($libraries) > 0) $library
Definition:
document_picker.inc:47
$editor
$editor
Definition:
document_picker.inc:37
$document_library_id
$document_library_id
Definition:
document_picker.inc:38
linkPickerTabs
linkPickerTabs($qs)
Definition:
link_picker_tabs.inc:36
$script
if(! $document_library_id &&count($libraries) > 0) $script
Definition:
document_picker.inc:47
$tabs
$tabs
Definition:
document_picker.inc:74
code
cms.sonjara.com
cms
components
link_picker
pages
document_picker.inc
Generated on Tue Mar 23 2021 15:36:13 for CMS by
1.9.1