10 include_once (
"FDL/Class.Doc.php");
11 include_once (
"FDL/Class.DocAttr.php");
13 include_once (
"Class.TableLayout.php");
14 include_once (
"Class.QueryDb.php");
15 include_once (
"Class.QueryGen.php");
16 include_once (
"FDL/freedom_util.php");
17 include_once (
"FDL/family_help.php");
18 include_once (
"VAULT/Class.VaultFile.php");
24 $docid = GetHttpVars(
"id");
25 $abstract = (GetHttpVars(
"abstract",
'N') ==
"Y");
26 $props = (GetHttpVars(
"props",
'N') ==
"Y");
27 $zonebodycard = GetHttpVars(
"zone");
28 $vid = GetHttpVars(
"vid");
29 $ulink = (GetHttpVars(
"ulink",
'2'));
30 $target = GetHttpVars(
"target");
31 $reload = ($action->read(
"reload$docid",
"N") ==
"Y");
32 if (($target !=
"mail") && ($target !=
"te")) $action->lay->set(
"MAILVIEW",
false);
33 else $action->lay->set(
"MAILVIEW",
true);
34 $action->lay->set(
"fhelp", ($action->
Read(
"navigator",
"") ==
"EXPLORER") ?
"_blank" :
"fhidden");
35 $action->lay->set(
'verifyfiles',
false);
36 $action->lay->set(
'POSTIT', (GetHttpVars(
"postit",
'Y') ==
"Y"));
38 if ($ulink ==
"N") $ulink =
false;
39 else if ($ulink ==
"Y") $ulink = 1;
40 $action->lay->set(
"ulink", $ulink);
42 $action->parent->AddJsRef(sprintf(
"?app=FDL&action=ALLVIEWJS&wv=%s", $action->
getParam(
'WVERSION')));
43 $action->parent->addJsRef(
"lib/jquery/jquery.js");
44 $action->parent->addJsRef(
"lib/jquery-ui/js/jquery-ui.js");
45 $action->parent->addCssRef(
"css/dcp/jquery-ui.css");
53 $baseurl = $action->GetParam(
"CORE_BASEURL");
54 $standurl = $action->GetParam(
"CORE_STANDURL");
60 $action->parent->addJsRef(
"FDL/Layout/viewcard.js");
62 $action->parent->AddJsRef($action->GetParam(
"CORE_PUBURL") .
"/FDL/Layout/reload.js");
63 $action->unregister(
"reload$docid");
65 $action->lay->eset(
"refreshfld", GetHttpVars(
"refreshfld"));
67 $action->lay->eset(
"ITSELF", (isset(
$_SERVER[
"REQUEST_URI"]) ?
$_SERVER[
"REQUEST_URI"] :
'#'));
69 if (!
$doc->isAffected()) $action->
exitError(sprintf(_(
"cannot see unknow reference %s") ,
$docid));
76 if (
$doc->isConfidential()) {
77 redirect($action,
"FDL",
"FDL_CONFIDENTIAL&id=" .
$doc->id);
79 $useRss = (
$doc->getRawValue(
"gui_isrss") ==
"yes");
80 $action->lay->set(
"RSS", $useRss);
81 if ($useRss) $action->lay->eset(
"rsslink",
$doc->getRssLink());
83 $param_zone_footer = json_decode($action->
getParam(
"FOOTER_ZONE_VIEW") ,
true);
84 $zone_footer = array();
85 foreach ($param_zone_footer as $zone) {
86 $zone_footer[] = array(
90 $action->lay->SetBlockData(
"ZONE_FOOTER", $zone_footer);
104 if (
$doc->cvid > 0) {
111 $cvdoc = clone $cvdoc;
117 $err = $cvdoc->control($vid);
119 $tview = $cvdoc->getView($vid);
120 $err =
$doc->setMask($tview[
"CV_MSKID"]);
122 if ($zonebodycard ==
"") {
123 $zonebodycard = $tview[
"CV_ZVIEW"];
131 $vid =
$doc->getDefaultView(
false,
"id");
133 setHttpVar(
"vid", $vid);
134 if ($zonebodycard ==
"") {
135 $tview = $cvdoc->getView($vid);
136 $zonebodycard = $tview[
"CV_ZVIEW"];
142 $action->lay->set(
"emblem",
$doc->getEmblem());
143 $domains =
$doc->getDomainIds();
144 if (empty($domains)) {
145 $action->lay->set(
"inDomain",
false);
147 $action->lay->set(
"inDomain",
true);
150 if (
$doc->doctype ===
'Z') {
151 if (
$doc->lmodify ===
"D") {
152 $err = _(
"This document has been deleted");
154 $err = _(
"This revision has been deleted");
158 $doc->disableEditControl();
161 $doc->enableEditControl();
162 if (
$doc->hasWaitingFiles()) {
166 $action->lay->set(
'verifyfiles',
true);
170 if ($zonebodycard ==
"") {
171 $zonebodycard =
$doc->defaultview;
173 if ($zonebodycard ==
"") {
174 $zonebodycard =
"FDL:VIEWBODYCARD";
177 if ($action->
getParam(
"ISIE", null) === null) {
182 $zo =
$doc->getZoneOption($zonebodycard);
183 if (GetHttpVars(
"dochead") ==
"") $dochead = (!preg_match(
"/[T|U|V]/", $zo, $reg));
184 else $dochead = (GetHttpVars(
"dochead",
'Y') ==
"Y");
185 $action->lay->set(
"viewbarmenu", ($zo ==
"V"));
187 $action->lay->set(
"LGTEXTERROR", strlen(
$err));
189 $action->lay->
Set(
"ZONEBODYCARD",
$doc->viewDoc($zonebodycard, $target, $ulink, $abstract));
197 $action->lay->
Set(
"reference",
$doc->initid . ((
$doc->name ==
"") ?
"" :
" ({$doc->name})"));
199 $action->lay->
Set(
"revision",
$doc->revision);
200 $action->lay->
Set(
"V_TITLE",
$doc->getDocAnchor(
$doc->id, $target));
202 $action->lay->
Set(
"lockedid", 0);
203 $action->lay->
Set(
"comment",
'');
205 if (
$doc->confidential > 0) $action->lay->eSet(
"locked", _(
"confidential"));
206 else if (
$doc->locked == - 1) $action->lay->eSet(
"locked", _(
"fixed"));
207 else if (
$doc->archiveid) $action->lay->eSet(
"locked", _(
"archived"));
208 else if (
$doc->control(
"edit") !=
"") $action->lay->eSet(
"locked", _(
"read only"));
209 else if (
$doc->locked == 0) {
210 $action->lay->eSet(
"locked", _(
"not locked"));
213 $action->lay->eSet(
"locked",
$user->firstname .
" " .
$user->lastname);
214 $action->lay->
Set(
"lockedid",
$user->fid);
217 $action->lay->
Set(
"dhelp",
"none");
218 if (
$doc->fromid > 0) {
219 $cdoc =
$doc->getFamilyDocument();
220 $action->lay->eSet(
"classtitle", $cdoc->getTitle());
222 $action->lay->
Set(
"dhelp",
"");
223 $action->lay->
Set(
"helpid",
$doc->fromid);
226 $action->lay->
Set(
"classtitle", _(
"no family"));
228 $action->lay->
Set(
"postitid", (
$doc->postitid > 0) ?
$doc->postitid :
false);
229 $action->lay->
Set(
"waskid", 0);
230 $action->lay->
Set(
"latestwaskid", 0);
232 if (
$doc->locked != - 1) {
233 $latestidwask =
$doc->getLatestIdWithAsk();
235 $rdoc = new_doc(
$doc->dbaccess, $latestidwask);
237 if (!$rdoc->askIsCompleted()) $action->lay->
Set(
"latestwaskid", $latestidwask);
240 if (!
$doc->askIsCompleted()) {
241 $action->lay->
Set(
"waskid",
"1");
245 if (($target ==
"mail") && (
$doc->icon !=
"")) $action->lay->
Set(
"iconsrc",
"cid:icon");
246 else $action->lay->
Set(
"iconsrc",
$doc->geticon());
248 if (
$doc->fromid > 0) $action->lay->
Set(
"cid",
$doc->fromid);
249 else $action->lay->
Set(
"cid",
$doc->id);
251 $action->lay->
Set(
"viewstate",
"none");
252 $action->lay->
Set(
"state",
"");
254 $state =
$doc->getState();
255 $action->lay->
Set(
"statecolor",
$doc->getStateColor(
"transparent"));
257 if (
$doc->locked == - 1) $action->lay->eSet(
"state", $action->
text($state));
260 $action->lay->eSet(
"state", $action->Text(
$doc->getStateActivity(
$doc->getState())));
262 $action->lay->
Set(
"viewstate",
"inherit");
265 $action->lay->
Set(
"version",
$doc->version);
267 $action->lay->
Set(
"title",
$doc->getHTMLTitle());
268 $action->lay->
Set(
"id",
$doc->id);
272 $listattr =
$doc->GetAbstractAttributes();
274 $listattr =
$doc->GetNormalAttributes();
277 $action->lay->
Set(
"HEAD", $dochead);
281 $canCreateMail = $famMail->control(
'create') ==
"";
282 $action->lay->
Set(
"amail", ((
$doc->usefor !=
"P") && $canCreateMail && (
$doc->control(
'send') ==
"")) ?
"inline" :
"none");
284 $doc->adate =
$doc->getTimeDate(0,
true);
285 $doc->modify(
true, array(
288 if (
$doc->delUTag($action->user->id,
"TOVIEW") ==
"") {
289 $err =
$doc->addUTag($action->user->id,
"VIEWED");
292 $help =
$doc->getHelpPage();
293 $action->lay->
Set(
"helpurl", ($help->isAlive()) ? $help->getAttributeHelpUrl() :
false);
294 $action->lay->
Set(
"helpid", ($help->isAlive()) ? $help->id :
false);
redirectAsGuest(Action &$action)
exitError($texterr, $exit=true, $code="")
initExplorerParam(Application &$app, $defaultValue=false)
getFamilyHelpFile(Action &$action, $docid)
getHttpVars($name, $def="", $scope="all")
new_Doc($dbaccess, $id= '', $latest=false)
if($file) if($subject==""&&$file) if($subject=="") $err