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
freedom_mod.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
* Modification of documents
9
*
10
* @author Anakeen 2000
11
* @version $Id: freedom_mod.php,v 1.24 2007/10/09 16:44:47 eric Exp $
12
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13
* @package FDL
14
* @subpackage GED
15
*/
16
/**
17
*/
18
19
include_once (
"FDL/modcard.php"
);
20
21
include_once (
"FDL/Class.Dir.php"
);
22
include_once (
"FDL/Class.DocFam.php"
);
23
// -----------------------------------
24
function
freedom_mod
(&
$action
)
25
{
26
// -----------------------------------
27
// Get all the params
28
$dirid =
GetHttpVars
(
"dirid"
, 0);
29
$docid
=
GetHttpVars
(
"id"
, 0);
30
$retedit =
GetHttpVars
(
"retedit"
,
"N"
) ==
"Y"
;
// true if return need edition
31
$dbaccess
=
$action
->GetParam(
"FREEDOM_DB"
);
32
33
$err
=
modcard
(
$action
, $ndocid);
// ndocid change if new doc
34
if
(
$err
!=
""
)
$action
->AddWarningMsg(
$err
);
35
else
{
36
37
$doc
=
new_Doc
(
$dbaccess
, $ndocid);
38
if
(
$docid
> 0)
$action
->AddLogMsg(sprintf(_(
"%s has been modified"
) ,
$doc
->title));
39
40
if
(
$docid
== 0) {
41
AddLogMsg
(sprintf(_(
"%s has been created"
) ,
$doc
->title));
42
if
($dirid > 0) {
43
$fld =
new_Doc
(
$dbaccess
, $dirid);
44
if
($fld->doctype !=
'D'
) $dirid = 0;
45
}
46
// first try in current folder
47
if
($dirid > 0) {
48
$err
= $fld->AddFile(
$doc
->id);
49
if
(
$err
!=
""
) {
50
$action
->AddLogMsg(
$err
);
51
$dirid = 0;
52
}
53
}
54
// second try in default folder for family
55
/*
56
if ($dirid == 0) {
57
$cdoc = $doc->getFamDoc();
58
if ($cdoc->dfldid>0) {
59
$dirid=$cdoc->dfldid;
60
$fld = new_Doc($dbaccess,$dirid);
61
$err=$fld->AddFile($doc->id);
62
if ($err != "") {
63
$action->AddLogMsg($err);
64
$dirid=0;
65
}
66
}
67
}
68
*/
69
// third try in home folder
70
if
($dirid == 0) {
71
$fld =
new_Doc
(
$dbaccess
,
UNCLASS_FLD
);
72
$home = $fld->getHome();
73
74
if
($home->id > 0) $fld = $home;
75
$err
= $fld->AddFile(
$doc
->id);
76
if
(
$err
!=
""
)
$action
->AddLogMsg(
$err
);
77
}
78
}
79
}
80
81
if
($retedit) {
82
redirect(
$action
,
GetHttpVars
(
"redirect_app"
,
"FREEDOM"
) ,
GetHttpVars
(
"redirect_act"
,
"FREEDOM_EDIT&id=$ndocid"
) ,
$action
->GetParam(
"CORE_STANDURL"
));
83
}
else
{
84
// $action->register("reload$ndocid","Y"); // to reload cached client file
85
redirect(
$action
,
GetHttpVars
(
"redirect_app"
,
"FDL"
) ,
GetHttpVars
(
"redirect_act"
,
"FDL_CARD&refreshfld=Y&id=$ndocid"
) ,
$action
->GetParam(
"CORE_STANDURL"
));
86
}
87
}
88
?>
← centre documentaire
© anakeen
- published under
CC License
-
Dynacase