home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2003 September / PC Answers September 2003.iso / Software / trial / MonitorIT 5.2.06 / monitorit_fullsetup.exe / data1.cab / Js / GroupFunc.js < prev    next >
Encoding:
JavaScript  |  2003-06-24  |  2.9 KB  |  97 lines

  1. /* ======================================================================
  2. DESC: Common Group Functions for the Administer Operations
  3.  
  4. PLATFORMS: >= MS IE 4.0
  5.  
  6. USAGE NOTES: 
  7. ====================================================================== */
  8. var   GrpLupRecCount = 0; // Count of records returned from Group Lookup operation
  9. var   GrpSelectIdx = 0; // Index of currently selected Group 
  10. var    GroupRecLength = 4; // Length of a Group Lookup record in the Store
  11.  
  12. /* Process Group LOOKUP RECORD Event */
  13. function processGroupLookupRecord(Gid,GrpName,GrpDesc,GNameObj,GStoreObj) {
  14.     // place data from Lookup Record into specified Store
  15.     ++GrpLupRecCount;
  16.     if ( GNameObj != null ) {
  17.         addElementToSelect(GNameObj,GrpName);  
  18.     }
  19.     // Add to Storage
  20.     addElementToSelect(GStoreObj,GrpName);
  21.     addElementToSelect(GStoreObj,Gid);
  22.     addElementToSelect(GStoreObj,GrpDesc);
  23.     addElementToSelect(GStoreObj,0);
  24.     GroupRecLength = 4;
  25. }
  26.  
  27. /* Process DB Error in Group Lookup Operation */
  28. function processGroupOpError() {
  29.     top.Rstatus.Pstat("An error occurred during GROUP LOOKUP operation",true);
  30. }
  31.  
  32. /* Get Group Name from Store based on Group ID */
  33. function getGroupName(Gid,GSelObj,GStoreObj) {
  34.     var GrpName = "";
  35.     for (var i=0, j=0; i < GStoreObj.length; ++j, i+=GroupRecLength) {
  36.         if ( GStoreObj.options[i+1].text == Gid ) {
  37.             GrpName = GStoreObj.options[i].text;
  38.             GrpSelectIdx = j;
  39.             if ( GSelObj != null ) {
  40.                 GSelObj.options[j].selected = "selected";
  41.             }
  42.             break;
  43.         }
  44.     }
  45.     return GrpName;
  46. }
  47.  
  48. /* Get Group ID from Store based on Group Name */
  49. function getGroupID(GNM,GStoreObj) {
  50.     var GID = 0;
  51.     for (var i=0, j=0; i < GStoreObj.length; ++j, i+=GroupRecLength) {
  52.         if ( GStoreObj.options[i].text == GNM ) {
  53.             GrpSelectIdx = j;
  54.             GID = GStoreObj.options[i+1].text;
  55.             break;
  56.         }
  57.     }
  58.     return GID;
  59. }
  60.  
  61. /* Unconditionally deselect all Group names in combo */
  62. function allDeselectGroup(GSelObj) {
  63.     GSelObj.selectedIndex = -1;
  64. }
  65.  
  66. /* Are all Group Names Selected in combo? */
  67. function IsAllGroupSelected(GSobj,GCobj) {
  68.     allGSel = 0; // initialize count
  69.     var lth = GCobj.length;  // number of entries in the Combo
  70.     for (var i=0, j=3; i < lth; ++i, j+=GroupRecLength) { // Check each one
  71.         if (GCobj.options[i].selected) { // Selected?
  72.             GSobj.options[j].text = 1; // set selected
  73.             ++allGSel; 
  74.         }
  75.         else {
  76.             GSobj.options[j].text = 0; // set unselected    
  77.         }
  78.     }
  79.     allGSel = ((allGSel == 0) || (allGSel == lth)) ? 1 : 0;
  80.     return allGSel;
  81. }
  82.  
  83. /* Expand Group Name Field on MouseOver Event; Restore Group Name Field on MouseOut Event */
  84. function processGroupMouseOver(GCBobj) {
  85.     if ( GCBobj.size > 1 ) { // if already set
  86.        return; // ignore
  87.     }
  88.     if (GCBobj.multiple == 1 && GCBobj.length != 0) {
  89.         GCBobj.size = (GCBobj.length < 4) ? GCBobj.length : 4;
  90.     }
  91. }
  92. function processGroupMouseOut(GCBobj) {
  93.     if (GCBobj.multiple == 1) {
  94.         GCBobj.size = 1;
  95.     }
  96. }
  97.