PageSourceSearch

https://imigresen-online.imi.gov.my/eservices/js/BaseCommon.js?v=3

js imi.gov.my collected 2026-09-24 08:56:05 UTC 16,895 bytes, 486 lines download raw bytes

1function doThis(doWhat, actionName){
2    var hdAct = doWhat.split("&")[0];
3    document.forms[0].hdAction.value=hdAct;
4
5    if( hdAct == "create" || hdAct == "update" || hdAct == "createOrUpdate"  || hdAct == "CREATEUPDATE_BLOCKMENU"
6        ) {
7        if(confirm("Are you sure ?")){
8            // genXML(); // uncomment this if audit trails is require
9            document.forms[0].submit();
10        }
11    }
12    else if( hdAct == "delete" ||hdAct == "RESET_PASSWORD"||hdAct == "FORCE_LOGOUT" ) {
13        if(confirm("Are you sure to "+hdAct+" this record")){
14            // genXML(); // uncomment this if audit trails is require
15            document.forms[0].action=actionName+"?hdAction="+doWhat;
16            document.forms[0].submit();
17        }
18    }
19    else {
20        if( hdAct == "getSearchUpdate" ){
21            if(confirm("Current setting will be reset, are you sure to get latest schema ?")){
22                document.forms[0].submit();
23            }
24            return;
25        }
26        else {
27
28            if(hdAct == "getSort"){
29                var sortId = doWhat.split("=")[1];
30                document.getElementById("hdAction").value=hdAct;
31                document.getElementById("sortId").value=sortId;
32                document.forms[0].action=actionName;
33            }
34            else if(hdAct == "getCreate" ||hdAct == "getList" ){
35                document.getElementById("hdAction").value=hdAct;
36                document.forms[0].action=actionName;
37            }
38            else {
39                document.forms[0].action=actionName+"?hdAction="+doWhat;
40            }
41
42            document.forms[0].submit();
43        }
44    }
45}
46
47function openNewWindow(doWhat, actionName){
48    newWindow(actionName+"?hdAction="+doWhat,'name','700','400','yes');
49}
50
51function newWindow(mypage,myname,w,h,scroll){
52    var win= null;
53    var winl = (screen.width-w)/2;
54    var wint = (screen.height-h)/2;
55    var settings ='height='+h+',';
56    settings +='width='+w+',';
57    settings +='top='+wint+',';
58    settings +='left='+winl+',';
59    settings +='scrollbars='+scroll+',';
60    settings +='resizable=yes';
61    win=window.open(mypage,myname,settings);
62    if(parseInt(navigator.appVersion) >= 4){
63        win.window.focus();
64    }
65}
66
67function popUpThirdPartyAttach(url){
68    popUpWin(url,'upload','900','500','no');//popUpWin(url,'name','500','650','no');
69
70}
71
72function popUpWin(mypage,myname,w,h,scroll){
73	var win = null;
74	var winl = (screen.width-w)/2;
75	var wint = (screen.height-h)/2;
76	var settings ='height='+h+',';
77	settings +='width='+w+',';
78	settings +='top='+wint+',';
79	settings +='left='+winl+',';
80	settings +='scrollbars='+scroll+',';
81	settings +='resizable=no';
82	win=window.open(mypage,myname,settings);
83	if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
84}
85
86function doWorkflow(doWhat, actionName){
87
88    var hdAct = doWhat.split("&")[0];
89    if( hdAct == "RELEASE_ME" || hdAct == "ADM_RELEASE_ME") {
90        if(confirm("Are you sure ?")){
91
92            document.forms[0].action=actionName+"?hdAction="+doWhat;
93            document.forms[0].submit();
94        }
95    }else {
96
97        document.forms[0].action=actionName+"?hdAction="+doWhat;
98        document.forms[0].submit();
99
100    }
101
102
103}
104
105function getMenuTree(modCd,actionName, isDefault){
106    document.forms[0].action=actionName+"/ComMenuControl.mybase?hdAction=GET_MENUS&hdModCd="+modCd+"&hdIsDefault="+isDefault+"";
107    document.forms[0].submit();
108}
109
110function getMenuPage(doWhat){
111
112    var doAct = doWhat.split("?")[0];
113    var doInfo = doWhat.split("?")[1];
114     
115    var hdActVal = doInfo.split("&")[0].split("=")[1];
116    var hdMenuVal = doInfo.split("&")[1].split("=")[1];
117    var hdTxnVal = doInfo.split("&")[2].split("=")[1];
118     
119    document.getElementById("hdAction").value = hdActVal;
120    document.getElementById("menuId").value = hdMenuVal;
121    document.getElementById("txnId").value = hdTxnVal;
122    
123    document.forms[0].action=doAct;
124    if(document.getElementById("txtSchAll") != null){
125        document.getElementById("txtSchAll").value = "";
126    }
127    document.forms[0].submit();
128}
129
130
131function schAll(){
132    document.forms[0].hdAction.value="getList";
133    document.forms[0].submit();
134   
135}
136function checkSearchingData(schData){
137    if(schData != null && schData.length > 0 ){
138        highlightSearchTerms(schData);
139    }
140}
141
142function doShowAll(){
143    document.getElementById("txtSchAll").value = "";
144    document.forms[0].hdAction.value="getList";
145    document.forms[0].submit();
146    
147}
148
149/*
150* This is the function that actually highlights a text string by
151* adding HTML tags before and after all occurrences of the search
152* term. You can pass your own tags if you'd like, or if the
153* highlightStartTag or highlightEndTag parameters are omitted or
154* are empty strings then the default <font> tags will be used.
155*/
156function doHighlight(bodyText, searchTerm, highlightStartTag, highlightEndTag)
157{
158    // the highlightStartTag and highlightEndTag parameters are optional
159    if ((!highlightStartTag) || (!highlightEndTag)) {
160        highlightStartTag = "<font style='color:blue; background-color:yellow;'>";
161        highlightEndTag = "</font>";
162    }
163
164    // find all occurences of the search term in the given text,
165    // and add some "highlight" tags to them (we're not using a
166    // regular expression search, because we want to filter out
167    // matches that occur within HTML tags and script blocks, so
168    // we have to do a little extra validation)
169    var newText = "";
170    var i = -1;
171    var lcSearchTerm = searchTerm.toLowerCase();
172    var lcBodyText = bodyText.toLowerCase();
173
174    while (bodyText.length > 0) {
175        i = lcBodyText.indexOf(lcSearchTerm, i+1);
176        if (i < 0) {
177            newText += bodyText;
178            bodyText = "";
179        } else {
180            // skip anything inside an HTML tag
181            if (bodyText.lastIndexOf(">", i) >= bodyText.lastIndexOf("<", i)) {
182                // skip anything inside a <script> block
183                if (lcBodyText.lastIndexOf("/script>", i) >= lcBodyText.lastIndexOf("<script", i)) {
184                    newText += bodyText.substring(0, i) + highlightStartTag + bodyText.substr(i, searchTerm.length) + highlightEndTag;
185                    bodyText = bodyText.substr(i + searchTerm.length);
186                    lcBodyText = bodyText.toLowerCase();
187                    i = -1;
188                }
189            }
190        }
191    }
192
193    return newText;
194}
195
196
197/*
198* This is sort of a wrapper function to the doHighlight function.
199* It takes the searchText that you pass, optionally splits it into
200* separate words, and transforms the text on the current web page.
201* Only the "searchText" parameter is required; all other parameters
202* are optional and can be omitted.
203*/
204function highlightSearchTerms(searchText, treatAsPhrase, warnOnFailure, highlightStartTag, highlightEndTag)
205{
206    // if the treatAsPhrase parameter is true, then we should search for
207    // the entire phrase that was entered; otherwise, we will split the
208    // search string so that each word is searched for and highlighted
209    // individually
210    if (treatAsPhrase) {
211        searchArray = [searchText];
212    } else {
213        searchArray = searchText.split(" ");
214    }
215
216    if (!document.body || typeof(document.body.innerHTML) == "undefined") {
217        if (warnOnFailure) {
218            alert("Sorry, for some reason the text of this page is unavailable. Searching will not work.");
219        }
220        return false;
221    }
222
223    var bodyText = document.body.innerHTML;
224    for (var i = 0; i < searchArray.length; i++) {
225        bodyText = doHighlight(bodyText, searchArray[i], highlightStartTag, highlightEndTag);
226    }
227
228    document.body.innerHTML = bodyText;
229    return true;
230}
231
232
233//function gotoPageNo(act, maxPage, hdAction, path){
234//alert(hdAction);
235//    if(act == "first") {
236//        if(document.forms[0].currentPgNo.value=='1'){
237//            fnAlert(" Sorry, you are at the first page ");
238//            return;
239//        } else {
240//            document.forms[0].hdPgNo.value = '1';
241//        }
242//    }
243//    else if(act == "last") {
244//        if(document.forms[0].currentPgNo.value==maxPage){
245//            fnAlert(" Sorry, you are at the last page ");
246//            return;
247//        } else {
248//            document.forms[0].hdPgNo.value = maxPage;
249//        }
250//    }
251//    else if(act == "prev") {
252//        if(document.forms[0].currentPgNo.value=='1'){
253//            fnAlert(" Sorry, no previous page available because of you are at the first page ");
254//            return;
255//        } else {
256//            document.forms[0].hdPgNo.value = Math.abs(document.forms[0].currentPgNo.value) - 1;
257//        }
258//    }
259//    else if(act == "next") {
260//        if(document.forms[0].currentPgNo.value==maxPage){
261//            fnAlert(" Sorry, no next page available because of you are at the last page ");
262//            return;
263//        } else {
264//            document.forms[0].hdPgNo.value = Math.abs(document.forms[0].currentPgNo.value) + 1;
265//        }
266//    }
267//    else {
268//
269//
270//        if(CheckEntry("currentPgNo","3","y","N")){
271//            if(Math.abs(document.forms[0].currentPgNo.value) > maxPage ){
272//                fnAlert(" Sorry, only "+maxPage+" page/s available  ");
273//                return;
274//            }
275//            else {
276//                document.forms[0].hdPgNo.value = document.forms[0].currentPgNo.value;
277//            }
278//        }
279//        else {
280//            document.getElementById("currentPgNo").value = "1";
281//        }
282//    }
283//
284//
285//
286//    if(maxPage!='1'){
287//        //document.forms[0].hdAction.value="getList";
288//		alert("2")
289//        //document.forms[0].submit(hdAction);
290//		document.location.href = path+"/carianLulus?action="+hdAction;
291//    } else {
292//        fnAlert("Sorry, only one(1) page available");
293//        return;
294//    }
295//
296//}
297
298
299function doDelRow(rowStart, tblID){
300    var oMyTable = document.getElementById(tblID);
301    if(oMyTable.rows.length==2){
302        alert(" Sorry, you cannot delete first row ");
303        return false;
304    }
305    if(confirm("Are you sure to delete this row/s ?"))
306    {
307        for( a=0 ; a<2 ; a++)
308        {
309            for( i=rowStart ; i<oMyTable.rows.length ; i++)
310            {
311                oCheckBox =oMyTable.rows.item(i).cells(0).getElementsByTagName("INPUT").item(0);
312                if(oMyTable.rows.length==2){
313                    alert(" Sorry, you cannot delete first row ");
314                    break;
315                }
316                if(oCheckBox.checked)
317                {
318                    oNewRow = oMyTable.rows[i].removeNode(true);
319                }
320            }
321        }
322    }
323    return false;
324}
325
326
327function doAddWfLevelRow(tblId) {
328
329    var tbl=document.getElementById(tblId);
330    var i=document.getElementById("hdTable").rows.length;
331    var rowColor = (((i)%2)==0)?"gridnew":"gridnew";
332
333    var tbody = tbl.getElementsByTagName("TBODY")[0];
334    var row = document.createElement("TR")
335    var td1 = document.createElement("TD")
336    var td2 = document.createElement("TD")
337    var td3 = document.createElement("TD")
338    var td4 = document.createElement("TD")
339
340    td1.innerHTML = "<input type='checkbox' name='level_id' id='level_id_"+i+"' /><input type=\"hidden\" name=\"level_is_new\" value=\"Y\" />";
341    td2.innerHTML = "<input type='text' name='level_description' id='level_description_"+i+"' size=\"40\"  />";
342    td3.innerHTML = "<input type='text' name='level_flow_no' id='level_flow_no_"+i+"' size=\"5\"/>";
343    td4.innerHTML = "<input type='hidden' name='level_sts_id' id='level_sts_id_"+i+"' value=\"R01\"/> Active ";
344
345
346    td1.className=rowColor;
347    td2.className=rowColor;
348    td3.className=rowColor;
349    td4.className=rowColor;
350
351    row.appendChild(td1);
352    row.appendChild(td2);
353    row.appendChild(td3);
354    row.appendChild(td4);
355
356    tbody.appendChild(row);
357    doAddHiddenTable();
358
359}
360
361function doAddHiddenTable() {
362
363    var tbl=document.getElementById("hdTable");
364    var tbody = tbl.getElementsByTagName("TBODY")[0];
365    var row = document.createElement("TR")
366    var td1 = document.createElement("TD")
367    td1.innerHTML = "&nbsp;";
368    row.appendChild(td1);
369    tbody.appendChild(row);
370}
371
372function doDelWfLevelRow(rowStart, tblID){
373    var oMyTable = document.getElementById(tblID);
374    if(oMyTable.rows.length==2){
375        alert(" Sorry, you cannot delete first row ");
376        return false;
377    }
378    if(confirm("Are you sure to delete this row/s ?"))
379    {
380        for( a=0 ; a<2 ; a++)
381        {
382            for( i=rowStart ; i<oMyTable.rows.length ; i++)
383            {
384                oCheckBox =oMyTable.rows.item(i).cells(0).getElementsByTagName("INPUT").item(0);
385                if(oMyTable.rows.length==2){
386                    alert(" Sorry, you cannot delete first row ");
387                    break;
388                }
389                if(oCheckBox.checked) {
390                    oNewRow = oMyTable.rows[i].removeNode(true);
391                }
392            }
393        }
394    }
395    return false;
396}
397
398
399function populateResult( result, objId){
400    //document.getElementById(objId).value = result;
401    //document.getElementById(objId).style.width = ""+Math.abs( result.length * 7 )+"px";
402
403    // draw combo box
404
405    var combo = document.getElementById(objId);
406    var option = document.createElement("option");
407
408    combo.remove(combo);
409
410    option.text = result.split("-")[1];
411    option.value = result.split("-")[0];
412
413    try {
414        combo.add(option, null); //Standard
415    }catch(error) {
416        combo.add(option); // IE only
417    }
418
419}
420
421function populateResultUploadPspt(imagePath, imageValName, objId, imageId, gambaId){    
422    document.getElementById(objId).src = imageValName;//imagePath;
423    document.getElementById(imageId).value = imageValName;
424    document.getElementById(gambaId).disabled = false;
425}
426
427function populateResultUploadPspt(imagePath, imageValName, objId, imageId, gambaId, ICAOstr, ICAOnew, imagePhotoInd){    
428    if (typeof imageValName !== "undefined" && imageValName !== null && imageValName !== "") {
429        document.getElementById(objId).src = imageValName;//imagePath;
430        document.getElementById(imageId).value = imageValName;
431        document.getElementById(gambaId).disabled = false;
432    
433        document.getElementById("allICAOresult").value = ICAOstr;
434        document.getElementById("newICAOresult").value = ICAOnew;
435        document.getElementById("imagePhotoInd").value = imagePhotoInd;
436    }
437}
438
439function populateResultUploadPspt2(indicator,gambaId){    
440    document.getElementById("photoUploadSts").value = indicator;
441    if (indicator === 1) {
442//        document.getElementById('divPhotoImg').style.display = 'none';
443//        //document.getElementById(gambaId).disabled = false;
444//        document.getElementById('lblCbUploadPhoto').style.display = 'none';
445//        document.getElementById('lblCbBypassPhoto').style.display = 'inline';
446        document.getElementById("imageCheck").value = '99';
447    } else if (indicator === 0) {
448//        document.getElementById('divPhotoImg').style.display = 'inline';
449//        document.getElementById('lblCbUploadPhoto').style.display = 'inline';
450//        document.getElementById('lblCbBypassPhoto').style.display = 'none';
451        document.getElementById("imageCheck").value = '2';
452    }
453}
454
455function populateResultUploadMacs(imagePath, imageValName, objId, imageId, gambaId){
456    document.getElementById(objId).src = imageValName;//imagePath;
457    document.getElementById(imageId).value = imageValName;
458}
459
460function genXML(){
461    var frm = document.forms[0];
462
463    var auditXML = "<audit>";
464    with (frm) {
465        for (i=0; i < elements.length; i++) {
466            //if (elements[i].type != 'button' && elements[i].type != 'hidden') {
467            if (elements[i].type != 'button') {
468                if(!(elements[i].name=='hdAction' || elements[i].name=='hdPgNo' || elements[i].name=='hdAuditDtl')){
469                    auditXML += "<"+elements[i].name+">"+elements[i].value+"</"+elements[i].name+">";
470                }
471               
472            }
473        }
474        }
475    auditXML+="</audit>";
476    frm.hdAuditDtl.value = auditXML;
477//fnAlert("auditXML :"+frm.hdAuditDtl.value);
478}
479
480function getMenuTree(menuId){
481    alert('menuId >>'+menuId);
482    window.location.href=window.location.href+"?menuId=" + menuId;
483    document.getElementById("menuId").value = menuId;
484    session.setAttribute("REQ_MOD_CODE", menuId);
485//    document.forms[0].submit('getMenus');
486}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.