1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: cInclude('includes', 'functions.tpl.php');
19: cInclude('includes', 'functions.str.php');
20: cInclude('includes', 'functions.pathresolver.php');
21:
22: $db2 = cRegistry::getDb();
23:
24: $idcat = (isset($_REQUEST['idcat']) && is_numeric($_REQUEST['idcat'])) ? $_REQUEST['idcat'] : -1;
25: $next = (isset($_REQUEST['next']) && is_numeric($_REQUEST['next']) && $_REQUEST['next'] > 0) ? $_REQUEST['next'] : 0;
26:
27: $dateformat = getEffectiveSetting('dateformat', 'date', 'Y-m-d');
28: $templateDescription = '';
29:
30: if (!isset($syncfrom)) {
31: $syncfrom = -1;
32: }
33:
34: $syncoptions = $syncfrom;
35:
36:
37: if (!isset($_SESSION['count_duplicate'])) {
38: $_SESSION['count_duplicate'] = 0;
39: }
40:
41: if ($action == 'con_duplicate' && ($perm->have_perm_area_action("con", "con_duplicate") || $perm->have_perm_area_action_item("con", "con_duplicate", $idcat))) {
42:
43: $count = (int) $_SESSION['count_duplicate'];
44:
45:
46: if ($_GET['count_duplicate'] < $count) {
47: } else {
48:
49: $newidartlang = conCopyArticle($duplicate, $idcat);
50: $count++;
51: $_SESSION['count_duplicate'] = $count;
52: }
53: }
54:
55: if ($action == 'con_syncarticle' && ($perm->have_perm_area_action("con", "con_syncarticle") || $perm->have_perm_area_action_item("con", "con_syncarticle", $idcat))) {
56: if ($_POST['idarts']) {
57: $idarts = json_decode($_POST['idarts'], true);
58: } else {
59: $idarts = array(
60: $idart
61: );
62: }
63:
64:
65: $catLang = new cApiCategoryLanguage();
66: foreach ($idarts as $idart) {
67: if (!$catLang->loadByCategoryIdAndLanguageId($idcat, $lang)) {
68: strSyncCategory($idcat, $sourcelanguage, $lang);
69: }
70: conSyncArticle($idart, $sourcelanguage, $lang);
71: }
72: }
73:
74:
75: $listColumns = array(
76: "mark" => i18n("Mark"),
77: "start" => i18n("Article"),
78: "title" => i18n("Title"),
79: "changeddate" => i18n("Changed"),
80: "publisheddate" => i18n("Published"),
81: "sortorder" => i18n("Sort order"),
82: "template" => i18n("Template"),
83: "actions" => i18n("Actions")
84: );
85:
86:
87: $actionList = array(
88: "online",
89: "duplicate",
90: "locked",
91: "todo",
92: "delete",
93: "usetime"
94: );
95:
96:
97: $_cecIterator = $_cecRegistry->getIterator("Contenido.ArticleList.Columns");
98: if ($_cecIterator->count() > 0) {
99: while ($chainEntry = $_cecIterator->next()) {
100: $newColumnList = $chainEntry->execute($listColumns);
101: if (is_array($newColumnList)) {
102: $listColumns = $newColumnList;
103: }
104: }
105: }
106:
107: $_cecIterator = $_cecRegistry->getIterator("Contenido.ArticleList.Actions");
108: if ($_cecIterator->count() > 0) {
109: while ($chainEntry = $_cecIterator->next()) {
110: $newActionList = $chainEntry->execute($actionList);
111: if (is_array($newActionList)) {
112: $actionList = $newActionList;
113: }
114: }
115: }
116:
117: $cat_idtpl = 0;
118:
119: if (is_numeric($idcat) && ($idcat >= 0)) {
120:
121:
122: if (isset($sortby)) {
123: $currentuser->setUserProperty("system", "sortorder-idlang-$lang-idcat-$idcat", $sortby);
124: }
125: if (isset($sortmode)) {
126: $currentuser->setUserProperty("system", "sortmode-idlang-$lang-idcat-$idcat", $sortmode);
127: }
128:
129: if (isset($elemperpage) && is_numeric($elemperpage)) {
130: $currentuser->setUserProperty("system", "elemperpage-idlang-$lang-idcat-$idcat", $elemperpage);
131: } else {
132: $elemperpage = $currentuser->getUserProperty("system", "elemperpage-idlang-$lang-idcat-$idcat");
133: if (!is_numeric($elemperpage)) {
134: $elemperpage = 10;
135: }
136: }
137:
138: $col = new cApiInUseCollection();
139:
140: if ((($idcat == 0 || $perm->have_perm_area_action('con')) && $perm->have_perm_item('str', $idcat)) || $perm->have_perm_area_action('con', 'con_makestart') || $perm->have_perm_area_action('con', 'con_makeonline') || $perm->have_perm_area_action('con', 'con_deleteart') || $perm->have_perm_area_action('con', 'con_tplcfg_edit') || $perm->have_perm_area_action('con', 'con_lock') || $perm->have_perm_area_action('con', 'con_makecatonline') || $perm->have_perm_area_action('con', 'con_changetemplate') || $perm->have_perm_area_action('con_editcontent', 'con_editart') || $perm->have_perm_area_action('con_editart', 'con_edit') || $perm->have_perm_area_action('con_editart', 'con_newart') || $perm->have_perm_area_action('con_editart', 'con_saveart') || $perm->have_perm_area_action('con_tplcfg', 'con_tplcfg_edit') || $perm->have_perm_area_action_item('con', 'con_makestart', $idcat) || $perm->have_perm_area_action_item('con', 'con_makeonline', $idcat) || $perm->have_perm_area_action_item('con', 'con_deleteart', $idcat) || $perm->have_perm_area_action_item('con', 'con_tplcfg_edit', $idcat) || $perm->have_perm_area_action_item('con', 'con_lock', $idcat) || $perm->have_perm_area_action_item('con', 'con_makecatonline', $idcat) || $perm->have_perm_area_action_item('con', 'con_changetemplate', $idcat) || $perm->have_perm_area_action_item('con_editcontent', 'con_editart', $idcat) || $perm->have_perm_area_action_item('con_editart', 'con_edit', $idcat) || $perm->have_perm_area_action_item('con_editart', 'con_newart', $idcat) || $perm->have_perm_area_action_item('con_tplcfg', 'con_tplcfg_edit', $idcat) || $perm->have_perm_area_action_item('con_editart', 'con_saveart', $idcat)) {
141:
142: $sortby = $currentuser->getUserProperty("system", "sortorder-idlang-$lang-idcat-$idcat");
143: $sortmode = $currentuser->getUserProperty("system", "sortmode-idlang-$lang-idcat-$idcat");
144:
145: $sql = "SELECT
146: a.idart AS idart,
147: a.idlang AS idlang,
148: a.idartlang AS idartlang,
149: a.title AS title,
150: c.idcat AS idcat,
151: {ISSTART}
152: c.idcatart AS idcatart,
153: a.idtplcfg AS idtplcfg,
154: a.published AS published,
155: a.online AS online,
156: a.created AS created,
157: a.lastmodified AS lastmodified,
158: a.timemgmt AS timemgmt,
159: a.datestart AS datestart,
160: a.dateend AS dateend,
161: a.artsort AS artsort,
162: a.redirect AS redirect,
163: a.locked AS locked
164: FROM
165: " . $cfg["tab"]["art_lang"] . " AS a,
166: " . $cfg["tab"]["art"] . " AS b,
167: " . $cfg["tab"]["cat_art"] . " AS c
168: WHERE
169: (a.idlang = " . $lang . " {SYNCOPTIONS}) AND
170: a.idart = b.idart AND
171: b.idclient = " . $client . " AND
172: b.idart = c.idart AND
173: c.idcat = " . $idcat;
174:
175:
176: $sql_count = "SELECT
177: COUNT(*) AS article_count
178: FROM
179: " . $cfg["tab"]["art_lang"] . " AS a,
180: " . $cfg["tab"]["art"] . " AS b,
181: " . $cfg["tab"]["cat_art"] . " AS c
182: WHERE
183: (a.idlang = " . cSecurity::toInteger($lang) . " {SYNCOPTIONS}) AND
184: a.idart = b.idart AND
185: b.idclient = " . cSecurity::toInteger($client) . " AND
186: b.idart = c.idart AND
187: c.idcat = " . cSecurity::toInteger($idcat);
188:
189: $sql = str_replace("{ISSTART}", '', $sql);
190:
191: if ($syncoptions == -1) {
192: $sql = str_replace("{SYNCOPTIONS}", '', $sql);
193: $sql_count = str_replace("{SYNCOPTIONS}", '', $sql_count);
194: } else {
195: $sql = str_replace("{SYNCOPTIONS}", "OR a.idlang = '" . $syncoptions . "'", $sql);
196: $sql_count = str_replace("{SYNCOPTIONS}", "OR a.idlang = '" . $syncoptions . "'", $sql_count);
197: }
198:
199:
200: if ($sortmode !== 'asc' && $sortmode !== 'desc') {
201: $sortmode = 'asc';
202: }
203: switch ($sortby) {
204: case 2:
205: $sql .= ' ORDER BY a.lastmodified ' . strtoupper($sortmode);
206: break;
207: case 3:
208: $sql .= ' ORDER BY a.published ' . strtoupper($sortmode) . ', a.lastmodified ' . strtoupper($sortmode);
209: break;
210: case 4:
211: $sql .= ' ORDER BY a.artsort ' . strtoupper($sortmode);
212: break;
213: default:
214:
215: $sql .= ' ORDER BY a.title ' . strtoupper($sortmode);
216: $sortby = 1;
217: }
218:
219:
220: if ($elemperpage > 0) {
221: $db->query($sql_count);
222: $db->nextRecord();
223: $iArticleCount = $db->f("article_count");
224:
225:
226: if ($iArticleCount == 0) {
227: $next = 0;
228: } elseif ($next >= $iArticleCount) {
229: $next = (ceil($iArticleCount / $elemperpage) - 1) * $elemperpage;
230: }
231: $sql .= " LIMIT $next, $elemperpage";
232: } else {
233: $iArticleCount = 0;
234: }
235:
236:
237: $db->query($sql);
238:
239:
240: $tpl->reset();
241:
242:
243: $no_article = true;
244:
245: $aArticles = Array();
246:
247: while ($db->nextRecord()) {
248: $sItem = "k" . $db->f("idart");
249:
250: if ($db->f("idlang") == $lang || !array_key_exists($sItem, $aArticles)) {
251: $aArticles[$sItem]["idart"] = $db->f("idart");
252: $aArticles[$sItem]["idlang"] = $db->f("idlang");
253: $aArticles[$sItem]["idartlang"] = $db->f("idartlang");
254: $aArticles[$sItem]["title"] = cSecurity::unFilter($db->f("title"));
255: $aArticles[$sItem]["is_start"] = isStartArticle($db->f("idartlang"), $idcat, $lang);
256: $aArticles[$sItem]["idcatart"] = $db->f("idcatart");
257: $aArticles[$sItem]["idtplcfg"] = $db->f("idtplcfg");
258: $aArticles[$sItem]["published"] = $db->f("published");
259: $aArticles[$sItem]["online"] = $db->f("online");
260: $aArticles[$sItem]["created"] = $db->f("created");
261: $aArticles[$sItem]["idcat"] = $db->f("idcat");
262: $aArticles[$sItem]["lastmodified"] = $db->f("lastmodified");
263: $aArticles[$sItem]["timemgmt"] = $db->f("timemgmt");
264: $aArticles[$sItem]["datestart"] = $db->f("datestart");
265: $aArticles[$sItem]["dateend"] = $db->f("dateend");
266: $aArticles[$sItem]["artsort"] = $db->f("artsort");
267: $aArticles[$sItem]["locked"] = $db->f("locked");
268: $aArticles[$sItem]["redirect"] = $db->f("redirect");
269: }
270: }
271:
272: $artlist = array();
273: $colitem = array();
274: $articlesOnline = 0;
275: $articlesOffline = 0;
276: $articlesLocked = 0;
277: $articlesUnlocked = 0;
278: $articlesToSync = 0;
279: $articlesToRemove = 0;
280:
281: foreach ($aArticles as $sart) {
282: $idart = $sart["idart"];
283: $idlang = $sart["idlang"];
284:
285: $idtplcfg = $sart["idtplcfg"];
286: $idartlang = $sart["idartlang"];
287: $lidcat = $sart["idcat"];
288: $idcatlang = 0;
289: $idart = $sart["idart"];
290: $published = $sart["published"];
291: $online = $sart["online"];
292:
293: $is_start = $sart["is_start"];
294:
295: $idcatart = $sart["idcatart"];
296: $created = $sart["created"];
297: $modified = $sart["lastmodified"];
298:
299: if ($modified === '0000-00-00 00:00:00') {
300: $modified = i18n("not modified yet");
301: } else {
302: $modified = date($dateformat, strtotime($modified));
303: }
304: $title = conHtmlSpecialChars($sart["title"]);
305: $timemgmt = $sart["timemgmt"];
306: $datestart = $sart["datestart"];
307: $dateend = $sart["dateend"];
308: $sortkey = $sart["artsort"];
309: $locked = $sart["locked"];
310: $redirect = $sart["redirect"];
311:
312: $published = ($published != '0000-00-00 00:00:00') ? date($dateformat, strtotime($published)) : i18n("not yet published");
313: $created = date($dateformat, strtotime($created));
314: $alttitle = "idart" . ': ' . $idart . ' ' . "idcatart" . ': ' . $idcatart . ' ' . "idartlang" . ': ' . $idartlang;
315:
316: if ($idlang != $lang) {
317: $articlesToSync++;
318: } else {
319: if ($online == 1) {
320: $articlesOnline++;
321: } else {
322: $articlesOffline++;
323: }
324: if ($locked == 1) {
325: $articlesLocked++;
326: } else {
327: $articlesUnlocked++;
328: }
329: $articlesToRemove++;
330: }
331:
332: if ((($obj = $col->checkMark("article", $idartlang)) === false) || $obj->get("userid") == $auth->auth['uid']) {
333: $inUse = false;
334: } else {
335: $vuser = new cApiUser($obj->get("userid"));
336: $inUseUser = $vuser->getField("username");
337: $inUseUserRealName = $vuser->getField("realname");
338:
339: $inUse = true;
340: $title = $title . " (" . i18n("Article is in use") . ")";
341: $alttitle = sprintf(i18n("Article in use by %s (%s)"), $inUseUser, $inUseUserRealName) . " " . $alttitle;
342: }
343:
344:
345: $tmp_rowid = $idart . "-" . $idartlang . "-" . $lidcat . "-" . $idcatlang . "-" . $idcatart . "-" . $idlang;
346: $tpl->set('d', 'ROWID', $tmp_rowid);
347:
348: if ($idlang != $lang) {
349: $colitem[$tmp_rowid] = 'con_sync';
350: }
351:
352:
353: if ($perm->have_perm_area_action('con_editcontent', 'con_editart') || $perm->have_perm_area_action_item('con_editcontent', 'con_editart', $idcat)) {
354: if ($idlang != $lang) {
355: $tmp_alink = $sess->url("main.php?area=con_editcontent&action=con_editart&changeview=prev&idartlang=$idartlang&idart=$idart&idcat=$idcat&frame=$frame&tmpchangelang=$idlang");
356: $titlelink = '<a href="' . $tmp_alink . '" title="' . $alttitle . '">' . $title . '</a>';
357: } else {
358: $tmp_alink = $sess->url("main.php?area=con_editcontent&action=con_editart&changeview=edit&idartlang=$idartlang&idart=$idart&idcat=$idcat&frame=$frame");
359: $titlelink = '<a href="' . $tmp_alink . '" title="' . $alttitle . '">' . $title . '</a>';
360: }
361: } else {
362: $tmp_alink = '';
363: $titlelink = $title;
364: }
365:
366: if ($timemgmt == "1") {
367: $sql = "SELECT NOW() AS TIME";
368:
369: $db3 = cRegistry::getDb();
370:
371: $db3->query($sql);
372: $db3->nextRecord();
373:
374: $starttimestamp = strtotime($datestart);
375: $endtimestamp = strtotime($dateend);
376: $nowtimestamp = strtotime($db3->f("TIME"));
377:
378: if (($nowtimestamp < $endtimestamp) && ($nowtimestamp > $starttimestamp)) {
379: $usetime = '<img class="vAlignMiddle tableElement" src="images/but_time_2.gif" alt="' . i18n("Article with time control online") . '" title="' . i18n("Article with time control online") . '">';
380: } else {
381: $usetime = '<img class="vAlignMiddle tableElement" src="images/but_time_1.gif" alt="' . i18n("Article with time control offline") . '" title="' . i18n("Article with time control offline") . '">';
382: }
383: } else {
384: $usetime = '';
385: }
386:
387:
388: if (($perm->have_perm_area_action('con', 'con_lock') || $perm->have_perm_area_action_item('con', 'con_lock', $idcat)) && $inUse == false) {
389: if ($locked == 1) {
390: $lockimg = 'images/article_locked.gif';
391: $lockalt = i18n("Unfreeze article");
392: } else {
393: $lockimg = 'images/article_unlocked.gif';
394: $lockalt = i18n("Freeze article");
395: }
396: $tmp_lock = '<a href="' . $sess->url("main.php?area=con&idcat=$idcat&action=con_lock&frame=4&idart=$idart&next=$next") . '" title="' . $lockalt . '"><img class="vAlignMiddle tableElement" src="' . $lockimg . '" title="' . $lockalt . '" alt="' . $lockalt . '" border="0"></a>';
397: } else {
398: if ($locked == 1) {
399: $lockimg = 'images/article_locked.gif';
400: $lockalt = i18n("Article is frozen");
401: } else {
402: $lockimg = 'images/article_unlocked.gif';
403: $lockalt = i18n("Article is not frozen");
404: }
405: $tmp_lock = '<img class="vAlignMiddle tableElement" src="' . $lockimg . '" title="' . $lockalt . '" alt="' . $lockalt . '" border="0">';
406: }
407:
408: if ($idlang != $lang) {
409: $lockedlink = '';
410: } else {
411: $lockedlink = $tmp_lock;
412: }
413:
414: if ($sortkey == '') {
415: $sortkey = ' ';
416: }
417:
418: $tmp_articletitle = $titlelink;
419:
420:
421: if ($perm->have_perm_area_action('con_editart', 'con_edit') || $perm->have_perm_area_action_item('con_editart', 'con_edit', $idcat)) {
422: $tmp_artconf = '<a href="' . $sess->url("main.php?area=con_editart&action=con_edit&frame=4&idart=$idart&idcat=$idcat") . '" title="' . i18n("Article properties") . '"><img class="vAlignMiddle tableElement" src="' . $cfg["path"]["images"] . 'but_art_conf2.gif" alt="' . i18n("Article properties") . '" title="' . i18n("Article properties") . '" border="0"></a>';
423: } else {
424: $tmp_artconf = '';
425: }
426:
427: $tmp_sync = '';
428: if ($idlang != $lang) {
429: $sql = "SELECT idcatlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . cSecurity::toInteger($idcat) . "' AND idlang='" . cSecurity::toInteger($lang) . "'";
430: $db->query($sql);
431:
432: if ($db->nextRecord()) {
433: $tmp_sync = '<a href="' . $sess->url("main.php?area=con&action=con_syncarticle&idart=$idart&sourcelanguage=$idlang&frame=4&idcat=$idcat&next=$next") . '" title="' . i18n("Copy article to the current language") . '"><img class="vAlignMiddle tableElement" src="' . $cfg["path"]["images"] . 'but_sync_art.gif" alt="' . i18n("Copy article to the current language") . '" title="' . i18n("Copy article to the current language") . '" border="0"></a>';
434: } else {
435: $tmp_sync = '';
436: $articlesToSync--;
437: $articlesToRemove--;
438: }
439: }
440:
441:
442: if (!is_object($db2)) {
443: $db2 = cRegistry::getDb();
444: }
445:
446: $sql2 = "SELECT
447: b.name AS tplname,
448: b.idtpl AS idtpl,
449: b.description AS description
450: FROM
451: " . $cfg["tab"]["tpl_conf"] . " AS a,
452: " . $cfg["tab"]["tpl"] . " AS b
453: WHERE
454: a.idtplcfg = " . cSecurity::toInteger($idtplcfg) . " AND
455: a.idtpl = b.idtpl";
456:
457: $db2->query($sql2);
458: $db2->nextRecord();
459:
460: $a_tplname = $db2->f("tplname");
461: $a_idtpl = $db2->f("idtpl");
462: $templateDescription = $db2->f("description");
463:
464:
465: if (0 == $idtplcfg) {
466: $sql2 = "SELECT
467: c.idtpl AS idtpl,
468: c.name AS name,
469: c.description,
470: b.idtplcfg AS idtplcfg
471: FROM
472: " . $cfg['tab']['tpl_conf'] . " AS a,
473: " . $cfg['tab']['cat_lang'] . " AS b,
474: " . $cfg['tab']['tpl'] . " AS c
475: WHERE
476: b.idcat = " . cSecurity::toInteger($idcat) . " AND
477: b.idlang = " . cSecurity::toInteger($lang) . " AND
478: b.idtplcfg = a.idtplcfg AND
479: c.idtpl = a.idtpl AND
480: c.idclient = " . cSecurity::toInteger($client);
481: $db2->query($sql2);
482: $db2->nextRecord();
483: $a_tplname = $db2->f("name") ? '<i>' . $db2->f("name") . '</i>' : "--- " . i18n("None") . " ---";
484: }
485:
486:
487: $imgsrc = "isstart";
488:
489: if ($is_start == false) {
490: $imgsrc .= '0';
491: } else {
492: $imgsrc .= '1';
493: }
494: if (isArtInMultipleUse($idart)) {
495: $imgsrc .= 'm';
496: }
497: if ((int) $redirect == 1) {
498: $imgsrc .= 'r';
499: }
500:
501: $imgsrc .= '.gif';
502:
503: if ($idlang == $lang && ($perm->have_perm_area_action('con', 'con_makestart') || $perm->have_perm_area_action_item('con', 'con_makestart', $idcat)) && $idcat != 0) {
504: if ($is_start == false) {
505: $tmp_link = '<a href="' . $sess->url("main.php?area=con&idcat=$idcat&action=con_makestart&idcatart=$idcatart&frame=4&is_start=1&next=$next") . '" title="' . i18n("Flag as start article") . '"><img class="vAlignMiddle tableElement" src="images/' . $imgsrc . '" border="0" title="' . i18n("Flag as start article") . '" alt="' . i18n("Flag as start article") . '"></a>';
506: } else {
507: $tmp_link = '<a href="' . $sess->url("main.php?area=con&idcat=$idcat&action=con_makestart&idcatart=$idcatart&frame=4&is_start=0&next=$next") . '" title="' . i18n("Flag as normal article") . '"><img class="vAlignMiddle tableElement" src="images/' . $imgsrc . '" border="0" title="' . i18n("Flag as normal article") . '" alt="' . i18n("Flag as normal article") . '"></a>';
508: }
509: } else {
510: if ($is_start == true) {
511: $sTitle = i18n("Start article");
512: } else {
513: $sTitle = i18n("Normal article");
514: }
515:
516: $tmp_img = '<img class="vAlignMiddle tableElement" src="images/' . $imgsrc . '" border="0" title="' . $sTitle . '" alt="' . $sTitle . '">';
517:
518: $tmp_link = $tmp_img;
519: }
520:
521: $tmp_start = $tmp_link;
522:
523:
524: if (($perm->have_perm_area_action('con', 'con_duplicate') || $perm->have_perm_area_action_item('con', 'con_duplicate', $idcat)) && $idcat != 0) {
525: $imgsrc = "but_copy.gif";
526:
527:
528: $tmp_link = '<a href="' . $sess->url("main.php?area=con&idcat=$idcat&action=con_duplicate&duplicate=$idart&frame=4&next=$next") . "&count_duplicate=" . $_SESSION['count_duplicate'] . '" title="' . i18n("Duplicate article") . '"><img class="vAlignMiddle tableElement" src="images/' . $imgsrc . '" border="0" title="' . i18n("Duplicate article") . '" alt="' . i18n("Duplicate article") . '"></a>';
529: } else {
530: $tmp_link = '';
531: }
532:
533: if ($idlang != $lang) {
534: $duplicatelink = '';
535: } else {
536: $duplicatelink = $tmp_link;
537: }
538:
539:
540: $todolink = '';
541:
542: $subject = urlencode(sprintf(i18n("Reminder for article '%s'"), $title));
543: $mycatname = '';
544: conCreateLocationString($idcat, " / ", $mycatname);
545: $message = urlencode(sprintf(i18n("Reminder for article '%s'\nCategory: %s"), $title, $mycatname));
546:
547: $todolink = new TODOLink("idart", $idart, $subject, $message);
548:
549:
550: if ($online) {
551: if (($perm->have_perm_area_action('con', 'con_makeonline') || $perm->have_perm_area_action_item('con', 'con_makeonline', $idcat)) && ($idcat != 0)) {
552: $tmp_online = '<a href="' . $sess->url("main.php?area=con&idcat=$idcat&action=con_makeonline&frame=4&idart=$idart&next=$next") . '" title="' . i18n("Make offline") . '"><img class="vAlignMiddle tableElement" src="images/online.gif" title="' . i18n("Make offline") . '" alt="' . i18n("Make offline") . '" border="0"></a>';
553: } else {
554: $tmp_online = '<img class="vAlignMiddle tableElement" src="images/online.gif" title="' . i18n("Article is online") . '" alt="' . i18n("Article is online") . '" border="0">';
555: }
556: } else {
557: if (($perm->have_perm_area_action('con', 'con_makeonline') || $perm->have_perm_area_action_item('con', 'con_makeonline', $idcat)) && ($idcat != 0)) {
558: $tmp_online = '<a href="' . $sess->url("main.php?area=con&idcat=$idcat&action=con_makeonline&frame=4&idart=$idart&next=$next") . '" title="' . i18n("Make online") . '"><img class="vAlignMiddle tableElement" src="images/offline.gif" title="' . i18n("Make online") . '" alt="' . i18n("Make online") . '" border="0"></a>';
559: } else {
560: $tmp_online = '<img class="vAlignMiddle tableElement" src="images/offline.gif" title="' . i18n("Article is offline") . '" alt="' . i18n("Article is offline") . '" border="0">';
561: }
562: }
563:
564: if ($idlang != $lang) {
565: $onlinelink = '';
566: } else {
567: $onlinelink = $tmp_online;
568: }
569:
570:
571: if (($perm->have_perm_area_action('con', 'con_deleteart') || $perm->have_perm_area_action_item('con', 'con_deleteart', $idcat)) && $inUse == false) {
572: $tmp_title = $title;
573: if (strlen($tmp_title) > 30) {
574: $tmp_title = substr($tmp_title, 0, 27) . "...";
575: }
576:
577: $confirmString = sprintf(i18n("Are you sure to delete the following article:<br><br><b>%s</b>"), conHtmlSpecialChars($tmp_title));
578: $tmp_del = '<a href="javascript:void(0)" onclick="Con.showConfirmation("' . $confirmString . '", function() { deleteArticle(' . $idart . ', ' . $idcat . ', ' . $next . '); });return false;" title="' . i18n("Delete article") . '"><img class="vAlignMiddle tableElement" src="images/delete.gif" title="' . i18n("Delete article") . '" alt="' . i18n("Delete article") . '"></a>';
579: } else {
580: $tmp_del = '';
581: }
582:
583: if ($idlang != $lang) {
584: $deletelink = '';
585: } else {
586: $deletelink = $tmp_del;
587: }
588:
589:
590: cInclude('includes', 'functions.lang.php');
591: $tpl->set('d', 'DIRECTION', 'dir="' . langGetTextDirection($lang) . '"');
592:
593:
594:
595: $no_article = false;
596: foreach ($listColumns as $listColumn => $ctitle) {
597: switch ($listColumn) {
598: case "mark":
599: $value = '<input type="checkbox" name="mark" value="' . $idart . '" class="mark_articles">';
600: break;
601: case "start":
602: $value = $tmp_start . $usetime;
603: break;
604: case "title":
605: $value = $tmp_articletitle;
606: break;
607: case "changeddate":
608: $value = $modified;
609: break;
610: case "publisheddate":
611: $value = $published;
612: break;
613: case "sortorder":
614: $value = $sortkey;
615: break;
616: case "template":
617: $value = $a_tplname;
618: break;
619: case "actions":
620: $actions = array();
621: foreach ($actionList as $actionItem) {
622: switch ($actionItem) {
623: case "todo":
624: $actionValue = $todolink;
625: break;
626: case "artconf":
627: $actionValue = $tmp_artconf;
628: break;
629: case "online":
630: $actionValue = $onlinelink;
631: break;
632: case "locked":
633: $actionValue = $lockedlink;
634: break;
635: case "duplicate":
636: $actionValue = $duplicatelink;
637: break;
638: case "delete":
639: $actionValue = $deletelink;
640: break;
641: case "usetime":
642: $actionValue = '';
643: break;
644: default:
645:
646: $_cecIterator = $_cecRegistry->getIterator("Contenido.ArticleList.RenderAction");
647: $contents = array();
648: if ($_cecIterator->count() > 0) {
649: while ($chainEntry = $_cecIterator->next()) {
650: $contents[] = $chainEntry->execute($idcat, $idart, $idartlang, $actionItem);
651: }
652: }
653: $actionValue = implode('', $contents);
654: break;
655: }
656:
657: $actions[] = $actionValue;
658: }
659:
660: if ($tmp_sync != '') {
661: $actions[] = $tmp_sync;
662: }
663:
664:
665: if ($tmp_sync != '') {
666: $actions[] = '<a id="properties" href="main.php?area=con_editart&action=con_edit&frame=4&idcat=' . $idcat . '&idart=' . $idart . '&contenido=' . $contenido . '">
667: <img class="vAlignMiddle tableElement" onmouseover="this.style.cursor=\'pointer\'" src="images/but_art_conf2.gif" title="' . i18n("Display properties") . '" alt="' . i18n("Display properties") . '" style="cursor: pointer;">
668: </a>';
669: }
670:
671: $value = implode("\n", $actions);
672: break;
673: default:
674: $contents = array();
675:
676: $_cecIterator = $_cecRegistry->getIterator("Contenido.ArticleList.RenderColumn");
677: if ($_cecIterator->count() > 0) {
678: $contents = array();
679: while ($chainEntry = $_cecIterator->next()) {
680: $contents[] = $chainEntry->execute($idcat, $idart, $idartlang, $listColumn);
681: }
682: }
683: $value = implode('', $contents);
684: }
685: $artlist[$tmp_rowid][$listColumn] = $value;
686: $artlist[$tmp_rowid]['templateDescription'] = $templateDescription;
687: }
688: }
689:
690: $headers = array();
691:
692:
693: $sortColumns = array(
694: 'title' => 1,
695: 'changeddate' => 2,
696: 'publisheddate' => 3,
697: 'sortorder' => 4
698: );
699: foreach ($listColumns as $key => $listColumn) {
700:
701: $width = ($key == 'title' || $listColumn == i18n('Title')) ? '100%' : '1%';
702:
703: if (in_array($key, array_keys($sortColumns))) {
704: $newSortmode = 'asc';
705:
706:
707: if ($sortby == $sortColumns[$key] && $sortmode == 'asc') {
708: $newSortmode = 'desc';
709: }
710:
711: if ($sortby == $sortColumns[$key]) {
712: $imageSrc = ($sortmode == 'asc') ? 'images/sort_up.gif' : 'images/sort_down.gif';
713: $sortImage = '<img src="' . $imageSrc . '">';
714: } else {
715: $sortImage = '';
716: }
717: $sortLink = $sess->url("main.php?area=con&frame=4&idcat=$idcat&sortby=$sortColumns[$key]&sortmode=$newSortmode");
718: $col = '<a href="' . $sortLink . '" class="gray">' . $listColumn . $sortImage . '</a>';
719: } else {
720: $col = $listColumn;
721: }
722: $headers[] = '<th width="' . $width . '" nowrap="nowrap">' . $col . '</th>';
723: }
724:
725: $tpl->set('s', 'HEADERS', implode("\n", $headers));
726:
727: if ($elemperpage > 0 && $iArticleCount > 0 && $iArticleCount > $elemperpage) {
728: for ($i = 1; $i <= ceil($iArticleCount / $elemperpage); $i++) {
729: $iNext = ($i - 1) * $elemperpage;
730: if ($sBrowseLinks !== '') {
731: $sBrowseLinks .= ' ';
732: }
733: if ($next == $iNext) {
734: $sBrowseLinks .= $i . "\n";
735:
736: } else {
737: $tmp_alink = $sess->url("main.php?area=con&frame=$frame&idcat=$idcat&next=$iNext");
738: $sBrowseLinks .= '<a href="' . $tmp_alink . '">' . $i . '</a>' . "\n";
739: }
740: }
741: $tpl->set('s', 'NEXT', $next);
742: $tpl->set('s', 'BROWSE', sprintf(i18n("Go to page: %s"), $sBrowseLinks));
743: } else {
744: $tpl->set('s', 'NEXT', "0");
745: $tpl->set('s', 'BROWSE', ' ');
746: }
747: $tpl->set('s', 'CLICK_ROW_NOTIFICATION', i18n("Click on a row to select an article for editing"));
748:
749:
750: $bulkEditingFunctions = '';
751: if ($articlesOffline > 0 && ($perm->have_perm_area_action("con", "con_makeonline") || $perm->have_perm_area_action_item("con", "con_makeonline", $idcat))) {
752: $bulkEditingFunctions .= createBulkEditingFunction('con_makeonline', 'images/online.gif', i18n('Set articles online'));
753: }
754: if ($articlesOnline > 0 && ($perm->have_perm_area_action("con", "con_makeonline") || $perm->have_perm_area_action_item("con", "con_makeonline", $idcat))) {
755: $bulkEditingFunctions .= createBulkEditingFunction('con_makeonline invert', 'images/offline.gif', i18n('Set articles offline'));
756: }
757: if ($articlesUnlocked > 0 && ($perm->have_perm_area_action("con", "con_lock") || $perm->have_perm_area_action_item("con", "con_lock", $idcat))) {
758: $bulkEditingFunctions .= createBulkEditingFunction('con_lock', 'images/article_unlocked.gif', i18n('Freeze articles'));
759: }
760: if ($articlesLocked > 0 && ($perm->have_perm_area_action("con", "con_lock") || $perm->have_perm_area_action_item("con", "con_lock", $idcat))) {
761: $bulkEditingFunctions .= createBulkEditingFunction('con_lock invert', 'images/article_locked.gif', i18n('Unfreeze articles'));
762: }
763: if ($articlesToSync > 0 && ($perm->have_perm_area_action("con", "con_syncarticle") || $perm->have_perm_area_action_item("con", "con_syncarticle", $idcat))) {
764: $bulkEditingFunctions .= createBulkEditingFunction('con_syncarticle', 'images/but_sync_art.gif', i18n('Copy article to the current language'));
765: }
766: if ($articlesToRemove > 0 && ($perm->have_perm_area_action("con", "con_deleteart") || $perm->have_perm_area_action_item("con", "con_deleteart", $idcat))) {
767: $bulkEditingFunctions .= createBulkEditingFunction('con_deleteart', 'images/delete.gif', i18n('Delete articles'), 'Con.showConfirmation("' . i18n('Are you sure to delete the selected articles') . '", deleteArticles)');
768: }
769:
770: if ($bulkEditingFunctions == "") {
771: $bulkEditingFunctions = i18n("Your permissions do not allow any actions here");
772: }
773: $tpl->set('s', 'BULK_EDITING_FUNCTIONS', $bulkEditingFunctions);
774:
775: if (count($artlist) > 0) {
776: foreach ($artlist as $key2 => $artitem) {
777:
778: $cells = array();
779:
780: foreach ($listColumns as $key => $listColumn) {
781:
782: if ($key == 'template') {
783: $templateDescription = $artitem['templateDescription'];
784: $descString = '<b>' . $artitem[$key] . '</b>';
785:
786: $sTemplatename = cApiStrTrimHard($artitem[$key], 20);
787: if (strlen($artitem[$key]) > 20) {
788: $cells[] = '<td nowrap="nowrap" class="bordercell tooltip" title="' . $descString . '">' . $sTemplatename . '</td>';
789: } else {
790: $cells[] = '<td nowrap="nowrap" class="bordercell">' . $artitem[$key] . '</td>';
791: }
792: } else {
793: $cells[] = '<td nowrap="nowrap" class="bordercell">' . $artitem[$key] . '</td>';
794: }
795: }
796: $tpl->set('d', 'CELLS', implode("\n", $cells));
797:
798: if ($colitem[$key2] == 'con_sync') {
799: $tpl->set('d', 'CSS_CLASS', 'class="con_sync"');
800: } else {
801: $tpl->set('d', 'CSS_CLASS', '');
802: }
803:
804: $tpl->set('d', 'ROWID', $key2);
805: $tpl->next();
806: }
807: } else {
808: $emptyCell = '<td nowrap="nowrap" class="bordercell" colspan="' . count($listColumns) . '">' . i18n("No articles found") . '</td>';
809: $tpl->set('d', 'CELLS', $emptyCell);
810: $tpl->set('d', 'CSS_CLASS', '');
811: $tpl->set('d', 'ROWID', '');
812: }
813:
814:
815: $aElemPerPage = array(
816: 0 => i18n("All"),
817: 10 => "10",
818: 25 => "25",
819: 50 => "50",
820: 75 => "75",
821: 100 => "100"
822: );
823:
824: $tpl2 = new cTemplate();
825: $tpl2->set('s', 'NAME', 'sort');
826: $tpl2->set('s', 'CLASS', 'text_medium');
827: $tpl2->set('s', 'OPTIONS', 'onchange="changeElemPerPage(this)"');
828:
829: foreach ($aElemPerPage as $key => $value) {
830: $selected = ($elemperpage == $key) ? 'selected="selected"' : '';
831: $tpl2->set('d', 'VALUE', $key);
832: $tpl2->set('d', 'CAPTION', $value);
833: $tpl2->set('d', 'SELECTED', $selected);
834: $tpl2->next();
835: }
836:
837: $select = (!$no_article) ? $tpl2->generate($cfg["path"]["templates"] . $cfg['templates']['generic_select'], true) : ' ';
838: $caption = (!$no_article) ? i18n("Items per page:") : ' ';
839:
840: $tpl->set('s', 'ELEMPERPAGECAPTION', $caption);
841: $tpl->set('s', 'ELEMPERPAGE', $select);
842:
843: $tpl->set('s', 'IDCAT', $idcat);
844: $tpl->set('s', 'SOURCELANGUAGE', $idlang);
845:
846:
847: $sql = "SELECT
848: b.name AS name,
849: d.idtpl AS idtpl
850: FROM
851: (" . $cfg["tab"]["cat"] . " AS a,
852: " . $cfg["tab"]["cat_lang"] . " AS b,
853: " . $cfg["tab"]["tpl_conf"] . " AS c)
854: LEFT JOIN
855: " . $cfg["tab"]["tpl"] . " AS d
856: ON
857: d.idtpl = c.idtpl
858: WHERE
859: a.idclient = " . cSecurity::toInteger($client) . " AND
860: a.idcat = " . cSecurity::toInteger($idcat) . " AND
861: b.idlang = " . cSecurity::toInteger($lang) . " AND
862: b.idcat = a.idcat AND
863: c.idtplcfg = b.idtplcfg";
864:
865: $db->query($sql);
866:
867: if ($db->nextRecord()) {
868:
869:
870: }
871:
872: $cat_idtpl = $db->f("idtpl");
873:
874: $cat_name = renderBackendBreadcrumb($syncoptions, false, true);
875:
876:
877: if ($no_article) {
878: $tpl->set('d', "START", ' ');
879: $tpl->set('d', "ARTICLE", i18n("No articles found"));
880: $tpl->set('d', "PUBLISHED", ' ');
881: $tpl->set('d', "LASTMODIFIED", ' ');
882: $tpl->set('d', "ARTCONF", ' ');
883: $tpl->set('d', "TPLNAME", ' ');
884: $tpl->set('d', "LOCKED", ' ');
885: $tpl->set('d', "DUPLICATE", ' ');
886: $tpl->set('d', "TPLCONF", ' ');
887: $tpl->set('d', "ONLINE", ' ');
888: $tpl->set('d', "DELETE", ' ');
889: $tpl->set('d', "USETIME", ' ');
890: $tpl->set('d', "TODO", ' ');
891: $tpl->set('d', "SORTKEY", ' ');
892:
893: $tpl->next();
894: }
895:
896:
897: 898: 899: 900: 901: 902:
903:
904: if (($perm->have_perm_area_action_item('con', 'con_tplcfg_edit', $idcat) || $perm->have_perm_area_action('con', 'con_tplcfg_edit')) && $foreignlang == false) {
905: if (0 != $idcat) {
906: $tpl->set('s', 'CATEGORY', $cat_name);
907: $tpl->set('s', 'CATEGORY_CONF', $tmp_img);
908: $tpl->set('s', 'CATEGORY_LINK', $tmp_link);
909: } else {
910: $tpl->set('s', 'CATEGORY', $cat_name);
911: $tpl->set('s', 'CATEGORY_CONF', ' ');
912: $tpl->set('s', 'CATEGORY_LINK', ' ');
913: }
914: } else {
915: $tpl->set('s', 'CATEGORY', $cat_name);
916: $tpl->set('s', 'CATEGORY_CONF', ' ');
917: $tpl->set('s', 'CATEGORY_LINK', ' ');
918: }
919:
920:
921: $tpl->set('s', 'SELF_URL', $sess->url("main.php?area=con&frame=4&idcat=$idcat"));
922:
923:
924: $warningBox = '';
925: if (strHasStartArticle($idcat, $lang) === false) {
926: $warningBox = $notification->returnNotification('warning', i18n('This category does not have a configured start article.'));
927: }
928:
929:
930: if (($perm->have_perm_area_action('con_editart', 'con_newart') || $perm->have_perm_area_action_item('con_editart', 'con_newart', $idcat)) && $foreignlang == false) {
931: if ($idcat != 0 && $cat_idtpl != 0) {
932: $tpl->set('s', 'NEWARTICLE_TEXT', '<a id="newArtTxt" href="' . $sess->url("main.php?area=con_editart&frame=$frame&action=con_newart&idcat=$idcat") . '">' . i18n("Create new article") . '</a>');
933: $tpl->set('s', 'NEWARTICLE_IMG', '<a id="newArtImg" href="' . $sess->url("main.php?area=con_editart&frame=$frame&action=con_newart&idcat=$idcat") . '" title="' . i18n("Create new article") . '"><img src="images/but_art_new.gif" border="0" alt="' . i18n("Create new article") . '"></a>');
934: $tpl->set('s', 'CATTEMPLATE', $warningBox);
935: } else {
936: $notification_text = $notification->returnNotification("error", i18n("Creation of articles is only possible if the category has a assigned template."));
937: $tpl->set('s', 'CATTEMPLATE', $notification_text);
938: $tpl->set('s', 'NEWARTICLE_TEXT', ' ');
939: $tpl->set('s', 'NEWARTICLE_IMG', ' ');
940: }
941: } else {
942: $tpl->set('s', 'NEWARTICLE_TEXT', ' ');
943: $tpl->set('s', 'NEWARTICLE_IMG', ' ');
944: $tpl->set('s', 'CATTEMPLATE', $warningBox);
945: }
946:
947: $str = '';
948:
949: $tpl->set('s', 'NOTIFICATION', $str);
950:
951:
952: if ($no_article) {
953: $tpl->set('s', 'NOARTICLE_CSS', "display: none;");
954: $tpl->set('s', 'NOARTICLE_JS', 'true');
955: } else {
956: $tpl->set('s', 'NOARTICLE_CSS', "");
957: $tpl->set('s', 'NOARTICLE_JS', 'false');
958: }
959:
960:
961: $tpl->set('s', 'IDTPL', $idtpl ? $idtpl : $cat_idtpl);
962: $tpl->set('s', 'SYNCOPTIONS', $syncoptions);
963: $tpl->set('s', 'DISPLAY_MENU', 1);
964:
965:
966: $tpl->generate($cfg['path']['templates'] . $cfg['templates']['con_art_overview']);
967: } else {
968: $notification->displayNotification("error", i18n("Permission denied"));
969: }
970: } else {
971: $tpl->reset();
972: $tpl->set('s', 'CONTENTS', '');
973: $tpl->generate($cfg['path']['templates'] . $cfg['templates']['blank']);
974: }
975:
976: 977: 978: 979: 980: 981: 982: 983: 984:
985: function createBulkEditingFunction($class, $imageSrc, $alt, $onclick = '') {
986: $function = new cHTMLLink();
987: $function->setClass($class);
988: if ($onclick !== '') {
989: $function->setEvent('click', $onclick);
990: }
991: $image = new cHTMLImage($imageSrc);
992: $image->setAlt($alt);
993: $function->setContent($image);
994:
995: return $function->render();
996: }
997: