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
editattribute.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
* Specific menu for family
9
*
10
* @author Anakeen 2000
11
* @version $Id: editattribute.php,v 1.4 2006/11/13 16:06:39 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/Class.Doc.php"
);
20
/**
21
* Edit an attribute inline
22
* @param Action &$action current action
23
* @global docid Http var : document identificator to see
24
* @global attrid Http var : the id of attribute to edit
25
*/
26
function
editattribute
(&
$action
)
27
{
28
$docid
=
GetHttpVars
(
"docid"
);
29
$attrid =
GetHttpVars
(
"attrid"
);
30
$modjsft =
GetHttpVars
(
"modjsft"
,
"modattr"
);
31
$dbaccess
=
$action
->GetParam(
"FREEDOM_DB"
);
32
33
header(
'Content-type: text/xml; charset=utf-8'
);
34
35
$mb = microtime();
36
37
$action
->lay->set(
"CODE"
,
"OK"
);
38
$action
->lay->set(
"warning"
,
""
);
39
if
($modjsft ==
"undefined"
) $modjsft =
"modattr"
;
40
$action
->lay->set(
"modjsft"
, $modjsft);
41
42
$doc
=
new_Doc
(
$dbaccess
,
$docid
);
43
if
(!
$doc
->isAffected())
$err
= sprintf(_(
"cannot see unknow reference %s"
) ,
$docid
);
44
if
(
$err
==
""
) {
45
$action
->lay->set(
"docid"
,
$doc
->id);
46
$err
=
$doc
->lock(
true
);
// autolock
47
if
(
$err
==
""
)
$action
->AddActionDone(
"LOCKDOC"
,
$doc
->id);
48
if
(
$err
!=
""
) {
49
// test object permission before modify values (no access control on values yet)
50
$err
=
$doc
->canEdit();
51
}
52
53
if
(
$err
==
""
) {
54
$a
=
$doc
->getAttribute($attrid);
55
if
(!
$a
)
$err
= sprintf(_(
"unknown attribute %s for document %s"
) , $attrid,
$doc
->title);
56
$action
->lay->set(
"attrid"
,
$a
->id);
57
$action
->lay->set(
"longtext"
, (
$a
->type ==
"longtext"
));
58
if
(
$err
==
""
) {
59
}
60
}
61
$action
->lay->set(
"thetext"
,
$doc
->getValue($attrid));
62
}
63
64
if
(
$err
!=
""
)
$action
->lay->set(
"CODE"
,
"KO"
);
65
$action
->lay->set(
"warning"
,
$err
);
66
$action
->lay->set(
"delay"
,
microtime_diff
(microtime() , $mb));
67
// notify actions done
68
$action
->getActionDone($actcode, $actarg);
69
$tact
= array();
70
foreach
($actcode as $k => $v) {
71
$tact
[] = array(
72
"acode"
=> $v,
73
"aarg"
=> $actarg[$k]
74
);
75
}
76
$action
->lay->setBlockData(
"ACTIONS"
,
$tact
);
77
$action
->clearActionDone();
78
}
79
?>
← centre documentaire
© anakeen
- published under
CC License
-
Dynacase