From 2f860bdf70392746fe61cc02fa4bb0a6c6621ebb Mon Sep 17 00:00:00 2001 From: Marc Egger Date: Thu, 16 May 2019 13:14:26 +0200 Subject: [PATCH 1/8] implement frontend and mockup --- javascript/src/Utils.js | 19 ++++- mockup/tablesorter.php | 163 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 mockup/tablesorter.php diff --git a/javascript/src/Utils.js b/javascript/src/Utils.js index b432ee2e..f76115b5 100644 --- a/javascript/src/Utils.js +++ b/javascript/src/Utils.js @@ -17,4 +17,21 @@ var QfqNS = QfqNS || {}; return idSelector.replace(/(:|\.)/, "\\$1"); }; -})(QfqNS); \ No newline at end of file +})(QfqNS); + +$(document).ready(function () { + var more = 'more..'; + var less = 'less..'; + var moreButtonHtml = ''; + var moreButton = $(moreButtonHtml).insertAfter('span.qfq-more-text'); + moreButton.click(function () { + var moreText = $(this).siblings('span.qfq-more-text'); + if ($(this).text() === more) { + $(this).text(less); + moreText.show(); + } else { + $(this).text(more); + moreText.hide(); + } + }); +}); \ No newline at end of file diff --git a/mockup/tablesorter.php b/mockup/tablesorter.php new file mode 100644 index 00000000..6dd59782 --- /dev/null +++ b/mockup/tablesorter.php @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + Input Mode Switcher + + + +
+
+
+
+ +




+ + "important", + "public" => true, + "uid" => 235645, + "tableId" => "tableNr1", + "view" => ["columnSelection" => [0, 1], "filters" => ["", "hi"], "sortList" => [[0, 1]]] + ], + [ + "name" => "main", + "public" => true, + "uid" => 235645, + "tableId" => "tableNr1", + "view" => ["columnSelection" => [0, 3], "filters" => ["no"], "sortList" => [[0, 1]]] + ] + ]; + + $tablesorterViewsSafeJson = htmlentities(json_encode($tablesorterViews), ENT_QUOTES, 'UTF-8'); + $tablesorterTableId = 1; + $tablesorterUid = 1234; + + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NrSubmittedStatusLabelsFirst NameLast NameTitleEmailAffiliationOther AffiliationPositionOther PositionSupervisor NameSupervisor AffiliationSupervisor Other AffiliationSupervisor EmailPurposeOther PurposeExperiment Descr.Research QuestionsStatistical QuestionsOther Statistical QuestionsDescr. of Stat. QuestionsSoftwareOther SoftwarePrevious ConsultingLast ConsultingLast Consulting IDAttached Filesdel
2019-aw-0012019/04/18in progressHansBeckerhans.becker@uzh.chUniversity Medicine inc. USZPhD candidateRoger GruberFaculty of Scienceaslkdf@usz.chPublicationEs war einmal ein Frosch. Dieser Frosch war lokal inspiriert.Ein Frosch der voller Ueberraschungen war. EinEin Frosch gegen den Rest der Welt. Ein Frosch gegenRNo
+ +
+
+ +
+


+ + + + + + + + + + + + \ No newline at end of file -- GitLab From df23520b2f851b5e80a0523c1ac751cae968ca09 Mon Sep 17 00:00:00 2001 From: Marc Egger Date: Thu, 16 May 2019 13:23:52 +0200 Subject: [PATCH 2/8] implement frontend and mockup --- less/qfq-bs.css.less | 4 ++++ mockup/tablesorter.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/less/qfq-bs.css.less b/less/qfq-bs.css.less index 0c7bf520..c05df6be 100644 --- a/less/qfq-bs.css.less +++ b/less/qfq-bs.css.less @@ -803,4 +803,8 @@ legend { 100% { transform: scaleX(-1) rotate(0deg); } +} + +span.qfq-more-text { + display: none } \ No newline at end of file diff --git a/mockup/tablesorter.php b/mockup/tablesorter.php index 6dd59782..be6a8982 100644 --- a/mockup/tablesorter.php +++ b/mockup/tablesorter.php @@ -109,9 +109,9 @@ Es war einmal ein Frosch. Dieser Frosch war lokal inspiriert. - Ein Frosch der voller Ueberraschungen war. Ein + Ein Frosch der voller Ueberraschungen war. Ein Frosch der voller Ueberraschungen war. Ein Frosch der voller Ueberraschungen war. Ein Frosch der voller Ueberraschungen war. - Ein Frosch gegen den Rest der Welt. Ein Frosch gegen + Ein Frosch gegen den Rest der Welt. Ein Frosch gegen den Rest der Welt. Ein Frosch gegen den Rest der Welt. Haus R No -- GitLab From cf2a7893492f10d8d5bf6f7fb0084b866afd1294 Mon Sep 17 00:00:00 2001 From: Marc Egger Date: Mon, 20 May 2019 10:44:22 +0200 Subject: [PATCH 3/8] remove more.. button border --- javascript/src/Utils.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/javascript/src/Utils.js b/javascript/src/Utils.js index f76115b5..c706512e 100644 --- a/javascript/src/Utils.js +++ b/javascript/src/Utils.js @@ -19,10 +19,12 @@ var QfqNS = QfqNS || {}; })(QfqNS); + +// Hide long text and append "more.." button $(document).ready(function () { var more = 'more..'; var less = 'less..'; - var moreButtonHtml = ''; + var moreButtonHtml = ''; var moreButton = $(moreButtonHtml).insertAfter('span.qfq-more-text'); moreButton.click(function () { var moreText = $(this).siblings('span.qfq-more-text'); -- GitLab From 230656b0e97bf26067a01963a8b922689bc7da6a Mon Sep 17 00:00:00 2001 From: Marc Egger Date: Mon, 20 May 2019 12:51:15 +0200 Subject: [PATCH 4/8] qfq-bs.css.less: move class --- less/qfq-bs.css.less | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/less/qfq-bs.css.less b/less/qfq-bs.css.less index c05df6be..8f6069a3 100644 --- a/less/qfq-bs.css.less +++ b/less/qfq-bs.css.less @@ -709,6 +709,10 @@ select.qfq-locked:invalid { border: 1px dashed #25adf1; } +span.qfq-more-text { + display: none +} + // Droplets .qfq-droplet-container { @@ -803,8 +807,4 @@ legend { 100% { transform: scaleX(-1) rotate(0deg); } -} - -span.qfq-more-text { - display: none } \ No newline at end of file -- GitLab From e9db84e700dbc94d067146cf985a0856b05a354f Mon Sep 17 00:00:00 2001 From: Marc Egger Date: Mon, 20 May 2019 14:53:50 +0200 Subject: [PATCH 5/8] add sql functions QBAR and QMORE and run function.sql on version change --- .../Source/core/database/DatabaseUpdate.php | 1 + extension/Source/sql/functions.sql | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 extension/Source/sql/functions.sql diff --git a/extension/Source/core/database/DatabaseUpdate.php b/extension/Source/core/database/DatabaseUpdate.php index 9a5e7780..60eced8e 100644 --- a/extension/Source/core/database/DatabaseUpdate.php +++ b/extension/Source/core/database/DatabaseUpdate.php @@ -125,6 +125,7 @@ class DatabaseUpdate { if ($dbUpdate === SYSTEM_DB_UPDATE_ALWAYS || ($dbUpdate === SYSTEM_DB_UPDATE_AUTO && $new != $old)) { $this->dbUpdateStatements($old, $new); $this->db->playSqlFile(__DIR__ . '/../../sql/formEditor.sql'); + $this->db->playSqlFile(__DIR__ . '/../../sql/functions.sql'); $qfqLog = $this->db->getQfqLogFile(); Logger::logMessage(date('Y.m.d H:i:s ') . ": Updated from QFQ version '$old' to '$new'", $qfqLog); diff --git a/extension/Source/sql/functions.sql b/extension/Source/sql/functions.sql new file mode 100644 index 00000000..02615bd8 --- /dev/null +++ b/extension/Source/sql/functions.sql @@ -0,0 +1,39 @@ +### +# +# QMORE(input, maxlen) +# inserts a span into `input` after `maxlen` number of characters and returns it. +# +DROP FUNCTION IF EXISTS QMORE; +DELIMITER // +CREATE FUNCTION QMORE ( input TEXT, maxlen INT ) +RETURNS TEXT DETERMINISTIC +BEGIN +DECLARE output TEXT; +IF maxlen < 1 THEN +SET maxlen = 1; +END IF; +IF CHAR_LENGTH(input) > maxlen THEN +SET output = CONCAT(INSERT(input, maxlen, 0, ''), ''); +ELSE +SET output = input; +END IF; +RETURN output; +END; // +DELIMITER ; + + +### +# +# QBAR(input) +# replaces '|' in `input` with '\|' +# +DROP FUNCTION IF EXISTS QBAR; +DELIMITER // +CREATE FUNCTION QBAR ( input TEXT ) +RETURNS TEXT DETERMINISTIC +BEGIN +DECLARE output TEXT; +SET output = REPLACE(input, '|', '\\|'); +RETURN output; +END; // +DELIMITER ; \ No newline at end of file -- GitLab From 0055945d92cccf4a5cecad67340bc9605da1650c Mon Sep 17 00:00:00 2001 From: Marc Egger Date: Tue, 21 May 2019 14:02:08 +0200 Subject: [PATCH 6/8] change mockup name and content --- mockup/moreText.html | 65 ++++++++++++++++ mockup/tablesorter.php | 163 ----------------------------------------- 2 files changed, 65 insertions(+), 163 deletions(-) create mode 100644 mockup/moreText.html delete mode 100644 mockup/tablesorter.php diff --git a/mockup/moreText.html b/mockup/moreText.html new file mode 100644 index 00000000..8fcb9094 --- /dev/null +++ b/mockup/moreText.html @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + Input Mode Switcher + + + +
+
+
+
+ +




+ + Ein Frosch der voller Ueberraschungen war. Ein Frosch der voller Ueberraschungen war. Ein Frosch der voller Ueberraschungen war. Ein Frosch der voller Ueberraschungen war. + +
+
+ +
+


+ + + + + + + + + + + + \ No newline at end of file diff --git a/mockup/tablesorter.php b/mockup/tablesorter.php deleted file mode 100644 index be6a8982..00000000 --- a/mockup/tablesorter.php +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - Input Mode Switcher - - - -
-
-
-
- -




- - "important", - "public" => true, - "uid" => 235645, - "tableId" => "tableNr1", - "view" => ["columnSelection" => [0, 1], "filters" => ["", "hi"], "sortList" => [[0, 1]]] - ], - [ - "name" => "main", - "public" => true, - "uid" => 235645, - "tableId" => "tableNr1", - "view" => ["columnSelection" => [0, 3], "filters" => ["no"], "sortList" => [[0, 1]]] - ] - ]; - - $tablesorterViewsSafeJson = htmlentities(json_encode($tablesorterViews), ENT_QUOTES, 'UTF-8'); - $tablesorterTableId = 1; - $tablesorterUid = 1234; - - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NrSubmittedStatusLabelsFirst NameLast NameTitleEmailAffiliationOther AffiliationPositionOther PositionSupervisor NameSupervisor AffiliationSupervisor Other AffiliationSupervisor EmailPurposeOther PurposeExperiment Descr.Research QuestionsStatistical QuestionsOther Statistical QuestionsDescr. of Stat. QuestionsSoftwareOther SoftwarePrevious ConsultingLast ConsultingLast Consulting IDAttached Filesdel
2019-aw-0012019/04/18in progressHansBeckerhans.becker@uzh.chUniversity Medicine inc. USZPhD candidateRoger GruberFaculty of Scienceaslkdf@usz.chPublicationEs war einmal ein Frosch. Dieser Frosch war lokal inspiriert.Ein Frosch der voller Ueberraschungen war. Ein Frosch der voller Ueberraschungen war. Ein Frosch der voller Ueberraschungen war. Ein Frosch der voller Ueberraschungen war.Ein Frosch gegen den Rest der Welt. Ein Frosch gegen den Rest der Welt. Ein Frosch gegen den Rest der Welt. HausRNo
- -
-
- -
-


- - - - - - - - - - - - \ No newline at end of file -- GitLab From e535ecd8a6f28f74bbb7f4f7a6b4c0ea37839990 Mon Sep 17 00:00:00 2001 From: Marc Egger Date: Tue, 21 May 2019 17:09:31 +0200 Subject: [PATCH 7/8] add documentation --- extension/Documentation/Manual.rst | 34 ++++++++++++++++++++++++++++++ mockup/moreText.html | 29 ------------------------- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/extension/Documentation/Manual.rst b/extension/Documentation/Manual.rst index 27b7bc10..4526429d 100644 --- a/extension/Documentation/Manual.rst +++ b/extension/Documentation/Manual.rst @@ -6470,6 +6470,40 @@ Example:: CONCAT('y|F:', p.pathFileName,'|t:File (link)|o:', p.pathFileName) AS _link FROM Person AS p   + +.. _special-sql-functions: + +Special SQL Functions +--------------------- + +.. _qbar-qscape-qfq-delimiter: + +QBAR: Escape qfq Delimiter +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The SQL function QBAR(text) replaces "|" with "\\|" in `text` to prevent conflicts with the qfq special column notation. + +Example:: + + 10.sql = SELECT CONCAT('T:fileadmin/', QBAR(p.name), '.pdf') AS _thumbnail + FROM Person AS p   + +.. _qmore-truncate-long-text: + +QMORE: Truncate Long Text +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The SQL function QMORE(text, n) truncates `text` if it is longer than `n` characters and adds a "more.." button. If the "more..." +button is clicked, the whole text is displayed. + +Example:: + + 10.sql = SELECT QMORE("This is a text which is longer than 10 characters", 10) + +Output: + +This is a `more..` + .. _download: Download diff --git a/mockup/moreText.html b/mockup/moreText.html index 8fcb9094..3a606127 100644 --- a/mockup/moreText.html +++ b/mockup/moreText.html @@ -7,8 +7,6 @@ - - Input Mode Switcher @@ -34,32 +32,5 @@ - - - - - \ No newline at end of file -- GitLab From 75dd87214b0e08ec780c99e28909a81e5068e310 Mon Sep 17 00:00:00 2001 From: Carsten Rose Date: Wed, 22 May 2019 12:06:36 +0200 Subject: [PATCH 8/8] Manaul.rst: Refs #8270 - minor updates --- extension/Documentation/Manual.rst | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/extension/Documentation/Manual.rst b/extension/Documentation/Manual.rst index 4526429d..d20d8f75 100644 --- a/extension/Documentation/Manual.rst +++ b/extension/Documentation/Manual.rst @@ -5573,9 +5573,9 @@ Special column names +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | _XLSn |Used for Excel export. Prepend 'n=' and append a `newline` character around the string. See `excel-export`_. | +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| _+html-tag attributes |The content will be wrapped with ''. Example: SELECT 'example' AS '_+a href="http://example.com"' creates 'example' | +| _+|The content will be wrapped with ''. Example: SELECT 'example' AS '_+a href="http://example.com"' creates 'example' | +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| _=varname |The content will be saved in store 'user' under 'varname'. Retrieve it later via {{varname:U}}. See `STORE_USER`_, `store_user_examples`_ | +| _= |The content will be saved in store 'user' under 'varname'. Retrieve it later via {{varname:U}}. Example: 'SELECT "Hello world" AS _=text'. See `STORE_USER`_, `store_user_examples`_ | +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |_ |Suppress output. Column names with leading underscore are used to select data from the database and make it available in other parts of the report without generating any output. | +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -5588,6 +5588,7 @@ Column: _link * Most URLs will be rendered via class link. * Column names like `_pagee`, `_mailto`, ... are wrapper to class link. * The parameters for link contains a prefix to make them position-independent. +* Parameter have to be separated with '|'. If '|' is part of the value, it needs to be escaped '\\|'. This can be done via QFQ SQL function `QBAR()` - see `qbar-qscape-qfq-delimiter`_. +---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ |URL|IMG|Meaning |Qualifier |Example |Description | @@ -5660,6 +5661,8 @@ Column: _link | | |Delete record | x[:a|r|c] |x, x:r, x:c |a: ajax (only QFQ internal used), r: report (default), c: close (current page, open last page) | +---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ + + .. _render-mode: Render mode @@ -6478,23 +6481,26 @@ Special SQL Functions .. _qbar-qscape-qfq-delimiter: -QBAR: Escape qfq Delimiter +QBAR: Escape QFQ Delimiter ^^^^^^^^^^^^^^^^^^^^^^^^^^ -The SQL function QBAR(text) replaces "|" with "\\|" in `text` to prevent conflicts with the qfq special column notation. +The SQL function QBAR(text) replaces "|" with "\\|" in `text` to prevent conflicts with the QFQ special column notation. +In general this function should be used when there is a chance that unplanned '|'-characters occur. Example:: - 10.sql = SELECT CONCAT('T:fileadmin/', QBAR(p.name), '.pdf') AS _thumbnail - FROM Person AS p   + 10.sql = SELECT CONCAT('p:notes|t:Information: ', QBAR(Note.title), '|b') AS _link FROM Note   + +In case 'Note.title' contains a '|' (like 'fruit | numbers'), it will confuse the '... AS _link' class. Therefore it's +necessary to 'escape' (adding a '\' in front of the problematic character) the bar which is done by using `QBAR()`. .. _qmore-truncate-long-text: -QMORE: Truncate Long Text -^^^^^^^^^^^^^^^^^^^^^^^^^^ +QMORE: Truncate Long Text - more/less +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The SQL function QMORE(text, n) truncates `text` if it is longer than `n` characters and adds a "more.." button. If the "more..." -button is clicked, the whole text is displayed. +button is clicked, the whole text is displayed. The stored procedure QMORE() will inject some HTML/CSS code. Example:: @@ -7485,9 +7491,9 @@ last used (STORE_USER) or (first time call during browser session) takes the def # Semester switch 10 { sql = SELECT '{{semId:SUY}}' AS '_=semId', - CONCAT('p:{{pageAlias:T}}&semId=', sp.id, '|t:', sp.name, '|s|b|G:glyphicon-chevron-left') AS _link, + CONCAT('p:{{pageAlias:T}}&semId=', sp.id, '|t:', QBAR(sp.name), '|s|b|G:glyphicon-chevron-left') AS _link, ' ', - CONCAT('p:{{pageAlias:T}}&semId=', sn.id, '|t:', sn.name, '|s|b|G:glyphicon-chevron-right|R') AS _link + CONCAT('p:{{pageAlias:T}}&semId=', sn.id, '|t:', QBAR(sn.name), '|s|b|G:glyphicon-chevron-right|R') AS _link FROM semester AS sc LEFT JOIN semester AS sp ON sp.id=sc.id-1 LEFT JOIN semester AS sn ON sc.id+1=sn.id AND sn.show_semester_from<=CURDATE() -- GitLab