]> git.wh0rd.org - tt-rss.git/commitdiff
move editPrefProfiles to pref-prefs
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 1 Apr 2013 08:34:49 +0000 (12:34 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 1 Apr 2013 08:34:49 +0000 (12:34 +0400)
classes/dlg.php
classes/pref/prefs.php
js/prefs.js

index 376f8d265d22980ff251136c5d842bdbc6847352..32a3b230afbbb7d6d48663bf42e7ec691001ce93 100644 (file)
@@ -42,122 +42,6 @@ class Dlg extends Handler_Protected {
                //return;
        }
 
-       function editPrefProfiles() {
-               print "<div dojoType=\"dijit.Toolbar\">";
-
-               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 "</div>";
-
-               $result = db_query($this->link, "SELECT title,id FROM ttrss_settings_profiles
-                       WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
-
-               print "<div class=\"prefProfileHolder\">";
-
-               print "<form id=\"profile_edit_form\" onsubmit=\"return false\">";
-
-               print "<table width=\"100%\" class=\"prefFeedProfileList\"
-                       cellspacing=\"0\" id=\"prefFeedProfileList\">";
-
-               print "<tr class=\"placeholder\" id=\"FCATR-0\">"; #odd
-
-               print "<td width='5%' align='center'><input
-                       id='FCATC-0'
-                       onclick='toggleSelectRow2(this);'
-                       dojoType=\"dijit.form.CheckBox\"
-                       type=\"checkbox\"></td>";
-
-               if (!$_SESSION["profile"]) {
-                       $is_active = __("(active)");
-               } else {
-                       $is_active = "";
-               }
-
-               print "<td><span>" .
-                       __("Default profile") . " $is_active</span></td>";
-
-               print "</tr>";
-
-               $lnum = 1;
-
-               while ($line = db_fetch_assoc($result)) {
-
-                       $class = ($lnum % 2) ? "even" : "odd";
-
-                       $profile_id = $line["id"];
-                       $this_row_id = "id=\"FCATR-$profile_id\"";
-
-                       print "<tr class=\"placeholder\" $this_row_id>";
-
-                       $edit_title = htmlspecialchars($line["title"]);
-
-                       print "<td width='5%' align='center'><input
-                               onclick='toggleSelectRow2(this);'
-                               id='FCATC-$profile_id'
-                               dojoType=\"dijit.form.CheckBox\"
-                               type=\"checkbox\"></td>";
-
-                       if ($_SESSION["profile"] == $line["id"]) {
-                               $is_active = __("(active)");
-                       } else {
-                               $is_active = "";
-                       }
-
-                       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', method: '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 "</table>";
-               print "</form>";
-               print "</div>";
-
-               print "<div class='dlgButtons'>
-                       <div style='float : left'>
-                       <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 dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').hide()\">".
-                       __('Close this window')."</button>";
-               print "</div>";
-
-       }
-
        function pubOPMLUrl() {
                $url_path = Opml::opml_publish_url($this->link);
 
index 21b25c6319d44e3b3fc4d070d7b978612e002d7f..cc523092f4af3996110f6582d2d6edea988889b1 100644 (file)
@@ -2,7 +2,7 @@
 class Pref_Prefs extends Handler_Protected {
 
        function csrf_ignore($method) {
-               $csrf_ignored = array("index", "updateself", "customizecss");
+               $csrf_ignored = array("index", "updateself", "customizecss", "editprefprofiles");
 
                return array_search($method, $csrf_ignored) !== false;
        }
@@ -898,5 +898,122 @@ class Pref_Prefs extends Handler_Protected {
 
        }
 
+       function editPrefProfiles() {
+               print "<div dojoType=\"dijit.Toolbar\">";
+
+               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 "</div>";
+
+               $result = db_query($this->link, "SELECT title,id FROM ttrss_settings_profiles
+                       WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
+
+               print "<div class=\"prefProfileHolder\">";
+
+               print "<form id=\"profile_edit_form\" onsubmit=\"return false\">";
+
+               print "<table width=\"100%\" class=\"prefFeedProfileList\"
+                       cellspacing=\"0\" id=\"prefFeedProfileList\">";
+
+               print "<tr class=\"placeholder\" id=\"FCATR-0\">"; #odd
+
+               print "<td width='5%' align='center'><input
+                       id='FCATC-0'
+                       onclick='toggleSelectRow2(this);'
+                       dojoType=\"dijit.form.CheckBox\"
+                       type=\"checkbox\"></td>";
+
+               if (!$_SESSION["profile"]) {
+                       $is_active = __("(active)");
+               } else {
+                       $is_active = "";
+               }
+
+               print "<td><span>" .
+                       __("Default profile") . " $is_active</span></td>";
+
+               print "</tr>";
+
+               $lnum = 1;
+
+               while ($line = db_fetch_assoc($result)) {
+
+                       $class = ($lnum % 2) ? "even" : "odd";
+
+                       $profile_id = $line["id"];
+                       $this_row_id = "id=\"FCATR-$profile_id\"";
+
+                       print "<tr class=\"placeholder\" $this_row_id>";
+
+                       $edit_title = htmlspecialchars($line["title"]);
+
+                       print "<td width='5%' align='center'><input
+                               onclick='toggleSelectRow2(this);'
+                               id='FCATC-$profile_id'
+                               dojoType=\"dijit.form.CheckBox\"
+                               type=\"checkbox\"></td>";
+
+                       if ($_SESSION["profile"] == $line["id"]) {
+                               $is_active = __("(active)");
+                       } else {
+                               $is_active = "";
+                       }
+
+                       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', method: '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 "</table>";
+               print "</form>";
+               print "</div>";
+
+               print "<div class='dlgButtons'>
+                       <div style='float : left'>
+                       <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 dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').hide()\">".
+                       __('Close this window')."</button>";
+               print "</div>";
+
+       }
+
+
 }
 ?>
index 678332616344a336fde7418105ae7e19177dca2d..30dad0d880c417f810aff64d5b62cc3fcea82380 100644 (file)
@@ -1400,7 +1400,7 @@ function editProfiles() {
                if (dijit.byId("profileEditDlg"))
                        dijit.byId("profileEditDlg").destroyRecursive();
 
-               var query = "backend.php?op=dlg&method=editPrefProfiles";
+               var query = "backend.php?op=pref-prefs&method=editPrefProfiles";
 
                dialog = new dijit.Dialog({
                        id: "profileEditDlg",