[443] | 1 | define([ |
---|
[495] | 2 | "../../widgets/TabbedBrowser", |
---|
[487] | 3 | "../classes/categories", |
---|
| 4 | "../classes/questions", |
---|
| 5 | "../classes/topics", |
---|
[495] | 6 | "dojo/_base/array", |
---|
[487] | 7 | "dojo/_base/declare", |
---|
[495] | 8 | "dojo/_base/lang" |
---|
| 9 | ], function(TabbedBrowser, categories, questions, topics, array, declare, lang) { |
---|
| 10 | return declare([TabbedBrowser],{ |
---|
[443] | 11 | tabPosition: 'left-h', |
---|
[495] | 12 | include: null, |
---|
[443] | 13 | dndType: "question", |
---|
[495] | 14 | getCategories: function(){ |
---|
[501] | 15 | var opts = {}; |
---|
| 16 | if ( this.include ) { opts[this.include] = true; } |
---|
| 17 | return categories.query(opts); |
---|
[443] | 18 | }, |
---|
[495] | 19 | getCategoryName: function(category){ return category.name; }, |
---|
| 20 | getCategoryCount: function(category){ return category.count; }, |
---|
| 21 | getTopics: function(category) { |
---|
[501] | 22 | var opts = {category:category.name}; |
---|
| 23 | if ( this.include ) { opts[this.include] = true; } |
---|
| 24 | return topics.query(opts); |
---|
[495] | 25 | }, |
---|
| 26 | getTopicName: function(topic){ return topic.name; }, |
---|
| 27 | getTopicCount: function(topic){ return topic.count; }, |
---|
| 28 | getItems: function(category,topic) { |
---|
[501] | 29 | var opts = {category:category.name,topic:topic.name}; |
---|
| 30 | if ( this.include ) { opts[this.include] = true; } |
---|
| 31 | return questions.query(opts); |
---|
[443] | 32 | }, |
---|
[495] | 33 | getItemName: function(item) { |
---|
[477] | 34 | var title = '['+item.code+']'+item.title; |
---|
[535] | 35 | if ( !this.include && !item.publicationDate ) { |
---|
| 36 | title += ' (*)'; |
---|
[477] | 37 | } |
---|
| 38 | return title; |
---|
| 39 | }, |
---|
[495] | 40 | areItemsEqual: function(i1,i2) { |
---|
| 41 | return questions.getId(i1) === questions.getId(i2); |
---|
[443] | 42 | } |
---|
| 43 | }); |
---|
| 44 | }); |
---|