Merge branch 'MDL-32442' of git://github.com/merrill-oakland/moodle
[moodle.git] / backup / bb / bb5.5_to_moodle.xsl
blobe3e736cbf1e8ae04907679a25bee3ef5d7412458
1 <?xml version='1.0'?>
2 <xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4 <xsl:output method="xml" encoding="UTF-8" />
5 <xsl:template match="/">
6 <MOODLE_BACKUP>
7 <INFO>
8 <NAME>backup-from-blackboard.zip</NAME>
9 <MOODLE_VERSION>2004083100</MOODLE_VERSION>
10 <MOODLE_RELEASE>1.4</MOODLE_RELEASE>
11 <BACKUP_VERSION>2004083100</BACKUP_VERSION>
12 <BACKUP_RELEASE>1.4</BACKUP_RELEASE>
13 <DATE>1094240862</DATE>
14 <ORIGINAL_WWWROOT>INSERT URL HERE</ORIGINAL_WWWROOT>
15 <DETAILS>
16 <MOD>
17 <NAME>assignment</NAME>
18 <INCLUDED>true</INCLUDED>
19 <USERINFO>true</USERINFO>
20 </MOD>
21 <MOD>
22 <NAME>chat</NAME>
23 <INCLUDED>true</INCLUDED>
24 <USERINFO>true</USERINFO>
25 </MOD>
26 <MOD>
27 <NAME>choice</NAME>
28 <INCLUDED>true</INCLUDED>
29 <USERINFO>true</USERINFO>
30 </MOD>
31 <MOD>
32 <NAME>forum</NAME>
33 <INCLUDED>true</INCLUDED>
34 <USERINFO>true</USERINFO>
35 </MOD>
36 <MOD>
37 <NAME>glossary</NAME>
38 <INCLUDED>true</INCLUDED>
39 <USERINFO>true</USERINFO>
40 </MOD>
41 <MOD>
42 <NAME>journal</NAME>
43 <INCLUDED>true</INCLUDED>
44 <USERINFO>true</USERINFO>
45 </MOD>
46 <MOD>
47 <NAME>label</NAME>
48 <INCLUDED>true</INCLUDED>
49 <USERINFO>true</USERINFO>
50 </MOD>
51 <MOD>
52 <NAME>lesson</NAME>
53 <INCLUDED>true</INCLUDED>
54 <USERINFO>true</USERINFO>
55 </MOD>
56 <MOD>
57 <NAME>quiz</NAME>
58 <INCLUDED>false</INCLUDED>
59 <USERINFO>false</USERINFO>
60 </MOD>
61 <MOD>
62 <NAME>resource</NAME>
63 <INCLUDED>true</INCLUDED>
64 <USERINFO>true</USERINFO>
65 </MOD>
66 <MOD>
67 <NAME>scorm</NAME>
68 <INCLUDED>false</INCLUDED>
69 <USERINFO>false</USERINFO>
70 </MOD>
71 <MOD>
72 <NAME>survey</NAME>
73 <INCLUDED>false</INCLUDED>
74 <USERINFO>false</USERINFO>
75 </MOD>
76 <MOD>
77 <NAME>wiki</NAME>
78 <INCLUDED>false</INCLUDED>
79 <USERINFO>false</USERINFO>
80 </MOD>
81 <MOD>
82 <NAME>workshop</NAME>
83 <INCLUDED>true</INCLUDED>
84 <USERINFO>true</USERINFO>
85 </MOD>
86 <USERS>course</USERS>
87 <LOGS>false</LOGS>
88 <USERFILES>false</USERFILES>
89 <COURSEFILES>true</COURSEFILES>
90 </DETAILS>
91 </INFO>
92 <COURSE>
93 <!-- Get course specific information -->
94 <xsl:apply-templates select="document('res00001.dat')//COURSE"/>
97 <SECTIONS>
98 <!-- Create a title section -->
99 <xsl:for-each select="document('res00001.dat')" >
100 <xsl:call-template name="title_section" />
101 </xsl:for-each>
104 <!-- Create a topic for each top level Bb item and add section modules ONE folder deep -->
105 <xsl:for-each select="manifest/organizations/tableofcontents/item">
106 <xsl:variable name="section_number" select="position()"/>
107 <xsl:call-template name="sections">
108 <xsl:with-param name="section_number" select="$section_number"/>
109 <xsl:with-param name="recurse" >false</xsl:with-param>
110 </xsl:call-template>
111 </xsl:for-each>
113 <!-- Create a topic for each second level Bb item which is a folder, recursively make section modules -->
114 <xsl:for-each select="manifest/organizations/tableofcontents/item/item">
115 <xsl:sort order="descending" select="document(concat(@identifierref,'.dat'))/CONTENT/FLAGS/ISFOLDER/@value"/>
116 <xsl:if test="document(concat(@identifierref,'.dat'))/CONTENT/FLAGS/ISFOLDER/@value = 'true'">
117 <xsl:variable name="prev_sections" select="count(/manifest/organizations/tableofcontents/item)"/>
118 <xsl:variable name="section_number" select="position()+$prev_sections"/>
119 <xsl:call-template name="sections">
120 <xsl:with-param name="section_number" select="$section_number"/>
121 <xsl:with-param name="recurse" >true</xsl:with-param>
122 </xsl:call-template>
123 </xsl:if>
124 </xsl:for-each>
125 </SECTIONS>
127 <MODULES>
128 <xsl:call-template name="modules" />
129 </MODULES>
131 </COURSE>
132 </MOODLE_BACKUP>
133 </xsl:template>
135 <xsl:template match="COURSE">
136 <HEADER>
137 <ID>2</ID>
138 <CATEGORY>
139 <ID></ID>
140 <NAME><xsl:value-of select="CATEGORIES/CATEGORY/@value"/></NAME>
141 </CATEGORY>
142 <PASSWORD></PASSWORD>
143 <IDNUMBER>4</IDNUMBER>
144 <FORMAT>topics</FORMAT>
145 <SHOWGRADES>1</SHOWGRADES>
146 <BLOCKINFO>participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity</BLOCKINFO>
147 <NEWSITEMS>5</NEWSITEMS>
148 <TEACHER>Teacher</TEACHER>
149 <TEACHERS>Teachers</TEACHERS>
150 <STUDENT>Student</STUDENT>
151 <STUDENTS>Students</STUDENTS>
152 <GUEST>
153 <xsl:choose>
154 <xsl:when test="FLAGS/ALLOWGUESTS/@value = 'true' ">1</xsl:when>
155 <xsl:when test="FLAGS/ALLOWGUESTS/@value = 'false' ">0</xsl:when>
156 <xsl:otherwise></xsl:otherwise>
157 </xsl:choose>
158 </GUEST>
159 <STARTDATE>1094270400</STARTDATE>
160 <ENROLPERIOD>0</ENROLPERIOD>
161 <NUMSECTIONS>10</NUMSECTIONS>
162 <MAXBYTES>2097152</MAXBYTES>
163 <SHOWREPORTS>0</SHOWREPORTS>
164 <GROUPMODE>0</GROUPMODE>
165 <GROUPMODEFORCE>0</GROUPMODEFORCE>
166 <LANG></LANG>
167 <COST></COST>
168 <MARKER>0</MARKER>
169 <VISIBLE>
170 <xsl:choose>
171 <xsl:when test="FLAGS/ISAVAILABLE/@value = 'true' ">1</xsl:when>
172 <xsl:when test="FLAGS/ISAVAILABLE/@value = 'false' ">0</xsl:when>
173 <xsl:otherwise></xsl:otherwise>
174 </xsl:choose>
175 </VISIBLE>
176 <HIDDENSECTIONS>0</HIDDENSECTIONS>
177 <TIMECREATED>1094240775</TIMECREATED>
178 <TIMEMODIFIED>1094240775</TIMEMODIFIED>
179 <SUMMARY><xsl:value-of select="DESCRIPTION"/></SUMMARY>
180 <SHORTNAME><xsl:value-of select="COURSEID/@value"/></SHORTNAME>
181 <FULLNAME><xsl:value-of select="TITLE/@value"/></FULLNAME>
182 </HEADER>
183 </xsl:template>
185 <!-- ############# Sections ############# -->
187 <xsl:template name="title_section" match="resource">
188 <SECTION>
189 <ID>0</ID>
190 <NUMBER>0</NUMBER>
191 <SUMMARY>&lt;div style="text-align: center;"&gt;&lt;font size="5" style="font-family: arial,helvetica,sans-serif;"&gt;<xsl:value-of select="COURSE/TITLE/@value"/>&lt;/font&gt;&lt;/div&gt;
192 <xsl:value-of select="COURSE/DESCRIPTION"/>
193 </SUMMARY>
194 <VISIBLE>1</VISIBLE>
195 <MODS>
196 <xsl:call-template name="news_forum_section_mod" >
197 <xsl:with-param name="mod_number">1</xsl:with-param>
198 </xsl:call-template>
199 </MODS>
200 </SECTION>
201 </xsl:template>
203 <xsl:template name="sections" match="resource">
204 <xsl:param name="section_number">1. </xsl:param>
205 <xsl:param name="recurse"/>
206 <SECTION>
207 <ID><xsl:value-of select="$section_number"/></ID>
208 <NUMBER><xsl:value-of select="$section_number"/></NUMBER>
209 <SUMMARY>&lt;span style="font-weight: bold;"&gt;<xsl:value-of select="@title"/>&lt;/span&gt;</SUMMARY>
210 <VISIBLE>1</VISIBLE>
211 <MODS>
213 <xsl:choose>
214 <xsl:when test="$recurse = 'true'">
215 <xsl:variable name="mod_number" select="substring-after(@identifierref,'res')"/>
216 <xsl:call-template name="item_recurse_files" >
217 <xsl:with-param name="mod_number" select="$mod_number"/>
218 <xsl:with-param name="indent" >0</xsl:with-param>
219 <xsl:with-param name="recurse" select="$recurse" />
220 </xsl:call-template>
222 </xsl:when>
224 <xsl:when test="$recurse = 'false'">
225 <xsl:for-each select="item">
226 <xsl:variable name="mod_number" select="substring-after(@identifierref,'res')"/>
227 <!-- Create one section-mod -->
228 <xsl:for-each select="document(concat(@identifierref,'.dat'))">
229 <xsl:call-template name="section_mod">
230 <xsl:with-param name="mod_number" select="$mod_number"/>
231 <xsl:with-param name="indent" select="0"/>
232 </xsl:call-template>
233 </xsl:for-each>
235 </xsl:for-each>
236 </xsl:when>
237 </xsl:choose>
239 </MODS>
240 </SECTION>
241 </xsl:template>
243 <xsl:template name="item_recurse_files">
244 <xsl:param name="mod_number">1. </xsl:param>
245 <xsl:param name="indent">1. </xsl:param>
246 <xsl:param name="recurse"/>
249 <!-- Create one section-mod -->
250 <xsl:for-each select="document(concat(@identifierref,'.dat'))">
251 <xsl:call-template name="section_mod">
252 <xsl:with-param name="mod_number" select="$mod_number"/>
253 <xsl:with-param name="indent" select="$indent"/>
254 </xsl:call-template>
255 </xsl:for-each>
257 <!-- Depth first recursion to preserve order -->
258 <xsl:for-each select="item">
259 <xsl:variable name="m_number" select="substring-after(@identifierref,'res')"/>
260 <xsl:call-template name="item_recurse_files" >
261 <xsl:with-param name="mod_number" select="$m_number"/>
262 <xsl:with-param name="indent" select="$indent + 1"/>
263 </xsl:call-template>
264 </xsl:for-each>
266 </xsl:template>
269 <!-- Determines the type of section mod entry and calls the appropriate creation template -->
270 <xsl:template name="section_mod" >
271 <xsl:param name="mod_number">1. </xsl:param>
272 <xsl:param name="contenttype" />
273 <xsl:param name="indent">1. </xsl:param>
275 <!-- Every file will have a label module describing it -->
276 <xsl:choose>
277 <!-- Detected one or more files -->
278 <xsl:when test="CONTENT/FILES/FILEREF/RELFILE/@value != ''">
279 <!-- Create a label -->
280 <xsl:call-template name="section_mod_generic">
281 <xsl:with-param name="mod_number" ><xsl:value-of select="$mod_number"/></xsl:with-param>
282 <xsl:with-param name="indent" ><xsl:value-of select="$indent"/></xsl:with-param>
283 <xsl:with-param name="type" >label</xsl:with-param>
284 </xsl:call-template>
286 <!-- Create a resource for each file -->
287 <xsl:for-each select="CONTENT/FILES/FILEREF">
288 <xsl:call-template name="section_mod_generic">
289 <xsl:with-param name="mod_number" ><xsl:value-of select="$mod_number"/>0<xsl:value-of select="position()"/></xsl:with-param>
290 <xsl:with-param name="indent" select="$indent + 1"/>
291 <xsl:with-param name="type" >resource</xsl:with-param>
292 </xsl:call-template>
293 </xsl:for-each>
295 </xsl:when>
298 <!-- Detected a folder -->
299 <xsl:when test="CONTENT/FLAGS/ISFOLDER/@value = 'true'">
300 <!-- Create a label -->
301 <xsl:call-template name="section_mod_generic">
302 <xsl:with-param name="mod_number" select="$mod_number"/>
303 <xsl:with-param name="indent" select="$indent"/>
304 <xsl:with-param name="type" >label</xsl:with-param>
305 </xsl:call-template>
306 </xsl:when>
308 <!-- Detected text -->
309 <xsl:when test="CONTENT/MAINDATA/FLAGS/ISHTML/@value = 'true'">
310 <!-- Create a resource -->
311 <xsl:call-template name="section_mod_generic">
312 <xsl:with-param name="mod_number" select="$mod_number"/>
313 <xsl:with-param name="indent" select="$indent"/>
314 <xsl:with-param name="type" >resource</xsl:with-param>
315 </xsl:call-template>
316 </xsl:when>
318 <!-- Detected external link -->
319 <xsl:when test="EXTERNALLINK/TITLE/@value != '' ">
320 <!-- Create a label -->
321 <xsl:call-template name="section_mod_generic">
322 <xsl:with-param name="mod_number" select="$mod_number"/>
323 <xsl:with-param name="indent" select="$indent"/>
324 <xsl:with-param name="type" >label</xsl:with-param>
325 </xsl:call-template>
327 <!-- Create a resource -->
328 <xsl:call-template name="section_mod_generic">
329 <xsl:with-param name="mod_number" select="$mod_number"/>
330 <xsl:with-param name="indent" select="$indent"/>
331 <xsl:with-param name="type" >resource</xsl:with-param>
332 </xsl:call-template>
333 </xsl:when>
335 <!-- Detected staffinfo -->
336 <xsl:when test="STAFFINFO/COURSEID/@value != '' ">
337 <!-- Create a resource -->
338 <xsl:call-template name="section_mod_generic">
339 <xsl:with-param name="mod_number" select="$mod_number"/>
340 <xsl:with-param name="indent" select="$indent"/>
341 <xsl:with-param name="type" >resource</xsl:with-param>
342 </xsl:call-template> -->
343 </xsl:when>
344 <xsl:otherwise>
345 </xsl:otherwise>
347 </xsl:choose>
350 </xsl:template>
352 <!-- ############# Section Modules ############# -->
353 <!-- Creates one section module entry.
354 Works for types: label, resource (text), resource (externallink)
356 <xsl:template name="section_mod_generic" >
357 <xsl:param name="mod_number">1. </xsl:param>
358 <xsl:param name="indent">1. </xsl:param>
359 <xsl:param name="type"/>
361 <MOD>
362 <ID><xsl:if test="$type = 'label'">1</xsl:if><xsl:value-of select="$mod_number"/>0</ID>
363 <ZIBA_NAME>
364 <xsl:value-of select="CONTENT/TITLE"/>
365 <xsl:value-of select="EXTERNALLINK/TITLE/@value"/>
366 </ZIBA_NAME>
367 <TYPE><xsl:value-of select="$type"/></TYPE>
368 <INSTANCE><xsl:value-of select="$mod_number"/></INSTANCE>
369 <ADDED>1094240775</ADDED>
370 <DELETED>0</DELETED>
371 <SCORE>0</SCORE>
372 <INDENT><xsl:value-of select="$indent"/></INDENT>
373 <VISIBLE>1</VISIBLE>
374 <GROUPMODE>0</GROUPMODE>
375 </MOD>
377 </xsl:template>
379 <!-- ############# Modules ############# -->
380 <!-- Creates a module-label entry -->
381 <xsl:template name="module_label" >
382 <xsl:param name="mod_number">1. </xsl:param>
383 <MOD>
384 <ID><xsl:value-of select="$mod_number"/></ID>
385 <LABELFOUND></LABELFOUND>
386 <MODTYPE>label</MODTYPE>
387 <NAME>
388 <!-- for CONTENT text -->
389 <xsl:value-of select="TITLE"/>
390 <!-- for EXTERNALLINK text -->
391 <xsl:value-of select="TITLE/@value"/>
392 </NAME>
393 <CONTENT>
394 &lt;span style="font-style: italic;"&gt;
395 <!-- for CONTENT text -->
396 <xsl:value-of select="TITLE"/>
397 <!-- for EXTERNALLINK text -->
398 <xsl:value-of select="TITLE/@value"/>
399 :&lt;/span&gt;
400 <!-- for CONTENT text -->
401 <xsl:value-of select="MAINDATA/TEXT"/>
402 <!-- for EXTERNALLINK text -->
403 <xsl:value-of select="DESCRIPTION/TEXT"/>
404 </CONTENT>
405 <TIMEMODIFIED>1094240775</TIMEMODIFIED>
406 </MOD>
407 </xsl:template>
409 <!-- Creates one module-file entry -->
410 <xsl:template name="module_file" >
411 <xsl:param name="mod_number">1. </xsl:param>
412 <xsl:param name="summary"/>
413 <MOD>
414 <ID><xsl:value-of select="$mod_number"/></ID>
415 <MODTYPE>resource</MODTYPE>
416 <NAME>
417 <!-- <xsl:value-of select="FILES/FILEREF/RELFILE/@value"/> -->
418 <xsl:value-of select="RELFILE/@value"/>
419 </NAME>
420 <TYPE>file</TYPE>
421 <REFERENCE>
422 <!-- <xsl:value-of select="FILES/FILEREF/CONTENTID/@value"/>/<xsl:value-of select="FILES/FILEREF/RELFILE/@value"/> -->
423 <xsl:value-of select="CONTENTID/@value"/>/<xsl:value-of select="RELFILE/@value"/>
424 </REFERENCE>
425 <SUMMARY>
426 <xsl:value-of select="$summary"/>
427 </SUMMARY>
428 <ALLTEXT></ALLTEXT>
429 <POPUP></POPUP>
430 <OPTIONS></OPTIONS>
431 <TIMEMODIFIED>1094240775</TIMEMODIFIED>
432 </MOD>
433 </xsl:template>
435 <!-- Creates one module-text-staffinfo entry -->
436 <!-- TODO staff photo -->
437 <xsl:template name="module_text_staffinfo" >
438 <xsl:param name="mod_number">1. </xsl:param>
439 <MOD>
440 <ID><xsl:value-of select="$mod_number"/></ID>
441 <MODTYPE>resource</MODTYPE>
442 <NAME>
443 <xsl:value-of select="CONTACT/NAME/FORMALTITLE/@value"/><xsl:text> </xsl:text><xsl:value-of select="CONTACT/NAME/GIVEN/@value"/><xsl:text> </xsl:text><xsl:value-of select="CONTACT/NAME/FAMILY/@value"/>
444 </NAME>
445 <TYPE>text</TYPE>
446 <REFERENCE></REFERENCE>
447 <SUMMARY>
448 <xsl:value-of select="CONTACT/NAME/FORMALTITLE/@value"/><xsl:text> </xsl:text><xsl:value-of select="CONTACT/NAME/GIVEN/@value"/><xsl:text> </xsl:text><xsl:value-of select="CONTACT/NAME/FAMILY/@value"/>
449 </SUMMARY>
450 <ALLTEXT>
451 Title:<xsl:value-of select="CONTACT/NAME/FORMALTITLE/@value"/>
452 Given Name:<xsl:value-of select="CONTACT/NAME/GIVEN/@value"/>
453 Family Name:<xsl:value-of select="CONTACT/NAME/FAMILY/@value"/>
454 Phone:<xsl:value-of select="CONTACT/PHONE"/>
455 Office Hours:<xsl:value-of select="CONTACT/OFFICE/HOURS"/>
456 Office Address:<xsl:value-of select="CONTACT/OFFICE/ADDRESS"/>
457 Homepage:<xsl:value-of select="HOMEPAGE/@value"/>
458 </ALLTEXT>
459 <POPUP></POPUP>
460 <OPTIONS></OPTIONS>
461 <TIMEMODIFIED>1094240775</TIMEMODIFIED>
462 </MOD>
463 </xsl:template>
465 <!-- Creates one module-text entry -->
466 <xsl:template name="module_text" >
467 <xsl:param name="mod_number">1. </xsl:param>
468 <MOD>
469 <ID><xsl:value-of select="$mod_number"/></ID>
470 <MODTYPE>resource</MODTYPE>
471 <NAME>
472 <xsl:value-of select="TITLE"/>
473 <!-- For announcements -->
474 <xsl:value-of select="TITLE/@value"/>
475 </NAME>
476 <TYPE>text</TYPE>
477 <REFERENCE></REFERENCE>
478 <SUMMARY>
479 <xsl:value-of select="TITLE"/>
480 <!-- For announcements -->
481 <xsl:value-of select="TITLE/@value"/>
482 </SUMMARY>
483 <ALLTEXT>
484 <xsl:value-of select="MAINDATA/TEXT"/>
485 <!-- For announcements -->
486 <xsl:value-of select="DESCRIPTION/TEXT"/>
487 </ALLTEXT>
488 <POPUP></POPUP>
489 <OPTIONS></OPTIONS>
490 <TIMEMODIFIED>1094240775</TIMEMODIFIED>
491 </MOD>
492 </xsl:template>
494 <!-- Creates one module-link entry -->
495 <xsl:template name="module_link" >
496 <xsl:param name="mod_number">1. </xsl:param>
497 <MOD>
498 <ID><xsl:value-of select="$mod_number"/></ID>
499 <MODTYPE>resource</MODTYPE>
500 <NAME>
501 <xsl:value-of select="URL/@value"/>
502 </NAME>
503 <TYPE>file</TYPE>
504 <REFERENCE>
505 <xsl:value-of select="URL/@value"/>
506 </REFERENCE>
507 <SUMMARY>
508 <xsl:value-of select="TITLE/@value"/>&lt;br/&gt;
509 <xsl:value-of select="URL/@value"/>
510 </SUMMARY>
511 <ALLTEXT>
512 <xsl:value-of select="DESCRIPTION/TEXT"/>
513 </ALLTEXT>
514 <POPUP></POPUP>
515 <OPTIONS></OPTIONS>
516 <TIMEMODIFIED>1094240775</TIMEMODIFIED>
517 </MOD>
518 </xsl:template>
520 <!-- ############# Modules Decisions ############# -->
522 <!-- Creates all module entries -->
523 <xsl:template name="modules" match="resource">
524 <!-- Create the News Forum Module -->
525 <xsl:call-template name="news_forum_mod">
526 <xsl:with-param name="mod_number" >1</xsl:with-param>
527 </xsl:call-template>
528 <!-- Create all other modules -->
529 <xsl:for-each select="//resource">
530 <xsl:variable name="mod_number" select="substring-after(@identifier,'res')"/>
531 <xsl:for-each select="document(concat('',@file))">
532 <xsl:apply-templates select="//FORUM">
533 <xsl:with-param name="mod_number" select="$mod_number"/>
534 </xsl:apply-templates>
535 <xsl:apply-templates select="//CONTENT">
536 <xsl:with-param name="mod_number" select="$mod_number"/>
537 </xsl:apply-templates>
538 <xsl:apply-templates select="//EXTERNALLINK">
539 <xsl:with-param name="mod_number" select="$mod_number"/>
540 </xsl:apply-templates>
541 <xsl:apply-templates select="//STAFFINFO">
542 <xsl:with-param name="mod_number" select="$mod_number"/>
543 </xsl:apply-templates>
544 </xsl:for-each>
545 </xsl:for-each>
546 </xsl:template>
549 <!-- Create an EXTERNALLINK module entry -->
550 <xsl:template match="EXTERNALLINK">
551 <xsl:param name="mod_number">1. </xsl:param>
552 <!-- Every link module will have a label module describing it -->
553 <xsl:call-template name="module_label">
554 <xsl:with-param name="mod_number" select="$mod_number"/>
555 </xsl:call-template>
557 <xsl:call-template name="module_link">
558 <xsl:with-param name="mod_number" select="$mod_number"/>
559 </xsl:call-template>
561 </xsl:template>
563 <!-- Create a STAFFINFO module entry -->
564 <xsl:template match="STAFFINFO">
565 <xsl:param name="mod_number">1. </xsl:param>
566 <!-- Every staffinfo module will have a label module describing it -->
567 <xsl:call-template name="module_text_staffinfo">
568 <xsl:with-param name="mod_number" select="$mod_number"/>
569 </xsl:call-template>
571 </xsl:template>
573 <!-- Create a CONTENT module entry -->
574 <xsl:template match="CONTENT">
575 <xsl:param name="mod_number">1. </xsl:param>
577 <xsl:choose>
578 <!-- Detected a file -->
579 <xsl:when test="FILES/FILEREF/RELFILE/@value != ''">
581 <!-- Every file module will have a label module describing it -->
582 <xsl:call-template name="module_label">
583 <xsl:with-param name="mod_number" select="$mod_number"/>
584 </xsl:call-template>
586 <xsl:variable name="summary" select="MAINDATA/TEXT"/>
588 <xsl:for-each select="FILES/FILEREF">
589 <xsl:call-template name="module_file">
590 <xsl:with-param name="mod_number" ><xsl:value-of select="$mod_number"/>0<xsl:value-of select="position()"/></xsl:with-param>
591 <xsl:with-param name="summary" ><xsl:value-of select="$summary"/></xsl:with-param>
592 </xsl:call-template>
593 </xsl:for-each>
595 </xsl:when>
597 <!-- Detected a folder -->
598 <xsl:when test="FLAGS/ISFOLDER/@value = 'true'">
600 <xsl:call-template name="module_label">
601 <xsl:with-param name="mod_number" select="$mod_number"/>
602 </xsl:call-template>
604 </xsl:when>
606 <!-- Detected text -->
607 <xsl:when test="MAINDATA/FLAGS/ISHTML/@value = 'true'">
609 <xsl:call-template name="module_text">
610 <xsl:with-param name="mod_number" select="$mod_number"/>
611 </xsl:call-template>
613 </xsl:when>
615 <xsl:otherwise>
616 <UNKNOWN>
617 <xsl:value-of select="TITLE"/>
618 </UNKNOWN>
619 </xsl:otherwise>
620 </xsl:choose>
622 </xsl:template>
623 <!-- ############# Forum conversion ################# -->
625 <xsl:template match="FORUM">
626 <xsl:param name="mod_number">1. </xsl:param>
627 <MOD>
628 <ID><xsl:value-of select="$mod_number"/></ID>
629 <MODTYPE>forum</MODTYPE>
630 <TYPE>general</TYPE>
631 <NAME>
632 <xsl:value-of select="TITLE/@value"/>
633 </NAME>
634 <INTRO>
635 <xsl:value-of select="DESCRIPTION/TEXT"/>
636 </INTRO>
637 <OPEN>2</OPEN>
638 <ASSESSED>0</ASSESSED>
639 <ASSESSPUBLIC>0</ASSESSPUBLIC>
640 <ASSESSTIMESTART>0</ASSESSTIMESTART>
641 <ASSESSTIMEFINISH>0</ASSESSTIMEFINISH>
642 <MAXBYTES>0</MAXBYTES>
643 <SCALE>0</SCALE>
644 <FORCESUBSCRIBE>0</FORCESUBSCRIBE>
645 <RSSTYPE>0</RSSTYPE>
646 <RSSARTICLES>0</RSSARTICLES>
647 <TIMEMODIFIED></TIMEMODIFIED>
648 <!--
649 <DISCUSSIONS>
650 <xsl:for-each select="MESSAGETHREADS/MSG">
651 <xsl:variable name="discussion_id" select="position()"/>
652 <DISCUSSION>
653 <ID>
654 <xsl:value-of select="$mod_number"/>0<xsl:value-of select="$discussion_id"/>
655 </ID>
656 <NAME>
657 <xsl:value-of select="TITLE/@value"/>
658 </NAME>
659 <FIRSTPOST>2</FIRSTPOST>
660 <USERID>1</USERID>
661 <GROUPID>-1</GROUPID>
662 <ASSESSED>1</ASSESSED>
663 <TIMEMODIFIED>1094748430</TIMEMODIFIED>
664 <USERMODIFIED>1</USERMODIFIED>
665 <POSTS>
666 <xsl:call-template name="MSG">
667 <xsl:with-param name="parent" select="0"/>
668 <xsl:with-param name="post_id">
669 <xsl:value-of select="$mod_number"/>0<xsl:value-of select="$discussion_id"/>0<xsl:value-of select="position()"/>
670 </xsl:with-param>
671 </xsl:call-template>
672 </POSTS>
673 </DISCUSSION>
674 </xsl:for-each>
675 </DISCUSSIONS>
677 </MOD>
678 </xsl:template>
680 <xsl:template name="MSG" match="MSG">
681 <xsl:param name="parent" select="1"/>
682 <xsl:param name="post_id" select="1"/>
683 <POST>
684 <ID><xsl:value-of select="$post_id"/></ID>
685 <PARENT> <xsl:value-of select="$parent"/></PARENT>
686 <USERID>1</USERID>
687 <CREATED>1094748430</CREATED>
688 <MODIFIED>1094748430</MODIFIED>
689 <MAILED>1</MAILED>
690 <SUBJECT><xsl:value-of select="TITLE/@value"/></SUBJECT>
691 <MESSAGE><xsl:value-of select="MESSAGETEXT"/></MESSAGE>
692 <FORMAT>1</FORMAT>
693 <ATTACHMENT></ATTACHMENT>
694 <TOTALSCORE>0</TOTALSCORE>
695 </POST>
697 <xsl:for-each select="MSG">
698 <xsl:call-template name="MSG">
699 <xsl:with-param name="parent" select="$post_id"/>
700 <xsl:with-param name="post_id">
701 <xsl:value-of select="$post_id"/>0<xsl:value-of select="position()"/>
702 </xsl:with-param>
703 </xsl:call-template>
704 </xsl:for-each>
705 </xsl:template>
707 <xsl:template name="news_forum_section_mod" >
708 <xsl:param name="mod_number">1. </xsl:param>
709 <MOD>
710 <ID>1</ID>
711 <ZIBA_NAME>
712 News forum
713 </ZIBA_NAME>
714 <TYPE>news</TYPE>
715 <INSTANCE>1</INSTANCE>
716 <ADDED>1094240775</ADDED>
717 <DELETED>0</DELETED>
718 <SCORE>0</SCORE>
719 <INDENT>0</INDENT>
720 <VISIBLE>1</VISIBLE>
721 <GROUPMODE>0</GROUPMODE>
722 </MOD>
723 </xsl:template>
725 <xsl:template name="news_forum_mod" >
726 <xsl:param name="mod_number">1. </xsl:param>
727 <MOD>
728 <ID><xsl:value-of select="$mod_number"/></ID>
729 <MODTYPE>forum</MODTYPE>
730 <TYPE>news</TYPE>
731 <NAME>News forum</NAME>
732 <INTRO>General news and announcements</INTRO>
733 <OPEN>2</OPEN>
734 <ASSESSED>0</ASSESSED>
735 <ASSESSPUBLIC>0</ASSESSPUBLIC>
736 <ASSESSTIMESTART>0</ASSESSTIMESTART>
737 <ASSESSTIMEFINISH>0</ASSESSTIMEFINISH>
738 <MAXBYTES>0</MAXBYTES>
739 <SCALE>0</SCALE>
740 <FORCESUBSCRIBE>0</FORCESUBSCRIBE>
741 <RSSTYPE>0</RSSTYPE>
742 <RSSARTICLES>0</RSSARTICLES>
743 <TIMEMODIFIED></TIMEMODIFIED>
744 <DISCUSSIONS>
745 <xsl:for-each select="//resource">
746 <xsl:variable name="m_number" select="substring-after(@identifier,'res')"/>
747 <xsl:variable name="discussion_id" select="position()"/>
748 <xsl:for-each select="document(concat('',@file))">
749 <xsl:if test="//ANNOUNCEMENT/TITLE/@value != ''">
750 <xsl:call-template name="ANNOUNCEMENT">
751 <xsl:with-param name="discussion_id" select="$discussion_id"/>
752 </xsl:call-template>
753 </xsl:if>
754 </xsl:for-each>
755 </xsl:for-each>
757 </DISCUSSIONS>
758 </MOD>
759 </xsl:template>
761 <!-- Create an ANNOUNCEMENT forum entry -->
762 <xsl:template name="ANNOUNCEMENT" >
763 <xsl:param name="discussion_id">1. </xsl:param>
764 <DISCUSSION>
765 <ID>
766 <xsl:value-of select="$discussion_id"/>
767 </ID>
768 <NAME><xsl:value-of select="//ANNOUNCEMENT/TITLE/@value"/></NAME>
769 <FIRSTPOST><xsl:value-of select="$discussion_id"/></FIRSTPOST>
770 <USERID>1</USERID>
771 <GROUPID>-1</GROUPID>
772 <ASSESSED>1</ASSESSED>
773 <TIMEMODIFIED>1094748430</TIMEMODIFIED>
774 <USERMODIFIED>1</USERMODIFIED>
775 <POSTS>
776 <POST>
777 <ID><xsl:value-of select="$discussion_id"/></ID>
778 <PARENT>0</PARENT>
779 <USERID>1</USERID>
780 <CREATED>1094748430</CREATED>
781 <MODIFIED>1094748430</MODIFIED>
782 <MAILED>1</MAILED>
783 <SUBJECT><xsl:value-of select="//ANNOUNCEMENT/TITLE/@value"/></SUBJECT>
784 <MESSAGE><xsl:value-of select="//ANNOUNCEMENT/DESCRIPTION/TEXT"/></MESSAGE>
785 <FORMAT>1</FORMAT>
786 <ATTACHMENT></ATTACHMENT>
787 <TOTALSCORE>0</TOTALSCORE>
788 </POST>
789 </POSTS>
790 </DISCUSSION>
792 <!--
793 <xsl:call-template name="MSG">
794 <xsl:with-param name="parent" select="0"/>
795 <xsl:with-param name="post_id">
796 <xsl:value-of select="$mod_number"/>0<xsl:value-of select="$discussion_id"/>0<xsl:value-of select="position()"/>
797 </xsl:with-param>
798 </xsl:call-template>
800 </xsl:template>
803 </xsl:stylesheet>