summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rwxr-xr-xclasses/article.php8
-rw-r--r--classes/dlg.php22
-rwxr-xr-xclasses/feeds.php89
-rw-r--r--classes/opml.php7
-rwxr-xr-xclasses/pref/feeds.php105
-rwxr-xr-xclasses/pref/filters.php18
-rw-r--r--classes/pref/labels.php10
-rw-r--r--classes/pref/prefs.php57
-rw-r--r--classes/pref/system.php6
-rw-r--r--classes/pref/users.php61
10 files changed, 189 insertions, 194 deletions
diff --git a/classes/article.php b/classes/article.php
index 50a61a019..248dcdb9e 100755
--- a/classes/article.php
+++ b/classes/article.php
@@ -727,7 +727,7 @@ class Article extends Handler_Protected {
if (!$zoom_mode) {
$rv['content'] .= "<span id=\"ATSTR-$id\">$tags_str</span>
<a title=\"".__('Edit tags for this article')."\"
- href=\"#\" onclick=\"editArticleTags($id, $feed_id)\">(+)</a>";
+ href=\"#\" onclick=\"Article.editTags($id)\">(+)</a>";
$rv['content'] .= "<div dojoType=\"dijit.Tooltip\"
id=\"ATSTRTIP-$id\" connectId=\"ATSTR-$id\"
@@ -877,7 +877,7 @@ class Article extends Handler_Protected {
$tags_str = "";
for ($i = 0; $i < $maxtags; $i++) {
- $tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"viewfeed({feed:'".$tags[$i]."'})\">" . $tags[$i] . "</a>, ";
+ $tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"Feeds.open({feed:'".$tags[$i]."'})\">" . $tags[$i] . "</a>, ";
}
$tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2);
@@ -907,8 +907,8 @@ class Article extends Handler_Protected {
static function format_article_note($id, $note, $allow_edit = true) {
- $str = "<div class='articleNote' onclick=\"editArticleNote($id)\">
- <div class='noteEdit' onclick=\"editArticleNote($id)\">".
+ $str = "<div class='articleNote' onclick=\"Plugins.Note.edit($id)\">
+ <div class='noteEdit' onclick=\"Plugins.Note.edit($id)\">".
($allow_edit ? __('(edit note)') : "")."</div>$note</div>";
return $str;
diff --git a/classes/dlg.php b/classes/dlg.php
index 9ac5cd12f..7ac18bb90 100644
--- a/classes/dlg.php
+++ b/classes/dlg.php
@@ -49,10 +49,10 @@ class Dlg extends Handler_Protected {
print "<div align='center'>";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return opmlRegenKey()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return Helpers.OPML.changeKey()\">".
__('Generate new URL')."</button> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return CommonDialogs.closeInfoBox()\">".
__('Close this window')."</button>";
print "</div>";
@@ -85,7 +85,7 @@ class Dlg extends Handler_Protected {
print "<div align='center'>";
- print "<button onclick=\"return closeInfoBox()\">".
+ print "<button onclick=\"return CommonDialogs.closeInfoBox()\">".
__('Close this window')."</button>";
print "</div>";
@@ -139,7 +139,7 @@ class Dlg extends Handler_Protected {
$key_escaped = str_replace("'", "\\'", $key);
- echo "<a href=\"javascript:viewfeed({feed:'$key_escaped'}) \" style=\"font-size: " .
+ echo "<a href=\"#\" onclick=\"Feeds.open({feed:'$key_escaped'}) \" style=\"font-size: " .
$size . "px\" title=\"$value articles tagged with " .
$key . '">' . $key . '</a> ';
}
@@ -150,7 +150,7 @@ class Dlg extends Handler_Protected {
print "<div align='center'>";
print "<button dojoType=\"dijit.form.Button\"
- onclick=\"return closeInfoBox()\">".
+ onclick=\"return CommonDialogs.closeInfoBox()\">".
__('Close this window')."</button>";
print "</div>";
@@ -166,7 +166,9 @@ class Dlg extends Handler_Protected {
$url_path = htmlspecialchars($this->params[2]) . "&key=" . $key;
- print "<h2>".__("You can view this feed as RSS using the following URL:")."</h2>";
+ $feed_title = Feeds::getFeedTitle($feed_id, $is_cat);
+
+ print "<div>".T_sprintf("%s can be accessed via the following secret URL:", $feed_title)."</div>";
print "<div class=\"tagCloudContainer\">";
print "<a id='gen_feed_url' href='$url_path' target='_blank'>$url_path</a>";
@@ -174,10 +176,10 @@ class Dlg extends Handler_Protected {
print "<div align='center'>";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return CommonDialogs.genUrlChangeKey('$feed_id', '$is_cat')\">".
__('Generate new URL')."</button> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return CommonDialogs.closeInfoBox()\">".
__('Close this window')."</button>";
print "</div>";
@@ -190,10 +192,10 @@ class Dlg extends Handler_Protected {
print_warning(__("You are using default tt-rss password. Please change it in the Preferences (Personal data / Authentication)."));
print "<div align='center'>";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"gotoPreferences()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"document.location.href = 'prefs.php'\">".
__('Open Preferences')."</button> ";
print "<button dojoType=\"dijit.form.Button\"
- onclick=\"return closeInfoBox()\">".
+ onclick=\"return CommonDialogs.closeInfoBox()\">".
__('Close this window')."</button>";
print "</div>";
}
diff --git a/classes/feeds.php b/classes/feeds.php
index b548205ed..9fe528723 100755
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -15,21 +15,21 @@ class Feeds extends Handler_Protected {
$feed_id, $is_cat, $search,
$error, $feed_last_updated) {
- $catchup_sel_link = "catchupSelection()";
+ $catchup_sel_link = "Headlines.catchupSelection()";
- $archive_sel_link = "archiveSelection()";
- $delete_sel_link = "deleteSelection()";
+ $archive_sel_link = "Headlines.archiveSelection()";
+ $delete_sel_link = "Headlines.deleteSelection()";
- $sel_all_link = "selectArticles('all')";
- $sel_unread_link = "selectArticles('unread')";
- $sel_none_link = "selectArticles('none')";
- $sel_inv_link = "selectArticles('invert')";
+ $sel_all_link = "Headlines.select('all')";
+ $sel_unread_link = "Headlines.select('unread')";
+ $sel_none_link = "Headlines.select('none')";
+ $sel_inv_link = "Headlines.select('invert')";
- $tog_unread_link = "selectionToggleUnread()";
- $tog_marked_link = "selectionToggleMarked()";
- $tog_published_link = "selectionTogglePublished()";
+ $tog_unread_link = "Headlines.selectionToggleUnread()";
+ $tog_marked_link = "Headlines.selectionToggleMarked()";
+ $tog_published_link = "Headlines.selectionTogglePublished()";
- $set_score_link = "setSelectionScore()";
+ $set_score_link = "Article.selectionSetScore()";
if ($is_cat) $cat_q = "&is_cat=$is_cat";
@@ -50,8 +50,8 @@ class Feeds extends Handler_Protected {
$reply .= "<span class='r'>
<a href=\"#\"
- title=\"".__("View as RSS feed")."\"
- onclick=\"displayDlg('".__("View as RSS")."','generatedFeed', '$feed_id:$is_cat:$rss_link')\">
+ title=\"".__("Show as feed")."\"
+ onclick=\"App.displayDlg('".__("Show as feed")."','generatedFeed', '$feed_id:$is_cat:$rss_link')\">
<img class=\"noborder\" src=\"images/pub_set.png\"></a>";
@@ -95,7 +95,7 @@ class Feeds extends Handler_Protected {
$reply .= "</span> "; */
$reply .= "<select dojoType=\"dijit.form.Select\"
- onchange=\"headlineActionsChange(this)\">";
+ onchange=\"Headlines.onActionChanged(this)\">";
$reply .= "<option value=\"0\" disabled='1'>".__('Select...')."</option>";
@@ -124,12 +124,12 @@ class Feeds extends Handler_Protected {
}
if (PluginHost::getInstance()->get_plugin("mail")) {
- $reply .= "<option value=\"emailArticle(false)\">".__('Forward by email').
+ $reply .= "<option value=\"Plugins.Mail.send()\">".__('Forward by email').
"</option>";
}
if (PluginHost::getInstance()->get_plugin("mailto")) {
- $reply .= "<option value=\"mailtoArticle(false)\">".__('Forward by email').
+ $reply .= "<option value=\"Plugins.Mailto.send()\">".__('Forward by email').
"</option>";
}
@@ -137,7 +137,8 @@ class Feeds extends Handler_Protected {
//$reply .= "<option value=\"catchupPage()\">".__('Mark as read')."</option>";
- $reply .= "<option value=\"displayDlg('".__("View as RSS")."','generatedFeed', '$feed_id:$is_cat:$rss_link')\">".__('View as RSS')."</option>";
+ $reply .= "<option value=\"App.displayDlg('".__("Show as feed")."','generatedFeed', '$feed_id:$is_cat:$rss_link')\">".
+ __('Show as feed')."</option>";
$reply .= "</select>";
@@ -299,7 +300,7 @@ class Feeds extends Handler_Protected {
$label_cache = $line["label_cache"];
$labels = false;
- $mouseover_attrs = "onmouseover='postMouseIn(event, $id)' onmouseout='postMouseOut($id)'";
+ $mouseover_attrs = "onmouseover='Article.mouseIn($id)' onmouseout='Article.mouseOut($id)'";
if ($label_cache) {
$label_cache = json_decode($label_cache, true);
@@ -331,11 +332,11 @@ class Feeds extends Handler_Protected {
$marked_pic_src = $line["marked"] ? "mark_set.png" : "mark_unset.png";
$class .= $line["marked"] ? " marked" : "";
- $marked_pic = "<img src=\"images/$marked_pic_src\" class=\"marked-pic marked-$id\" onclick='toggleMark($id)'>";
+ $marked_pic = "<img src=\"images/$marked_pic_src\" class=\"marked-pic marked-$id\" onclick='Headlines.toggleMark($id)'>";
$published_pic_src = $line["published"] ? "pub_set.png" : "pub_unset.png";
$class .= $line["published"] ? " published" : "";
- $published_pic = "<img src=\"images/$published_pic_src\" class=\"pub-pic pub-$id\" onclick='togglePub($id)'>";
+ $published_pic = "<img src=\"images/$published_pic_src\" class=\"pub-pic pub-$id\" onclick='Headlines.togglePub($id)'>";
$updated_fmt = make_local_datetime($line["updated"], false, false, false, true);
$date_entered_fmt = T_sprintf("Imported at %s",
@@ -345,7 +346,7 @@ class Feeds extends Handler_Protected {
$score_pic = "images/" . get_score_pic($score);
- $score_pic = "<img class='score-pic' score='$score' onclick='changeScore($id, this)' src=\"$score_pic\"
+ $score_pic = "<img class='score-pic' score='$score' onclick='Article.setScore($id, this)' src=\"$score_pic\"
title=\"$score\">";
if ($score > 500) {
@@ -388,11 +389,11 @@ class Feeds extends Handler_Protected {
$vgroup_last_feed = $feed_id;
- $vf_catchup_link = "<a class='catchup' onclick='catchupFeedInGroup($feed_id);' href='#'>".__('mark feed as read')."</a>";
+ $vf_catchup_link = "<a class='catchup' onclick='Feeds.catchupFeedInGroup($feed_id);' href='#'>".__('mark feed as read')."</a>";
- $reply['content'] .= "<div data-feed-id='$feed_id' class='feed-titl'>".
+ $reply['content'] .= "<div data-feed-id='$feed_id' class='feed-title'>".
"<div style='float : right'>$feed_icon_img</div>".
- "<a class='title' href=\"#\" onclick=\"viewfeed({feed:$feed_id})\">".
+ "<a class='title' href=\"#\" onclick=\"Feeds.open({feed:$feed_id})\">".
$line["feed_title"]."</a>
$vf_catchup_link</div>";
@@ -405,7 +406,7 @@ class Feeds extends Handler_Protected {
$reply['content'] .= "<div class='left'>";
$reply['content'] .= "<input dojoType=\"dijit.form.CheckBox\"
- type=\"checkbox\" onclick=\"toggleSelectRow2(this)\"
+ type=\"checkbox\" onclick=\"Headlines.onRowChecked(this)\"
class='rchk'>";
$reply['content'] .= "$marked_pic";
@@ -413,7 +414,7 @@ class Feeds extends Handler_Protected {
$reply['content'] .= "</div>";
- $reply['content'] .= "<div onclick='return hlClicked(event, $id)'
+ $reply['content'] .= "<div onclick='return Headlines.click(event, $id)'
class=\"title\"><span class='hl-content $hlc_suffix'>";
$reply['content'] .= "<a class=\"title $hlc_suffix\"
href=\"" . htmlspecialchars($line["link"]) . "\"
@@ -434,7 +435,7 @@ class Feeds extends Handler_Protected {
if (@$line["feed_title"]) {
$rgba = @$rgba_cache[$feed_id];
- $reply['content'] .= "<span class=\"feed\"><a style=\"background : rgba($rgba, 0.3)\" href=\"#\" onclick=\"viewfeed({feed:$feed_id})\">".
+ $reply['content'] .= "<span class=\"feed\"><a style=\"background : rgba($rgba, 0.3)\" href=\"#\" onclick=\"Feeds.open({feed:$feed_id})\">".
truncate_string($line["feed_title"],30)."</a></span>";
}
}
@@ -451,7 +452,7 @@ class Feeds extends Handler_Protected {
if ($line["feed_title"] && !$vfeed_group_enabled) {
- $reply['content'] .= "<span onclick=\"viewfeed({feed:$feed_id})\"
+ $reply['content'] .= "<span onclick=\"Feeds.open({feed:$feed_id})\"
style=\"cursor : pointer\"
title=\"".htmlspecialchars($line['feed_title'])."\">
$feed_icon_img</span>";
@@ -481,14 +482,14 @@ class Feeds extends Handler_Protected {
$vgroup_last_feed = $feed_id;
- $vf_catchup_link = "<a class='catchup' onclick='catchupFeedInGroup($feed_id);' href='#'>".__('mark feed as read')."</a>";
+ $vf_catchup_link = "<a class='catchup' onclick='Feeds.catchupFeedInGroup($feed_id);' href='#'>".__('mark feed as read')."</a>";
$feed_icon_src = Feeds::getFeedIcon($feed_id);
$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"$feed_icon_src\">";
$reply['content'] .= "<div data-feed-id='$feed_id' class='feed-title'>".
"<div style=\"float : right\">$feed_icon_img</div>".
- "<a href=\"#\" class='title' onclick=\"viewfeed({feed:$feed_id})\">".
+ "<a href=\"#\" class='title' onclick=\"Feeds.open({feed:$feed_id})\">".
$line["feed_title"]."</a> $vf_catchup_link</div>";
}
@@ -504,7 +505,7 @@ class Feeds extends Handler_Protected {
$tmp_content .= "<div style=\"vertical-align : middle\">";
$tmp_content .= "<input dojoType=\"dijit.form.CheckBox\"
- type=\"checkbox\" onclick=\"toggleSelectRow2(this, false, true)\"
+ type=\"checkbox\" onclick=\"Headlines.onRowChecked(this)\"
class='rchk'>";
$tmp_content .= "$marked_pic";
@@ -523,7 +524,7 @@ class Feeds extends Handler_Protected {
// data-article-id included for context menu
$tmp_content .= "<span
- onclick=\"return cdmClicked(event, $id);\"
+ onclick=\"return Headlines.click(event, $id);\"
data-article-id=\"$id\"
class=\"titleWrap hlMenuAttach $hlc_suffix\">
<a class=\"title $hlc_suffix\"
@@ -535,9 +536,13 @@ class Feeds extends Handler_Protected {
$tmp_content .= $labels_str;
- $tmp_content .= "<span class='collapse'>
- <img src=\"images/collapse.png\" onclick=\"return cdmCollapseActive(event)\"
- title=\"".__("Collapse article")."\"/></span>";
+ if (!get_pref("CDM_EXPANDED")) {
+ $tmp_content .= "<span class='collapse'>
+ <img src=\"images/collapse.png\" onclick=\"return Article.cdmUnsetActive(event)\"
+ title=\"" . __("Collapse article") . "\"/></span>";
+
+ $tmp_content .= "<span class='excerpt'>" . $line["content_preview"] . "</span>";
+ }
$tmp_content .= "</span>";
@@ -547,7 +552,7 @@ class Feeds extends Handler_Protected {
$tmp_content .= "<div class=\"feed\">
<a href=\"#\" style=\"background-color: rgba($rgba,0.3)\"
- onclick=\"viewfeed({feed:$feed_id})\">".
+ onclick=\"Feeds.open({feed:$feed_id})\">".
truncate_string($line["feed_title"],30)."</a>
</div>";
}
@@ -561,13 +566,13 @@ class Feeds extends Handler_Protected {
if (!get_pref("VFEED_GROUP_BY_FEED") && $line["feed_title"]) {
$tmp_content .= "<span style=\"cursor : pointer\"
title=\"".htmlspecialchars($line["feed_title"])."\"
- onclick=\"viewfeed({feed:$feed_id})\">$feed_icon_img</span>";
+ onclick=\"Feeds.open({feed:$feed_id})\">$feed_icon_img</span>";
}
$tmp_content .= "</div>"; //score wrapper2
$tmp_content .= "</div>"; //header
- $tmp_content .= "<div class=\"content\" onclick=\"return cdmClicked(event, $id, true);\">";
+ $tmp_content .= "<div class=\"content\" onclick=\"return Headlines.click(event, $id, true);\">";
$tmp_content .= "<div id=\"POSTNOTE-$id\">";
if ($line['note']) {
@@ -628,7 +633,7 @@ class Feeds extends Handler_Protected {
$tmp_content .= "<img src='images/tag.png' alt='Tags' title='Tags'>
<span id=\"ATSTR-$id\">$tags_str</span>
<a title=\"".__('Edit tags for this article')."\"
- href=\"#\" onclick=\"editArticleTags($id)\">(+)</a>";
+ href=\"#\" onclick=\"Article.editTags($id)\">(+)</a>";
$num_comments = (int) $line["num_comments"];
$entry_comments = "";
@@ -722,7 +727,7 @@ class Feeds extends Handler_Protected {
if ($num_errors > 0) {
$reply['content'] .= "<br/>";
- $reply['content'] .= "<a class=\"insensitive\" href=\"#\" onclick=\"showFeedsWithErrors()\">" .
+ $reply['content'] .= "<a class=\"insensitive\" href=\"#\" onclick=\"CommonDialogs.showFeedsWithErrors()\">" .
__('Some feeds have update errors (click for details)') . "</a>";
}
$reply['content'] .= "</span></p></div>";
@@ -913,7 +918,7 @@ class Feeds extends Handler_Protected {
if ($num_errors > 0) {
$reply['headlines']['content'] .= "<br/>";
- $reply['headlines']['content'] .= "<a class=\"insensitive\" href=\"#\" onclick=\"showFeedsWithErrors()\">".
+ $reply['headlines']['content'] .= "<a class=\"insensitive\" href=\"#\" onclick=\"CommonDialogs.showFeedsWithErrors()\">".
__('Some feeds have update errors (click for details)')."</a>";
}
$reply['headlines']['content'] .= "</span></p>";
@@ -1014,7 +1019,7 @@ class Feeds extends Handler_Protected {
<button dojoType=\"dijit.form.Button\" class=\"btn-primary\" type=\"submit\" onclick=\"return dijit.byId('feedAddDlg').execute()\">".__('Subscribe')."</button>";
if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) {
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return feedBrowser()\">".__('More feeds')."</button>";
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return CommonDialogs.feedBrowser()\">".__('More feeds')."</button>";
}
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').hide()\">".__('Cancel')."</button>
diff --git a/classes/opml.php b/classes/opml.php
index 5b7690375..1b1897e7d 100644
--- a/classes/opml.php
+++ b/classes/opml.php
@@ -8,11 +8,8 @@ class Opml extends Handler_Protected {
}
function export() {
- $output_name = $_REQUEST["filename"];
- if (!$output_name) $output_name = "TinyTinyRSS.opml";
-
- $show_settings = $_REQUEST["settings"];
-
+ $output_name = "tt-rss_".date("Y-m-d").".opml";
+ $show_settings = $_REQUEST["include_settings"];
$owner_uid = $_SESSION["uid"];
$rc = $this->opml_export($output_name, $owner_uid, false, ($show_settings == 1));
diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php
index 43570c740..e0ee82fad 100755
--- a/classes/pref/feeds.php
+++ b/classes/pref/feeds.php
@@ -492,7 +492,7 @@ class Pref_Feeds extends Handler_Protected {
@unlink($icon_file);
print "<script type=\"text/javascript\">";
- print "parent.uploadIconHandler($rc);";
+ print "parent.CommonDialogs.uploadIconHandler($rc);";
print "</script>";
return;
}
@@ -745,9 +745,9 @@ class Pref_Feeds extends Handler_Protected {
<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">
<input type=\"hidden\" name=\"feed_id\" value=\"$feed_id\">
<input type=\"hidden\" name=\"method\" value=\"uploadicon\">
- <button class=\"\" dojoType=\"dijit.form.Button\" onclick=\"return uploadFeedIcon();\"
+ <button class=\"\" dojoType=\"dijit.form.Button\" onclick=\"return CommonDialogs.uploadFeedIcon();\"
type=\"submit\">".__('Replace')."</button>
- <button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick=\"return removeFeedIcon($feed_id);\"
+ <button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick=\"return CommonDialogs.removeFeedIcon($feed_id);\"
type=\"submit\">".__('Remove')."</button>
</form>";
@@ -765,7 +765,7 @@ class Pref_Feeds extends Handler_Protected {
print "<div class='dlgButtons'>
<div style=\"float : left\">
- <button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick='return unsubscribeFeed($feed_id, \"$title\")'>".
+ <button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick='return CommonDialogs.unsubscribeFeed($feed_id, \"$title\")'>".
__('Unsubscribe')."</button>";
print "</div>";
@@ -1149,14 +1149,14 @@ class Pref_Feeds extends Handler_Protected {
if ($num_errors > 0) {
$error_button = "<button dojoType=\"dijit.form.Button\"
- onclick=\"showFeedsWithErrors()\" id=\"errorButton\">" .
+ onclick=\"CommonDialogs.showFeedsWithErrors()\" id=\"errorButton\">" .
__("Feeds with errors") . "</button>";
}
$inactive_button = "<button dojoType=\"dijit.form.Button\"
id=\"pref_feeds_inactive_btn\"
style=\"display : none\"
- onclick=\"showInactiveFeeds()\">" .
+ onclick=\"dijit.byId('feedTree').showInactiveFeeds()\">" .
__("Inactive feeds") . "</button>";
$feed_search = clean($_REQUEST["search"]);
@@ -1174,7 +1174,7 @@ class Pref_Feeds extends Handler_Protected {
print "<div style='float : right; padding-right : 4px;'>
<input dojoType=\"dijit.form.TextBox\" id=\"feed_search\" size=\"20\" type=\"search\"
value=\"$feed_search\">
- <button dojoType=\"dijit.form.Button\" onclick=\"updateFeedList()\">".
+ <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedTree').reload()\">".
__('Search')."</button>
</div>";
@@ -1190,15 +1190,15 @@ class Pref_Feeds extends Handler_Protected {
print "<div dojoType=\"dijit.form.DropDownButton\">".
"<span>" . __('Feeds')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
- print "<div onclick=\"quickAddFeed()\"
+ print "<div onclick=\"CommonDialogs.quickAddFeed()\"
dojoType=\"dijit.MenuItem\">".__('Subscribe to feed')."</div>";
- print "<div onclick=\"editSelectedFeed()\"
+ print "<div onclick=\"dijit.byId('feedTree').editSelectedFeed()\"
dojoType=\"dijit.MenuItem\">".__('Edit selected feeds')."</div>";
- print "<div onclick=\"resetFeedOrder()\"
+ print "<div onclick=\"dijit.byId('feedTree').resetFeedOrder()\"
dojoType=\"dijit.MenuItem\">".__('Reset sort order')."</div>";
- print "<div onclick=\"batchSubscribe()\"
+ print "<div onclick=\"dijit.byId('feedTree').batchSubscribe()\"
dojoType=\"dijit.MenuItem\">".__('Batch subscribe')."</div>";
- print "<div dojoType=\"dijit.MenuItem\" onclick=\"removeSelectedFeeds()\">"
+ print "<div dojoType=\"dijit.MenuItem\" onclick=\"dijit.byId('feedTree').removeSelectedFeeds()\">"
.__('Unsubscribe')."</div> ";
print "</div></div>";
@@ -1206,11 +1206,11 @@ class Pref_Feeds extends Handler_Protected {
print "<div dojoType=\"dijit.form.DropDownButton\">".
"<span>" . __('Categories')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
- print "<div onclick=\"createCategory()\"
+ print "<div onclick=\"dijit.byId('feedTree').createCategory()\"
dojoType=\"dijit.MenuItem\">".__('Add category')."</div>";
- print "<div onclick=\"resetCatOrder()\"
+ print "<div onclick=\"dijit.byId('feedTree').resetCatOrder()\"
dojoType=\"dijit.MenuItem\">".__('Reset sort order')."</div>";
- print "<div onclick=\"removeSelectedCategories()\"
+ print "<div onclick=\"dijit.byId('feedTree').removeSelectedCategories()\"
dojoType=\"dijit.MenuItem\">".__('Remove selected')."</div>";
print "</div></div>";
@@ -1247,15 +1247,15 @@ class Pref_Feeds extends Handler_Protected {
var bare_id = id.substr(id.indexOf(':')+1);
if (id.match('FEED:')) {
- editFeed(bare_id);
+ CommonDialogs.editFeed(bare_id);
} else if (id.match('CAT:')) {
- editCat(bare_id, item);
+ dijit.byId('feedTree').editCategory(bare_id, item);
}
</script>
<script type=\"dojo/method\" event=\"onLoad\" args=\"item\">
Element.hide(\"feedlistLoading\");
- checkInactiveFeeds();
+ dijit.byId('feedTree').checkInactiveFeeds();
</script>
</div>";
@@ -1270,11 +1270,11 @@ class Pref_Feeds extends Handler_Protected {
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('OPML')."\">";
- print "<p>" . __("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.") .
- __("Only main settings profile can be migrated using OPML.") . "</p>";
+ print_notice(__("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.") .
+ __("Only main settings profile can be migrated using OPML."));
print "<iframe id=\"upload_iframe\"
- name=\"upload_iframe\" onload=\"opmlImportComplete(this)\"
+ name=\"upload_iframe\" onload=\"Helpers.OPML.onImportComplete(this)\"
style=\"width: 400px; height: 100px; display: none;\"></iframe>";
print "<form name=\"opml_form\" style='display : block' target=\"upload_iframe\"
@@ -1285,28 +1285,33 @@ class Pref_Feeds extends Handler_Protected {
</label>
<input type=\"hidden\" name=\"op\" value=\"dlg\">
<input type=\"hidden\" name=\"method\" value=\"importOpml\">
- <button dojoType=\"dijit.form.Button\" onclick=\"return opmlImport();\" type=\"submit\">" .
- __('Import my OPML') . "</button>";
+ <button dojoType=\"dijit.form.Button\" onclick=\"return Helpers.OPML.import();\" type=\"submit\">" .
+ __('Import OPML') . "</button>";
- print "<hr>";
+ print "</form>";
+
+ print "<p/>";
- $opml_export_filename = "TinyTinyRSS_".date("Y-m-d").".opml";
+ print "<form dojoType=\"dijit.form.Form\" id=\"opmlExportForm\">";
- print "<p>" . __('Filename:') .
- " <input class=\"input input-text\" type=\"text\" id=\"filename\" value=\"$opml_export_filename\" />&nbsp;" .
- __('Include settings') . "<input type=\"checkbox\" id=\"settings\" checked=\"1\"/>";
+ print "<button dojoType=\"dijit.form.Button\"
+ onclick=\"Helpers.OPML.export()\" >" .
+ __('Export OPML') . "</button>";
- print "</p><button dojoType=\"dijit.form.Button\"
- onclick=\"gotoExportOpml(document.opml_form.filename.value, document.opml_form.settings.checked)\" >" .
- __('Export OPML') . "</button></p></form>";
+ print "<label>";
+ print_checkbox("include_settings", true, "1", "");
+ print "&nbsp;" . __("Include settings");
+ print "</label>";
+
+ print "</form>";
print "<hr>";
- print "<p>" . __('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.') . "</p>";
+ print_notice(__('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.'));
print_warning("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.");
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return displayDlg('".__("Public OPML URL")."','pubOPMLUrl')\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return App.displayDlg('".__("Public OPML URL")."','pubOPMLUrl')\">".
__('Display published OPML URL')."</button> ";
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
@@ -1323,10 +1328,10 @@ class Pref_Feeds extends Handler_Protected {
print "<p>";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return displayDlg('".__("View as RSS")."','generatedFeed', '$rss_url')\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return App.displayDlg('".__("Show as feed")."','generatedFeed', '$rss_url')\">".
__('Display URL')."</button> ";
- print "<button class=\"warning\" dojoType=\"dijit.form.Button\" onclick=\"return clearFeedAccessKeys()\">".
+ print "<button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick=\"return Helpers.clearFeedAccessKeys()\">".
__('Clear all generated URLs')."</button> ";
print "</p>";
@@ -1412,9 +1417,9 @@ class Pref_Feeds extends Handler_Protected {
print "<div dojoType=\"dijit.form.DropDownButton\">".
"<span>" . __('Select')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
- print "<div onclick=\"selectTableRows('prefInactiveFeedList', 'all')\"
+ print "<div onclick=\"Tables.select('prefInactiveFeedList', true)\"
dojoType=\"dijit.MenuItem\">".__('All')."</div>";
- print "<div onclick=\"selectTableRows('prefInactiveFeedList', 'none')\"
+ print "<div onclick=\"Tables.select('prefInactiveFeedList', false)\"
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
print "</div></div>";
print "</div>"; #toolbar
@@ -1428,20 +1433,17 @@ class Pref_Feeds extends Handler_Protected {
while ($line = $sth->fetch()) {
$feed_id = $line["id"];
- $this_row_id = "id=\"FUPDD-$feed_id\"";
- # class needed for selectTableRows()
- print "<tr class=\"placeholder\" $this_row_id>";
+ print "<tr class=\"placeholder\" data-row-id='$feed_id'>";
- # id needed for selectTableRows()
print "<td width='5%' align='center'><input
- onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
- type=\"checkbox\" id=\"FUPDC-$feed_id\"></td>";
+ onclick='Tables.onRowChecked(this);' dojoType=\"dijit.form.CheckBox\"
+ type=\"checkbox\"></td>";
print "<td>";
print "<a class=\"visibleLink\" href=\"#\" ".
"title=\"".__("Click to edit feed")."\" ".
- "onclick=\"editFeed(".$line["id"].")\">".
+ "onclick=\"CommonDialogs.editFeed(".$line["id"].")\">".
htmlspecialchars($line["title"])."</a>";
print "</td><td class=\"insensitive\" align='right'>";
@@ -1477,9 +1479,9 @@ class Pref_Feeds extends Handler_Protected {
print "<div dojoType=\"dijit.form.DropDownButton\">".
"<span>" . __('Select')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
- print "<div onclick=\"selectTableRows('prefErrorFeedList', 'all')\"
+ print "<div onclick=\"Tables.select('prefErrorFeedList', true)\"
dojoType=\"dijit.MenuItem\">".__('All')."</div>";
- print "<div onclick=\"selectTableRows('prefErrorFeedList', 'none')\"
+ print "<div onclick=\"Tables.select('prefErrorFeedList', false)\"
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
print "</div></div>";
print "</div>"; #toolbar
@@ -1493,20 +1495,17 @@ class Pref_Feeds extends Handler_Protected {
while ($line = $sth->fetch()) {
$feed_id = $line["id"];
- $this_row_id = "id=\"FERDD-$feed_id\"";
- # class needed for selectTableRows()
- print "<tr class=\"placeholder\" $this_row_id>";
+ print "<tr class=\"placeholder\" data-row-id='$feed_id'>";
- # id needed for selectTableRows()
print "<td width='5%' align='center'><input
- onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
- type=\"checkbox\" id=\"FERDC-$feed_id\"></td>";
+ onclick='Tables.onRowChecked(this);' dojoType=\"dijit.form.CheckBox\"
+ type=\"checkbox\"></td>";
print "<td>";
print "<a class=\"visibleLink\" href=\"#\" ".
"title=\"".__("Click to edit feed")."\" ".
- "onclick=\"editFeed(".$line["id"].")\">".
+ "onclick=\"CommonDialogs.editFeed(".$line["id"].")\">".
htmlspecialchars($line["title"])."</a>: ";
print "<span class=\"insensitive\">";
diff --git a/classes/pref/filters.php b/classes/pref/filters.php
index e3503d545..8fe3bbda6 100755
--- a/classes/pref/filters.php
+++ b/classes/pref/filters.php
@@ -429,7 +429,7 @@ class Pref_Filters extends Handler_Protected {
$data = htmlspecialchars(json_encode($line));
- print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='toggleSelectListRow2(this)'>".
+ print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='Lists.onRowChecked(this)'>".
"<span onclick=\"dijit.byId('filterEditDlg').editRule(this)\">".$this->getRuleName($line)."</span>".
"<input type='hidden' name='rule[]' value=\"$data\"/></li>";
}
@@ -473,7 +473,7 @@ class Pref_Filters extends Handler_Protected {
$data = htmlspecialchars(json_encode($line));
- print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='toggleSelectListRow2(this)'>".
+ print "<li><input dojoType='dijit.form.CheckBox' type='checkbox' onclick='Lists.onRowChecked(this)'>".
"<span onclick=\"dijit.byId('filterEditDlg').editAction(this)\">".$this->getActionName($line)."</span>".
"<input type='hidden' name='action[]' value=\"$data\"/></li>";
}
@@ -797,20 +797,20 @@ class Pref_Filters extends Handler_Protected {
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
print "</div></div>";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return quickAddFilter()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return Filters.quickAddFilter()\">".
__('Create filter')."</button> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return joinSelectedFilters()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterTree').joinSelectedFilters()\">".
__('Combine')."</button> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return editSelectedFilter()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterTree').editSelectedFilter()\">".
__('Edit')."</button> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return resetFilterOrder()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterTree').resetFilterOrder()\">".
__('Reset sort order')."</button> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return removeSelectedFilters()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterTree').removeSelectedFilters()\">".
__('Remove')."</button> ";
print "</div>"; # toolbar
@@ -840,7 +840,7 @@ class Pref_Filters extends Handler_Protected {
var bare_id = id.substr(id.indexOf(':')+1);
if (id.match('FILTER:')) {
- editFilter(bare_id);
+ dijit.byId('filterTree').editFilter(bare_id);
}
</script>
@@ -1044,7 +1044,7 @@ class Pref_Filters extends Handler_Protected {
print "<div class=\"dlgSecCont\">";
print "<select name=\"action_id\" dojoType=\"dijit.form.Select\"
- onchange=\"filterDlgCheckAction(this)\">";
+ onchange=\"Filters.filterDlgCheckAction(this)\">";
$res = $this->pdo->query("SELECT id,description FROM ttrss_filter_actions
ORDER BY name");
diff --git a/classes/pref/labels.php b/classes/pref/labels.php
index 1dbe3e18c..49118ab4a 100644
--- a/classes/pref/labels.php
+++ b/classes/pref/labels.php
@@ -275,13 +275,13 @@ class Pref_Labels extends Handler_Protected {
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
print "</div></div>";
- print"<button dojoType=\"dijit.form.Button\" onclick=\"return addLabel()\">".
+ print"<button dojoType=\"dijit.form.Button\" onclick=\"CommonDialogs.addLabel()\">".
__('Create label')."</button dojoType=\"dijit.form.Button\"> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedLabels()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('labelTree').removeSelected()\">".
__('Remove')."</button dojoType=\"dijit.form.Button\"> ";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"labelColorReset()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('labelTree').resetColors()\">".
__('Clear colors')."</button dojoType=\"dijit.form.Button\">";
@@ -310,7 +310,7 @@ class Pref_Labels extends Handler_Protected {
var bare_id = id.substr(id.indexOf(':')+1);
if (id.match('LABEL:')) {
- editLabel(bare_id);
+ dijit.byId('labelTree').editLabel(bare_id);
}
</script>
</div>";
@@ -323,4 +323,4 @@ class Pref_Labels extends Handler_Protected {
print "</div>"; #container
}
-} \ No newline at end of file
+}
diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php
index 82456f342..41beabb9e 100644
--- a/classes/pref/prefs.php
+++ b/classes/pref/prefs.php
@@ -183,7 +183,7 @@ class Pref_Prefs extends Handler_Protected {
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
evt.preventDefault();
if (this.validate()) {
- notify_progress('Saving data...', true);
+ Notify.progress('Saving data...', true);
new Ajax.Request('backend.php', {
parameters: dojo.objectToQuery(this.getValues()),
@@ -249,12 +249,12 @@ class Pref_Prefs extends Handler_Protected {
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
evt.preventDefault();
if (this.validate()) {
- notify_progress('Changing password...', true);
+ Notify.progress('Changing password...', true);
new Ajax.Request('backend.php', {
parameters: dojo.objectToQuery(this.getValues()),
onComplete: function(transport) {
- notify('');
+ Notify.close();
if (transport.responseText.indexOf('ERROR: ') == 0) {
$('pwd_change_infobox').innerHTML =
@@ -316,14 +316,14 @@ class Pref_Prefs extends Handler_Protected {
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
evt.preventDefault();
if (this.validate()) {
- notify_progress('Disabling OTP', true);
+ Notify.progress('Disabling OTP', true);
new Ajax.Request('backend.php', {
parameters: dojo.objectToQuery(this.getValues()),
onComplete: function(transport) {
- notify('');
+ Notify.close();
if (transport.responseText.indexOf('ERROR: ') == 0) {
- notify_error(transport.responseText.replace('ERROR: ', ''));
+ Notify.error(transport.responseText.replace('ERROR: ', ''));
} else {
window.location.reload();
}
@@ -367,14 +367,14 @@ class Pref_Prefs extends Handler_Protected {
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
evt.preventDefault();
if (this.validate()) {
- notify_progress('Saving data...', true);
+ Notify.progress('Saving data...', true);
new Ajax.Request('backend.php', {
parameters: dojo.objectToQuery(this.getValues()),
onComplete: function(transport) {
- notify('');
+ Notify.close();
if (transport.responseText.indexOf('ERROR:') == 0) {
- notify_error(transport.responseText.replace('ERROR:', ''));
+ Notify.error(transport.responseText.replace('ERROR:', ''));
} else {
window.location.reload();
}
@@ -436,12 +436,12 @@ class Pref_Prefs extends Handler_Protected {
onComplete: function(transport) {
var msg = transport.responseText;
if (quit) {
- gotoMain();
+ document.location.href = 'index.php';
} else {
if (msg == 'PREFS_NEED_RELOAD') {
window.location.reload();
} else {
- notify_info(msg);
+ Notify.info(msg);
}
}
} });
@@ -542,7 +542,7 @@ class Pref_Prefs extends Handler_Protected {
} else if ($pref_name == "USER_STYLESHEET") {
print "<button dojoType=\"dijit.form.Button\"
- onclick=\"customizeCSS()\">" . __('Customize') . "</button>";
+ onclick=\"Helpers.customizeCSS()\">" . __('Customize') . "</button>";
} else if ($pref_name == "USER_CSS_THEME") {
@@ -608,11 +608,11 @@ class Pref_Prefs extends Handler_Protected {
print "<br/>";
print " <button dojoType=\"dijit.form.Button\" disabled=\"$has_serial\"
- onclick=\"insertSSLserial('$cert_serial')\">" .
+ onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '$cert_serial')\">" .
__('Register') . "</button>";
print " <button dojoType=\"dijit.form.Button\"
- onclick=\"insertSSLserial('')\">" .
+ onclick=\"dijit.byId('SSL_CERT_SERIAL').attr('value', '')\">" .
__('Clear') . "</button>";
} else if ($pref_name == 'DIGEST_PREFERRED_TIME') {
@@ -659,10 +659,10 @@ class Pref_Prefs extends Handler_Protected {
</div>
</div>";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return editProfiles()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return Helpers.editProfiles()\">".
__('Manage profiles')."</button> ";
- print "<button dojoType=\"dijit.form.Button\" class=\"btn-danger\" onclick=\"return validatePrefsReset()\">".
+ print "<button dojoType=\"dijit.form.Button\" class=\"btn-danger\" onclick=\"return Helpers.confirmReset()\">".
__('Reset to defaults')."</button>";
print "&nbsp;";
@@ -689,12 +689,12 @@ class Pref_Prefs extends Handler_Protected {
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
evt.preventDefault();
if (this.validate()) {
- notify_progress('Saving data...', true);
+ Notify.progress('Saving data...', true);
new Ajax.Request('backend.php', {
parameters: dojo.objectToQuery(this.getValues()),
onComplete: function(transport) {
- notify('');
+ Notify.close();
if (confirm(__('Selected plugins have been enabled. Reload?'))) {
window.location.reload();
}
@@ -756,7 +756,7 @@ class Pref_Prefs extends Handler_Protected {
if (count($tmppluginhost->get_all($plugin)) > 0) {
if (in_array($name, $system_enabled)) {
- print "<td><a href='#' onclick=\"clearPluginData('$name')\"
+ print "<td><a href='#' onclick=\"Helpers.clearPluginData('$name')\"
class='visibleLink'>".__("Clear data")."</a></td>";
}
}
@@ -799,7 +799,7 @@ class Pref_Prefs extends Handler_Protected {
$plugin_icon = $checked ? "plugin.png" : "plugin_disabled.png";
- print "<td align='center'><input id='FPCHK-$name' name='plugins[]' value='$name' onclick='toggleSelectRow2(this);'
+ print "<td align='center'><input id='FPCHK-$name' name='plugins[]' value='$name' onclick='Tables.onRowChecked(this);'
dojoType=\"dijit.form.CheckBox\" $checked $disabled
type=\"checkbox\"></td>";
@@ -816,7 +816,7 @@ class Pref_Prefs extends Handler_Protected {
if (count($tmppluginhost->get_all($plugin)) > 0) {
if (in_array($name, $system_enabled) || in_array($name, $user_enabled)) {
- print "<td><a href='#' onclick=\"clearPluginData('$name')\" class='visibleLink'>".__("Clear data")."</a></td>";
+ print "<td><a href='#' onclick=\"Helpers.clearPluginData('$name')\" class='visibleLink'>".__("Clear data")."</a></td>";
}
}
@@ -992,9 +992,9 @@ class Pref_Prefs extends Handler_Protected {
print "<div dojoType=\"dijit.form.DropDownButton\">".
"<span>" . __('Select')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
- print "<div onclick=\"selectTableRows('prefFeedProfileList', 'all')\"
+ print "<div onclick=\"Tables.select('prefFeedProfileList', true)\"
dojoType=\"dijit.MenuItem\">".__('All')."</div>";
- print "<div onclick=\"selectTableRows('prefFeedProfileList', 'none')\"
+ print "<div onclick=\"Tables.select('prefFeedProfileList', false)\"
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
print "</div></div>";
@@ -1019,11 +1019,10 @@ class Pref_Prefs extends Handler_Protected {
print "<table width=\"100%\" class=\"prefFeedProfileList\"
cellspacing=\"0\" id=\"prefFeedProfileList\">";
- print "<tr class=\"placeholder\" id=\"FCATR-0\">"; #odd
+ print "<tr class=\"placeholder\">"; # data-row-id='0' <-- no point, shouldn't be removed
print "<td width='5%' align='center'><input
- id='FCATC-0'
- onclick='toggleSelectRow2(this);'
+ onclick='Tables.onRowChecked(this);'
dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\"></td>";
@@ -1043,15 +1042,13 @@ class Pref_Prefs extends Handler_Protected {
while ($line = $sth->fetch()) {
$profile_id = $line["id"];
- $this_row_id = "id=\"FCATR-$profile_id\"";
- print "<tr class=\"placeholder\" $this_row_id>";
+ print "<tr class=\"placeholder\" data-row-id='$profile_id'>";
$edit_title = htmlspecialchars($line["title"]);
print "<td width='5%' align='center'><input
- onclick='toggleSelectRow2(this);'
- id='FCATC-$profile_id'
+ onclick='Tables.onRowChecked(this);'
dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\"></td>";
diff --git a/classes/pref/system.php b/classes/pref/system.php
index 2099ebb9c..d60b419cf 100644
--- a/classes/pref/system.php
+++ b/classes/pref/system.php
@@ -26,7 +26,7 @@ class Pref_System extends Handler_Protected {
function index() {
print "<div dojoType=\"dijit.layout.AccordionContainer\" region=\"center\">";
- print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Error Log')."\">";
+ print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Event Log')."\">";
if (LOG_DESTINATION == "sql") {
@@ -37,10 +37,10 @@ class Pref_System extends Handler_Protected {
LIMIT 100");
print "<button dojoType=\"dijit.form.Button\"
- onclick=\"updateSystemList()\">".__('Refresh')."</button> ";
+ onclick=\"Helpers.updateEventLog()\">".__('Refresh')."</button> ";
print "&nbsp;<button dojoType=\"dijit.form.Button\"
- onclick=\"clearSqlLog()\">".__('Clear log')."</button> ";
+ class=\"btn-danger\" onclick=\"Helpers.clearEventLog()\">".__('Clear')."</button> ";
print "<p><table width=\"100%\" cellspacing=\"10\" class=\"prefErrorLog\">";
diff --git a/classes/pref/users.php b/classes/pref/users.php
index 1e6eae227..aeab28153 100644
--- a/classes/pref/users.php
+++ b/classes/pref/users.php
@@ -218,12 +218,13 @@ class Pref_Users extends Handler_Protected {
}
function add() {
-
$login = trim(clean($_REQUEST["login"]));
$tmp_user_pwd = make_password(8);
$salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
$pwd_hash = encrypt_password($tmp_user_pwd, $salt, true);
+ if (!$login) return; // no blank usernames
+
$sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE
login = ?");
$sth->execute([$login]);
@@ -243,18 +244,18 @@ class Pref_Users extends Handler_Protected {
$new_uid = $row['id'];
- print format_notice(T_sprintf("Added user <b>%s</b> with password <b>%s</b>",
- $login, $tmp_user_pwd));
+ print T_sprintf("Added user %s with password %s",
+ $login, $tmp_user_pwd);
initialize_user($new_uid);
} else {
- print format_warning(T_sprintf("Could not create user <b>%s</b>", $login));
+ print T_sprintf("Could not create user %s", $login);
}
} else {
- print format_warning(T_sprintf("User <b>%s</b> already exists.", $login));
+ print T_sprintf("User %s already exists.", $login);
}
}
@@ -282,9 +283,9 @@ class Pref_Users extends Handler_Protected {
$sth->execute([$pwd_hash, $new_salt, $uid]);
if ($show_password) {
- print T_sprintf("Changed password of user <b>%s</b> to <b>%s</b>", $login, $tmp_user_pwd);
+ print T_sprintf("Changed password of user %s to %s", $login, $tmp_user_pwd);
} else {
- print_notice(T_sprintf("Sending new password of user <b>%s</b> to <b>%s</b>", $login, $email));
+ print_notice(T_sprintf("Sending new password of user %s to %s", $login, $email));
}
if ($email) {
@@ -341,7 +342,7 @@ class Pref_Users extends Handler_Protected {
print "<div style='float : right; padding-right : 4px;'>
<input dojoType=\"dijit.form.TextBox\" id=\"user_search\" size=\"20\" type=\"search\"
value=\"$user_search\">
- <button dojoType=\"dijit.form.Button\" onclick=\"updateUsersList()\">".
+ <button dojoType=\"dijit.form.Button\" oncl1ick=\"Users.reload()\">".
__('Search')."</button>
</div>";
@@ -354,20 +355,20 @@ class Pref_Users extends Handler_Protected {
print "<div dojoType=\"dijit.form.DropDownButton\">".
"<span>" . __('Select')."</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
- print "<div onclick=\"selectTableRows('prefUserList', 'all')\"
+ print "<div onclick=\"Tables.select('prefUserList', true)\"
dojoType=\"dijit.MenuItem\">".__('All')."</div>";
- print "<div onclick=\"selectTableRows('prefUserList', 'none')\"
+ print "<div onclick=\"Tables.select('prefUserList', false)\"
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
print "</div></div>";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"addUser()\">".__('Create user')."</button>";
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"Users.add()\">".__('Create user')."</button>";
print "
- <button dojoType=\"dijit.form.Button\" onclick=\"editSelectedUser()\">".
+ <button dojoType=\"dijit.form.Button\" onclick=\"Users.editSelected()\">".
__('Edit')."</button dojoType=\"dijit.form.Button\">
- <button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedUsers()\">".
+ <button dojoType=\"dijit.form.Button\" onclick=\"Users.removeSelected()\">".
__('Remove')."</button dojoType=\"dijit.form.Button\">
- <button dojoType=\"dijit.form.Button\" onclick=\"resetSelectedUserPass()\">".
+ <button dojoType=\"dijit.form.Button\" onclick=\"Users.resetSelected()\">".
__('Reset password')."</button dojoType=\"dijit.form.Button\">";
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
@@ -400,11 +401,11 @@ class Pref_Users extends Handler_Protected {
print "<tr class=\"title\">
<td align='center' width=\"5%\">&nbsp;</td>
- <td width='20%'><a href=\"#\" onclick=\"updateUsersList('login')\">".__('Login')."</a></td>
- <td width='20%'><a href=\"#\" onclick=\"updateUsersList('access_level')\">".__('Access Level')."</a></td>
- <td width='10%'><a href=\"#\" onclick=\"updateUsersList('num_feeds')\">".__('Subscribed feeds')."</a></td>
- <td width='20%'><a href=\"#\" onclick=\"updateUsersList('created')\">".__('Registered')."</a></td>
- <td width='20%'><a href=\"#\" onclick=\"updateUsersList('last_login')\">".__('Last login')."</a></td></tr>";
+ <td width='20%'><a href=\"#\" onclick=\"Users.reload('login')\">".__('Login')."</a></td>
+ <td width='20%'><a href=\"#\" onclick=\"Users.reload('access_level')\">".__('Access Level')."</a></td>
+ <td width='10%'><a href=\"#\" onclick=\"Users.reload('num_feeds')\">".__('Subscribed feeds')."</a></td>
+ <td width='20%'><a href=\"#\" onclick=\"Users.reload('created')\">".__('Registered')."</a></td>
+ <td width='20%'><a href=\"#\" onclick=\"Users.reload('last_login')\">".__('Last login')."</a></td></tr>";
$lnum = 0;
@@ -412,27 +413,21 @@ class Pref_Users extends Handler_Protected {
$uid = $line["id"];
- print "<tr id=\"UMRR-$uid\">";
+ print "<tr data-row-id=\"$uid\" onclick='Users.edit($uid)'>";
$line["login"] = htmlspecialchars($line["login"]);
-
$line["created"] = make_local_datetime($line["created"], false);
$line["last_login"] = make_local_datetime($line["last_login"], false);
- print "<td align='center'><input onclick='toggleSelectRow2(this);'
- dojoType=\"dijit.form.CheckBox\" type=\"checkbox\"
- id=\"UMCHK-$uid\"></td>";
-
- $onclick = "onclick='editUser($uid, event)' title='".__('Click to edit')."'";
-
- print "<td $onclick><img src='images/user.png' class='marked-pic' alt=''> " . $line["login"] . "</td>";
+ print "<td align='center'><input onclick='Tables.onRowChecked(this); event.stopPropagation();'
+ dojoType=\"dijit.form.CheckBox\" type=\"checkbox\"></td>";
- if (!$line["email"]) $line["email"] = "&nbsp;";
+ print "<td title='".__('Click to edit')."'><img src='images/user.png' class='marked-pic' alt=''> " . $line["login"] . "</td>";
- print "<td $onclick>" . $access_level_names[$line["access_level"]] . "</td>";
- print "<td $onclick>" . $line["num_feeds"] . "</td>";
- print "<td $onclick>" . $line["created"] . "</td>";
- print "<td $onclick>" . $line["last_login"] . "</td>";
+ print "<td>" . $access_level_names[$line["access_level"]] . "</td>";
+ print "<td>" . $line["num_feeds"] . "</td>";
+ print "<td>" . $line["created"] . "</td>";
+ print "<td>" . $line["last_login"] . "</td>";
print "</tr>";