Platform
3.1
PHP API documentation
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
viewextdoc.php
Go to the documentation of this file.
1
<?php
2
/*
3
* @author Anakeen
4
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5
* @package FDL
6
*/
7
/**
8
* View Document
9
*
10
* @author Anakeen 2000
11
* @version $Id: fdl_card.php,v 1.42 2008/12/02 15:20:52 eric Exp $
12
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13
* @package FDL
14
* @subpackage
15
*/
16
/**
17
*/
18
19
include_once (
"FDL/fdl_card.php"
);
20
21
include_once (
"FDL/popupdocdetail.php"
);
22
include_once (
"FDL/popupfamdetail.php"
);
23
/**
24
* View a extjs document
25
* @param Action &$action current action
26
* @global id Http var : document identificator to see
27
* @global latest Http var : (Y|N|L|P) if Y force view latest revision, L : latest fixed revision, P : previous revision
28
* @global state Http var : to view document in latest fixed state (only if revision > 0)
29
* @global abstract Http var : (Y|N) if Y view only abstract attribute
30
* @global props Http var : (Y|N) if Y view properties also
31
* @global zonebodycard Http var : if set, view other specific representation
32
* @global vid Http var : if set, view represention describe in view control (can be use only if doc has controlled view)
33
* @global ulink Http var : (Y|N)if N hyperlink are disabled
34
* @global target Http var : is set target of hyperlink can change (default _self)
35
* @global inline Http var : (Y|N) set to Y for binary template. View in navigator
36
* @global reload Http var : (Y|N) if Y update freedom folders in client navigator
37
* @global dochead Http var : (Y|N) if N don't see head of document (not title and icon)
38
*/
39
function
viewextdoc
(&
$action
)
40
{
41
if
(!file_exists(
'lib/ui/freedom-extui.js'
)) {
42
$err
= _(
"This action requires the installation of Dynacase Extui module"
);
43
$action
->ExitError(
$err
);
44
}
45
46
$ec = getHttpVars(
"extconfig"
);
47
if
($ec) {
48
$ec = json_decode($ec);
49
foreach
($ec as $k => $v) {
50
setHttpVar(
"ext:$k"
, $v);
51
//$action->register("ext:$k",$v);
52
53
}
54
}
55
56
fdl_card
(
$action
);
57
$docid
=
GetHttpVars
(
"id"
);
58
$dbaccess
=
$action
->GetParam(
"FREEDOM_DB"
);
59
$doc
=
new_Doc
(
$dbaccess
,
$docid
);
60
61
if
(
$doc
->doctype ==
'C'
) $popup =
getpopupfamdetail
(
$action
,
$docid
);
62
else
$popup =
getpopupdocdetail
(
$action
,
$docid
);
63
// rewrite for api 3.0
64
$im = array();
65
foreach
($popup as $k => $v) {
66
if
($v[
"visibility"
] !=
POPUP_INVISIBLE
) {
67
if
(preg_match(
"/zone=.*:pdf/"
, $v[
"url"
])) $url = $v[
"url"
];
68
else
$url = str_replace(array(
69
"FDL_CARD"
,
70
'app=GENERIC&action=GENERIC_EDIT'
,
71
"&action="
72
) , array(
73
"VIEWEXTDOC"
,
74
'app=FDL&action=EDITEXTDOC'
,
75
'&viewext=yes&action='
76
) , $v[
"url"
]);
77
$imenu = array(
78
"url"
=> $url,
79
"javascript"
=> str_replace(array(
80
"FDL_CARD"
,
81
'app=GENERIC&action=GENERIC_EDIT'
,
82
"&action="
83
) , array(
84
"VIEWEXTDOC"
,
85
'app=FDL&action=EDITEXTDOC'
,
86
'&viewext=yes&action='
87
) , $v[
"jsfunction"
]) ,
88
"visibility"
=> $v[
"visibility"
],
89
"label"
=> $v[
"descr"
],
90
"type"
=>
"item"
,
91
"target"
=> $v[
"target"
],
92
"description"
=> $v[
"title"
],
93
"backgroundColor"
=> $v[
"color"
],
94
"icon"
=> $v[
"icon"
],
95
"confirm"
=> (($v[
"confirm"
] && $v[
"confirm"
] !=
'false'
) ? array(
96
"label"
=> $v[
"tconfirm"
],
97
"continue"
=> _(
"yes"
) ,
98
"cancel"
=> _(
"no"
)
99
) : null)
100
);
101
if
(!$v[
"submenu"
]) {
102
$mainmenu = (
$doc
->doctype ==
'C'
) ? _(
"Family"
) : $v[
"submenu"
] =
$doc
->fromtitle;
103
$v[
"submenu"
] = $mainmenu;
104
}
105
if
($v[
"submenu"
]) {
106
if
(!$im[$v[
"submenu"
]]) {
107
$im[$v[
"submenu"
]] = array(
108
"type"
=>
"menu"
,
109
"label"
=> _($v[
"submenu"
]) ,
110
"items"
=> array()
111
);
112
if
($v[
"submenu"
] ==
$doc
->fromtitle) $im[$v[
"submenu"
]][
"icon"
] =
$doc
->getIcon();
113
}
114
$im[$v[
"submenu"
]][
"items"
][$k] = $imenu;
115
}
else
$im[$k] = $imenu;
116
}
117
}
118
$im[$mainmenu][
"items"
][
"histo"
] = array(
119
"script"
=> array(
120
"file"
=>
"lib/ui/fdl-interface-action-common.js"
,
121
"class"
=>
"Fdl.InterfaceAction.Historic"
122
) ,
123
"label"
=> _(
"Historic"
) ,
124
"visibility"
=> $im[$mainmenu][
"items"
][
"histo"
][
"visibility"
]
125
);
126
$fnote = new_doc(
$doc
->dbaccess,
"SIMPLENOTE"
);
127
if
($fnote->control(
"icreate"
) ==
""
) {
128
$im[$mainmenu][
"items"
][
"addpostit"
] = array(
129
"script"
=> array(
130
"file"
=>
"lib/ui/fdl-interface-action-common.js"
,
131
"class"
=>
"Fdl.InterfaceAction.SimpleNote"
132
) ,
133
"label"
=> _(
"Add a note"
) ,
134
"visibility"
=> $im[$mainmenu][
"items"
][
"addpostit"
][
"visibility"
]
135
);
136
}
else
{
137
$im[$mainmenu][
"items"
][
"addpostit"
][
"visibility"
] =
POPUP_INVISIBLE
;
138
}
139
if
(
$doc
->control(
"send"
) ==
""
) {
140
$im[$mainmenu][
"items"
][
"sendmail"
] = array(
141
"url"
=>
"?app=FDL&action=EDITMAIL&viewext=yes&mid="
.
$doc
->id,
142
"label"
=> _(
"Send document"
) ,
143
"visibility"
=>
POPUP_ACTIVE
144
);
145
}
146
$im[$mainmenu][
"items"
][
"viewprint"
] = array(
147
"javascript"
=>
"window.open('?app=FDL&action=IMPCARD&view=print&id="
.
$doc
->id .
"','_blank')"
,
148
"label"
=> _(
"View print version"
) ,
149
"visibility"
=>
POPUP_ACTIVE
150
);
151
$im[$mainmenu][
"items"
][
"reload"
] = array(
152
"script"
=> array(
153
"file"
=>
"lib/ui/fdl-interface-action-common.js"
,
154
"class"
=>
"Fdl.InterfaceAction.Reload"
155
) ,
156
"label"
=> _(
"Reload document"
) ,
157
"visibility"
=>
POPUP_ACTIVE
158
);
159
$action
->lay->set(
"documentMenu"
, json_encode($im));
160
161
$style
=
$action
->parent->getParam(
"STYLE"
);
162
163
$action
->parent->AddCssRef(
"STYLE/DEFAULT/Layout/EXT-ADAPTER-SYSTEM.css"
);
164
if
(file_exists(
$action
->parent->rootdir .
"/STYLE/$style/Layout/EXT-ADAPTER-USER.css"
)) {
165
$action
->parent->AddCssRef(
"STYLE/$style/Layout/EXT-ADAPTER-USER.css"
);
166
}
else
{
167
$action
->parent->AddCssRef(
"STYLE/DEFAULT/Layout/EXT-ADAPTER-USER.css"
);
168
}
169
}
170
?>
← centre documentaire
© anakeen
- published under
CC License
-
Dynacase