19 include_once (
"FDL/Class.SearchDoc.php");
20 include_once (
"FDL/Class.DocAttr.php");
21 include_once (
"FDL/freedom_util.php");
22 include_once (
"FDL/Class.QueryDir.php");
26 $sqlfilters = array() ,
41 $baseurl =
$action->GetParam(
"CORE_BASEURL");
42 $standurl =
$action->GetParam(
"CORE_STANDURL");
50 $action->lay->set(
"RSS", (
$dir->getValue(
"gui_isrss") ==
"yes" ?
true :
false));
52 $action->lay->set(
"foldername",
$dir->getHtmlTitle());
54 if (
$dir->defDoctype ==
'S') {
56 if ($sqlorder ==
"") $sqlorder =
$dir->getValue(
"se_orderby");
57 }
else $aclctrl =
"open";
60 $action->lay->Set(
"dirtitle", stripslashes(
$dir->getHtmlTitle()));
61 $action->lay->Set(
"dirid", $dirid);
63 $action->parent->AddJsRef(
$action->GetParam(
"CORE_JSURL") .
"/subwindow.js");
64 $action->parent->AddJsRef(
$action->GetParam(
"CORE_JSURL") .
"/resizeimg.js");
65 $action->parent->AddJsRef(
$action->GetParam(
"CORE_JSURL") .
"/geometry.js");
67 $action->lay->set(
"VALTERN", (
$action->GetParam(
"FDL_VIEWALTERN",
"yes") ==
"yes"));
70 $action->exitError(_(
"cannot see unknow folder"));
74 $pagefolder =
$action->Read(
"pagefolder");
75 $start = $pagefolder[$startpage];
79 if (count($terr) > 0) {
80 if (
$dir->defDoctype ==
'S') {
81 redirect(
$action,
"FDL",
"IMPCARD&zone=FREEDOM:PARAMDSEARCH:T&id=$dirid",
$action->GetParam(
"CORE_STANDURL") ,
true);
83 $action->addWarningMsg(implode(
"\n", $terr));
84 redirect(
$action,
"FDL",
"FDL_CARD&id=$dirid",
$action->GetParam(
"CORE_STANDURL") ,
true);
91 if ($dirid) $sd->useCollection($dirid);
92 $sd->excludeConfidential();
93 $sd->distinct = $distinct;
94 $sd->setOrder($sqlorder);
95 if ($sqlfilters)
foreach ($sqlfilters as
$filter) $sd->addFilter($filter);
96 $sd->setObjectReturn();
101 if (
$viewone && ($sd->count() == 1)) {
103 $doc1 = $sd->nextDoc();
105 if ($doc1->doctype ==
"D") redirect(
$action,
"FREEDOM",
"OPENFOLIO&id=" . $doc1->initid,
$action->GetParam(
"CORE_STANDURL"));
106 else redirect(
$action,
"FDL",
"FDL_CARD&latest=Y&id=" . $doc1->id,
$action->GetParam(
"CORE_STANDURL"));
112 include_once (
"FDL/popup_util.php");
131 if (!$sd->searchError()) {
133 if (
$action->GetParam(
"CORE_LANG") ==
"fr_FR") {
146 while (
$doc = $sd->nextDoc()) {
148 if (
$doc->isConfidential())
continue;
160 if (
$doc->doctype ==
"C")
$tdoc[$k][
"title"] =
"<B>" .
$title .
"</B>";
165 if (isset(
$doc->_highlight) &&
$doc->_highlight !=
"") {
166 $tdoc[$k][
"highlight"] =
$doc->_highlight;
168 $tdoc[$k][
"icontitle"] =
$tdoc[$k][
"highlight"];
171 $tdoc[$k][
"revdate"] = strftime($fdate, intval(
$doc->revdate));
175 $tdoc[$k][
"divid"] = $kdiv;
177 $tdoc[$k][
"locked"] =
"";
179 $tdoc[$k][
"emblemt"] =
"";
180 $tdoc[$k][
"emblemw"] =
"0";
181 $tdoc[$k][
"canedit"] = 1;
182 $tdoc[$k][
"postitid"] = (
$doc->postitid > 0) ?
$doc->postitid :
false;
183 $tdoc[$k][
"forumid"] = (
$doc->forumid > 0) ?
$doc->forumid :
false;
184 $tdoc[$k][
"inDomain"] =
$doc->isInDomain();
187 if (
$doc->confidential > 0) {
189 $tdoc[$k][
"emblemt"] = _(
"confidential");
191 $tdoc[$k][
"canedit"] =
false;
192 $tdoc[$k][
"locked"] = sprintf(
"<img src=\"%s\" title=\"%s\" width=\"20px\">",
$tdoc[$k][
"emblem"],
$tdoc[$k][
"emblemt"]);
193 }
else if (
$doc->locked == - 1) {
195 $tdoc[$k][
"emblemt"] = _(
"fixed");
197 $tdoc[$k][
"canedit"] =
false;
198 $tdoc[$k][
"locked"] = sprintf(
"<img src=\"%s\" title=\"%s\" width=\"20px\">",
$tdoc[$k][
"emblem"],
$tdoc[$k][
"emblemt"]);
199 }
else if (
$doc->lockdomainid > 0) {
201 $tdoc[$k][
"emblemt"] = _(
"domain locked");
203 $tdoc[$k][
"locked"] = sprintf(
"<img src=\"%s\" title=\"%s\" width=\"20px\">",
$tdoc[$k][
"emblem"],
$tdoc[$k][
"emblemt"]);
204 }
else if ((abs(
$doc->locked) ==
$action->parent->user->id)) {
206 $tdoc[$k][
"emblemt"] = _(
"locked");
208 $tdoc[$k][
"locked"] = sprintf(
"<img src=\"%s\" title=\"%s\" width=\"20px\">",
$tdoc[$k][
"emblem"],
$tdoc[$k][
"emblemt"]);
209 }
else if (
$doc->locked != 0) {
211 $tdoc[$k][
"emblemt"] = _(
"locked");
213 $tdoc[$k][
"canedit"] =
false;
214 $tdoc[$k][
"locked"] = sprintf(
"<img src=\"%s\" title=\"%s\" width=\"20px\">",
$tdoc[$k][
"emblem"],
$tdoc[$k][
"emblemt"]);
215 }
else if (
$doc->archiveid != 0) {
217 $tdoc[$k][
"emblemt"] = _(
"archived");
219 $tdoc[$k][
"canedit"] =
false;
220 $tdoc[$k][
"locked"] = sprintf(
"<img src=\"%s\" title=\"%s\" width=\"20px\">",
$tdoc[$k][
"emblem"],
$tdoc[$k][
"emblemt"]);
221 }
else if (
$doc->control(
"edit") !=
"") {
223 $tdoc[$k][
"emblemt"] = _(
"read-only");
225 $tdoc[$k][
"canedit"] =
false;
226 $tdoc[$k][
"locked"] = sprintf(
"<img src=\"%s\" title=\"%s\" width=\"20px\">",
$tdoc[$k][
"emblem"],
$tdoc[$k][
"emblemt"]);
243 if ($dirid > 0)
popupActive(
"popuplist", $kdiv,
'delete');
246 if (
$doc->doctype ==
'C') {
249 $cud = (
$doc->CanLockFile() ==
"");
257 if (
$dir->defDoctype !=
'D') {
265 if (
$doc->isRevisable())
$tdoc[$k][
"revision"] =
$doc->revision;
266 else $tdoc[$k][
"revision"] =
"";
269 $tdoc[$k][
"statecolor"] =
$doc->getStateColor(
"transparent");
271 $tdoc[$k][
"state"] =
"";
272 $tdoc[$k][
"statecolor"] =
"transparent";
275 if ((
$doc->doctype ==
'D') || (
$doc->doctype ==
'S'))
$tdoc[$k][
"isfld"] =
"true";
276 else $tdoc[$k][
"isfld"] =
"false";
280 if ($with_abstract) {
281 if (!
$doc->isConfidential()) {
284 if ($with_abstract === 2) {
288 $tdoc[$k][
"LOrR"] = ($k % 2 == 0) ?
"left" :
"right";
290 }
else $tdoc[$k][
"ABSTRACTVALUES"] =
"";
296 $adoc =
$doc->getFamDoc();
298 $famdocAlreadyExists =
false;
299 foreach ($tfamdoc as $famdoc) {
300 if ($famdoc[
'fid'] ==
$doc->fromid) {
301 $famdocAlreadyExists =
true;
305 if (!$famdocAlreadyExists) {
308 "iconfamsrc" =>
$tdoc[$k][
"iconsrc"],
309 "ftitle" => $adoc->title,
310 "fid" =>
$doc->fromid,
311 "blockattr" =>
"BATT" .
$doc->fromid,
312 "blockvalue" =>
"BVAL" .
$doc->fromid
316 $lattr[
$doc->fromid] = $adoc->GetAbstractAttributes();
318 $emptytableabstract = array();
319 foreach (
$lattr[
$doc->fromid] as $ka => $attr) {
320 if (($attr->mvisibility ==
'H') || ($attr->mvisibility ==
'I')) unset(
$lattr[
$doc->fromid][$ka]);
323 foreach (
$lattr[
$doc->fromid] as $ka => $attr) {
324 $emptytableabstract[$attr->id][
"value"] =
"-";
325 $taname[$attr->id][
"aname"] = $attr->getLabel();
327 $action->lay->SetBlockData(
"BATT" .
$doc->fromid, $taname);
333 if (
$doc->isConfidential()) {
334 foreach (
$lattr[
$doc->fromid] as $ka => $attr) {
338 foreach (
$lattr[
$doc->fromid] as $ka => $attr) {
340 if ($attr->type ==
"image") $tvalues[] =
'<img src="' .
$doc->getHtmlValue($attr,
$doc->getValue($attr->id,
"-") ,
$target) .
'&height=30" height="30">';
341 else $tvalues[] = (
$doc->getValue($attr->id) ?
$doc->getHtmlValue($attr,
$doc->getValue($attr->id) ,
$target) :
'-');
344 $tdoc[$k][
"values"] = implode(
'</td><td class="tlist">', $tvalues);
352 $collator =
new Collator(
$action->GetParam(
"CORE_LANG",
"fr_FR"));
353 usort(
$tdoc,
function(
$a, $b) use ($collator) {
354 $cmp = (
$a[
'fromid'] - $b[
'fromid']);
355 return ($cmp == 0) ? $collator->compare(
$a[
'title'], $b[
'title']) : $cmp;
362 addWarningMsg($sd->getError());
363 addLogMsg($sd->getSearchInfo());
368 $tboo[0][
"boo"] =
"";
369 $action->lay->SetBlockData(
"VIEWPROP", $tboo);
371 $action->lay->Set(
"nbdiv", $kdiv - 1);
376 $tdocByFromId = array();
378 $tdocByFromId[$doc[
'fromid']] []=
$doc;
384 foreach ($tdocByFromId as $fromid => $documentList) {
385 $action->lay->SetBlockData(
"BVAL" . $fromid, $documentList);
388 $collator =
new Collator(
$action->GetParam(
"CORE_LANG",
"fr_FR"));
389 usort($tfamdoc,
function(
$a, $b) use ($collator) {
390 return $collator->compare(
$a[
'ftitle'], $b[
'ftitle']);
392 $action->lay->SetBlockData(
"TABLEBODY", $tfamdoc);
402 if ($with_popup || $column) {
405 $licon->Set(
"nbdiv", $kdiv - 1);
406 $action->parent->AddJsCode($licon->gen());
409 $pagefolder[$startpage + 1] = $nbseedoc +
$start;
410 $action->Register(
"pagefolder", $pagefolder);
411 $action->lay->Set(
"next", $startpage + 1);
412 $action->lay->Set(
"prev", $startpage - 1);
414 $action->lay->Set(
"nbdoc", $nbdoc);
422 $cmp = (
$a[
'fromid'] - $b[
'fromid']);
423 return ($cmp == 0) ? strcasecmp(
$a[
'title'], $b[
'title']) : $cmp;
428 return strcasecmp(
$a[
"title"], $b[
"title"]);
435 $emptytableabstract = array();
436 foreach (
$lattr as $ka => $attr) {
437 $val =
$doc->GetHtmlAttrValue($ka,
$target, 2, -1,
true,
true);
439 if ($val)
$tout[] = $val;
441 return implode(
" - ",
$tout);