]> git.wh0rd.org - tt-rss.git/blobdiff - classes/pref/prefs.php
move addInstance call to instances plugin
[tt-rss.git] / classes / pref / prefs.php
index a5a699a67a7041591968d7fce12aa5efeefd13fa..21b25c6319d44e3b3fc4d070d7b978612e002d7f 100644 (file)
@@ -2,7 +2,7 @@
 class Pref_Prefs extends Handler_Protected {
 
        function csrf_ignore($method) {
-               $csrf_ignored = array("index", "updateself");
+               $csrf_ignored = array("index", "updateself", "customizecss");
 
                return array_search($method, $csrf_ignored) !== false;
        }
@@ -113,16 +113,16 @@ class Pref_Prefs extends Handler_Protected {
                        WHERE $profile_qpart AND owner_uid = ".$_SESSION["uid"]);
 
                initialize_user_prefs($this->link, $_SESSION["uid"], $_SESSION["profile"]);
-
-               print "PREFS_THEME_CHANGED";
        }
 
        function index() {
 
                global $access_level_names;
 
-               $prefs_blacklist = array("HIDE_READ_FEEDS", "FEEDS_SORT_BY_UNREAD",
-                                       "STRIP_UNSAFE_TAGS");
+               $prefs_blacklist = array("STRIP_UNSAFE_TAGS", "REVERSE_HEADLINES",
+                       "SORT_HEADLINES_BY_FEED_DATE");
+
+               /* "FEEDS_SORT_BY_UNREAD", "HIDE_READ_FEEDS", "REVERSE_HEADLINES" */
 
                $profile_blacklist = array("ALLOW_DUPLICATE_POSTS", "PURGE_OLD_DAYS",
                                        "PURGE_UNREAD_ARTICLES", "DIGEST_ENABLE", "DIGEST_CATCHUP",
@@ -387,11 +387,7 @@ class Pref_Prefs extends Handler_Protected {
                                parameters: dojo.objectToQuery(this.getValues()),
                                onComplete: function(transport) {
                                        var msg = transport.responseText;
-                                       if (msg.match('PREFS_THEME_CHANGED')) {
-                                               window.location.reload();
-                                       } else {
-                                               notify_info(msg);
-                                       }
+                                       notify_info(msg);
                        } });
                }
                </script>";
@@ -412,10 +408,12 @@ class Pref_Prefs extends Handler_Protected {
                        $profile_qpart = "profile IS NULL";
                }
 
-               if ($_SESSION["prefs_show_advanced"])
+               /* if ($_SESSION["prefs_show_advanced"])
                        $access_query = "true";
                else
-                       $access_query = "(access_level = 0 AND section_id != 3)";
+                       $access_query = "(access_level = 0 AND section_id != 3)"; */
+
+               $access_query = 'true';
 
                $result = db_query($this->link, "SELECT DISTINCT
                        ttrss_user_prefs.pref_name,short_desc,help_text,value,type_name,
@@ -492,6 +490,14 @@ class Pref_Prefs extends Handler_Protected {
                                print "<button dojoType=\"dijit.form.Button\"
                                        onclick=\"customizeCSS()\">" . __('Customize') . "</button>";
 
+                       } else if ($pref_name == "USER_CSS_THEME") {
+
+                               $themes = array_map("basename", glob("themes/*.css"));
+
+                               print_select($pref_name, $value, $themes,
+                                       'dojoType="dijit.form.Select"');
+
+
                        } else if ($pref_name == "DEFAULT_ARTICLE_LIMIT") {
 
                                $limits = array(15, 30, 45, 60);
@@ -602,7 +608,7 @@ class Pref_Prefs extends Handler_Protected {
 
                print "&nbsp;";
 
-               $checked = $_SESSION["prefs_show_advanced"] ? "checked='1'" : "";
+               /* $checked = $_SESSION["prefs_show_advanced"] ? "checked='1'" : "";
 
                print "<input onclick='toggleAdvancedPrefs()'
                                id='prefs_show_advanced'
@@ -610,7 +616,7 @@ class Pref_Prefs extends Handler_Protected {
                                $checked
                                type=\"checkbox\"></input>
                                <label for='prefs_show_advanced'>" .
-                               __("Show additional preferences") . "</label>";
+                               __("Show additional preferences") . "</label>"; */
 
                global $pluginhost;
                $pluginhost->run_hooks($pluginhost::HOOK_PREFS_TAB_SECTION,
@@ -626,7 +632,9 @@ class Pref_Prefs extends Handler_Protected {
 
                print "<h2>".__("Plugins")."</h2>";
 
-               print_notice(__("You will need to reload Tiny Tiny RSS for plugin changes to take effect."));
+               print "<p>" . __("You will need to reload Tiny Tiny RSS for plugin changes to take effect.") . "</p>";
+
+               print_notice(__("Download more plugins at tt-rss.org <a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/forum/viewforum.php?f=22\">forums</a> or <a target=\"_blank\" class=\"visibleLink\" href=\"http://tt-rss.org/wiki/Plugins\">wiki</a>."));
 
                print "<form dojoType=\"dijit.form.Form\" id=\"changePluginsForm\">";
 
@@ -685,7 +693,12 @@ class Pref_Prefs extends Handler_Protected {
                                                type=\"checkbox\"></td>";
 
                                print "<td>$name</td>";
-                               print "<td>" . htmlspecialchars($about[1]) . "</td>";
+                               print "<td>" . htmlspecialchars($about[1]);
+                               if (@$about[4]) {
+                                       print " &mdash; <a target=\"_blank\" class=\"visibleLink\"
+                                               href=\"".htmlspecialchars($about[4])."\">".__("more info")."</a>";
+                               }
+                               print "</td>";
                                print "<td>" . htmlspecialchars(sprintf("%.2f", $about[0])) . "</td>";
                                print "<td>" . htmlspecialchars($about[2]) . "</td>";
 
@@ -737,7 +750,13 @@ class Pref_Prefs extends Handler_Protected {
                                        type=\"checkbox\"></td>";
 
                                print "<td><label for='FPCHK-$name'>$name</label></td>";
-                               print "<td><label for='FPCHK-$name'>" . htmlspecialchars($about[1]) . "</label></td>";
+                               print "<td><label for='FPCHK-$name'>" . htmlspecialchars($about[1]) . "</label>";
+                               if (@$about[4]) {
+                                       print " &mdash; <a target=\"_blank\" class=\"visibleLink\"
+                                               href=\"".htmlspecialchars($about[4])."\">".__("more info")."</a>";
+                               }
+                               print "</td>";
+
                                print "<td>" . htmlspecialchars(sprintf("%.2f", $about[0])) . "</td>";
                                print "<td>" . htmlspecialchars($about[2]) . "</td>";
 
@@ -851,5 +870,33 @@ class Pref_Prefs extends Handler_Protected {
                global $pluginhost;
                $pluginhost->clear_data($pluginhost->get_plugin($name));
        }
+
+       function customizeCSS() {
+               $value = get_pref($this->link, "USER_STYLESHEET");
+
+               $value = str_replace("<br/>", "\n", $value);
+
+               print_notice(T_sprintf("You can override colors, fonts and layout of your currently selected theme with custom CSS declarations here. <a target=\"_blank\" class=\"visibleLink\" href=\"%s\">This file</a> can be used as a baseline.", "tt-rss.css"));
+
+               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
+               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setpref\">";
+               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"key\" value=\"USER_STYLESHEET\">";
+
+               print "<table width='100%'><tr><td>";
+               print "<textarea dojoType=\"dijit.form.SimpleTextarea\"
+                       style='font-size : 12px; width : 100%; height: 200px;'
+                       placeHolder='body#ttrssMain { font-size : 14px; };'
+                       name='value'>$value</textarea>";
+               print "</td></tr></table>";
+
+               print "<div class='dlgButtons'>";
+               print "<button dojoType=\"dijit.form.Button\"
+                       onclick=\"dijit.byId('cssEditDlg').execute()\">".__('Save')."</button> ";
+               print "<button dojoType=\"dijit.form.Button\"
+                       onclick=\"dijit.byId('cssEditDlg').hide()\">".__('Cancel')."</button>";
+               print "</div>";
+
+       }
+
 }
 ?>