diff --git a/modules/popup-dialog.php b/modules/popup-dialog.php index 062542a1c..1b90ecfd7 100644 --- a/modules/popup-dialog.php +++ b/modules/popup-dialog.php @@ -68,36 +68,44 @@ if ($id == "editPrefProfiles") { - print "".__('Settings Profiles').""; - print ""; - print "
-
"; - print "

"; +# print ""; + $result = db_query($link, "SELECT title,id FROM ttrss_settings_profiles WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title"); - print __('Select:')." - ".__('All').", - ".__('None').""; - print "

"; print "
"; - print ""; + print "
"; - print ""; + print ""; #odd print ""; + onclick='toggleSelectRow2(this);' + dojoType=\"dijit.form.CheckBox\" + type=\"checkbox\">"; if (!$_SESSION["profile"]) { $is_active = __("(active)"); @@ -105,7 +113,7 @@ $is_active = ""; } - print ""; print ""; @@ -116,16 +124,17 @@ $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 ""; + print ""; $edit_title = htmlspecialchars($line["title"]); print ""; + onclick='toggleSelectRow2(this);' + dojoType=\"dijit.form.CheckBox\" + type=\"checkbox\">"; if ($_SESSION["profile"] == $line["id"]) { $is_active = __("(active)"); @@ -133,9 +142,23 @@ $is_active = ""; } - print ""; - + print ""; + print ""; ++$lnum; @@ -147,19 +170,16 @@ print "
- - + +
"; - print ""; - print "
"; - print "]]>"; - //return; } if ($id == "pubOPMLUrl") { diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index 0927b4837..d82cb3f0d 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -1061,7 +1061,7 @@ print ""; + type=\"checkbox\">"; print "
" . + print "" . __("Default profile") . " $is_active
" . - $edit_title . " $is_active" . $edit_title . + " + $is_active
"; diff --git a/prefs.js b/prefs.js index d82761609..6baa9a0d4 100644 --- a/prefs.js +++ b/prefs.js @@ -72,26 +72,6 @@ function notify_callback2(transport) { notify_info(transport.responseText); } -function init_profile_inline_editor() { - try { - - if ($("prefFeedCatList")) { - var elems = $("prefFeedCatList").getElementsByTagName("SPAN"); - - for (var i = 0; i < elems.length; i++) { - if (elems[i].id && elems[i].id.match("FCATT-")) { - var id = elems[i].id.replace("FCATT-", ""); - new Ajax.InPlaceEditor(elems[i], - 'backend.php?op=rpc&subop=saveprofile&id=' + id); - } - } - } - - } catch (e) { - exception_error("init_profile_inline_editor", e); - } -} - function updateFeedList(sort_key) { try { @@ -145,51 +125,6 @@ function updateUsersList(sort_key) { } } -function addPrefProfile() { - - var profile = $("fadd_profile"); - - if (profile.value.length == 0) { - alert(__("Can't add profile: no name specified.")); - } else { - notify_progress("Adding profile..."); - - var query = "?op=rpc&subop=addprofile&title=" + - param_escape(profile.value); - - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - editProfiles(); - } }); - - } -} - - -function addFeedCat() { - - var cat = $("fadd_cat"); - - if (cat.value.length == 0) { - alert(__("Can't add category: no name specified.")); - } else { - notify_progress("Adding feed category..."); - - var query = "?op=pref-feeds&subop=editCats&action=add&cat=" + - param_escape(cat.value); - - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - infobox_callback2(transport); - } }); - - cat.value = ""; - - } -} - function addUser() { try { @@ -1488,9 +1423,95 @@ function inPreferences() { } function editProfiles() { - displayDlg('editPrefProfiles', false, function() { - init_profile_inline_editor(); - }); + try { + + if (dijit.byId("profileEditDlg")) + dijit.byId("profileEditDlg").destroyRecursive(); + + var query = "backend.php?op=dlg&id=editPrefProfiles"; + + dialog = new dijit.Dialog({ + id: "profileEditDlg", + title: __("Settings Profiles"), + style: "width: 600px", + getSelectedProfiles: function() { + return getSelectedTableRowIds("prefFeedProfileList"); + }, + removeSelected: function() { + var sel_rows = this.getSelectedProfiles(); + + if (sel_rows.length > 0) { + var ok = confirm(__("Remove selected profiles? Active and default profiles will not be removed.")); + + if (ok) { + notify_progress("Removing selected profiles...", true); + + var query = "?op=rpc&subop=remprofiles&ids="+ + param_escape(sel_rows.toString()); + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + notify(''); + editProfiles(); + } }); + + } + + } else { + alert(__("No profiles are selected.")); + } + }, + activateProfile: function() { + var sel_rows = this.getSelectedProfiles(); + + if (sel_rows.length == 1) { + + var ok = confirm(__("Activate selected profile?")); + + if (ok) { + notify_progress("Loading, please wait..."); + + var query = "?op=rpc&subop=setprofile&id="+ + param_escape(sel_rows.toString()); + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + window.location.reload(); + } }); + } + + } else { + alert(__("Please choose a profile to activate.")); + } + }, + addProfile: function() { + if (this.validate()) { + notify_progress("Creating profile...", true); + + var query = "?op=rpc&subop=addprofile&title=" + + param_escape(dialog.attr('value').newprofile); + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + notify(''); + editProfiles(); + } }); + + } + }, + execute: function() { + if (this.validate()) { + } + }, + href: query}); + + dialog.show(); + } catch (e) { + exception_error("editProfiles", e); + } } function activatePrefProfile() {