/dev/adei-asec

To get this branch, use:
bzr branch http://darksoft.org/webbzr/dev/adei-asec

« back to all changes in this revision

Viewing changes to setups/katrin/js/filter.js

  • Committer: Suren A. Chilingaryan
  • Date: 2010-08-13 14:18:27 UTC
  • Revision ID: csa@dside.dyndns.org-20100813141827-u3o97425ppvd5g7y
Revert back to SetConfiguration from SetCustomProperties while handling certain property in search; trully support HTML content in description field within search results; support execution in XMLModule; support for setup-specific javascript code; KATRIN update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function filter_set_callbacks(filter)
 
2
{
 
3
    filter.after_load = function() {filter.AfterLoad();};
 
4
    filter.dates.attachEvent("onSelect", function(id) {filter.OnSelect(id);});
 
5
}
 
6
 
 
7
function FILTER(id, control)
 
8
{
 
9
    //this.last_selected = 0;
 
10
    
 
11
    this.dates = new dhtmlXTreeObject(id, "100%", "100%", 0);
 
12
    this.dates.enableTreeLines(true);
 
13
    if (adei.cfg.dhtmlx_iconset) {
 
14
        this.dates.setImagePath(adei.cfg.dhtmlx_iconset);
 
15
    }
 
16
    this.dates.setDataMode("xml");
 
17
 
 
18
    filter_set_callbacks(this);
 
19
}
 
20
 
 
21
FILTER.prototype.HasSearch = function()
 
22
{
 
23
    return this.search != "" && this.search != undefined;
 
24
}
 
25
 
 
26
FILTER.prototype.OnSelect = function(id)
 
27
{
 
28
    //if (!this.HasSearch()) {
 
29
    //    this.last_selected = id;
 
30
    //}
 
31
    adei.SetCustomProperties("kdb_page=1&kdb_date=" + id);
 
32
}
 
33
 
 
34
FILTER.prototype.AfterLoad = function()
 
35
{
 
36
    if (this.HasSearch()) {
 
37
        this.dates.selectItem("all", true, false);
 
38
    }
 
39
    else {
 
40
        //this.dates.selectItem(this.last_selected, true, false);
 
41
        // Year
 
42
        var index = this.dates.hasChildren("all") - 1;
 
43
        if (index != -1) {
 
44
            var id = this.dates.getItemIdByIndex("all", index);
 
45
            this.dates.openItem(id);
 
46
            // Month
 
47
            index = this.dates.hasChildren(id) - 1;
 
48
            id = this.dates.getItemIdByIndex(id, index);
 
49
            this.dates.openItem(id);
 
50
            // Day
 
51
            index = this.dates.hasChildren(id) - 1;
 
52
            id = this.dates.getItemIdByIndex(id, index);
 
53
            this.dates.selectItem(id, true, false);
 
54
        }
 
55
    }
 
56
}
 
57
 
 
58
FILTER.prototype.SetSearch = function(search)
 
59
{
 
60
    if (search == this.search) {
 
61
        var selected = this.dates.getSelectedItemId();
 
62
        katrin.SetCustomProperties("kdb_date=" + selected);
 
63
        return;
 
64
    }
 
65
 
 
66
    this.search = search;
 
67
    this.dates.deleteChildItems(0);
 
68
    
 
69
    var props = "target=dates&kdb_search=" + this.search;
 
70
    this.dates.loadXML(adei.GetServiceURL("katrin", props), this.after_load);
 
71
}
 
72
 
 
73
FILTER.prototype.SetParameters = function(parameters)
 
74
{
 
75
    
 
76
}