summaryrefslogtreecommitdiff
path: root/server/xml
diff options
context:
space:
mode:
Diffstat (limited to 'server/xml')
-rw-r--r--server/xml/macros/test_button.xml6
-rw-r--r--server/xml/macros/test_lineedit.xml12
-rw-r--r--server/xml/macros/test_metawidget.xml13
-rw-r--r--server/xml/macros/test_resume.xml85
4 files changed, 87 insertions, 29 deletions
diff --git a/server/xml/macros/test_button.xml b/server/xml/macros/test_button.xml
index 9f01960..84f172e 100644
--- a/server/xml/macros/test_button.xml
+++ b/server/xml/macros/test_button.xml
@@ -1,6 +1,10 @@
<?xml version='1.0' encoding='UTF-8'?>
<macro name="test_button" version="1.0">
- <resume></resume>
+ <resume>
+ <script>
+ return value('dims')
+ </script>
+ </resume>
<queries>
</queries>
<maps>
diff --git a/server/xml/macros/test_lineedit.xml b/server/xml/macros/test_lineedit.xml
index 783ad57..d706b50 100644
--- a/server/xml/macros/test_lineedit.xml
+++ b/server/xml/macros/test_lineedit.xml
@@ -7,18 +7,14 @@
<maps>
</maps>
<scripts>
- <script name="A" language="lua">
- if ( value == '4' )
- then
- return true
- end
- return false
- </script>
+ <script language="lua" src="regexp.lua"/>
</scripts>
<widgets caption="Test LineEdit"
layout="vbox">
- <lineedit name="dims" value="tester" script="A" map="test.data" regexp="[0-9]"/>
+ <lineedit name="dims" value="tester"
+ map="test.data"
+ onChange="this:setValid(regexp('^%d?%d?%d$'))"/>
<frame layout="hbox">
<spacer />
diff --git a/server/xml/macros/test_metawidget.xml b/server/xml/macros/test_metawidget.xml
index a2d51ea..3e78ebe 100644
--- a/server/xml/macros/test_metawidget.xml
+++ b/server/xml/macros/test_metawidget.xml
@@ -10,14 +10,19 @@
<widgets caption="Test Metawidget"
layout="vbox">
- <metawidget layout="vbox" name="dims" format="${test1}: ${test2}" storechildren="true">
+ <metawidget layout="vbox" name="dims" format="${test1}: ${test2}"
+ storechildren="true">
<lineedit name="test1" value="test"/>
- <checkbox name="test2" value="ja" truevalue="ja" falsevalue="nej" caption="Og svaret er?"/>
+ <checkbox name="test2" value="ja" truevalue="ja" falsevalue="nej"
+ caption="Og svaret er?"/>
</metawidget>
- <metawidget layout="vbox" name="dims2" format="${a}: ${b}" storechildren="false">
+ <metawidget layout="vbox" name="dims2" format="${a}: ${b}"
+ storechildren="false">
<lineedit name="a" value="test"/>
- <checkbox name="b" value="ja" truevalue="ja" falsevalue="nej" caption="Og svaret er?"/>
+ <checkbox name="b" value="ja" truevalue="ja" falsevalue="nej"
+ caption="Og svaret er?"
+ onChange="w=widget('dims') w:setValid(this:checked())"/>
</metawidget>
<frame layout="hbox">
diff --git a/server/xml/macros/test_resume.xml b/server/xml/macros/test_resume.xml
index c3e3cbe..05afd3f 100644
--- a/server/xml/macros/test_resume.xml
+++ b/server/xml/macros/test_resume.xml
@@ -1,32 +1,85 @@
<?xml version='1.0' encoding='UTF-8'?>
<macro name="test_resume" version="1.0">
- <resume language="lua">
- -- This is a LUA program!
- if getValue('test2') == 'ja'
- then
- return getValue('dims') .. ' made out of ' .. getValue('test1') .. ' and ' .. getValue('test2')
- else
- return 'niksen'
- end
+
+ <resume>
+ <script src="regexp.lua"/>
+ <script>
+ -- inline code
+ if(regexp('.+', ''))
+ then
+ return 'a string'
+ else
+ return 'another string'
+ end
+ </script>
</resume>
+
<queries>
</queries>
+
<maps>
</maps>
+
<scripts>
+ <script language="lua" src="test.lua"/>
+ <script language="lua">
+ function bar(wdg)
+ w = widget(wdg)
+ w:setValid(this:checked())
+ end
+
+ function foo()
+ this:setValid((string.sub(this:value(), 1, 4) == 'test'))
+ end
+ </script>
</scripts>
+
<widgets caption="Test Resume"
layout="vbox">
- <metawidget layout="vbox" name="dims"
- format="${test1}: ${test2}"
- storechildren="true">
- <lineedit name="test1" value="test"/>
- <checkbox caption="Og svaret er?"
- name="test2" value="ja"
- truevalue="ja" falsevalue="nej"/>
- </metawidget>
+ <lineedit name="test1" value="test"
+ onChange="this:setValid(this:value()~='')"/>
+ <checkbox caption="Og svaret eer?"
+ name="test2" value="ja"
+ truevalue="ja" falsevalue="nej"
+ onChange="bar('test1')"/>
+ <textedit name="test3" value="tjae"
+ onChange="this:setValid(this:value() == 'a')"/>
+ <altcombobox name="dims" value="futtefejer" layout="vbox"
+ onChange="this:setValid((string.sub(this:value(), 1, 4) == 'test'))">
+ <item caption="Test1" value="test1"/>
+ <item caption="Test2" value="test2"/>
+ <item caption="Test3" value="test3"/>
+ <altitem caption="Test[n]" value="test4" innerwidget="inner">
+ <lineedit name="inner"/>
+ </altitem>
+ </altcombobox>
+
+ <combobox name="combo1" type="select"
+ onChange="this:setValid((string.sub(this:value(), 1, 4) == 'test'))">
+ <item caption="Test1" value="test1"/>
+ <item caption="Test2" value="test2"/>
+ <item caption="Test3" value="test3"/>
+ <item caption="Test4" value="test4"/>
+ </combobox>
+
+ <combobox name="combo2" type="search"
+ onChange="this:setValid((string.sub(this:value(), 1, 4) == 'test'))">
+ <item caption="Test1" value="test1"/>
+ <item caption="Test2" value="test2"/>
+ <item caption="Test3" value="test3"/>
+ <item caption="Test4" value="test4"/>
+ </combobox>
+
+ <combobox name="combo3" type="edit"
+ onChange="this:setValid((string.sub(this:value(), 1, 4) == 'test'))">
+ <item caption="Test1" value="test1"/>
+ <item caption="Test2" value="test2"/>
+ <item caption="Test3" value="test3"/>
+ <item caption="Test4" value="test4"/>
+ </combobox>
+
<frame layout="hbox">
<spacer />
<button caption="Reset" action="reset"/>