Commit bd1a0a24 authored by sampaioprimo's avatar sampaioprimo

[ENH] display in the feed admin page the default value for the title and the...

[ENH] display in the feed admin page the default value for the title and the description (trying to avoid empty title and description since both fields are mandatory, the best solution would be to have a way to declare that a preference field must not be empty)
parent 2abb5090
......@@ -942,71 +942,71 @@ function get_default_prefs() {
'feed_default_version' => '5',
'feed_img' => 'img/tiki/Tiki_WCG.png',
'feed_language' => 'en-us',
'feed_articles_desc' => '',
'feed_articles' => 'n',
'feed_articles_desc' => tra('Last articles.'),
'feed_articles_homepage' => '',
'feed_articles_max' => 10,
'feed_articles' => 'n',
'feed_articles_showAuthor' => 'n',
'feed_articles_title' => '',
'feed_articles_title' => tra('Tiki RSS feed for articles'),
'feed_blog' => 'n',
'feed_blog_desc' => '',
'feed_blog_desc' => tra('Last modifications to the blog.'),
'feed_blog_homepage' => '',
'feed_blog_max' => 10,
'feed_blog_showAuthor' => 'n',
'feed_blog_title' => '',
'feed_blog_title' => tra('Tiki RSS feed for blog: '),
'feed_blogs' => 'n',
'feed_blogs_desc' => '',
'feed_blogs_desc' => tra('Last posts to weblogs.'),
'feed_blogs_homepage' => '',
'feed_blogs_max' => 10,
'feed_blogs_showAuthor' => 'n',
'feed_blogs_title' => '',
'feed_blogs_title' => tra('Tiki RSS feed for weblogs'),
'feed_calendar' => 'n',
'feed_calendar_desc' => '',
'feed_calendar_desc' => tra('Upcoming events.'),
'feed_calendar_homepage' => '',
'feed_calendar_max' => 10,
'feed_calendar_showAuthor' => 'n',
'feed_calendar_title' => '',
'feed_calendar_title' => tra('Tiki RSS feed for calendars'),
'feed_directories' => 'n',
'feed_directories_desc' => '',
'feed_directories_desc' => tra('Last sites.'),
'feed_directories_homepage' => '',
'feed_directories_max' => 10,
'feed_directories_showAuthor' => 'n',
'feed_directories_title' => '',
'feed_directories_title' => tra('Tiki RSS feed for directory sites'),
'feed_file_galleries' => 'n',
'feed_file_galleries_desc' => '',
'feed_file_galleries_desc' => tra('Last files uploaded to the file galleries.'),
'feed_file_galleries_homepage' => '',
'feed_file_galleries_max' => 10,
'feed_file_galleries_showAuthor' => 'n',
'feed_file_galleries_title' => '',
'feed_file_galleries_title' => tra('Tiki RSS feed for file galleries'),
'feed_file_gallery' => 'n',
'feed_file_gallery_desc' => '',
'feed_file_gallery_desc' => tra('Last files uploaded to this file gallery. '),
'feed_file_gallery_homepage' => '',
'feed_file_gallery_max' => 10,
'feed_file_gallery_showAuthor' => 'n',
'feed_file_gallery_title' => '',
'feed_file_gallery_title' => tra('Tiki RSS feed for the file gallery: '),
'feed_forum' => 'n',
'feed_forum_desc' => '',
'feed_forum_desc' => tra('Last posts to this forum. '),
'feed_forum_homepage' => '',
'feed_forum_max' => 10,
'feed_forum_showAuthor' => 'n',
'feed_forum_title' => '',
'feed_forum_title' => tra('Tiki RSS feed for forum: '),
'feed_forums_max' => 10,
'feed_forums' => 'n',
'feed_forums_desc' => '',
'feed_forums_desc' => tra('Last topics in forums.'),
'feed_forums_showAuthor' => 'n',
'feed_forums_title' => '',
'feed_forums_title' => tra('Tiki RSS feed for forums'),
'feed_image_galleries' => 'n',
'feed_image_galleries_desc' => '',
'feed_image_galleries_desc' => tra('Last images uploaded to the image galleries.'),
'feed_image_galleries_homepage' => '',
'feed_image_galleries_max' => 10,
'feed_image_galleries_showAuthor' => 'n',
'feed_image_galleries_title' => '',
'feed_image_galleries_title' => tra('Tiki RSS feed for image galleries'),
'feed_image_gallery' => 'n',
'feed_image_gallery_desc' => '',
'feed_image_gallery_desc' => tra('Last images uploaded to this image gallery. '),
'feed_image_gallery_homepage' => '',
'feed_image_gallery_max' => 10,
'feed_image_gallery_showAuthor' => 'n',
'feed_image_gallery_title' => '',
'feed_image_gallery_title' => tra('Tiki RSS feed for the image gallery: '),
'feed_maps' => 'n',
'feed_maps_desc' => '',
'feed_maps_homepage' => '',
......@@ -1014,17 +1014,17 @@ function get_default_prefs() {
'feed_maps_showAuthor' => 'n',
'feed_maps_title' => '',
'feed_shoutbox' => '',
'feed_shoutbox_desc' => '',
'feed_shoutbox_desc' => tra('Last shoutbox messages.'),
'feed_shoutbox_homepage' => '',
'feed_shoutbox_max' => '',
'feed_shoutbox_showAuthor' => '',
'feed_shoutbox_title' => '',
'feed_shoutbox_title' => tra('Tiki RSS feed for shoutbox messages'),
'feed_tracker' => 'n',
'feed_tracker_desc' => '',
'feed_tracker_desc' => tra('Last items published on this tracker.'),
'feed_tracker_homepage' => '',
'feed_tracker_max' => 10,
'feed_tracker_showAuthor' => 'n',
'feed_tracker_title' => '',
'feed_tracker_title' => tra('Tiki RSS feed for individual trackers: '),
'feed_trackers' => 'n',
'feed_trackers_desc' => '',
'feed_trackers_homepage' => '',
......@@ -1032,11 +1032,11 @@ function get_default_prefs() {
'feed_trackers_showAuthor' => 'n',
'feed_trackers_title' => '',
'feed_wiki' => 'n',
'feed_wiki_desc' => '',
'feed_wiki_desc' => tra('Last modifications to the Wiki.'),
'feed_wiki_homepage' => '',
'feed_wiki_max' => 10,
'feed_wiki_showAuthor' => 'n',
'feed_wiki_title' => '',
'feed_wiki_title' => tra('Tiki RSS feed for the wiki pages'),
'max_rss_mapfiles' => 10,
'rss_mapfiles' => 'n',
'title_rss_mapfiles' => '',
......
......@@ -65,10 +65,8 @@ if ($topic and !$tikilib->user_has_perm_on_object($user,$topic,'topic','tiki_p_t
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"]=="EMPTY") {
$tmp = tra("Tiki RSS feed for articles");
$title = (!empty($feed_articles_title)) ? $feed_articles_title : $tmp;
$tmp = tra("Last articles.");
$desc = (!empty($feed_articles_desc)) ? $feed_articles_desc : $tmp;
$title = $prefs['feed_articles_title'];
$desc = $prefs['feed_articles_desc'];
$id = "articleId";
$titleId = "title";
$descId = "heading";
......
......@@ -31,9 +31,9 @@ $uniqueid = "$feed.$id=" . $_REQUEST["$id"];
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"] == "EMPTY") {
$tmp = $bloglib->get_blog($_REQUEST["$id"]);
$title = (!empty($prefs['feed_' . $feed . '_title'])) ? $prefs['feed_' . $feed . '_title'] : tra('Tiki RSS feed for blog: ');
$title = $prefs['feed_' . $feed . '_title'];
$title.= $tmp['title'];
$desc.= (!empty($prefs['feed_' . $feed . '_desc'])) ? $prefs['feed_' . $feed . '_desc'] : tra('Last modifications to the blog.');
$desc.= $prefs['feed_' . $feed . '_desc'];
$desc.= $tmp["description"];
$descId = "data";
$dateId = "created";
......
......@@ -32,8 +32,8 @@ $feed = "blogs";
$uniqueid = $feed;
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"] == "EMPTY") {
$title = (!empty($prefs['feed_blogs_title'])) ? $prefs['feed_blogs_title'] : tra("Tiki RSS feed for weblogs");
$desc = (!empty($prefs['feed_blogs_desc'])) ? $prefs['feed_blogs_desc'] : tra("Last posts to weblogs.");
$title = $prefs['feed_blogs_title'];
$desc = $prefs['feed_blogs_desc'];
$now = date("U");
$id = "postId";
$descId = "data";
......
......@@ -40,8 +40,8 @@ if (isset($_REQUEST["calendarIds"])) {
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"]=="EMPTY") {
$title = tra("Tiki RSS feed for calendars");
$desc = tra("Upcoming events.");
$title = $prefs['feed_'.$feed.'_title'];
$desc = $prefs['feed_'.$feed.'_desc'];
$id = "calitemId";
$titleId = "name";
$descId = "body";
......@@ -49,11 +49,6 @@ if ($output["data"]=="EMPTY") {
$authorId = "user";
$readrepl = "tiki-calendar_edit_item.php?viewcalitemId=%s";
$tmp = $prefs['feed_'.$feed.'_title'];
if ($tmp<>'') $title = $tmp;
$tmp = $prefs['feed_'.$feed.'_desc'];
if ($desc<>'') $desc = $tmp;
$allCalendars = $calendarlib->list_calendars();
// build a list of viewable calendars
......
......@@ -32,8 +32,8 @@ $feed = "directories";
$uniqueid = $feed;
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"] == "EMPTY") {
$title = (!empty($feed_directories_desc)) ? $feed_directories_desc : tra("Tiki RSS feed for directory sites");
$desc = (!empty($feed_directories_desc)) ? $feed_directories_desc : tra("Last sites.");
$title = $prefs['feed_directories_title'];
$desc = $prefs['feed_directories_desc'];
$id = "siteId";
$titleId = "name";
$descId = "description";
......
......@@ -21,8 +21,8 @@ $uniqueid = $feed;
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"]=="EMPTY") {
$title = (!empty($feed_file_galleries_title)) ? $feed_file_galleries_title : tra("Tiki RSS feed for file galleries");
$desc = (!empty($feed_file_galleries_desc)) ? $feed_file_galleries_desc : tra("Last files uploaded to the file galleries.");
$title = $prefs['feed_file_galleries_title'];
$desc = $prefs['feed_file_galleries_desc'];
$id = "fileId";
$descId = "description";
$dateId = "lastModif";
......@@ -30,11 +30,6 @@ if ($output["data"]=="EMPTY") {
$titleId = "filename";
$readrepl = "tiki-download_file.php?$id=%s";
$tmp = $prefs['feed_'.$feed.'_title'];
if ($tmp<>'') $title = $tmp;
$tmp = $prefs['feed_'.$feed.'_desc'];
if ($desc<>'') $desc = $tmp;
$changes = $tikilib->list_files(0, $prefs['feed_file_galleries_max'], $dateId.'_desc', '');
$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, '', $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
}
......
......@@ -39,9 +39,10 @@ $output = $rsslib->get_from_cache($uniqueid);
if ($output["data"]=="EMPTY") {
if (count($galleryIds) == 1) {
$tmp = $tikilib->get_file_gallery($galleryIds[0]);
$title = empty($prefs['feed_file_gallery_title'])? tra("Tiki RSS feed for the file gallery: "): $prefs['feed_file_gallery_title'];
$title = $prefs['feed_file_gallery_title'];
$title .= $tmp['name'];
$desc = empty($tmp['description'])? $prefs['feed_file_gallery_desc']: $tmp['description'];
$desc = $prefs['feed_file_gallery_desc'];
$desc .= $tmp['description'];
} else {
$title = (!empty($prefs['feed_file_galleries_title'])) ? $prefs['feed_file_galleries_title'] : tra("Tiki RSS feed for file galleries");
$desc = (!empty($prefs['feed_file_galleries_desc'])) ? $prefs['feed_file_galleries_desc'] : tra("Last files uploaded to the file galleries.");
......@@ -62,15 +63,6 @@ if ($output["data"]=="EMPTY") {
$readrepl = "tiki-download_file.php?$id=%s";
}
if ($title=="") {
$tmp = $prefs['feed_'.$feed.'_title'];
if ($tmp<>'') $title = $tmp;
}
if ($desc=="") {
$tmp = $prefs['feed_'.$feed.'_desc'];
if ($desc<>'') $desc = $tmp;
}
$changes = $tikilib->get_files( 0, $prefs['feed_file_gallery_max'], $dateId.'_desc', '', $galleryIds);
$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, '', $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
}
......
......@@ -39,8 +39,8 @@ $output = $rsslib->get_from_cache($uniqueid);
if ($output["data"]=="EMPTY") {
$tmp = $commentslib->get_forum($_REQUEST["forumId"]);
$title = tra("Tiki RSS feed for forum: ").$tmp["name"];
$desc = $tmp["description"];
$title = $prefs['feed_forum_title'].$tmp["name"];
$desc = $prefs['feed_forum_desc'] . $tmp["description"];
$param = "threadId";
$descId = "data";
$dateId = "commentDate";
......@@ -48,11 +48,6 @@ if ($output["data"]=="EMPTY") {
$titleId = "title";
$readrepl = "tiki-view_forum_thread.php?$id=%s&comments_parentId=%s";
$tmp = $prefs['feed_'.$feed.'_title'];
if ($tmp<>'') $title = $tmp;
$tmp = $prefs['feed_'.$feed.'_desc'];
if ($desc<>'') $desc = $tmp;
$changes = $tikilib->list_forum_topics($_REQUEST["$id"],0, $prefs['feed_forum_max'], $dateId.'_desc', '');
$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, $param, $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
}
......
......@@ -31,8 +31,8 @@ $uniqueid = $feed;
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"]=="EMPTY") {
$title = (!empty($prefs['feed_forums_title'])) ? $prefs['feed_forums_title'] : tra("Tiki RSS feed for forums");
$desc = (!empty($prefs['feed_forums_desc'])) ? $prefs['feed_forums_desc'] : tra("Last topics in forums.");
$title = $prefs['feed_forums_title'];
$desc = $prefs['feed_forums_desc'];
$id = 'object';
$param = "threadId";
$descId = "data";
......@@ -41,11 +41,6 @@ if ($output["data"]=="EMPTY") {
$titleId = "title";
$readrepl = 'tiki-view_forum_thread.php?forumId=%s&comments_parentId=%s';
$tmp = $prefs['feed_'.$feed.'_title'];
if ($tmp<>'') $title = $tmp;
$tmp = $prefs['feed_'.$feed.'_desc'];
if ($desc<>'') $desc = $tmp;
$changes = $tikilib -> list_all_forum_topics(0, $prefs['feed_forums_max'], $dateId.'_desc', '');
$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, $param, $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
}
......
......@@ -32,8 +32,8 @@ $uniqueid = $feed;
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"]=="EMPTY") {
$title = (!empty($prefs['feed_image_galleries_title'])) ? $prefs['feed_image_galleries_title'] : tra("Tiki RSS feed for image galleries");
$desc = (!empty($prefs['feed_image_galleries_desc'])) ? $prefs['feed_image_galleries_desc'] : tra("Last images uploaded to the image galleries.");
$title = $prefs['feed_image_galleries_title'];
$desc = $prefs['feed_image_galleries_desc'];
$id = "imageId";
$titleId = "name";
......@@ -42,11 +42,6 @@ if ($output["data"]=="EMPTY") {
$authorId = "user";
$readrepl = "tiki-browse_image.php?imageId=%s";
$tmp = $prefs['feed_'.$feed.'_title'];
if ($tmp<>'') $title = $tmp;
$tmp = $prefs['feed__'.$feed.'_desc'];
if ($desc<>'') $desc = $tmp;
$changes = $imagegallib->list_images(0,$prefs['feed_image_galleries_max'],$dateId.'_desc', '');
$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, '', $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
}
......
......@@ -34,8 +34,8 @@ $output = $rsslib->get_from_cache($uniqueid);
if ($output["data"]=="EMPTY") {
$tmp = $imagegallib->get_gallery($_REQUEST["galleryId"]);
$title = tra("Tiki RSS feed for the image gallery: ").$tmp["name"];
$desc = $tmp["description"]; // TODO: make configurable
$title = $prefs['feed_image_gallery_title'].$tmp["name"];
$desc = $prefs['feed_image_gallery_desc'] . $tmp["description"];
$id = "imageId";
$titleId = "name";
$descId = "description";
......@@ -43,11 +43,6 @@ if ($output["data"]=="EMPTY") {
$dateId = "created";
$readrepl = "tiki-browse_image.php?imageId=%s";
$tmp = $prefs['feed_'.$feed.'_title'];
if ($tmp<>'') $title = $tmp;
$tmp = $prefs['feed_'.$feed.'_desc'];
if ($desc<>'') $desc = $tmp;
$changes = $imagegallib->get_images( 0,$prefs['feed_image_gallery_max'],$dateId.'_desc', '', $_REQUEST["galleryId"]);
$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, '', $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
}
......
......@@ -30,8 +30,8 @@ $feed = "shoutbox";
$uniqueid = $feed;
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"]=="EMPTY") {
$title = (!empty($prefs['feed_articles_title'])) ? $prefs['feed_articles_title'] : tra("Tiki RSS feed for shoutbox messages");
$desc = (!empty($prefs['feed_articles_desc'])) ? $prefs['feed_articles_desc'] : tra("Last shoutbox messages.");
$title = $prefs['feed_shoutbox_title'];
$desc = $prefs['feed_shoutbox_desc'];
$id = "msgId";
$titleId = "msgId";
......@@ -40,11 +40,6 @@ if ($output["data"]=="EMPTY") {
$authorId = "user";
$readrepl = "tiki-shoutbox.php?get=%s";
$tmp = $prefs['feed_'.$feed.'_title'];
if ($tmp<>'') $title = $tmp;
$tmp = $prefs['feed_'.$feed.'_desc'];
if ($desc<>'') $desc = $tmp;
$changes = $shoutboxlib -> list_shoutbox(0, $prefs['feed_articles_max'], $id.'_desc');
$tmp = null;
$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, '', $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
......
......@@ -39,8 +39,8 @@ if (isset($_REQUEST['sort_mode'])) {
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"] == "EMPTY") {
$tmp = $tikilib->get_tracker($_REQUEST["$id"]);
$title = tra("Tiki RSS feed for individual trackers: ") . $tmp["name"];
$desc = $tmp["description"];
$title = $prefs['feed_tracker_title'] . $tmp["name"];
$desc = $prefs['feed_tracker_desc'] . $tmp["description"];
$tmp = null;
$tmp = $prefs['feed_' . $feed . '_title'];
if ($tmp <> '') $title = $tmp;
......
......@@ -33,8 +33,8 @@ $uniqueid = $feed;
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"]=="EMPTY") {
$title = (!empty($prefs['feed_wiki_title'])) ? $prefs['feed_wiki_title'] : tra("Tiki RSS feed for the wiki pages");
$desc = (!empty($prefs['feed_wiki_desc'])) ? $prefs['feed_wiki_desc'] : tra("Last modifications to the Wiki.");
$title = $prefs['feed_wiki_title'];
$desc = $prefs['feed_wiki_desc'];
$id = "pageName";
$titleId = "pageName";
$descId = "data";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment