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
editextdoc.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 (
"GENERIC/generic_edit.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
editextdoc
(&
$action
)
40
{
41
42
$rzone =
GetHttpVars
(
"rzone"
);
// special zone when finish edition
43
$ezone =
GetHttpVars
(
"ezone"
);
// special zone when finish edition
44
$rvid =
GetHttpVars
(
"rvid"
);
// special zone when finish edition
45
$rtarget =
GetHttpVars
(
"rtarget"
,
"_self"
);
// special zone when finish edition return target
46
$classid =
GetHttpVars
(
"classid"
);
// special zone when finish edition
47
$vid =
GetHttpVars
(
"vid"
);
// special controlled view
48
$ec = getHttpVars(
"extconfig"
);
49
if
($ec) {
50
$ec = json_decode($ec);
51
foreach
($ec as $k => $v) setHttpVar(
"ext:$k"
, $v);
52
}
53
54
$docid
=
GetHttpVars
(
"id"
);
55
$dbaccess
=
$action
->GetParam(
"FREEDOM_DB"
);
56
57
if
((
$docid
=== 0) || (
$docid
===
""
) || (
$docid
===
"0"
)) {
58
if
($classid ==
""
)
$action
->exitError(sprintf(_(
"Creation aborded : no family specified"
)));
59
if
(!is_numeric($classid)) $classid =
getFamIdFromName
(
$dbaccess
, $classid);
60
if
($classid ==
""
)
$action
->exitError(sprintf(_(
"Creation aborded : unknow family %s"
) ,
GetHttpVars
(
"classid"
,
getDefFam
(
$action
))));
61
if
($classid > 0) {
62
$cdoc =
new_Doc
(
$dbaccess
, $classid);
63
if
($cdoc->control(
'create'
) !=
""
)
$action
->exitError(sprintf(_(
"no privilege to create this kind (%s) of document"
) , $cdoc->gettitle()));
64
if
($cdoc->control(
'icreate'
) !=
""
)
$action
->exitError(sprintf(_(
"no privilege to create interactivaly this kind (%s) of document"
) , $cdoc->gettitle()));
65
}
66
67
$doc
=
createDoc
(
$dbaccess
, $classid);
68
if
($usefor ==
'D'
|| $usefor ==
'Q'
)
$doc
->state =
''
;
69
if
(!
$doc
)
$action
->exitError(sprintf(_(
"no privilege to create this kind (%d) of document"
) , $classid));
70
}
else
{
71
$doc
=
new_Doc
(
$dbaccess
,
$docid
,
true
);
// always latest revision
72
$rev =
getLatestRevisionNumber
(
$dbaccess
,
$doc
->initid,
$doc
->fromid);
73
if
(
$doc
->revision != $rev)
$action
->ExitError(sprintf(
"document %d : multiple alive revision (%d <> %d)"
,
$doc
->initid,
$doc
->revision, $rev));
74
$docid
=
$doc
->id;
75
setHttpVar(
"id"
,
$doc
->id);
76
$err
=
$doc
->lock(
true
);
// autolock
77
if
(
$err
!=
""
)
$action
->ExitError(
$err
);
78
if
(
$err
==
""
)
$action
->AddActionDone(
"LOCKDOC"
,
$doc
->id);
79
80
$classid =
$doc
->fromid;
81
if
(!
$doc
->isAlive())
$action
->ExitError(_(
"document not referenced"
));
82
}
83
84
$im = array();
85
if
(
$doc
) {
86
// rewrite for api 3.0
87
$im[
"save"
] = array(
88
"url"
=>
''
,
89
"javascript"
=>
"submitEdit()"
,
90
"icon"
=>
$doc
->getIcon() ,
91
"visibility"
=>
POPUP_ACTIVE
,
92
"label"
=> (
$doc
->id > 0) ? _(
"Save"
) : _(
"Create"
) ,
93
"target"
=>
"_self"
,
94
"description"
=>
''
,
95
"backgroundColor"
=>
''
96
);
97
$im[
"cancel"
] = array(
98
"url"
=> (
$doc
->id > 0) ?
'?app=FDL&action=UNLOCKFILE&auto=Y&viewext=yes&id='
.
$doc
->id :
'?app=FREEDOM&action=FREEDOM_LOGO'
,
99
"javascript"
=>
""
,
100
"visibility"
=>
POPUP_ACTIVE
,
101
"label"
=> _(
"Cancel"
) ,
102
"target"
=>
"_self"
,
103
"description"
=>
''
,
104
"backgroundColor"
=>
''
,
105
"icon"
=>
''
106
);
107
if
(
true
||
GetHttpVars
(
"viewconstraint"
) ==
"Y"
) {
108
if
(
$action
->user->id == 1) {
109
$im[
"saveforce"
] = array(
110
"url"
=>
''
,
111
"javascript"
=>
"submitEdit(null,true)"
,
112
"visibility"
=>
POPUP_INVISIBLE
,
113
"description"
=> _(
"override constraints"
) ,
114
"label"
=> (
$doc
->id > 0) ? _(
"Save !"
) : _(
"Create !"
) ,
115
"target"
=>
"_self"
,
116
"backgroundColor"
=>
''
,
117
"icon"
=>
''
118
);
119
}
120
}
121
}
122
$action
->lay->set(
"documentMenu"
, json_encode($im));
123
$action
->lay->set(
"rtarget"
, $rtarget);
124
$action
->lay->set(
"title"
, (
$docid
) ?
$doc
->getTitle() :
$doc
->getTitle(
$doc
->fromid));
125
$action
->lay->set(
"vid"
, $vid);
126
$action
->lay->set(
"rvid"
, $rvid);
127
$action
->lay->set(
"rzone"
, $rzone);
128
$action
->lay->set(
"ezone"
, $ezone);
129
$action
->lay->set(
"id"
,
$doc
->id);
130
$action
->lay->set(
"classid"
, $classid);
131
if
(
$docid
)
$action
->lay->set(
"STITLE"
,
addJsSlashes
(
$doc
->getHTMLTitle()));
132
else
$action
->lay->set(
"STITLE"
,
addJsSlashes
(sprintf(_(
"Creation %s"
) ,
$doc
->getHTMLTitle(
$doc
->fromid))));
133
$style
=
$action
->parent->getParam(
"STYLE"
);
134
135
$action
->parent->AddCssRef(
"STYLE/DEFAULT/Layout/EXT-ADAPTER-SYSTEM.css"
);
136
if
(file_exists(
$action
->parent->rootdir .
"/STYLE/$style/Layout/EXT-ADAPTER-USER.css"
)) {
137
$action
->parent->AddCssRef(
"STYLE/$style/Layout/EXT-ADAPTER-USER.css"
);
138
}
else
{
139
$action
->parent->AddCssRef(
"STYLE/DEFAULT/Layout/EXT-ADAPTER-USER.css"
);
140
}
141
}
142
?>
← centre documentaire
© anakeen
- published under
CC License
-
Dynacase