Commit 9018f45a authored by Carsten  Rose's avatar Carsten Rose
Browse files

OnArray.php: The 'escape' of the escaped token has to be removed.

parent bd436f38
......@@ -131,7 +131,8 @@ class OnArray {
$arr = explode($delimiter, $encodedStr);
for ($ii = 0; $ii < count($arr); $ii++) {
$arr[$ii] = str_replace(SUBSTITUTE, '\\' . $delimiter, $arr[$ii]);
// $arr[$ii] = str_replace(SUBSTITUTE, '\\' . $delimiter, $arr[$ii]);
$arr[$ii] = str_replace(SUBSTITUTE, $delimiter, $arr[$ii]);
}
return $arr;
......
......@@ -960,6 +960,10 @@ EOF;
$result = $link->renderLink('p:person|c:n|q:do you really want:warn:I do:Shut up');
$this->assertEquals('<a href="?id=person" ' . $js . ' >?id=person</a>', $result);
$js = str_replace('do you really want', 'My Question:some nice value', $js);
$result = $link->renderLink("p:person|c:n|q:My Question\\:some nice value:warn:I do:Shut up");
$this->assertEquals('<a href="?id=person" ' . $js . ' >?id=person</a>', $result);
}
......
......@@ -405,7 +405,49 @@ class ReportTest extends AbstractDatabaseTest {
*
*/
public function testReportPageTokenQuestion() {
// TODO: implement
$js = <<<EOF
id="12345" onClick="var alert = new QfqNS.Alert('Please confirm', 'info', [
{ label: 'Ok', eventName: 'ok' },
{ label: 'Cancel',eventName: 'cancel'}
]);
alert.on('alert.ok', function() {
window.location = $('#12345').attr('href');
});
alert.show();
return false;"
EOF;
// _Page: pagealias, param, Text, Tooltip, Question
$result = $this->report->process("10.sql = SELECT 'p:form&r=123&a=hello&type=5&L=3&final=world|t:Person|o:This is a tooltip|q' AS _page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="internal" title="This is a tooltip" ' . $js . ' >Person</a>', $result);
// _Page: pagealias, param, Text, Tooltip, Question
$js = str_replace('Please confirm', 'My Question', $js);
$result = $this->report->process("10.sql = SELECT 'p:form&r=123&a=hello&type=5&L=3&final=world|t:Person|o:This is a tooltip|q:My Question' AS _page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="internal" title="This is a tooltip" ' . $js . ' >Person</a>', $result);
// _Page: pagealias, param, Text, Tooltip, Question:Level
$js = str_replace('info', 'error', $js);
$result = $this->report->process("10.sql = SELECT 'p:form&r=123&a=hello&type=5&L=3&final=world|t:Person|o:This is a tooltip|q:My Question:error' AS _page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="internal" title="This is a tooltip" ' . $js . ' >Person</a>', $result);
// _Page: pagealias, param, Text, Tooltip, Question:Level, Button Ok
$js = str_replace('Ok', 'YES', $js);
$result = $this->report->process("10.sql = SELECT 'p:form&r=123&a=hello&type=5&L=3&final=world|t:Person|o:This is a tooltip|q:My Question:error:YES' AS _page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="internal" title="This is a tooltip" ' . $js . ' >Person</a>', $result);
// _Page: pagealias, param, Text, Tooltip, Question:Level, Button Cancel
$js = str_replace('Cancel', 'NO', $js);
$result = $this->report->process("10.sql = SELECT 'p:form&r=123&a=hello&type=5&L=3&final=world|t:Person|o:This is a tooltip|q:My Question:error:YES:NO' AS _page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="internal" title="This is a tooltip" ' . $js . ' >Person</a>', $result);
// _Page: pagealias, param, Text, Tooltip, Question:Level (with escaped colon)
// $js = str_replace('Cancel', 'NO', $js);
$js = str_replace('My Question', 'Other Question:some nice value', $js);
$result = $this->report->process("10.sql = SELECT 'p:form&r=123&a=hello&type=5&L=3&final=world|t:Person|o:This is a tooltip|q:Other Question\\\:some nice value:error:YES:NO' AS _page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="internal" title="This is a tooltip" ' . $js . ' >Person</a>', $result);
}
/**
......@@ -479,19 +521,45 @@ EOF;
$result = $this->report->process("10.sql = SELECT 'form&r=123&a=hello&type=5&L=3&final=world|Person|This is a tooltip|My Question|myclass|mytarget' AS _Page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="myclass" target="mytarget" title="This is a tooltip" ' . $js . ' >Person</a>', $result);
//TODO: implement
// _Page: pagealias, param, Text, Tooltip, Question, Class, Target, Rendermode
// $result = $this->report->process("10.sql = SELECT 'form&r=123&a=hello&type=5&L=3&final=world|Person|This is a tooltip|My Question|myclass|mytarget|0' AS _Page FROM Person ORDER BY id LIMIT 1");
// $this->assertEquals('', $result);
// _Page: pagealias, param, Text, Tooltip, Question, Class, Target, Rendermode 0: URL + Text
$result = $this->report->process("10.sql = SELECT 'form&r=123&a=hello&type=5&L=3&final=world|Person|This is a tooltip|My Question|myclass|mytarget|0' AS _Page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="myclass" target="mytarget" title="This is a tooltip" ' . $js . ' >Person</a>', $result);
// _Page: pagealias, param, Text, Tooltip, Question, Class, Target, Rendermode, Sip ON 1
// $result = $this->report->process("10.sql = SELECT 'form&r=123&a=hello&type=5&L=3&final=world|Person|This is a tooltip||myclass|mytarget|0|1' AS _Page FROM Person ORDER BY id LIMIT 1");
// $this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="myclass" target="mytarget" title="This is a tooltip" ' . $js .' >Person</a>', $result);
// _Page: pagealias, param, Text, Tooltip, Question, Class, Target, Rendermode 0: URL
$result = $this->report->process("10.sql = SELECT 'form&r=123&a=hello&type=5&L=3&final=world||This is a tooltip|My Question|myclass|mytarget|0' AS _Page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="myclass" target="mytarget" title="This is a tooltip" ' . $js . ' >index.php?id=form&type=5&L=3&s=badcaffee1234</a>', $result);
// _Page: pagealias, param, Text, Tooltip, Question, Class, Target, Rendermode 2: URL
$result = $this->report->process("10.sql = SELECT 'form&r=123&a=hello&type=5&L=3&final=world||This is a tooltip|My Question|myclass|mytarget|2' AS _Page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('', $result);
// _Page: pagealias, param, Text, Tooltip, Question, Class, Target, Rendermode 3: URL + Text
$result = $this->report->process("10.sql = SELECT 'form&r=123&a=hello&type=5&L=3&final=world|Person|This is a tooltip|My Question|myclass|mytarget|3' AS _Page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('Person', $result);
// _Page: pagealias, param, Text, Tooltip, Question, Class, Target, Rendermode 4: URL + Text
$result = $this->report->process("10.sql = SELECT 'form&r=123&a=hello&type=5&L=3&final=world|Person|This is a tooltip|My Question|myclass|mytarget|4' AS _Page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('index.php?id=form&type=5&L=3&s=badcaffee1234', $result);
// _Page: pagealias, param, Text, Tooltip, Question, Class, Target, Rendermode 4: URL
$result = $this->report->process("10.sql = SELECT 'form&r=123&a=hello&type=5&L=3&final=world|Person|This is a tooltip|My Question|myclass|mytarget|4' AS _Page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('index.php?id=form&type=5&L=3&s=badcaffee1234', $result);
// _Page: pagealias, param, Text, Tooltip, Question, Class, Target, Rendermode 4: URL + Text
$result = $this->report->process("10.sql = SELECT 'form&r=123&a=hello&type=5&L=3&final=world|Person|This is a tooltip|My Question|myclass|mytarget|5' AS _Page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('', $result);
// _Page: pagealias, param, Text, Tooltip, Question, Class, Target, Rendermode 4: URL
$result = $this->report->process("10.sql = SELECT 'form&r=123&a=hello&type=5&L=3&final=world||This is a tooltip|My Question|myclass|mytarget|5' AS _Page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('', $result);
// _Page: pagealias, param, Text, Tooltip, Question, Class, Target, Rendermode, Sip OFF
// $result = $this->report->process("10.sql = SELECT 'form&r=123&a=hello&type=5&L=3&final=world|Person|This is a tooltip||myclass|mytarget|0|0' AS _Page FROM Person ORDER BY id LIMIT 1");
// $this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="internal" title="This is a tooltip" ' . $js .' >Person</a>', $result);
// _Page: pagealias, param, Text, Tooltip, Question, Class, Target, Rendermode, Sip ON (1)
$result = $this->report->process("10.sql = SELECT 'form&r=123&a=hello&type=5&L=3&final=world|Person|This is a tooltip||myclass|mytarget|0|1' AS _Page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="index.php?id=form&type=5&L=3&s=badcaffee1234" class="myclass" target="mytarget" title="This is a tooltip" >Person</a>', $result);
// _Page: pagealias, param, Text, Tooltip, Question, Class, Target, Rendermode, Sip OFF (0)
$result = $this->report->process("10.sql = SELECT 'form&r=123&a=hello&type=5&L=3&final=world|Person|This is a tooltip||myclass|mytarget|0|0' AS _Page FROM Person ORDER BY id LIMIT 1");
$this->assertEquals('<a href="?id=form&r=123&a=hello&type=5&L=3&final=world" class="myclass" target="mytarget" title="This is a tooltip" >Person</a>', $result);
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment