diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2013-01-27 00:07:18 +0100 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2013-01-27 00:08:45 +0100 |
commit | c4b79fb817c7cc4018f1a90c733e13b8e694ea48 (patch) | |
tree | fd7cd5812256e0a46997399e3f48938d7d60384f /oracle-conversion | |
parent | 4f25dfc69e3e582328702c9f1afb83c1ff9f70c4 (diff) | |
download | sqltutor-plugin-c4b79fb817c7cc4018f1a90c733e13b8e694ea48.tar.gz sqltutor-plugin-c4b79fb817c7cc4018f1a90c733e13b8e694ea48.tar.bz2 sqltutor-plugin-c4b79fb817c7cc4018f1a90c733e13b8e694ea48.zip |
Add xsl-powered script to create KAPV in moodle
Diffstat (limited to 'oracle-conversion')
-rw-r--r-- | oracle-conversion/create-kapv-in-moodle.sh | 15 | ||||
-rw-r--r-- | oracle-conversion/lesson-add-to-moodle.xsl | 57 | ||||
-rw-r--r-- | oracle-conversion/sort-lesson.xsl | 22 |
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>&</xsl:text> + + <xsl:text>query=</xsl:text> + <xsl:value-of select="str:encode-uri(MUSTER,true())"/> + <xsl:text>&</xsl:text> + + <xsl:value-of select="str:encode-uri('introeditor[text]',true())"/> + <xsl:text>=</xsl:text> + <xsl:value-of select="str:encode-uri('<p>', true())"/> + <xsl:value-of select="str:encode-uri(TEXT,true())"/> + <xsl:value-of select="str:encode-uri('</p>', true())"/> + <xsl:text>&</xsl:text> + + <xsl:value-of select="concat('module=', $module,'&')"/> + <xsl:value-of select="concat('course=', $course,'&')"/> + <xsl:value-of select="concat('coursemodule=', $coursemodule,'&')"/> + <xsl:value-of select="concat('section=', $section,'&')"/> + <xsl:value-of select="concat('sesskey=', $sesskey,'&')"/> + <xsl:text>introeditor%5Bformat%5D=1&</xsl:text><!--introeditor%5Bitemid%5D=518854351&</xsl:text>--> + <xsl:text>groupmode=0&visible=1&cmidnumber=&submitbutton2=Save%20and%20return%20to%20course&</xsl:text> + <xsl:text>modulename=sqlbox&instance=&add=sqlbox&update=0&return=0&sr=0&_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 "', $url,'/course/modedit.php?add=sqlbox&type=&course=',$course,'&section=',$section,'&return=0&sr=0" ')"/> + + + <xsl:value-of select="concat($url, '/course/modedit.php')"/> + + <xsl:text> </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> |