17 include_once (
"FDL/Class.Doc.php");
21 $docid = GetHttpVars(
"id", 0);
22 $viewapp = GetHttpVars(
"viewapp",
"FDL");
23 $viewact = GetHttpVars(
"viewact",
"FDL_CARD");
24 $target = GetHttpVars(
"target",
"");
25 $viewrev = (GetHttpVars(
"viewrev",
"Y") ==
"Y");
26 $comment = GetHttpVars(
"comment", _(
"no comment"));
27 $notice = (GetHttpVars(
"notice",
"Y") ==
"Y");
28 $action->parent->AddJsRef($action->GetParam(
"CORE_JSURL") .
"/subwindow.js");
29 $action->parent->AddJsRef($action->GetParam(
"CORE_PUBURL") .
"/FDL/Layout/common.js");
30 $action->parent->addJsRef(
"lib/jquery/jquery.js");
31 $action->parent->addJsRef(
"lib/jquery-ui/js/jquery-ui.js");
32 $action->parent->addCssRef(
"css/dcp/jquery-ui.css");
33 $action->parent->addJsRef(
"lib/jquery-dataTables/js/jquery.dataTables.min.js");
34 $action->parent->addCssRef(
"lib/jquery-dataTables/css/jquery.dataTables_themeroller.css");
35 $action->parent->addJsRef(
"FDL/Layout/viewhisto.js");
38 if ($localeconfig !==
false) {
39 $formatDate = $localeconfig[
'dateFormat'] .
" %H:%M:%S";
46 $action->lay->
Set(
"lastState",
$doc->getStateActivity(_(
"Current_state")));
48 $action->lay->
Set(
"lastState",
$doc->getHtmlTitle());
50 $action->lay->
Set(
"lastRevision",
$doc->revision);
53 $action->lay->
Set(
"lastColor",
$doc->getStateColor(
'transparent'));
54 $action->lay->
Set(
"docid",
$doc->id);
56 $action->lay->
Set(
"pastRevision", (
$doc->revision > 0));
57 $tc =
$doc->getHisto();
59 foreach ($tc as $vc) {
60 if ((!$notice) && ($vc[
"level"] <
HISTO_INFO)) {
72 "cauthor" => htmlspecialchars($vc[
"uname"]),
73 "clevel" => $vc[
"level"],
74 "ccomment" => nl2br(htmlentities($vc[
"comment"], ENT_COMPAT,
"UTF-8"))
77 $action->lay->SetBlockData(
"LASTCOMMENT", $tlc);
79 $action->lay->
Set(
"title",
$doc->getHTMLTitle());
80 $action->lay->eSet(
"target", $target);
81 $action->lay->eSet(
"VIEWAPP", $viewapp);
82 $action->lay->eSet(
"VIEWACT", $viewact);
83 $action->lay->eSet(
"VIEWREV", $viewrev);
84 $action->lay->eSet(
"notice", $notice);
88 $s->addFilter(
"initid = %d",
$doc->initid);
89 $s->setOrder(
"revision desc");
91 $s->setObjectReturn();
92 $dl =
$s->search()->getDocumentList();
102 foreach ($dl as $k => $rdoc) {
103 if ($rdoc->locked != - 1)
continue;
104 if ($rdoc->control(
'view'))
continue;
106 if ($k == 0) $trdoc[$k][
"owner"] = _(
"Modification date");
108 $trdoc[$k][
"revision"] = $rdoc->revision;
109 $trdoc[$k][
"version"] = htmlspecialchars($rdoc->version);
110 $trdoc[$k][
"target"] = ($target ==
"") ?
"doc_" . $rdoc->id : $target;
112 $state = $rdoc->getState();
113 $color = $rdoc->getStateColor();
114 $sact = $rdoc->getStateActivity(_(
"Current_state"));
115 $trdoc[$k][
"state"] = ($state ==
"") ? $rdoc->getHTMLTitle() : _($state);
116 $hastate = $hastate | ($state !=
"");
117 $trdoc[$k][
"color"] = ($color ==
"") ?
"transparent" : $color;
121 if (!in_array($rdoc->version, array_keys($tversion))) {
122 $tversion[$rdoc->version] =
"vtr" . $iversion++;
123 $trdoc[$k][
"cversion"] =
true;
125 $trdoc[$k][
"cversion"] =
false;
127 $trdoc[$k][
"vername"] = $tversion[$rdoc->version];
128 if ($rdoc->version) $hasVersion =
true;
129 $trdoc[$k][
"COMMENT"] =
"COMMENT$k";
131 $tc = $rdoc->getHisto();
134 foreach ($tc as $vc) {
135 if ((!$notice) && ($vc[
"level"] <
HISTO_INFO)) {
139 $stime = $vc[
"date"];
147 "cauthor" => htmlspecialchars($vc[
"uname"]),
148 "clevel" => $vc[
"level"],
149 "ccomment" => nl2br(htmlentities($vc[
"comment"], ENT_COMPAT,
"UTF-8"))
152 $action->lay->SetBlockData(
"COMMENT$k", $tlc);
154 $trdoc[$k][
"id"] = $rdoc->id;
155 $trdoc[$k][
"divid"] = $k;
157 if (!$hasnotice) $action->lay->
Set(
"notice",
true);
159 $action->lay->
Set(
"STATE", $hastate);
160 $action->lay->
Set(
"viewdiff", (
$s->count() > 1));
161 $action->lay->
Set(
"nodetail", ($iversion > 1));
163 $action->lay->
Set(
"hasversion", $hasVersion);
164 $action->lay->eSet(
"latestVersion",
$doc->version);
165 $action->lay->SetBlockData(
"TABLEBODY", $trdoc);
stringDateToLocaleDate($fdate, $format= '')
getLocaleConfig($core_lang= '')
static getDisplayName($uid)
viewhisto(Action &$action)
new_Doc($dbaccess, $id= '', $latest=false)