Commit d46e131a authored by Carsten  Rose's avatar Carsten Rose
Browse files

#3218 / download.php / export

Implemented spinning wheel (hourglass) displayed during rendering and downloading PDF.
Link.php, Report.php: New $vars[NAME_EXTRA_CONTENT_WRAP] which holds a '<button>' definition with necesary 'data-*' attributes. The Modal Dialog needs a uniq html id (derived from ttContentUid). That one is returned to Report() if there is at least one download element.
parent 5cef96e0
......@@ -1156,11 +1156,12 @@ Comment- and space-character
submitButtonText
''''''''''''''''
If specified and non empty, display a regular submit button at the bottom of the page with the given text.
This gives the form a ordinary HTML-form look'n' feel. With this option, the standard buttons on the top right border
should be hided to not confuse the user.
* Optional.
* Default: Empty
* Empty: a 'submit' button with a Bootstrap glyph 'check' symbol is rendered at the *top right corner* of the form.
* Non Empty: a 'submit' button, with <submitButtonText>, is rendered at the bottom of the form (without a 'check' glyph
symbol). Typically 'ShowButton: Save' will be unchecked to hide the regular save glyph symbol.
class
'''''
......@@ -1200,13 +1201,6 @@ classBody
* Predefined background colors: `qfq-color-white`, `qfq-color-grey-1` (dark), `qfq-color-grey-2` (light),
`qfq-color-blue-1` (dark), `qfq-color-blue-2`. (light)
submitButtonText
''''''''''''''''
If specified and non empty, display a regular submit button at the bottom of the page with the given text.
This gives the form a ordinary HTML-form look'n' feel. With this option, the standard buttons on the top right border
should be hided to not confuse the user.
extraDeleteForm
'''''''''''''''
......@@ -4088,21 +4082,6 @@ Solution for *#Challenge_2*:
+-------------+--------------------------------------------------------------------+--------+
Include a form via link/url
^^^^^^^^^^^^^^^^^^^^^^^^^^^
In most occasions it is handy if a formname does not have to be hard-coded in report but can be passed to the page as a
parameter. To achieve this, first build a link on page A which includes the required parameters:
**page A**
::
10.sql = SELECT CONCAT("p:pageB|U:form=Person&r=", id) AS _pagee FROM ...
..
The above example builds a link to pageB - refer to the :ref:`column-link`-manual for details. The link tells page B to
render the form with name formname and load the record with id id for editing.
......@@ -4245,16 +4224,19 @@ Accessing the database
The result of the SQL query is output row by row and column by column without adding any formatting information. See `Formatting Examples`_ for examples of how the output can be formatted.
The result of the SQL query is an output, row by row and column by column, without adding any formatting information.
See `Formatting Examples`_ for examples of how the output can be formatted.
Formatting Examples
^^^^^^^^^^^^^^^^^^^
Formating (i.e. wrapping of data with HTML tags etc.) can be achieved in two different ways:
One can add formatting output directly into the SQL by either putting it in a separate column of the output or by using concat to concatenate data and formatting output in a single column.
One can add formatting output directly into the SQL by either putting it in a separate column of the output or by using
concat to concatenate data and formatting output in a single column.
One can use ?level keys to define formatting information that will be put before/after/between all rows/columns of the actual levels result.
One can use ?level keys to define formatting information that will be put before/after/between all rows/columns of the
actual levels result.
Two columns
......
......@@ -554,6 +554,7 @@ const GLYPH_ICON_CHECK = 'glyphicon-ok';
const GLYPH_ICON_CLOSE = 'glyphicon-remove';
const GLYPH_ICON_TASKS = 'glyphicon-tasks';
const GLYPH_ICON_VIEW = 'glyphicon-eye-open';
const GLYPH_ICON_FILE = 'glyphicon-file';
// FORM
const F_ID = 'id';
......
<?PHP
<?php
/***************************************************************
* Copyright notice
*
......@@ -87,6 +87,7 @@ const NAME_SIP = 'sip';
const NAME_URL_PARAM = 'param';
const NAME_RIGHT = 'picturePositionRight';
const NAME_ACTION_DELETE = 'actionDelete';
const NAME_EXTRA_CONTENT_WRAP = 'extraContentWrap';
const FINAL_HREF = 'finalHref';
const FINAL_ANCHOR = 'finalAnchor';
......@@ -155,9 +156,6 @@ const QUESTION_INDEX_FLAG_MODAL = 5;
*/
class Link {
//TODO: delete muss noch implementiert werden
private $delete = '';
/**
* @var Sip
*/
......@@ -168,19 +166,12 @@ class Link {
*/
private $store = null;
/**
* @var bool
*/
private $phpUnit;
/**
* @var Utils
*/
private $renderControl = array();
private $linkClassSelector = array(TOKEN_CLASS_INTERNAL => "internal ", TOKEN_CLASS_EXTERNAL => "external ");
private $cssLinkClassInternal = '';
private $cssLinkClassExternal = '';
private $ttContentUid = '';
private $callTable = [
TOKEN_URL => 'buildUrl',
......@@ -228,11 +219,13 @@ class Link {
TOKEN_ACTION_DELETE => NAME_ACTION_DELETE,
];
// Used to find double definitions.
private $tokenMapping = [
TOKEN_URL => LINK_ANCHOR,
TOKEN_MAIL => LINK_ANCHOR,
TOKEN_PAGE => LINK_ANCHOR,
TOKEN_DOWNLOAD => LINK_ANCHOR,
TOKEN_PICTURE => LINK_PICTURE,
TOKEN_BULLET => LINK_PICTURE,
TOKEN_CHECK => LINK_PICTURE,
......@@ -261,6 +254,7 @@ class Link {
$this->store = Store::getInstance('', $phpUnit);
$this->cssLinkClassInternal = $this->store->getVar(SYSTEM_CSS_LINK_CLASS_INTERNAL, STORE_SYSTEM);
$this->cssLinkClassExternal = $this->store->getVar(SYSTEM_CSS_LINK_CLASS_EXTERNAL, STORE_SYSTEM);
$this->ttContentUid = $this->store->getVar(TYPO3_TT_CONTENT_UID, STORE_TYPO3);
/*
* mode:
......@@ -311,10 +305,11 @@ class Link {
* Build the whole link
*
* @param string $str Qualifier with params. 'report'-syntax. F.e.: A:u:www.example.com|G:P:home.gif|t:Home"
* @return string The complete HTML encoded Link like <a href='http://example.com' class='external'><img src='iconf.gif' title='help text'>Description</a>
* @param string $rcHtmlIdModalDownloadDialog - If the link is a download link, set it to true.
* @return string The complete HTML encoded Link like <a href='http://example.com' class='external'><img src='iconf.gif' title='help text'>Description</a>
* @throws UserReportException
*/
public function renderLink($str) {
public function renderLink($str, &$rcHtmlIdModalDownloadDialog) {
$tokenGiven = array();
......@@ -359,9 +354,11 @@ class Link {
case '3':
// $link = $htmlUrl . $vars[NAME_URL] . '</a>' . $vars[NAME_TOOL_TIP_JS][1];
$link = Support::wrapTag($vars[FINAL_ANCHOR], $vars[FINAL_HREF]);
$rcHtmlIdModalDownloadDialog = $this->getHtmlIdModalDownloadDialog();
break;
case '13':
$link = Support::wrapTag($vars[FINAL_ANCHOR], $vars[FINAL_HREF]);
$rcHtmlIdModalDownloadDialog = $this->getHtmlIdModalDownloadDialog();
// $vars[NAME_TEXT] = $vars[NAME_MAIL];
// $link = $this->encryptMailtoJS($vars, true);
break;
......@@ -369,9 +366,11 @@ class Link {
// 4: <a href=url ...>Text</a>
case '4':
$link = Support::wrapTag($vars[FINAL_ANCHOR], $vars[FINAL_CONTENT]);
$rcHtmlIdModalDownloadDialog = $this->getHtmlIdModalDownloadDialog();
break;
case '14':
$link = Support::wrapTag($vars[FINAL_ANCHOR], $vars[FINAL_CONTENT]);
$rcHtmlIdModalDownloadDialog = $this->getHtmlIdModalDownloadDialog();
// $link = $this->encryptMailtoJS($vars, true);
break;
case '21':
......@@ -483,6 +482,7 @@ class Link {
NAME_TOOL_TIP => '',
NAME_TOOL_TIP_JS => '',
NAME_URL_PARAM => '',
NAME_EXTRA_CONTENT_WRAP => '',
NAME_RENDER => '0',
NAME_RIGHT => 'l',
......@@ -622,11 +622,11 @@ class Link {
/**
* Compute final link parameter.
*
* @param $vars
* @param array $vars
* @return string
* @throws UserReportException
*/
private function processParameter($vars) {
private function processParameter(array $vars) {
$vars[FINAL_HREF] = $this->doHref($vars); // must be called before doToolTip()
$vars[FINAL_TOOL_TIP] = $this->doToolTip($vars);
......@@ -760,7 +760,7 @@ class Link {
$class = '';
}
if ($vars[NAME_GLYPH] !== '') {
if ($vars[NAME_GLYPH] !== '' && $vars[NAME_EXTRA_CONTENT_WRAP] == '') {
$class .= 'btn btn-default ';
}
......@@ -817,6 +817,10 @@ class Link {
}
}
if ($vars[NAME_EXTRA_CONTENT_WRAP] != '') {
$content = Support::wrapTag($vars[NAME_EXTRA_CONTENT_WRAP], $content);
}
return $content;
}
......@@ -875,7 +879,7 @@ EOF;
* @return string
* @throws UserReportException
*/
private function doAnchor(array $vars) {
private function doAnchor(array $vars) {
$attributes = '';
......@@ -1065,8 +1069,13 @@ EOF;
*/
private function buildDownload($vars, $value) {
$htmlIdModal = $this->getHtmlIdModalDownloadDialog();
$vars[NAME_GLYPH] = GLYPH_ICON_FILE;
$vars[NAME_GLYPH_TITLE] = "Download";
$vars[NAME_URL] = API_DIR . '/' . API_DOWNLOAD_PHP;
$vars[NAME_LINK_CLASS_DEFAULT] = $this->cssLinkClassInternal;
$vars[NAME_LINK_CLASS_DEFAULT] = NO_CLASS;
$vars[NAME_EXTRA_CONTENT_WRAP] = '<button type="button" class="btn btn-default" data-toggle="modal" data-target="#' . $htmlIdModal . '" data-backdrop="static" data-keyboard="false">';
return $vars;
}
......@@ -1313,4 +1322,11 @@ EOF;
return $vars;
}
/**
* @return string
*/
private function getHtmlIdModalDownloadDialog() {
return 'qfqModal' . $this->ttContentUid;
}
}
\ No newline at end of file
......@@ -81,6 +81,11 @@ class Report {
private $showDebugInfo = false;
/**
* @var string - will be set as soon as there is at least one download element. All download elements will reference this id.
*/
private $rcHtmlIdModalDownloadDialog = false;
/**
* Report constructor.
*
......@@ -476,9 +481,43 @@ class Report {
}
}
if ($this->rcHtmlIdModalDownloadDialog != '') {
$content .= $this->getModalCode($this->rcHtmlIdModalDownloadDialog);
}
return $content;
}
private function getModalCode($htmlId, $title = "Loading Document", $message = "Document is being generated. Please wait.") {
/*
* <!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#qfqModal101" data-backdrop="static" data-keyboard="false">
<span class="glyphicon glyphicon-search"></span>
</button>
*/
$code = <<<EOF
<!-- Modal -->
<div class="modal fade" id="$htmlId" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">$title</h4>
</div>
<div class="modal-body" style="text-align: center;">
<span class="glyphicon glyphicon-cog glyphicon-spin text-large-with-margin text-primary"></span>
<p>$message</p>
</div>
<div class="modal-footer">
<p>In Progress..</p>
</div>
</div>
</div>
</div>
EOF;
return $code;
}
/**
* Determine value:
* 1) if one specified in line: take it
......@@ -558,6 +597,7 @@ class Report {
$content = "";
$flagControl = false;
$flagOutput = true;
$dummy = false;
// Empty columnnames are allowed: check with isset
if (isset($columnName[0]) && $columnName[0] === "_") {
......@@ -568,7 +608,7 @@ class Report {
//TODO: reserved names,not starting with '_' will be still accepted - stop this!
switch ($columnName) {
case "link":
$content .= $this->link->renderLink($columnValue);
$content .= $this->link->renderLink($columnValue, $this->rcHtmlIdModalDownloadDialog);
break;
case "exec":
......@@ -587,7 +627,7 @@ class Report {
$pageColumnName = strtolower($columnName);
$tokenizedValue = $this->doFixColPosPage($columnName, $columnValue);
$linkValue = $this->doPage($pageColumnName, $tokenizedValue);
$content .= $this->link->renderLink($linkValue);
$content .= $this->link->renderLink($linkValue, $dummy);
break;
// Lowercase 'P'
......@@ -600,18 +640,18 @@ class Report {
case COLUMN_PAGEN:
case COLUMN_PAGES:
$linkValue = $this->doPage($columnName, $columnValue);
$content .= $this->link->renderLink($linkValue);
$content .= $this->link->renderLink($linkValue, $dummy);
break;
case COLUMN_DDOWNLOAD:
$tokenizedValue = $this->doFixColPosDownload($columnValue);
$linkValue = $this->doDownload($tokenizedValue);
$content .= $this->link->renderLink($linkValue);
$content .= $this->link->renderLink($linkValue, $this->rcHtmlIdModalDownloadDialog);
break;
case COLUMN_DOWNLOAD:
$linkValue = $this->doDownload($columnValue);
$content .= $this->link->renderLink($linkValue);
$content .= $this->link->renderLink($linkValue, $this->rcHtmlIdModalDownloadDialog);
break;
case "bullet":
......@@ -621,7 +661,7 @@ class Report {
// r:3|B:
$linkValue = TOKEN_RENDER . ":3|" . TOKEN_BULLET . ":" . $columnValue;
$content .= $this->link->renderLink($linkValue);
$content .= $this->link->renderLink($linkValue, $dummy);
break;
case "check":
......@@ -631,7 +671,7 @@ class Report {
// "r:3|C:
$linkValue = TOKEN_RENDER . ":3|" . TOKEN_CHECK . ":" . $columnValue;
$content .= $this->link->renderLink($linkValue);
$content .= $this->link->renderLink($linkValue, $dummy);
break;
case "img":
......
......@@ -47,6 +47,7 @@
<div class="col-md-6">
<div class="input-group">
<input id="input1" name="name" class="form-control" type="text" placeholder="Name" readonly>
<div class="input-group-btn">
<button class="btn btn-success"
onclick="$('#input1').prop('readonly',!$('#input1').prop('readonly'))">
......@@ -68,6 +69,7 @@
<div class="input-group">
<input id="passwordinput" type="password" name="password" class="form-control" type="text"
placeholder="Password">
<div class="input-group-btn">
<button class="btn btn-info"
onclick="$('#passwordinput').attr('type',$('#passwordinput').attr('type')==='password' ? 'text': 'password')">
......@@ -86,10 +88,15 @@
<label>Statement</label>
</div>
<div class="col-md-6">
<textarea class="form-control" rows="20" placeholder="Please give a brief statement of purpose, such as the topics of your main mathematical interest, your past work in mathematics, of your academic plans in graduate school and your subsequent career objectives."></textarea>
<span class="glyphicon glyphicon-info-sign text-info qfq-icon-inside" aria-hidden="true" onclick="$('#qfq-info-201').slideToggle('swing')"></span>
<textarea class="form-control" rows="20"
placeholder="Please give a brief statement of purpose, such as the topics of your main mathematical interest, your past work in mathematics, of your academic plans in graduate school and your subsequent career objectives."></textarea>
<span class="glyphicon glyphicon-info-sign text-info qfq-icon-inside" aria-hidden="true"
onclick="$('#qfq-info-201').slideToggle('swing')"></span>
<div class="alert alert-info" id="qfq-info-201" style="display: none;">
<p>Please give a brief statement of purpose, such as the topics of your main mathematical interest, your past work in mathematics, of your academic plans in graduate school and your subsequent career objectives.</p>
<p>Please give a brief statement of purpose, such as the topics of your main mathematical interest,
your past work in mathematics, of your academic plans in graduate school and your subsequent
career objectives.</p>
</div>
</div>
<div class="col-md-3 qfq-note">
......@@ -104,6 +111,7 @@
<div class="col-md-6">
<div class="input-group">
<input type=name="name" class="form-control" type="text" placeholder="Name">
<div class="input-group-btn">
<button class="btn btn-info" onclick="$('#qfq-info-202').slideToggle('swing')">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
......@@ -111,7 +119,9 @@
</div>
</div>
<div class="alert alert-info qfq-margin-top" id="qfq-info-202" style="display: none;">
<p>Please give a brief statement of purpose, such as the topics of your main mathematical interest, your past work in mathematics, of your academic plans in graduate school and your subsequent career objectives.</p>
<p>Please give a brief statement of purpose, such as the topics of your main mathematical interest,
your past work in mathematics, of your academic plans in graduate school and your subsequent
career objectives.</p>
</div>
</div>
<div class="col-md-3 qfq-note">
......@@ -120,7 +130,6 @@
</div>
</form>
</div>
......
......@@ -38,7 +38,8 @@
</div>
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#qfqModal101" data-backdrop="static" data-keyboard="false">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#qfqModal101" data-backdrop="static"
data-keyboard="false">
<span class="glyphicon glyphicon-search"></span>
</button>
......@@ -51,6 +52,7 @@
</div>
<div class="modal-body" style="text-align: center;">
<span class="glyphicon glyphicon-cog glyphicon-spin text-large-with-margin text-primary"></span>
<p>PDF Document is being generated. Please wait.</p>
</div>
<div class="modal-footer">
......
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