]> git.wh0rd.org - tt-rss.git/blobdiff - modules/popup-dialog.php
rework OPML import process
[tt-rss.git] / modules / popup-dialog.php
index 351d4b0f90717638cfa8e18df6d7c75f30d9926f..ec41ec4ee2d0acfca8e31584c8372b920ea6562b 100644 (file)
@@ -6,10 +6,8 @@
                print "<dlg id=\"$id\">";
 
                if ($id == "importOpml") {
-                       print "<title>".__('OPML Import')."</title>";
-                       print "<content><![CDATA[";
-
-                       print "<div class=\"prefFeedCatHolder\">";
+                       print "<div class=\"prefFeedOPMLHolder\">";
+                       header("Content-Type: text/html"); # required for iframe
 
                        $owner_uid = $_SESSION["uid"];
 
                        print "</div>";
 
                        print "<div align='center'>";
-
-                       print "<button onclick=\"return opmlImportDone()\">".
+                       print "<button dojoType=\"dijit.form.Button\" 
+                               onclick=\"dijit.byId('opmlImportDlg').hide()\">".
                                __('Close this window')."</button>";
-
                        print "</div>";
 
-                       print "<script type=\"text/javascript\">";
-                       print "parent.opmlImportHandler(this)";
-                       print "</script>";
-
                        print "</div>";
-                       print "]]></content>";
 
                        //return;
                }
 
                if ($id == "editPrefProfiles") {
 
-                       print "<title>".__('Settings Profiles')."</title>";
-                       print "<content><![CDATA[";
-
-                       print "<div><input id=\"fadd_profile\" 
-                                       onkeypress=\"return filterCR(event, addPrefProfile)\"
-                                       size=\"40\">
-                                       <button onclick=\"javascript:addPrefProfile()\">".
+                       print "<div dojoType=\"dijit.Toolbar\">";
+
+#                      TODO: depends on selectTableRows() being broken for this list
+#                      print "<div dojoType=\"dijit.form.DropDownButton\">".
+#                              "<span>" . __('Select')."</span>";
+#                      print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
+#                      print "<div onclick=\"selectTableRows('prefFeedProfileList', 'all')\" 
+#                              dojoType=\"dijit.MenuItem\">".__('All')."</div>";
+#                      print "<div onclick=\"selectTableRows('prefFeedProfileList', 'none')\" 
+#                              dojoType=\"dijit.MenuItem\">".__('None')."</div>";
+#                      print "</div></div>";
+
+#                      print "<div style='float : right'>";
+                       print "<input name=\"newprofile\" dojoType=\"dijit.form.ValidationTextBox\"
+                                       required=\"1\">
+                               <button dojoType=\"dijit.form.Button\" 
+                               onclick=\"dijit.byId('profileEditDlg').addProfile()\">".
                                        __('Create profile')."</button></div>";
 
-                       print "<p>";
+#                      print "</div>";
+
 
                        $result = db_query($link, "SELECT title,id FROM ttrss_settings_profiles
                                WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
 
-                       print   __('Select:')." 
-                               <a href=\"#\" onclick=\"selectTableRows('prefFeedCatList', 'all')\">".__('All')."</a>,
-                               <a href=\"#\" onclick=\"selectTableRows('prefFeedCatList', 'none')\">".__('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 "<table width=\"100%\" class=\"prefFeedProfileList\" 
+                               cellspacing=\"0\" id=\"prefFeedProfileList\">";
 
-                       print "<tr class=\"odd\" id=\"FCATR-0\">";
+                       print "<tr class=\"\" id=\"FCATR-0\">"; #odd
 
                        print "<td width='5%' align='center'><input 
-                               onclick='toggleSelectRow(this);' 
-                               type=\"checkbox\" id=\"FCCHK-0\"></td>";
+                               onclick='toggleSelectRow2(this);' 
+                               dojoType=\"dijit.form.CheckBox\"
+                               type=\"checkbox\"></td>";
 
                        if (!$_SESSION["profile"]) {
                                $is_active = __("(active)");
                                $is_active = "";
                        }
 
-                       print "<td><span id=\"FCATT-0\">" . 
+                       print "<td><span>" . 
                                __("Default profile") . " $is_active</span></td>";
                                
                        print "</tr>";
        
                                $class = ($lnum % 2) ? "even" : "odd";
        
-                               $cat_id = $line["id"];
-                               $this_row_id = "id=\"FCATR-$cat_id\"";
+                               $profile_id = $line["id"];
+                               $this_row_id = "id=\"FCATR-$profile_id\"";
        
-                               print "<tr class=\"$class\" $this_row_id>";
+                               print "<tr class=\"\" $this_row_id>";
        
                                $edit_title = htmlspecialchars($line["title"]);
        
                                print "<td width='5%' align='center'><input 
-                                       onclick='toggleSelectRow(this);' 
-                                       type=\"checkbox\" id=\"FCCHK-$cat_id\"></td>";
+                                       onclick='toggleSelectRow2(this);' 
+                                       dojoType=\"dijit.form.CheckBox\"
+                                       type=\"checkbox\"></td>";
 
                                if ($_SESSION["profile"] == $line["id"]) {
                                        $is_active = __("(active)");
                                        $is_active = "";
                                }
 
-                               print "<td><span id=\"FCATT-$cat_id\">" . 
-                                       $edit_title . "</span> $is_active</td>";
-                               
+                               print "<td><span dojoType=\"dijit.InlineEditBox\" 
+                                       width=\"300px\" autoSave=\"false\"
+                                       profile-id=\"$profile_id\">" . $edit_title .
+                                       "<script type=\"dojo/method\" event=\"onChange\" args=\"item\">
+                                               var elem = this;
+                                               dojo.xhrPost({
+                                                       url: 'backend.php',
+                                                       content: {op: 'rpc', subop: 'saveprofile',
+                                                               value: this.value,
+                                                               id: this.srcNodeRef.getAttribute('profile-id')},
+                                                               load: function(response) {
+                                                                       elem.attr('value', response);
+                                                       }
+                                               });     
+                                       </script>
+                               </span> $is_active</td>";
+                       
                                print "</tr>";
        
                                ++$lnum;
 
                        print "<div class='dlgButtons'>
                                <div style='float : left'>
-                               <button onclick=\"return removeSelectedPrefProfiles()\">".
-                               __('Remove')."</button>
-                               <button onclick=\"return activatePrefProfile()\">".
-                               __('Activate')."</button>
+                               <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').removeSelected()\">".
+                               __('Remove selected profiles')."</button>
+                               <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').activateProfile()\">".
+                               __('Activate profile')."</button>
                                </div>";
 
-                       print "<button onclick=\"return closeInfoBox()\">".
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').hide()\">".
                                __('Close this window')."</button>";
-
                        print "</div>";
-                       print "]]></content>";
 
-                       //return;
                }
 
                if ($id == "pubOPMLUrl") {
 
                        print "<div align='center'>";
 
-                       print "<button onclick=\"return opmlRegenKey()\">".
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"return opmlRegenKey()\">".
                                __('Generate new URL')."</button> ";
 
-                       print "<button onclick=\"return closeInfoBox()\">".
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">".
                                __('Close this window')."</button>";
 
                        print "</div>";
 
                if ($id == "search") {
 
-                       print "<title>".__('Search')."</title>";
-                       print "<content><![CDATA[";
-
-                       print "<form id='search_form'  onsubmit='return false'>";
-
-                       #$active_feed_id = db_escape_string($_REQUEST["param"]);
-
                        $params = explode(":", db_escape_string($_REQUEST["param"]), 2);
 
                        $active_feed_id = sprintf("%d", $params[0]);
 
                        if (!SPHINX_ENABLE) {
 
-                               print "<input onkeypress=\"return filterCR(event, search)\"
-                                       name=\"query\" size=\"20\" type=\"search\"      value=''>";
+                               print "<input dojoType=\"dijit.form.ValidationTextBox\" 
+                                       style=\"font-size : 16px; width : 12em;\"
+                                       required=\"1\" name=\"query\" type=\"search\" value=''>";
 
                                print " " . __('match on')." ";
 
                                                "content" => __("Content"),
                                        "both" => __("Title or content"));
        
-                               print_select_hash("match_on", 3, $search_fields); 
+                               print_select_hash("match_on", 3, $search_fields, 
+                                       'dojoType="dijit.form.Select"'); 
                        } else {
-                               print "<input onkeypress=\"return filterCR(event, search)\"
-                                       name=\"query\" size=\"50\" type=\"search\"      value=''>";
+                               print "<input dojoType=\"dijit.form.ValidationTextBox\" 
+                                       style=\"font-size : 16px; width : 20em;\"
+                                       required=\"1\" name=\"query\" type=\"search\" value=''>";
                        }
 
 
                        print "<br/>".__('Limit search to:')." ";
                        
-                       print "<select name=\"search_mode\">
+                       print "<select name=\"search_mode\" dojoType=\"dijit.form.Select\">
                                <option value=\"all_feeds\">".__('All feeds')."</option>";
                        
                        $feed_title = getFeedTitle($link, $active_feed_id);
                        }
                        
                        if ($active_feed_id && !$is_cat) {                              
-                               print "<option selected value=\"this_feed\">$feed_title</option>";
+                               print "<option selected=\"1\" value=\"this_feed\">$feed_title</option>";
                        } else {
-                               print "<option disabled>".__('This feed')."</option>";
+                               print "<option disabled=\"1\" value=\"false\">".__('This feed')."</option>";
                        }
 
                        if ($is_cat) {
-                               $cat_preselected = "selected";
+                               $cat_preselected = "selected=\"1\"";
                        }
 
                        if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) {
 
                        print "</div>";
 
-                       print "</form>";
-
                        print "<div class=\"dlgButtons\">
-                       <button onclick=\"javascript:search()\">".__('Search')."</button>
-                       <button onclick=\"javascript:closeInfoBox(true)\">".__('Cancel')."</button>
+                       <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">".__('Search')."</button>
+                       <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">".__('Cancel')."</button>
                        </div>";
-
-                       print "]]></content>";
-
-                       //return;
-
                }
 
                if ($id == "quickAddFilter") {
 
                        print "<div class=\"dlgButtons\">";
 
-                       print "<button onclick=\"return dijit.byId('filterEditDlg').execute()\">".
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').execute()\">".
                                __('Create')."</button> ";
 
-                       print "<button onclick=\"return dijit.byId('filterEditDlg').hide()\">".
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">".
                                __('Cancel')."</button>";
 
                        print "</div>";
 
                if ($id == "feedUpdateErrors") {
 
-                       print "<title>".__('Update Errors')."</title>";
+                       print "<title>".__('Feeds with update errors')."</title>";
                        print "<content><![CDATA[";
 
                        print __("These feeds have not been updated because of errors:");
 
                        print "<div align='center'>";
 
-                       print "<button onclick=\"return closeInfoBox()\">".
+                       print "<button dojoType=\"dijit.form.Button\" 
+                               onclick=\"return closeInfoBox()\">".
                                __('Close this window')."</button>";
 
                        print "]]></content>";
                        print "</div>";
 
                        print "<div align='center'>";
-                       print "<button onclick=\"return closeInfoBox()\">".
+                       print "<button dojoType=\"dijit.form.Button\" 
+                               onclick=\"return closeInfoBox()\">".
                                __('Close this window')."</button>";
                        print "</div>";
 
 
                if ($id == "emailArticle") {
 
-                       print "<title>".__('Forward article by email')."</title>";
-                       print "<content><![CDATA[";
-
-                       print "<form id=\"article_email_form\" onsubmit='return false'>";
-
                        $secretkey = sha1(uniqid(rand(), true));
 
                        $_SESSION['email_secretkey'] = $secretkey;
 
-                       print "<input type=\"hidden\" name=\"secretkey\" value=\"$secretkey\">";
-                       print "<input type=\"hidden\" name=\"op\" value=\"rpc\">";
-                       print "<input type=\"hidden\" name=\"subop\" value=\"sendEmail\">"; 
+                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"secretkey\" value=\"$secretkey\">";
+                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
+                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"sendEmail\">"; 
 
                        $result = db_query($link, "SELECT email, full_name FROM ttrss_users WHERE
                                id = " . $_SESSION["uid"]);
 
                        print "</td><td>";
 
-                       print "<input size=\"40\" disabled
-                                       onkeypress=\"return filterCR(event, false)\"
+                       print "<input dojoType=\"dijit.form.TextBox\" disabled=\"1\" style=\"width : 30em;\"
                                        value=\"$user_name <$user_email>\">";
 
                        print "</td></tr><tr><td>";
 
                        print "</td><td>";
 
-                       print "<input size=\"40\"
-                                       onkeypress=\"return filterCR(event, false)\"
-                                       name=\"destination\" id=\"destination\">";
+                       print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"
+                                       style=\"width : 30em;\"
+                                       name=\"destination\" id=\"emailArticleDlg_destination\">";
 
-                       print "<div class=\"autocomplete\" id=\"destination_choices\" 
-                                       style=\"display:none\"></div>"; 
+                       print "<div class=\"autocomplete\" id=\"emailArticleDlg_dst_choices\" 
+                                       style=\"z-index: 30; display : none\"></div>";  
 
                        print "</td></tr><tr><td>";
 
 
                        print "</td><td>";
 
-                       print "<input size=\"60\" class=\"iedit\"
-                                       onkeypress=\"return filterCR(event, false)\"
+                       print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"
+                                       style=\"width : 30em;\" 
                                        name=\"subject\" value=\"$subject\" id=\"subject\">";
 
-                       print "</td></tr></table>";
+                       print "</td></tr>";
 
-                       print "<textarea rows='10' class='iedit' style='font-size : small'
+                       print "<tr><td colspan='2'><textarea dojoType=\"dijit.form.SimpleTextarea\" style='font-size : 12px; width : 100%' rows=\"20\"
                                name='content'>$content</textarea>";
 
-                       print "</form>";
+                       print "</td></tr></table>";
 
                        print "<div class='dlgButtons'>";
-
-                       print "<button onclick=\"return emailArticleDo()\">".__('Send e-mail')."</button> ";
-                       print "<button onclick=\"return closeInfoBox()\">".__('Cancel')."</button>";
-
-                       print "]]></content>";
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').execute()\">".__('Send e-mail')."</button> ";
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').hide()\">".__('Cancel')."</button>";
+                       print "</div>";
 
                        //return;
                }
 
                        print "<div align='center'>";
 
-                       print "<button onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">".
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">".
                                __('Generate new URL')."</button> ";
 
-                       print "<button onclick=\"return closeInfoBox()\">".
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">".
                                __('Close this window')."</button>";
 
                        print "</div>";