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();
46 var form = (getForm() == "all") ? null : getForm();
47 var req = new Request(FETCH_RIDS, getMrid(), form );
48 req.callback( rresultHandleRIds );
53 function rresultHandleList() {
54 var ids = new CGI().param(PARAM_RLIST);
55 if(ids) _rresultHandleIds(ids, ids.length);
58 function rresultHandleRIds(r) {
59 var res = r.getResultObject();
60 _rresultHandleIds(res.ids, res.count);
63 function _rresultHandleIds(ids, count) {
64 HITCOUNT = parseInt(count);
65 runEvt('result', 'hitCountReceived');
66 runEvt('result', 'idsReceived', ids);
69 function rresultCollectRecords(ids) {
70 runEvt("result", "preCollectRecords");
72 for( var i = getOffset(); i!= getDisplayCount() + getOffset(); i++ ) {
73 if(ids[i] == null) break;
74 var req = new Request(FETCH_RMODS, parseInt(ids[i]));
75 req.callback(rresultHandleMods);
76 req.request.userdata = x++;
81 function rresultHandleMods(r) {
82 var rec = r.getResultObject();
83 runEvt('result', 'recordReceived', rec, r.userdata, false);
84 resultCollectCopyCounts(rec, r.userdata, FETCH_R_COPY_COUNTS);
85 if(resultPageIsDone()) {
86 runEvt('result', 'allRecordsReceived', recordsCache);
87 unHideMe($('copyright_block'));
92 function rresultLaunchDrawn(id, node) {
93 runEvt("rresult", "recordDrawn", id, node);
97 function rresultDoRecordSearch() {
99 var form = (!getForm() || getForm() == "all") ? null : getForm();
100 var sort = (getSort() == SORT_TYPE_REL) ? null : getSort();
101 var sortdir = (sort) ? ((getSortDir()) ? getSortDir() : SORT_DIR_ASC) : null;
103 var req = new Request(FETCH_SEARCH_RIDS, getRtype(),
107 org_unit : getLocation(),
109 limit : rresultLimit,
110 offset : getOffset(),
113 req.callback(rresultFilterSearchResults);
117 function rresultFilterSearchResults(r) {
118 var result = r.getResultObject();
120 for( var i = 0; i != result.ids.length; i++ )
121 ids.push(result.ids[i][0]);
122 _rresultHandleIds( ids, result.count );