Invalid item argument in setFeedUnread()

Development-related discussion, including bundled plugins
Cyanatide
Bear Rating Trainee
Bear Rating Trainee
Posts: 5
Joined: 30 May 2013, 14:29

Invalid item argument in setFeedUnread()

Postby Cyanatide » 01 Jul 2013, 13:52

Hi!
I try to modify makefeedtree() to have in one hand a menu which list my feed separating local feeds (on my server) and external feeds:

Code: Select all

$src_feed = array();
$src_feed['id'] = 'src';
$src_feed['name'] = __('Source feeds');
$src_feed['items'] = array();
$src_feed['type'] = 'category';

$cat = array();
$cat['id'] = 'LOCAL';
$cat['bare_id'] = 0;
$cat['name'] = __('Local feeds');
$cat['items'] = array();
$cat['checkbox'] = false;
$cat['type'] = 'category';
$cat['unread'] = 0;
$cat['child_unread'] = 0;

[function to get my feeds]

$cat = array();
$cat['id'] = 'EXTERNAL';
$cat['bare_id'] = 1;
$cat['name'] = __('External feeds');
$cat['items'] = array();
$cat['checkbox'] = false;
$cat['type'] = 'category';
$cat['unread'] = 0;
$cat['child_unread'] = 0;

[function to get my feeds]


and in the other hand a menu listing my feeds by category:

Code: Select all

$tgt_feed = array();
$tgt_feed['id'] = 'tgt';
$tgt_feed['name'] = __('Target feeds');
$tgt_feed['items'] = array();
$tgt_feed['type'] = 'category';

[function to get my feeds, using get_category_items()]


If I display the two menus separatly, no problem but if I display both menus:

Code: Select all

$fl['items'] = array($src_feed, $tgt_feed);
.

I get This Error:

Code: Select all

Exception: Error, dojo.data.ItemFileWriteStore: Invalid item argument.
Function: setFeedUnread()
Location: tt-rss-layer.js?1368437666:15

The error will be reported to the configured log destination.

Stack trace:

.cache["dojo/data/ItemFileReadStore"]/</_139<[email protected]://erss.test.cluster.local/lib/dojo/tt-rss-layer.js?1368437666:15
.cache["dojo/data/ItemFileWriteStore"]/</<[email protected]://erss.test.cluster.local/lib/dojo/tt-rss-layer.js?1368437666:15
.cache["dojo/data/ItemFileWriteStore"]/</<[email protected]://erss.test.cluster.local/lib/dojo/tt-rss-layer.js?1368437666:15
[email protected]://erss.test.cluster.local/index.php#f=39&c=0:542
[email protected]://erss.test.cluster.local/index.php#f=39&c=0:539
[email protected]://erss.test.cluster.local/index.php#f=39&c=0:349
[email protected]://erss.test.cluster.local/index.php#f=39&c=0:333
[email protected]://erss.test.cluster.local/index.php#f=39&c=0:101
[email protected]://erss.test.cluster.local/index.php#f=39&c=0:329
Ajax.Request<[email protected]://erss.test.cluster.local/lib/prototype.js?1368437666:1617
Ajax.Request<[email protected]://erss.test.cluster.local/lib/prototype.js?1368437666:1547
bind/<@http://erss.test.cluster.local/lib/prototype.js?1368437666:393


What is this error? How can i solve it?
Thanks!

Cyanatide
Bear Rating Trainee
Bear Rating Trainee
Posts: 5
Joined: 30 May 2013, 14:29

Re: Invalid item argument in setFeedUnread()

Postby Cyanatide » 02 Jul 2013, 13:30

New information, in fact, the problem is that each feed is listed two time: one time in array $src_feed and another time in $tgt_feed. I do not want a unicity constraint in my tree. Where can I remove it?

Cyanatide
Bear Rating Trainee
Bear Rating Trainee
Posts: 5
Joined: 30 May 2013, 14:29

Re: Invalid item argument in setFeedUnread()

Postby Cyanatide » 03 Jul 2013, 11:42

Ok, I think my problem comes from my object treeItem in my function setFeedValue:

Code: Select all

setFeedValue: function(feed, is_cat, key, value) {
      if (!value) value = '';
      if (!this.store._itemsByIdentity) return undefined;

      if (is_cat)
         treeItem = this.store._itemsByIdentity['CAT:' + feed];
      else
         treeItem = this.store._itemsByIdentity['FEED:' + feed];

      if (treeItem){
         if(feed==57)
         {
         alert("feed:"+feed+", is_cat:"+is_cat+", key:"+key+", value:"+value);
         console.log(treeItem);
         }
         return this.store.setValue(treeItem, key, value);
      }
   },

Here is my treeItem in the working case:

Code: Select all

({id:["FEED:57"], bare_id:[57], name:["Le Monde.fr : \xE0 la Une"], checkbox:[false], error:[""], icon:["feed-icons/57.ico"], param:["Jul 02, 18:11"], unread:[0], type:["feed"], _S:{_arrayOfAllItems:[{id:["src"], name:["Source feeds"], items:[{id:["EXTERNAL"], bare_id:[1], name:["External feeds"], items:[{}], checkbox:[false], type:["category"], unread:[0], child_unread:[0], param:["(1 feed)"], _S:{}, _0:1, _RRM:{src:{items:true}}}], type:["category"], param:[1], _RI:true, _S:{}, _0:0}, {id:["EXTERNAL"], bare_id:[1], name:["External feeds"], items:[{}], checkbox:[false], type:["category"], unread:[0], child_unread:[0], param:["(1 feed)"], _S:{}, _0:1, _RRM:{src:{items:true}}}, {}], _arrayOfTopLevelItems:[{id:["src"], name:["Source feeds"], items:[{id:["EXTERNAL"], bare_id:[1], name:["External feeds"], items:[{}], checkbox:[false], type:["category"], unread:[0], child_unread:[0], param:["(1 feed)"], _S:{}, _0:1, _RRM:{src:{items:true}}}], type:["category"], param:[1], _RI:true, _S:{}, _0:0}], _loadFinished:true, _jsonFileUrl:"backend.php?op=pref_feeds&method=getfeedtree", _ccUrl:"backend.php?op=pref_feeds&method=getfeedtree", url:"backend.php?op=pref_feeds&method=getfeedtree", _jsonData:(void 0), data:null, _datatypeMap:{Date:{type:function Date() {
    [native code]
}, deserialize:(function (_13b){return _138.fromISOString(_13b);}), serialize:(function (obj){return _d0.toISOString(obj,{zulu:true});})}}, _features:{'dojo.data.api.Read':true, 'dojo.data.api.Identity':"id", 'dojo.data.api.Write':true, 'dojo.data.api.Notification':true}, _itemsByIdentity:{src:{id:["src"], name:["Source feeds"], items:[{id:["EXTERNAL"], bare_id:[1], name:["External feeds"], items:[{}], checkbox:[false], type:["category"], unread:[0], child_unread:[0], param:["(1 feed)"], _S:{}, _0:1, _RRM:{src:{items:true}}}], type:["category"], param:[1], _RI:true, _S:{}, _0:0}, EXTERNAL:{id:["EXTERNAL"], bare_id:[1], name:["External feeds"], items:[{}], checkbox:[false], type:["category"], unread:[0], child_unread:[0], param:["(1 feed)"], _S:{}, _0:1, _RRM:{src:{items:true}}}, 'FEED:57':{}}, _storeRefPropName:"_S", _itemNumPropName:"_0", _rootItemPropName:"_RI", _reverseRefMap:"_RRM", _loadInProgress:false, _queuedFetches:[], _pending:{_newItems:{}, _modifiedItems:{}, _deletedItems:{}}, _saveInProgress:false, onNew:(function (){
"use strict";
var _25b=_249;var args=arguments;var _25c=_25a.before;while(_25c){args=_25c.advice.apply(this,args)||args;_25c=_25c.next;}if(_25a.around){var _25d=_25a.around.advice(this,args);}var _25e=_25a.after;while(_25e&&_25e.id<_25b){if(_25e.receiveArguments){var _25f=_25e.advice.apply(this,args);_25d=_25f===_248?_25d:_25f;}else{_25d=_25e.advice.call(this,_25d,args);}_25e=_25e.next;}return _25d;}), onDelete:(function (){
"use strict";
var _25b=_249;var args=arguments;var _25c=_25a.before;while(_25c){args=_25c.advice.apply(this,args)||args;_25c=_25c.next;}if(_25a.around){var _25d=_25a.around.advice(this,args);}var _25e=_25a.after;while(_25e&&_25e.id<_25b){if(_25e.receiveArguments){var _25f=_25e.advice.apply(this,args);_25d=_25f===_248?_25d:_25f;}else{_25d=_25e.advice.call(this,_25d,args);}_25e=_25e.next;}return _25d;}), onSet:(function (){
"use strict";
var _25b=_249;var args=arguments;var _25c=_25a.before;while(_25c){args=_25c.advice.apply(this,args)||args;_25c=_25c.next;}if(_25a.around){var _25d=_25a.around.advice(this,args);}var _25e=_25a.after;while(_25e&&_25e.id<_25b){if(_25e.receiveArguments){var _25f=_25e.advice.apply(this,args);_25d=_25f===_248?_25d:_25f;}else{_25d=_25e.advice.call(this,_25d,args);}_25e=_25e.next;}return _25d;}), _labelAttr:"name"}, _0:2, _RRM:{EXTERNAL:{items:true}}})


And now the case where it doesn't work:

Code: Select all

({id:["FEED:57"], bare_id:[57], name:["Le Monde.fr : \xE0 la Une"], checkbox:[false], error:[""], icon:["feed-icons/57.ico"], param:["Jul 02, 18:11"], unread:[0], type:["feed"]})


It seems that my object treeItem isn't correctly created!
Have you an idea?


Return to “Development”

Who is online

Users browsing this forum: No registered users and 3 guests