summaryrefslogtreecommitdiff
path: root/oracle-conversion
diff options
context:
space:
mode:
Diffstat (limited to 'oracle-conversion')
-rw-r--r--oracle-conversion/create-kapv-in-moodle.sh15
-rw-r--r--oracle-conversion/lesson-add-to-moodle.xsl57
-rw-r--r--oracle-conversion/sort-lesson.xsl22
3 files changed, 94 insertions, 0 deletions
diff --git a/oracle-conversion/create-kapv-in-moodle.sh b/oracle-conversion/create-kapv-in-moodle.sh
new file mode 100644
index 0000000..e501a86
--- /dev/null
+++ b/oracle-conversion/create-kapv-in-moodle.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+xsltproc sort-lesson.xsl lesson.xml | \
+ xsltproc \
+ --stringparam cookie MoodleSession=XXXXXXXXXXXXXXXXXXXXXXXXXX \
+ --stringparam sesskey xxxxxxxxxx \
+ --stringparam url http://moodle.bnfr.net \
+ --stringparam module 23 \
+ --stringparam course 2 \
+ --stringparam section 1 \
+ lesson-add-to-moodle.xsl - | \
+ while read cmd;
+ do
+ eval $cmd
+ done
diff --git a/oracle-conversion/lesson-add-to-moodle.xsl b/oracle-conversion/lesson-add-to-moodle.xsl
new file mode 100644
index 0000000..53851e1
--- /dev/null
+++ b/oracle-conversion/lesson-add-to-moodle.xsl
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:str="http://exslt.org/strings"
+ extension-element-prefixes="str">
+
+<xsl:output method="text"/>
+
+<xsl:param name="cookie"/>
+<xsl:param name="course"/>
+<xsl:param name="coursemodule"></xsl:param>
+<xsl:param name="section">0</xsl:param>
+<xsl:param name="module"/>
+<xsl:param name="sesskey"/>
+<xsl:param name="url"/>
+
+<xsl:template match="ROW">
+ <xsl:text>curl -s -v --data "</xsl:text>
+ <xsl:text>name=</xsl:text>
+ <xsl:value-of select="str:encode-uri(concat('KAPV Aufgabe ', position()),true())"/>
+ <xsl:text>&amp;</xsl:text>
+
+ <xsl:text>query=</xsl:text>
+ <xsl:value-of select="str:encode-uri(MUSTER,true())"/>
+ <xsl:text>&amp;</xsl:text>
+
+ <xsl:value-of select="str:encode-uri('introeditor[text]',true())"/>
+ <xsl:text>=</xsl:text>
+ <xsl:value-of select="str:encode-uri('&lt;p&gt;', true())"/>
+ <xsl:value-of select="str:encode-uri(TEXT,true())"/>
+ <xsl:value-of select="str:encode-uri('&lt;/p&gt;', true())"/>
+ <xsl:text>&amp;</xsl:text>
+
+ <xsl:value-of select="concat('module=', $module,'&amp;')"/>
+ <xsl:value-of select="concat('course=', $course,'&amp;')"/>
+ <xsl:value-of select="concat('coursemodule=', $coursemodule,'&amp;')"/>
+ <xsl:value-of select="concat('section=', $section,'&amp;')"/>
+ <xsl:value-of select="concat('sesskey=', $sesskey,'&amp;')"/>
+ <xsl:text>introeditor%5Bformat%5D=1&amp;</xsl:text><!--introeditor%5Bitemid%5D=518854351&amp;</xsl:text>-->
+ <xsl:text>groupmode=0&amp;visible=1&amp;cmidnumber=&amp;submitbutton2=Save%20and%20return%20to%20course&amp;</xsl:text>
+ <xsl:text>modulename=sqlbox&amp;instance=&amp;add=sqlbox&amp;update=0&amp;return=0&amp;sr=0&amp;_qf__mod_sqlbox_mod_form=1</xsl:text>
+
+ <xsl:text>" </xsl:text>
+ <xsl:value-of select="concat('-b ', $cookie, ' ')"/>
+ <xsl:value-of select="concat('--referer &quot;', $url,'/course/modedit.php?add=sqlbox&amp;type=&amp;course=',$course,'&amp;section=',$section,'&amp;return=0&amp;sr=0&quot; ')"/>
+
+
+ <xsl:value-of select="concat($url, '/course/modedit.php')"/>
+
+ <xsl:text>&#10;</xsl:text>
+
+</xsl:template>
+
+<xsl:template match="/">
+ <xsl:apply-templates select="ROWSET/ROW"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/oracle-conversion/sort-lesson.xsl b/oracle-conversion/sort-lesson.xsl
new file mode 100644
index 0000000..54c4601
--- /dev/null
+++ b/oracle-conversion/sort-lesson.xsl
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:param name="modul">1</xsl:param>
+
+<xsl:template match="ROW">
+ <ROW>
+ <xsl:copy-of select="*"/>
+ </ROW>
+</xsl:template>
+<xsl:template match="ROW" mode="order">
+ <xsl:apply-templates select="//ROWSET[@NAME='lessons']/ROW[LESSON_ID=current()/LESSON_ID and MODUL=$modul and TYP='SELECT']"/>
+</xsl:template>
+
+<xsl:template match="/">
+ <ROWSET>
+ <xsl:apply-templates select="DATABASE/ROWSET[@NAME='lesson_order']/ROW[MODUL=$modul]" mode="order">
+ <xsl:sort select="NR"/>
+ </xsl:apply-templates>
+ </ROWSET>
+</xsl:template>
+</xsl:stylesheet>