More value heuristics
[contractdashboard.git] / lib / pChart2.1.0 / examples / index.php
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<?php if ( isset($_GET["Action"])) { $Script = $_GET["Script"]; highlight_file($Script); exit(); } ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
 <title>pChart 2.x - examples rendering</title>
 <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
 <style>
  body       { background-color: #F0F0F0; font-family: tahoma; font-size: 14px; height: 100%; overflow: auto;}
  table      { margin: 0px; padding: 0px; border: 0px; }
  tr         { margin: 0px; padding: 0px; border: 0px; }
  td         { font-family: tahoma; font-size: 11px; margin: 0px; padding: 0px; border: 0px; }
  div.folder { cursor: hand; cursor: pointer; }
  a.smallLinkGrey:link     { text-decoration: none; color: #6A6A6A; }
  a.smallLinkGrey:visited  { text-decoration: none; color: #6A6A6A; }
  a.smallLinkGrey:hover    { text-decoration: underline; color: #6A6A6A; }
  a.smallLinkBlack:link    { text-decoration: none; color: #000000; }
  a.smallLinkBlack:visited { text-decoration: none; color: #000000; }
  a.smallLinkBlack:hover   { text-decoration: underline; color: #000000; }
 </style>
</head>
<body>
 
<?php
 /* Files that we don't want to see in the tree */
 $Exclusion = array(".","..","index.php","buildAll.cmd","pictures","resources","delayedLoader","sandbox");
 
 /* Determine the current package version */
 $FileHandle  = fopen("../readme.txt", "r");
 for ($i=0; $i<=5; $i++) { $buffer = fgets($FileHandle, 4096); }
 fclose($FileHandle);
 $Values  = preg_split("/:/",$buffer);
 $Values  = preg_split("/ /",$Values[1]);
 $Version = strip_tags($Values[1]);
 
 /* Build a list of the examples & categories */
 $DirectoryHandle = opendir(".");
  {
   $Tree = "";
   while (($FileName = readdir($DirectoryHandle)) !== false)
   {
    if ( !in_array($FileName,$Exclusion))
     {
      $FileHandle  = fopen($FileName, "r");
      $buffer      = fgets($FileHandle, 4096);
      $buffer      = fgets($FileHandle, 4096);
      fclose($FileHandle);
 
      if ( preg_match("/CAT:/",$buffer) )
       {
        $Categorie = str_replace(" /* CAT:","",$buffer);
        $Categorie = str_replace("*/","",$Categorie);
        $Categorie = trim($Categorie);
       }
      else
       { $Categorie = "z_root"; }
 
      $FileShortName = str_replace("example.","",$FileName);
      $FileShortName = str_replace(".php","",$FileShortName);
      $FileShortName = trim($FileShortName);
 
      $Tree[$Categorie][]=array("FileName"=>$FileName,"FileShortName"=>$FileShortName);
     }
   }
  closedir($DirectoryHandle);
 
  ksort($Tree);
?>
 
<table style='border: 2px solid #FFFFFF;'><tr><td>
<div style='font-size: 11px; padding: 2px; color: #FFFFFF; background-color: #666666; border-bottom: 3px solid #484848; width: 362px;'>&nbsp;Navigation</div>
<table style='padding: 1px; background-color: #E0E0E0; border: 1px solid #D0D0D0; border-top: 1px solid #FFFFFF;'><tr>
 <td width=16><img src='resources/application_view_tile.png' width=16 height=16 alt=''/></td>
 <td width=100>&nbsp;<b>Examples</b></td>
 <td width=16><img src='resources/application_view_list.png' width=16 height=16 alt=''/></td>
 <td width=100>&nbsp;<a class=smallLinkGrey href='sandbox/'>Sandbox</a></td>
 <td width=16><img src='resources/application_view_list.png' width=16 height=16 alt=''/></td>
 <td width=100>&nbsp;<a class=smallLinkGrey href='delayedLoader/'>Delayed loader</a></td>
</tr></table>
</td></tr></table>
 
<br/>
<table><tr><td valign='top'>
 
<table style='border: 2px solid #FFFFFF;'><tr><td>
<div style='font-size: 11px; padding: 2px; color: #FFFFFF; background-color: #666666; border-bottom: 3px solid #484848; width: 222px;'>&nbsp;Release <?php echo $Version; ?></div>
<div style='border: 3px solid #D0D0D0; border-top: 1px solid #FFFFFF; background-color: #FAFAFA; width: 220px; overflow: auto'>
<div style='padding: 1px; padding-bottom: 3px; color: #000000; background-color:#D0D0D0;'>
 <table><tr>
  <td><img src='resources/application_view_list.png' width=16 height=16 alt=''/></td>
  <td>&nbsp;Examples folder contents</td>
 </tr></table>
</div>
<?php
  $ID = 1; if ( isset($Tree["z_root"]) ) { $ID = 2; }
  foreach($Tree as $Key => $Elements)
   {
    if ( $ID == count($Tree) ) { $Icon = "dash-explorer-last.png"; $SubIcon = "dash-explorer-blank.png"; } else { $Icon = "dash-explorer.png"; $SubIcon = "dash-explorer-noleaf.png"; }
    if ( $Key != "z_root" )
     {
      echo "<table  noborder cellpadding=0 cellspacing=0>\r\n";
      echo " <tr valign=middle>\r\n";
      echo "  <td><img src='resources/".$Icon."' width=16 height=20 alt=''/></td>\r\n";
      echo "  <td><img src='resources/folder.png' width=16 height=16 alt=''/></td>\r\n";
      echo "  <td><div class=folder id='".$Key."_main' onclick='showHideMenu(".chr(34).$Key.chr(34).");'>&nbsp;".$Key."</div></td>\r\n";
      echo " </tr>\r\n";
      echo "</table>\r\n";
 
      echo "<table id='".$Key."' style='display: none;' noborder cellpadding=0 cellspacing=0><tr>\r\n";
      foreach($Elements as $SubKey => $Element)
       {
        $FileName      = $Element["FileName"];
        $FileShortName = $Element["FileShortName"];
 
        if ( $SubKey == count($Elements)-1 ) { $Icon = "dash-explorer-last.png"; } else { $Icon = "dash-explorer.png"; }
 
        echo " <tr valign=middle>\r\n";
        echo "  <td><img src='resources/".$SubIcon."' width=16 height=20 alt=''/></td>\r\n";
        echo "  <td><img src='resources/".$Icon."' width=16 height=20 alt=''/></td>\r\n";
        echo "  <td><img src='resources/application_view_tile.png' width=16 height=16 alt=''/></td>\r\n";
        echo "  <td>&nbsp;<a class=smallLinkGrey href='#' onclick='render(".chr(34).$FileName.chr(34).");'>".$FileShortName."</a></td>\r\n";
        echo " </tr>\r\n";
       }
      echo "</table>\r\n";
 
     }
    $ID++;
   }
 }
?>
</div>
</td></tr></table>
 
</td><td width=20></td><td valign='top' style='padding-top: 5px; font-size: 12px;'>
 
<table><tr>
 <td><img src='resources/chart_bar.png' width=16 height=16 alt=''/></td>
 <td>&nbsp;Rendering area</td>
</tr></table>
 
<div style='display:table-cell; padding: 10px; border: 2px solid #FFFFFF; vertical-align: middle; overflow: auto; background-image: url("resources/dash.png");'>
 <div style='font-size: 10px;' id=render>
  <table><tr><td><img src='resources/accept.png' width=16 height=16 alt=""/></td><td>Click on an example to render it!</td></tr></table>
 </div>
</div>
 
<br/><br/>
 
<table><tr>
 <td><img src='resources/application_view_list.png' width=16 height=16 alt=''/></td>
 <td>&nbsp;Source area</td>
</tr></table>
 
<div style='display:table-cell; padding: 10px;  border: 2px solid #FFFFFF; vertical-align: middle; overflow: auto; background-image: url("resources/dash.png");'>
 <div style='font-size: 10px;' id=source style='width: 700px;'>
  <table><tr><td><img src='resources/accept.png' width=16 height=16 alt=""/></td><td>Click on an example to get its source!</td></tr></table>
 </div>
</div>
 
</td></tr></table>
</body>
<script>
 URL        = "";
 SourceURL  = "";
 LastOpened = "";
 
 function showHideMenu(Element)
  {
   status = document.getElementById(Element).style.display;
   if ( status == "none" )
    {
     if ( LastOpened != "" && LastOpened != Element ) { showHideMenu(LastOpened); }
 
     document.getElementById(Element).style.display = "inline";
     document.getElementById(Element+"_main").style.fontWeight = "bold";
     LastOpened = Element;
    }
   else
    {
     document.getElementById(Element).style.display = "none";
     document.getElementById(Element+"_main").style.fontWeight = "normal";
     LastOpened = "";
    }
  }
 
 function render(PictureName)
  {
   opacity("render",100,0,100);
 
   RandomKey = Math.random(100);
   URL       = PictureName + "?Seed=" + RandomKey;
   SourceURL = PictureName;
 
   ajaxRender(URL);
  }
 
 function StartFade()
  {
   Loader     = new Image();   
   Loader.src = URL;   
   setTimeout("CheckLoadingStatus()", 200);   
  }
 
 function CheckLoadingStatus()   
  {   
   if ( Loader.complete == true )   
    {
     changeOpac(0, "render");
     HTMLResult = "<center><img src='" + URL + "' alt=''/></center>";
     document.getElementById("render").innerHTML = HTMLResult;
 
     opacity("render",0,100,100);
     view(SourceURL);
    }
   else  
    setTimeout("CheckLoadingStatus()", 200);   
  }   
 
 function changeOpac(opacity, id)   
  {   
   var object = document.getElementById(id).style;   
   object.opacity = (opacity / 100);   
   object.MozOpacity = (opacity / 100);   
   object.KhtmlOpacity = (opacity / 100);   
   object.filter = "alpha(opacity=" + opacity + ")";   
  }   
 
 function wait()
  {
   HTMLResult = "<center><img src='resources/wait.gif' width=24 height=24 alt=''/><br>Rendering</center>";
   document.getElementById("render").innerHTML = HTMLResult;
   changeOpac(20, "render");
  }
 
 function opacity(id, opacStart, opacEnd, millisec)
  {
   var speed = Math.round(millisec / 100);
   var timer = 0;
 
   if(opacStart > opacEnd)
    {
     for(i = opacStart; i >= opacEnd; i--)
      {
       setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
       timer++;
      }
     setTimeout("wait()",(timer * speed));
    }
   else if(opacStart < opacEnd)
    {
     for(i = opacStart; i <= opacEnd; i++)
      {
       setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
       timer++;
      }
    }
  }
 
 function ajaxRender(URL)
  {
   var xmlhttp=false;   
   /*@cc_on @*/  
   /*@if (@_jscript_version >= 5)  
    try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } }  
   @end @*/  
  
   if (!xmlhttp && typeof XMLHttpRequest!='undefined')   
    { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } }   
  
   if (!xmlhttp && window.createRequest)   
    { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } }   
  
   xmlhttp.open("GET", URL,true);
 
   xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { StartFade();  } }   
   xmlhttp.send(null)   
  }
 
 function view(URL)
  {
   var xmlhttp=false;   
   /*@cc_on @*/  
   /*@if (@_jscript_version >= 5)  
    try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } }  
   @end @*/  
  
   URL = "index.php?Action=View&Script=" + URL;
 
   if (!xmlhttp && typeof XMLHttpRequest!='undefined')   
    { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } }   
  
   if (!xmlhttp && window.createRequest)   
    { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } }   
  
   xmlhttp.open("GET", URL,true);
 
   xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { Result = xmlhttp.responseText; document.getElementById("source").innerHTML = Result.replace("/\<BR\>/");  } }   
   xmlhttp.send(null)   
  }
</script>
</html>
<?php
 function size($Value)
  {
   if ( $Value < 1024 ) { return($Value." o."); }
   if ( $Value >= 1024 && $Value < 1024000 ) { return(floor($Value/1024)." ko."); }
   return(floor($Value/1024000))." mo.";
  }
 
 function left($value,$NbChar)  
  { return substr($value,0,$NbChar); }  
 
 function right($value,$NbChar)  
  { return substr($value,strlen($value)-$NbChar,$NbChar); }  
 
 function mid($value,$Depart,$NbChar)  
  { return substr($value,$Depart-1,$NbChar); }  
?>