Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184

var GifDisplay = {} ;

GifDisplay.gif_url = ""; 

// strings containing the names of all active GifDisplays                            
GifDisplay.active_displays_l = new Array();

// the current displayFrame                                                          
GifDisplay.current_display = "";                                                                 
                                                                                     
// the list of displayFrame objects                                                  
GifDisplay.displays_l = new Array();                                                        
                                                                                     
//___________________________________________________________________________________
GifDisplay.displayFrame = function(name)                                                          
{                                                                                    
  this.name = name;                                                                  
  this.is_viewed = false;                                                            
  this.viewed_l = new Array();                                                       
}                                                                                    
                                                                                                                                                                        
//___________________________________________________________________________________
/*                                                                                   
  This function is called onload. It creates the list of                             
  displayFrame objects.                                                              
*/                                                                                   
GifDisplay.fillDisplayList = function()                                                           
{                                                     // Unused?                               
  var iframes_l = document.getElementsByTagName("iframe");                           
  for (i = 0; i < iframes_l.length; i++)                                             
  {                                                                                  
    GifDisplay.displays_l[i] = new GifDisplay.displayFrame(iframes_l[i].id);                               
  }                                                                                  
                                                                                     
  // the default current is the first:                                               
  GifDisplay.current_display = GifDisplay.displays_l[0];                                                   
}                                                                                    
                                                                                     
//___________________________________________________________________________________
GifDisplay.makeCurrent = function(display_frame_name)                                             
{                                                      // Unused?                                 
  for (i = 0; i < GifDisplay.displays_l.length; i++)                                            
  {                                                                                  
    if (GifDisplay.displays_l[i].name == display_frame_name)                                    
    {                                                                                
      break;                                                                         
    }                                                                                
  }                                                                                  
  GifDisplay.current_display = GifDisplay.displays_l[i];                                                   
}

//___________________________________________________________________________________
/*                                                                                   
  Returns true if the display frame provided as an argument                          
  is currently being viewed.                                                         
*/                                                                                                                                                                       
GifDisplay.isViewed = function(display_frame_name)                                                
{                                                     // Unused?                                
  for (i = 0; i < GifDisplay.displays_l.length; i++)                                     
  {                                                                                  
    if (GifDisplay.displays_l[i] == display_frame_name)                                  
    {                                                                                
      return true;                                                                   
    }                                                                                
  }                                                                                  
  return false;                                                                      
}                                                                                    
                                                                                     
//___________________________________________________________________________________
/*                                                                                   
  These functions get called if the user clicks on the "start viewing"               
  or "stop viewing" buttons of a display frame. They set the is_viewed               
  field of the displayFrame object.                                                  
*/                                                                                   
GifDisplay.getDisplayFrame = function(display_frame_name)                                         
{                                                          // Unused?                            
  for (i = 0; i < GifDisplay.displays_l.length; i++)                                            
  {                                                                                  
    if (GifDisplay.displays_l[i].name == display_frame_name)                                    
    return GifDisplay.displays_l[i];                                                            
  }                                                                                  
}                                                                                    
                                                                                     
//___________________________________________________________________________________
GifDisplay.startViewing = function(display_frame_name)                                            
{                                                        // Unused?                            
  var display = GifDisplay.getDisplayFrame(display_frame_name);                                 
                                                                                     
  if (display.is_viewed)                                                             
  {                                                                                  
    alert('This GifViewer is already active');                                       
    return;                                                                          
  }                                                                                  
                                                                                     
  display.is_viewed = true;                                                          
  GifDisplay.updateDisplay(display_frame_name);                                                 
}                                                                                    
 
//___________________________________________________________________________________
GifDisplay.stopViewing = function(display_frame_name)                                             
{                                                         // Unused?                             
  var display = GifDisplay.getDisplayFrame(display_frame_name);                                 
  display.is_viewed = false;                                                         
}  

//___________________________________________________________________________________
/*                                                                                   
  This function is initially called when the "start viewing" button                  
  of a display frame is pressed and keeps calling itself every                       
  [interval] msec, refreshing the frame until it becomes inactive.                   
*/                                                                                   
GifDisplay.updateDisplay = function(display_frame_name)                                           
{                                                         // Unused?                            
  var interval = 5000;                                                               
  var display_frame = GifDisplay.getDisplayFrame(display_frame_name);                           
                                                                                     
  if (display_frame.is_viewed == true)                                               
  {                                                                                  
    GifDisplay.makeDisplayRequest(display_frame_name);                                          
    if (display_frame.viewed_l.length != 0)                                          
    {                                                                                
      window.frames[display_frame_name].location.href = GifDisplay.getGifURL(display_frame_name); 
    }                                                                                
  }                                                                                  
  var this_function_call = "updateDisplay('" + display_frame_name + "')";            
  setTimeout(this_function_call, interval);                                          
}                                                                                    
                                                                                     
//___________________________________________________________________________________
GifDisplay.getGifURL = function(display_frame_name)                                               
{                                                     // Unused?                                
  var url = WebLib.getContextURL();                                                         
  url = url + "/temporary/" + display_frame_name + ".gif";                           
  return url;                                                                        
}                                                                                    
                                                                                     
//___________________________________________________________________________________
GifDisplay.getDisplayRequestURL = function(display_frame_name)                                    
{                                                     // Unused?                                 
  url = WebLib.getApplicationURL();                                                         
  //url = url + "/Request?"                                                             
  url = url + "RequestID=Draw"                                                 
  url = url + "&" + "Current=" + contentViewer_current;                              
  url = url + "&" + "DisplayFrameName=" + display_frame_name;                        
                                                                                     
  var display_frame = GifDisplay.getDisplayFrame(display_frame_name);                           
  for (i = 0; i < display_frame.viewed_l.length; i++)                                
  {                                                                                  
    url = url + "&" + "View=" + display_frame.viewed_l[i];                           
  }                                                                                  
  return url;                                                                        
}

//___________________________________________________________________________________
GifDisplay.makeDisplayRequest = function(display_frame_name)                                      
{                                                       // Unused?                                   
  url = GifDisplay.getDisplayRequestURL(display_frame_name);                                    
  // pass a reference to the updateGifURL function:                                  
  WebLib.makeRequest(url, updateGifURL);                                                    
}                                                                                    
                                                                                     
//___________________________________________________________________________________
GifDisplay.updateGifURL = function()                                                              
{                                                       // Unused?                               
  if (WebLib.http_request.readyState == 4)                                                  
  {                                                                                  
    if (WebLib.http_request.status == 200)                                                  
    {                                                                                
      var xmldoc;                                                                    
                                                                                     
       // Load the xml elements on javascript lists:                                 
      if (WebLib.http_request != false)                                                     
      {                                                                              
        xmldoc  = WebLib.http_request.responseXML;                                          
        GifDisplay.gif_url = xmldoc.getElementsByTagName('fileURL').item(0).firstChild.data;    
      }                                                                              
    }                                                                                
  }                                                                                  
}    
        
var fillDisplayList = GifDisplay.fillDisplayList ; // Call to this function is generated by WebPage.cc
                                                   // which is not under our control: will try to fix this