Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
editattribute.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Specific menu for family
8  *
9  * @author Anakeen
10  * @version $Id: editattribute.php,v 1.4 2006/11/13 16:06:39 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 
17 include_once ("FDL/Class.Doc.php");
18 /**
19  * Edit an attribute inline
20  * @param Action &$action current action
21  * @global string $docid Http var : document identifier to see
22  * @global string $attrid Http var : the id of attribute to edit
23  */
25 {
26  $docid = $action->getArgument("docid");
27  $attrid = $action->getArgument("attrid");
28  $modjsft = $action->getArgument("modjsft", "modattr");
29  $dbaccess = $action->dbaccess;
30 
31  header('Content-type: text/xml; charset=utf-8');
32 
33  $mb = microtime();
34 
35  $action->lay->set("CODE", "OK");
36  $action->lay->set("warning", "");
37  if ($modjsft == "undefined") $modjsft = "modattr";
38  $action->lay->eset("modjsft", $modjsft);
39  $err = '';
41  if (!$doc->isAffected()) $err = sprintf(_("cannot see unknow reference %s") , $docid);
42  if ($err == "") {
43  $action->lay->set("docid", $doc->id);
44  $err = $doc->lock(true); // autolock
45  if ($err == "") $action->AddActionDone("LOCKDOC", $doc->id);
46  if ($err != "") {
47  // test object permission before modify values (no access control on values yet)
48  $err = $doc->canEdit();
49  }
50 
51  if ($err == "") {
52  $a = $doc->getAttribute($attrid);
53  if (!$a) $err = sprintf(_("unknown attribute %s for document %s") , $attrid, $doc->title);
54  $action->lay->set("attrid", $a->id);
55  $action->lay->set("longtext", ($a->type == "longtext"));
56  if ($err == "") {
57  }
58  }
59  $action->lay->set("thetext", htmlspecialchars($doc->getRawValue($attrid)));
60  }
61 
62  if ($err != "") $action->lay->set("CODE", "KO");
63  $action->lay->set("warning", $err);
64  $action->lay->set("delay", microtime_diff(microtime() , $mb));
65  // notify actions done
66  $action->getActionDone($actcode, $actarg);
67  $tact = array();
68  foreach ($actcode as $k => $v) {
69  $tact[] = array(
70  "acode" => $v,
71  "aarg" => $actarg[$k]
72  );
73  }
74  $action->lay->setBlockData("ACTIONS", $tact);
75  $action->clearActionDone();
76 }
global $action
clearActionDone()
print< H1 > Check Database< i > $dbaccess</i ></H1 > $a
Definition: checklist.php:45
$docid
Definition: cleanFamily.php:13
microtime_diff($a, $b)
Definition: Lib.Common.php:302
new_Doc($dbaccess, $id= '', $latest=false)
getActionDone(&$actdone, &$arg)
static getArgument($k, $def= '')
$dbaccess
Definition: checkVault.php:17
if($file) if($subject==""&&$file) if($subject=="") $err
editattribute(Action &$action)
← centre documentaire © anakeen