]> git.wh0rd.org - tt-rss.git/blobdiff - modules/popup-dialog.php
implement settings profiles (bump schema)
[tt-rss.git] / modules / popup-dialog.php
index e75d8a9ad3044c989c974d1a726f8b83fefd1ed0..cca7b053c1275b6331bcebf3cfa24353f14a6570 100644 (file)
@@ -3,6 +3,97 @@
                $id = $_REQUEST["id"];
                $param = db_escape_string($_REQUEST["param"]);
 
+               if ($id == "editPrefProfiles") {
+
+                       print "<div id=\"infoBoxTitle\">".__('Settings Profiles')."</div>";
+                       print "<div class=\"infoBoxContents\">";
+
+                       print "<div><input id=\"fadd_profile\" 
+                                       onkeypress=\"return filterCR(event, addPrefProfile)\"
+                                       size=\"40\">
+                                       <button onclick=\"javascript:addPrefProfile()\">".
+                                       __('Create profile')."</button></div>";
+
+                       print "<p>";
+
+                       $result = db_query($link, "SELECT title,id FROM ttrss_settings_profiles
+                               WHERE owner_uid = ".$_SESSION["uid"]."ORDER BY title");
+
+                       print   __('Select:')." 
+                               <a href=\"javascript:selectPrefRows('fcat', true)\">".__('All')."</a>,
+                               <a href=\"javascript:selectPrefRows('fcat', false)\">".__('None')."</a>";
+
+                       print "<div class=\"prefFeedCatHolder\">";
+
+                       print "<form id=\"profile_edit_form\" onsubmit=\"return false\">";
+
+                       print "<table width=\"100%\" class=\"prefFeedCatList\" 
+                               cellspacing=\"0\" id=\"prefFeedCatList\">";
+
+                       print "<tr class=\"odd\" id=\"FCATR-0\">";
+
+                       print "<td width='5%' align='center'><input 
+                               onclick='toggleSelectPrefRow(this, \"fcat\");' 
+                               type=\"checkbox\" id=\"FCCHK-0\"></td>";
+
+                       print "<td><span id=\"FCATT-0\">" . 
+                               __("Default profile") . "</span></td>";         
+                               
+                       print "</tr>";
+
+                       $lnum = 1;
+                       
+                       while ($line = db_fetch_assoc($result)) {
+       
+                               $class = ($lnum % 2) ? "even" : "odd";
+       
+                               $cat_id = $line["id"];
+                               $this_row_id = "id=\"FCATR-$cat_id\"";
+       
+                               print "<tr class=\"$class\" $this_row_id>";
+       
+                               $edit_title = htmlspecialchars($line["title"]);
+       
+                               print "<td width='5%' align='center'><input 
+                                       onclick='toggleSelectPrefRow(this, \"fcat\");' 
+                                       type=\"checkbox\" id=\"FCCHK-$cat_id\"></td>";
+
+                               if ($_SESSION["profile"] == $line["id"]) {
+                                       $is_active = __("(active)");
+                               } else {
+                                       $is_active = "";
+                               }
+
+                               print "<td><span id=\"FCATT-$cat_id\">" . 
+                                       $edit_title . "</span> $is_active</td>";
+                               
+                               print "</tr>";
+       
+                               ++$lnum;
+                       }
+
+                       print "</table>";
+                       print "</form>";
+                       print "</div>";
+
+                       print "<div class='dlgButtons'>
+                               <div style='float : left'>
+                               <button onclick=\"return removeSelectedPrefProfiles()\">".
+                               __('Remove')."</button>
+                               <input class=\"button\"
+                               type=\"submit\" onclick=\"return activatePrefProfile()\" 
+                               value=\"".__('Activate')."\">
+                               </div>";
+
+                       print "<input class=\"button\"
+                               type=\"submit\" onclick=\"return closeInfoBox()\" 
+                               value=\"".__('Close this window')."\">";
+
+                       print "</div></div>";
+
+                       return;
+               }
+
                if ($id == "pubUrl") {
 
                        print "<div id=\"infoBoxTitle\">".__('Published Articles')."</div>";
 
                        print "<form id='feed_add_form' onsubmit='return false'>";
 
-                       print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">";
-                       print "<input type=\"hidden\" name=\"subop\" value=\"add\">"; 
-                       print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">"; 
+                       print "<input type=\"hidden\" name=\"op\" value=\"rpc\">";
+                       print "<input type=\"hidden\" name=\"subop\" value=\"addfeed\">"; 
+                       //print "<input type=\"hidden\" name=\"from\" value=\"tt-rss\">"; 
 
                        print "<div class=\"dlgSec\">".__("Feed")."</div>";
                        print "<div class=\"dlgSecCont\">";
 
                        print "<input size=\"40\"
                                        onkeypress=\"return filterCR(event, subscribeToFeed)\"
-                                       name=\"feed_url\"></td></tr>";
+                                       name=\"feed\" id=\"feed_url\"></td></tr>";
 
                        print "<br/>";
 
                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
                                print __('Place in category:') . " ";
-                               print_feed_cat_select($link, "cat_id");                 
+                               print_feed_cat_select($link, "cat");                    
                        }
 
                        print "</div>";
                                        <div class=\"dlgSec\">".__("Authentication")."</div>
                                        <div class=\"dlgSecCont\">".
 
-                                       __('Login:') . " <input name='auth_login' size=\"20\" 
+                                       __('Login:') . " <input name='login' size=\"20\" 
                                                        onkeypress=\"return filterCR(event, subscribeToFeed)\"> ".
                                        __('Password:') . "<input type='password'
-                                                       name='auth_pass' size=\"20\" 
+                                                       name='pass' size=\"20\" 
                                                        onkeypress=\"return filterCR(event, subscribeToFeed)\">
                                </div></div>";
 
                        return;
                }
 
+               if ($id == "feedBrowser") {
+
+                       print "<div id=\"infoBoxTitle\">".__('Feed Browser')."</div>";
+                       
+                       print "<div class=\"infoBoxContents\">";
+
+                       $browser_search = db_escape_string($_REQUEST["search"]);
+                       
+                       print "<form onsubmit='return false;' display='inline' 
+                               name='feed_browser' id='feed_browser'>";
+
+                       print "<input type=\"hidden\" name=\"op\" value=\"rpc\">";
+                       print "<input type=\"hidden\" name=\"subop\" value=\"updateFeedBrowser\">"; 
+
+                       print "
+                               <div style='float : right'>
+                               <img style='display : none' 
+                                       id='feed_browser_spinner' src='images/indicator_white.gif'>
+                               <input name=\"search\" size=\"20\" type=\"search\"
+                                       onchange=\"javascript:updateFeedBrowser()\" value=\"$browser_search\">
+                               <button onclick=\"javascript:updateFeedBrowser()\">".__('Search')."</button>
+                       </div>";
+
+                       print " <select name=\"mode\" onchange=\"updateFeedBrowser()\">
+                               <option value='1'>" . __('Popular feeds') . "</option>
+                               <option value='2'>" . __('Feed archive') . "</option>
+                               </select> ";
+
+                       print __("limit:");
+
+                       print " <select name=\"limit\" onchange='updateFeedBrowser()'>";
+
+                       foreach (array(25, 50, 100, 200) as $l) {
+                               $issel = ($l == $limit) ? "selected" : "";
+                               print "<option $issel>$l</option>";
+                       }
+                       
+                       print "</select> ";
+
+                       print "<p>";
+
+                       $owner_uid = $_SESSION["uid"];
+
+/*                     print   __('Select:')." 
+                               <a href=\"javascript:selectPrefRows('fbrowse', true)\">".__('All')."</a>,
+                                       <a href=\"javascript:selectPrefRows('fbrowse', false)\">".__('None')."</a>"; */
+
+                       print "<ul class='browseFeedList' id='browseFeedList'>";
+                       print_feed_browser($link, $search, 25);
+                       print "</ul>";
+
+                       print "<div align='center'>
+                               <button onclick=\"feedBrowserSubscribe()\">".__('Subscribe')."</button>
+                               <button style='display : none' id='feed_archive_remove' onclick=\"feedArchiveRemove()\">".__('Remove')."</button>
+                               <button onclick=\"closeInfoBox()\" >".__('Cancel')."</button></div>";
+
+                       print "</div>";
+                       return;
+               }
+
                if ($id == "search") {
 
                        print "<div id=\"infoBoxTitle\">".__('Search')."</div>";