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 function rresultDoSearch() {
14 table = G.ui.result.main_table;
15 hideMe(G.ui.result.row_template);
16 while( table.parentNode.rows.length <= (getDisplayCount() +1) )
17 hideMe(table.appendChild(G.ui.result.row_template.cloneNode(true)));
21 function rresultCollectIds() {
26 ids = JSON2js(cookieManager.read(COOKIE_RIDS));
27 _rresultHandleIds( ids, ids.length );
35 rresultDoRecordSearch();
44 var form = (getForm() == "all") ? null : getForm();
45 var req = new Request(FETCH_RIDS, getMrid(), form );
46 req.callback( rresultHandleRIds );
51 function rresultHandleList() {
52 var ids = new CGI().param(PARAM_RLIST);
53 if(ids) _rresultHandleIds(ids, ids.length);
56 function rresultHandleRIds(r) {
57 var res = r.getResultObject();
58 _rresultHandleIds(res.ids, res.count);
61 function _rresultHandleIds(ids, count) {
62 HITCOUNT = parseInt(count);
63 runEvt('result', 'hitCountReceived');
64 runEvt('result', 'idsReceived', ids);
67 function rresultCollectRecords(ids) {
68 runEvt("result", "preCollectRecords");
70 for( var i = getOffset(); i!= getDisplayCount() + getOffset(); i++ ) {
71 if(ids[i] == null) break;
72 var req = new Request(FETCH_RMODS, parseInt(ids[i]));
73 req.callback(rresultHandleMods);
74 req.request.userdata = x++;
79 function rresultHandleMods(r) {
80 var rec = r.getResultObject();
81 runEvt('result', 'recordReceived', rec, r.userdata, false);
82 resultCollectCopyCounts(rec, r.userdata, FETCH_R_COPY_COUNTS);
83 if(resultPageIsDone())
84 runEvt('result', 'allRecordsReceived', recordsCache);
88 function rresultLaunchDrawn(id, node) {
89 runEvt("rresult", "recordDrawn", id, node);
93 function rresultDoRecordSearch() {
95 var form = (!getForm() || getForm() == "all") ? null : getForm();
96 var sort = (getSort() == SORT_TYPE_REL) ? null : getSort();
97 var sortdir = (sort) ? ((getSortDir()) ? getSortDir() : SORT_DIR_ASC) : null;
99 var req = new Request(FETCH_SEARCH_RIDS, getRtype(),
103 org_unit : getLocation(),
105 limit : rresultLimit,
106 offset : getOffset(),
109 req.callback(rresultFilterSearchResults);
113 function rresultFilterSearchResults(r) {
114 var result = r.getResultObject();
116 for( var i = 0; i != result.ids.length; i++ )
117 ids.push(result.ids[i][0]);
118 _rresultHandleIds( ids, result.count );