1 var records = new Array();
4 var rresultLimit = 200;
6 function rresultUnload() { removeChildren(table); table = null;}
8 attachEvt("common", "unload", rresultUnload);
9 attachEvt("common", "run", rresultDoSearch);
10 attachEvt("result", "idsReceived", rresultCollectRecords);
11 attachEvt("result", "recordDrawn", rresultLaunchDrawn);
13 hideMe($('copyright_block'));
15 function rresultDoSearch() {
16 table = G.ui.result.main_table;
17 hideMe(G.ui.result.row_template);
18 while( table.parentNode.rows.length <= (getDisplayCount() +1) )
19 hideMe(table.appendChild(G.ui.result.row_template.cloneNode(true)));
23 function rresultCollectIds() {
28 ids = JSON2js(cookieManager.read(COOKIE_RIDS));
29 _rresultHandleIds( ids, ids.length );
37 rresultDoRecordSearch();
48 var form = (getForm() == "all") ? null : getForm();
49 var req = new Request(FETCH_RIDS, getMrid(), form );
50 req.callback( rresultHandleRIds );
55 function rresultHandleList() {
56 var ids = new CGI().param(PARAM_RLIST);
57 if(ids) _rresultHandleIds(ids, ids.length);
60 function rresultHandleRIds(r) {
61 var res = r.getResultObject();
62 _rresultHandleIds(res.ids, res.count);
65 function _rresultHandleIds(ids, count) {
66 HITCOUNT = parseInt(count);
67 runEvt('result', 'hitCountReceived');
68 runEvt('result', 'idsReceived', ids);
71 function rresultCollectRecords(ids) {
72 runEvt("result", "preCollectRecords");
74 for( var i = getOffset(); i!= getDisplayCount() + getOffset(); i++ ) {
75 if(ids[i] == null) break;
76 var req = new Request(FETCH_RMODS, parseInt(ids[i]));
77 req.callback(rresultHandleMods);
78 req.request.userdata = x++;
83 function rresultHandleMods(r) {
84 var rec = r.getResultObject();
85 runEvt('result', 'recordReceived', rec, r.userdata, false);
86 resultCollectCopyCounts(rec, r.userdata, FETCH_R_COPY_COUNTS);
87 if(resultPageIsDone()) {
88 runEvt('result', 'allRecordsReceived', recordsCache);
89 unHideMe($('copyright_block'));
94 function rresultLaunchDrawn(id, node) {
95 runEvt("rresult", "recordDrawn", id, node);
99 function rresultDoRecordSearch() {
101 var form = (!getForm() || getForm() == "all") ? null : getForm();
102 var sort = (getSort() == SORT_TYPE_REL) ? null : getSort();
103 var sortdir = (sort) ? ((getSortDir()) ? getSortDir() : SORT_DIR_ASC) : null;
105 var req = new Request(FETCH_SEARCH_RIDS, getRtype(),
109 org_unit : getLocation(),
111 limit : rresultLimit,
112 offset : getOffset(),
115 req.callback(rresultFilterSearchResults);
119 function rresultFilterSearchResults(r) {
120 var result = r.getResultObject();
122 for( var i = 0; i != result.ids.length; i++ )
123 ids.push(result.ids[i][0]);
124 _rresultHandleIds( ids, result.count );