fix drag and drop changing of categories; fix empty categories using wrong icon class
This commit is contained in:
parent
f0259baf13
commit
e8c20f9262
|
@ -36,7 +36,7 @@ dojo.declare("fox.PrefFeedTree", lib.CheckBoxTree, {
|
||||||
"dijitTreeRow Error";
|
"dijitTreeRow Error";
|
||||||
},
|
},
|
||||||
getIconClass: function (item, opened) {
|
getIconClass: function (item, opened) {
|
||||||
return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feedIcon";
|
return (!item || this.model.store.getValue(item, 'type') == 'category') ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feedIcon";
|
||||||
},
|
},
|
||||||
checkItemAcceptance: function(target, source, position) {
|
checkItemAcceptance: function(target, source, position) {
|
||||||
var item = dijit.getEnclosingWidget(target).item;
|
var item = dijit.getEnclosingWidget(target).item;
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
$root['id'] = 'root';
|
$root['id'] = 'root';
|
||||||
$root['name'] = __('Feeds');
|
$root['name'] = __('Feeds');
|
||||||
$root['items'] = array();
|
$root['items'] = array();
|
||||||
|
$root['type'] = 'category';
|
||||||
|
|
||||||
if (get_pref($link, 'ENABLE_FEED_CATS')) {
|
if (get_pref($link, 'ENABLE_FEED_CATS')) {
|
||||||
|
|
||||||
|
@ -44,6 +45,7 @@
|
||||||
$cat['bare_id'] = $feed_id;
|
$cat['bare_id'] = $feed_id;
|
||||||
$cat['name'] = $line['title'];
|
$cat['name'] = $line['title'];
|
||||||
$cat['items'] = array();
|
$cat['items'] = array();
|
||||||
|
$cat['type'] = 'category';
|
||||||
|
|
||||||
$feed_result = db_query($link, "SELECT id, title, last_error
|
$feed_result = db_query($link, "SELECT id, title, last_error
|
||||||
FROM ttrss_feeds
|
FROM ttrss_feeds
|
||||||
|
@ -132,12 +134,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($subop == "savefeedorder") {
|
if ($subop == "savefeedorder") {
|
||||||
if ($_POST['payload']) {
|
# if ($_POST['payload']) {
|
||||||
file_put_contents("/tmp/blahblah.txt", $_POST['payload']);
|
# file_put_contents("/tmp/blahblah.txt", $_POST['payload']);
|
||||||
}
|
# $data = json_decode($_POST['payload'], true);
|
||||||
|
# } else {
|
||||||
|
# $data = json_decode(file_get_contents("/tmp/blahblah.txt"), true);
|
||||||
|
# }
|
||||||
|
|
||||||
$data = file_get_contents("/tmp/blahblah.txt");
|
$data = json_decode($_POST['payload'], true);
|
||||||
$data = json_decode($data, true);
|
|
||||||
|
|
||||||
if (is_array($data) && is_array($data['items'])) {
|
if (is_array($data) && is_array($data['items'])) {
|
||||||
$cat_order_id = 0;
|
$cat_order_id = 0;
|
||||||
|
@ -145,8 +149,17 @@
|
||||||
$data_map = array();
|
$data_map = array();
|
||||||
|
|
||||||
foreach ($data['items'] as $item) {
|
foreach ($data['items'] as $item) {
|
||||||
|
|
||||||
|
if ($item['id'] != 'root') {
|
||||||
|
if (is_array($item['items'])) {
|
||||||
|
if (isset($item['items']['_reference'])) {
|
||||||
|
$data_map[$item['id']] = array($item['items']);
|
||||||
|
} else {
|
||||||
$data_map[$item['id']] =& $item['items'];
|
$data_map[$item['id']] =& $item['items'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($data['items'][0]['items'] as $item) {
|
foreach ($data['items'][0]['items'] as $item) {
|
||||||
$id = $item['_reference'];
|
$id = $item['_reference'];
|
||||||
|
@ -165,10 +178,17 @@
|
||||||
if (is_array($data_map[$id])) {
|
if (is_array($data_map[$id])) {
|
||||||
foreach ($data_map[$id] as $feed) {
|
foreach ($data_map[$id] as $feed) {
|
||||||
$id = $feed['_reference'];
|
$id = $feed['_reference'];
|
||||||
$bare_id = substr($id, strpos($id, ':')+1);
|
$feed_id = substr($id, strpos($id, ':')+1);
|
||||||
|
|
||||||
|
if ($bare_id != 0)
|
||||||
|
$cat_query = "cat_id = '$bare_id'";
|
||||||
|
else
|
||||||
|
$cat_query = "cat_id = NULL";
|
||||||
|
|
||||||
db_query($link, "UPDATE ttrss_feeds
|
db_query($link, "UPDATE ttrss_feeds
|
||||||
SET order_id = '$feed_order_id' WHERE id = '$bare_id' AND
|
SET order_id = '$feed_order_id',
|
||||||
|
$cat_query
|
||||||
|
WHERE id = '$feed_id' AND
|
||||||
owner_uid = " . $_SESSION["uid"]);
|
owner_uid = " . $_SESSION["uid"]);
|
||||||
|
|
||||||
++$feed_order_id;
|
++$feed_order_id;
|
||||||
|
|
Loading…
Reference in New Issue