Project

General

Profile

1
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
2
<html>
3
<head>
4
<title>
5
<a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008 Overview
6
</title>
7
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
8
<script>
9
function asd() {
10
	
11
		parent.document.title="Logger.js Overview";
12
	
13
}
14
</script>
15
</head>
16
<body bgcolor="white" onload="asd();">
17

    
18
<!-- ========== START OF NAVBAR ========== -->
19
<a name="navbar_top"><!-- --></a>
20
<table border="0" width="100%" cellpadding="1" cellspacing="0">
21
<tr>
22
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
23
<a name="navbar_top_firstrow"><!-- --></a>
24
<table border="0" cellpadding="0" cellspacing="3">
25
  <tr align="center" valign="top">
26
  
27
  
28
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
29
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
30
  
31

    
32
  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
33
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
34
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
35
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
36
  </tr>
37
</table>
38
</td>
39
<td bgcolor="#EEEEFF" align="right" valign="top">
40
<em>
41
<b><a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008</b></em>
42
</td>
43
</tr>
44

    
45
<tr>
46
<td bgcolor="white" class="NavBarCell2"><font size="-2">
47
&nbsp;PREV&nbsp;
48
&nbsp;NEXT</font></td>
49
<td bgcolor="white" class="NavBarCell2"><font size="-2">
50
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
51
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
52
&nbsp;&nbsp;
53
<script>
54
  <!--
55
  if(window==top) {
56
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
57
  }
58
  //-->
59
</script>
60
<noscript>
61
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
62
</noscript>
63
</font></td>
64
</tr>
65
</table>
66
<!-- =========== END OF NAVBAR =========== -->
67

    
68
<hr>
69
<center>
70
	
71
	   <h2>Logger.js</h2>
72
	
73
</center>
74

    
75
	
76

    
77

    
78
<h4>Summary</h4>
79
<p>
80
	
81
		No overview generated for 'Logger.js'<BR/><BR/>
82
	
83
</p>
84

    
85
<hr>
86

    
87

    
88
    <table border="1" cellpadding="3" cellspacing="0" width="100%">
89
    <tr bgcolor="#CCCCFF" class="TableHeadingColor">
90
    <td colspan=2><font size="+2">
91
    
92
        <b>Class Summary</b>
93
    
94
    </font></td>
95
    </tr>
96
    
97
    <tr bgcolor="white" class="TableRowColor">
98
    <td width="15%"><b><a href="Logger.html">Logger</a></b></td>
99
    <td>&nbsp;</td>
100
    </tr>
101
    
102
    </table>
103
    <hr/> 
104

    
105

    
106
<!-- ========== METHOD SUMMARY =========== -->
107

    
108
<!-- ========== END METHOD SUMMARY =========== -->
109

    
110

    
111
        <pre class="sourceview"><span class="comment">/*
112
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
113
$Id: Logger.js 3091 2007-08-09 12:21:54Z gjvoosten $
114
*/</span>
115
<span class="comment">
116
// Ensure this object's dependancies are loaded.</span>
117
mapbuilder.loadScript(baseDir+<span class="literal">"/model/ModelBase.js"</span>);
118

    
119
<span class="comment">/**
120
 * Records a log of events that occur over the course of mapbuilder execution
121
 * <span class="attrib">@constructor</span>
122
 * <span class="attrib">@base</span> ModelBase
123
 * <span class="attrib">@author</span> Mike Adair
124
 * <span class="attrib">@param</span> modelNode Pointer to the xml node for this model from the config file.
125
 * <span class="attrib">@param</span> parent    The parent model for the object.
126
 */</span>
127
<span class="reserved">function</span> Logger(modelNode, parent) {
128
<span class="comment">  // Inherit the ModelBase functions and parameters</span>
129
  ModelBase.apply(<span class="reserved">this</span>, new Array(modelNode, parent));
130
  <span class="reserved">this</span>.namespace = <span class="literal">"xmlns:mb='http://mapbuilder.sourceforge.net/mapbuilder'"</span>;
131
<span class="comment">
132
  //create a new document</span>
133
  <span class="reserved">this</span>.doc = Sarissa.getDomDocument(<span class="literal">"http://mapbuilder.sourceforge.net/mapbuilder"</span>,<span class="literal">"mb:Logger"</span>);//!no prefix on the URL
134
  Sarissa.setXpathNamespaces(<span class="reserved">this</span>.doc, <span class="reserved">this</span>.namespace);
135
  <span class="reserved">this</span>.doc.async = false;
136
  <span class="reserved">this</span>.doc.validateOnParse=false;  //IE6 SP2 parsing bug
137

    
138
  <span class="comment">/**
139
   * appends a new entry in the log file
140
   * <span class="attrib">@param</span> evenType    the name of the event that occured
141
   * <span class="attrib">@param</span> listenerId  the ID of the listener object
142
   * <span class="attrib">@param</span> targetId    the ID of the object passed to the listener function
143
   * <span class="attrib">@param</span> paramValue  any parameter info supplied to the listener function
144
   */</span>
145
  <span class="reserved">this</span>.logEvent = <span class="reserved">function</span>(eventType, listenerId, targetId, paramValue) {
146
    var eventLog = <span class="reserved">this</span>.doc.createElement(<span class="literal">"event"</span>);
147
    eventLog.setAttribute(<span class="literal">"time"</span>, new Date().getTime());
148
    eventLog.setAttribute(<span class="literal">"listener"</span>, listenerId);
149
    eventLog.setAttribute(<span class="literal">"target"</span>, targetId);
150
    <span class="reserved">if</span> (paramValue) eventLog.setAttribute(<span class="literal">"param"</span>, paramValue);
151
    eventLog.appendChild(<span class="reserved">this</span>.doc.createTextNode(eventType));
152
    <span class="reserved">this</span>.doc.documentElement.appendChild(eventLog);
153
  }
154

    
155
  <span class="comment">/**
156
   * clears all entries in the log file
157
   */</span>
158
  <span class="reserved">this</span>.clearLog = <span class="reserved">function</span>() {
159
    <span class="reserved">while</span> (<span class="reserved">this</span>.doc.documentElement.hasChildNodes() ) {
160
      <span class="reserved">this</span>.doc.documentElement.removeChild(<span class="reserved">this</span>.doc.documentElement.firstChild);
161
    }
162
    <span class="reserved">this</span>.callListeners(<span class="literal">"refresh"</span>);
163
  }
164

    
165
  <span class="comment">/**
166
   * save the log by http post to the serializeUrl URL provided
167
   */</span>
168
  <span class="reserved">this</span>.saveLog = <span class="reserved">function</span>() {
169
    <span class="reserved">if</span> (config.serializeUrl) {
170
      var tempDoc = postLoad(config.serializeUrl,logger.doc);
171
      tempDoc.setProperty(<span class="literal">"SelectionLanguage"</span>, <span class="literal">"XPath"</span>);
172
      Sarissa.setXpathNamespaces(tempDoc, <span class="literal">"xmlns:xlink='http://www.w3.org/1999/xlink'"</span>);
173
      var onlineResource = tempDoc.selectSingleNode(<span class="literal">"//OnlineResource"</span>);
174
      var fileUrl = onlineResource.attributes.getNamedItem(<span class="literal">"xlink:href"</span>).nodeValue;
175
      alert(mbGetMessage(<span class="literal">"eventLogSaved"</span>, fileUrl));
176
    } <span class="reserved">else</span> {
177
      alert(mbGetMessage(<span class="literal">"unableToSaveLog"</span>));
178
    }
179
  }
180

    
181
  <span class="comment">/**
182
   * save the log by http post to the serializeUrl URL provided
183
   */</span>
184
  <span class="reserved">this</span>.refreshLog = <span class="reserved">function</span>(objRef) {
185
    objRef.callListeners(<span class="literal">"refresh"</span>);
186
  }
187

    
188
  <span class="reserved">if</span> (parent) parent.addListener(<span class="literal">"refresh"</span>,<span class="reserved">this</span>.refreshLog, <span class="reserved">this</span>);
189
  window.onunload = <span class="reserved">this</span>.saveLog;   //automatically save the log when the page unloads
190
  window.logger = <span class="reserved">this</span>;             //global reference to the logger model
191
}
192
</pre>
193
	<hr>
194

    
195

    
196

    
197
<!-- ========== START OF NAVBAR ========== -->
198
<a name="navbar_top"><!-- --></a>
199
<table border="0" width="100%" cellpadding="1" cellspacing="0">
200
<tr>
201
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
202
<a name="navbar_top_firstrow"><!-- --></a>
203
<table border="0" cellpadding="0" cellspacing="3">
204
  <tr align="center" valign="top">
205
  
206
  
207
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
208
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
209
  
210

    
211
  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
212
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
213
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
214
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
215
  </tr>
216
</table>
217
</td>
218
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
219
<b><a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008</b></em>
220
</td>
221
</tr>
222

    
223
<tr>
224
<td bgcolor="white" class="NavBarCell2"><font size="-2">
225
&nbsp;PREV&nbsp;
226
&nbsp;NEXT</font></td>
227
<td bgcolor="white" class="NavBarCell2"><font size="-2">
228
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
229
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
230
&nbsp;&nbsp;
231
<script>
232
  <!--
233
  if(window==top) {
234
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
235
  }
236
  //-->
237
</script>
238
<noscript>
239
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
240
</noscript>
241
</font></td>
242
</tr>
243
</table>
244
<!-- =========== END OF NAVBAR =========== -->
245

    
246
<hr>
247
<font size="-1">
248

    
249
</font>
250
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Sun Apr 27 20:30:54 2008</div>
251
</body>
252
</html>
(258-258/316)