Commit 41506f2e authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'master' into 6249-subrecord-dnd

# Conflicts:
#	extension/Documentation/Manual.rst
#	extension/qfq/qfq/Constants.php
#	extension/qfq/qfq/QuickFormQuery.php
#	extension/qfq/sql/formEditor.sql
parents 2fdb9a29 37d1eb37
...@@ -25,7 +25,7 @@ require_once(__DIR__ . '/../helper/HelperFile.php'); ...@@ -25,7 +25,7 @@ require_once(__DIR__ . '/../helper/HelperFile.php');
require_once(__DIR__ . '/../exceptions/DownloadException.php'); require_once(__DIR__ . '/../exceptions/DownloadException.php');
//require_once(__DIR__ . '/../Evaluate.php'); //require_once(__DIR__ . '/../Evaluate.php');
//require_once(__DIR__ . '/../helper/KeyValueStringParser.php'); //require_once(__DIR__ . '/../helper/KeyValueStringParser.php');
//require __DIR__ . '/../../../Resources/Private/vendor/autoload.php'; require __DIR__ . '/../../../Resources/Private/vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
...@@ -142,10 +142,15 @@ class Excel { ...@@ -142,10 +142,15 @@ class Excel {
case EXCEL_STRING2: case EXCEL_STRING2:
case EXCEL_FORMULA: case EXCEL_FORMULA:
case EXCEL_NUMERIC: case EXCEL_NUMERIC:
case EXCEL_BOOL: case EXCEL_BASE64:
case EXCEL_NULL: case EXCEL_NULL:
case EXCEL_INLINE: case EXCEL_INLINE:
case EXCEL_ERROR: case EXCEL_ERROR:
if($key==EXCEL_BASE64){
$value=base64_decode($value);
$key=EXCEL_STRING;
}
$spreadsheet->getActiveSheet() $spreadsheet->getActiveSheet()
->setCellValueExplicit( ->setCellValueExplicit(
$posColumn . $posRow, $posColumn . $posRow,
...@@ -156,7 +161,10 @@ class Excel { ...@@ -156,7 +161,10 @@ class Excel {
break; break;
default: default:
throw new downloadException("Excel Export: unknown token " . $key, ERROR_UNKNOWN_TOKEN); $errorMsg[ERROR_MESSAGE_TO_USER] = 'Excel Export: unknown token';
$errorMsg[ERROR_MESSAGE_SUPPORT] = 'Unknown Token: ' . $key;
throw new downloadException(json_encode($errorMsg), ERROR_UNKNOWN_TOKEN);
} }
} }
......
...@@ -498,14 +498,14 @@ class Link { ...@@ -498,14 +498,14 @@ class Link {
* Iterate over all given token. Check for double definition. * Iterate over all given token. Check for double definition.
* *
* @param string $str * @param string $str
* @param array $tokenGiven * @param array $rcTokenGiven - return an array with found token.
* *
* @return array * @return array
* @throws CodeException * @throws CodeException
* @throws UserFormException * @throws UserFormException
* @throws UserReportException * @throws UserReportException
*/ */
private function fillParameter($str, array &$tokenGiven) { private function fillParameter($str, array &$rcTokenGiven) {
// Define all possible vars: no more isset(). // Define all possible vars: no more isset().
$vars = $this->initVars(); $vars = $this->initVars();
...@@ -530,13 +530,15 @@ class Link { ...@@ -530,13 +530,15 @@ class Link {
$value = isset($arr[1]) ? $arr[1] : ''; $value = isset($arr[1]) ? $arr[1] : '';
// Bookkeeping defined parameter. // Bookkeeping defined parameter.
if (isset($tokenGiven[$key])) { if (isset($rcTokenGiven[$key])) {
throw new UserReportException ("Multiple definitions for key '$key'", ERROR_MULTIPLE_DEFINITION); throw new UserReportException ("Multiple definitions for key '$key'", ERROR_MULTIPLE_DEFINITION);
} }
$tokenGiven[$key] = true; $rcTokenGiven[$key] = true;
if (!isset($this->tableVarName[$key])) { if (!isset($this->tableVarName[$key])) {
throw new UserReportException ("Unknown link qualifier: '$key' - did you forget the one character qualifier?", ERROR_UNKNOWN_LINK_QUALIFIER); $msg[ERROR_MESSAGE_TO_USER] = "Unknown link qualifier: '$key' - did you forget the one character qualifier?";
$msg[ERROR_MESSAGE_SUPPORT] = $str;
throw new UserReportException (json_encode($msg), ERROR_UNKNOWN_LINK_QUALIFIER);
} }
$keyName = $this->tableVarName[$key]; // convert token to name $keyName = $this->tableVarName[$key]; // convert token to name
...@@ -549,12 +551,12 @@ class Link { ...@@ -549,12 +551,12 @@ class Link {
$value = $this->checkValue($key, $value); $value = $this->checkValue($key, $value);
// Store value // Store value
if ((isset($tokenGiven[TOKEN_DOWNLOAD]) || isset($tokenGiven[TOKEN_COPY_TO_CLIPBOARD])) && if ((isset($rcTokenGiven[TOKEN_DOWNLOAD]) || isset($rcTokenGiven[TOKEN_COPY_TO_CLIPBOARD])) &&
($key == TOKEN_PAGE || $key == TOKEN_URL || $key == TOKEN_URL_PARAM || $key == TOKEN_FILE || $key == TOKEN_FILE_DEPRECATED)) { ($key == TOKEN_PAGE || $key == TOKEN_URL || $key == TOKEN_URL_PARAM || $key == TOKEN_FILE || $key == TOKEN_FILE_DEPRECATED)) {
$vars[NAME_COLLECT_ELEMENTS][] = $key . ':' . $value; $vars[NAME_COLLECT_ELEMENTS][] = $key . ':' . $value;
unset($tokenGiven[$key]); // Skip Bookkeeping for TOKEN_URL_PARAM | TOKEN_FILE | TOKEN_URL. unset($rcTokenGiven[$key]); // Skip Bookkeeping for TOKEN_URL_PARAM | TOKEN_FILE | TOKEN_URL.
continue; continue;
} else { } else {
// TOKEN_GLYPH should not treated as an regular image. Same applies to the other Glyph symbols, but those don't have a value, and therefore do not fill $vars['image']. // TOKEN_GLYPH should not treated as an regular image. Same applies to the other Glyph symbols, but those don't have a value, and therefore do not fill $vars['image'].
...@@ -585,17 +587,17 @@ class Link { ...@@ -585,17 +587,17 @@ class Link {
} }
// Download Link needs some extra work // Download Link needs some extra work
if ($tokenGiven[TOKEN_DOWNLOAD]) { if ($rcTokenGiven[TOKEN_DOWNLOAD]) {
$vars = $this->buildDownloadLate($vars); $vars = $this->buildDownloadLate($vars);
} }
// CopyToClipboard (Download) Link needs some extra work // CopyToClipboard (Download) Link needs some extra work
if ($tokenGiven[TOKEN_COPY_TO_CLIPBOARD]) { if ($rcTokenGiven[TOKEN_COPY_TO_CLIPBOARD]) {
$vars = $this->buildCopyToClipboardLate($vars); $vars = $this->buildCopyToClipboardLate($vars);
} }
// Final Checks // Final Checks
$this->checkParam($tokenGiven, $vars); $this->checkParam($rcTokenGiven, $vars);
return $vars; return $vars;
} }
...@@ -1431,7 +1433,7 @@ EOF; ...@@ -1431,7 +1433,7 @@ EOF;
// Clipboard Source // Clipboard Source
if ($vars[NAME_COPY_TO_CLIPBOARD] !== '') { if ($vars[NAME_COPY_TO_CLIPBOARD] !== '') {
$jsAction = 'onClick'; $jsAction = 'onClick';
$source = "{text: '" . $vars[NAME_COPY_TO_CLIPBOARD] . " '}"; $source = "{text: '" . OnString::replaceByUnicode($vars[NAME_COPY_TO_CLIPBOARD]) . "' }";
} elseif ($vars[NAME_FILE] !== '') { } elseif ($vars[NAME_FILE] !== '') {
$jsAction = 'onmousedown'; $jsAction = 'onmousedown';
......
...@@ -738,6 +738,11 @@ class Report { ...@@ -738,6 +738,11 @@ class Report {
$content .= $this->link->renderLink($linkValue); $content .= $this->link->renderLink($linkValue);
break; break;
case COLUMN_YANK:
$linkValue = $this->doYank($columnName, $columnValue);
$content .= $this->link->renderLink($linkValue);
break;
case COLUMN_PPDF: case COLUMN_PPDF:
case COLUMN_FFILE: case COLUMN_FFILE:
case COLUMN_ZZIP: case COLUMN_ZZIP:
...@@ -796,6 +801,9 @@ class Report { ...@@ -796,6 +801,9 @@ class Report {
case COLUMN_EXCEL_STRING: case COLUMN_EXCEL_STRING:
$content .= EXCEL_STRING . '=' . $columnValue . PHP_EOL; $content .= EXCEL_STRING . '=' . $columnValue . PHP_EOL;
break; break;
case COLUMN_EXCEL_BASE64:
$content .= EXCEL_BASE64 . '=' . base64_encode($columnValue) . PHP_EOL;
break;
case COLUMN_EXCEL_NUMERIC: case COLUMN_EXCEL_NUMERIC:
$content .= EXCEL_NUMERIC . '=' . $columnValue . PHP_EOL; $content .= EXCEL_NUMERIC . '=' . $columnValue . PHP_EOL;
break; break;
...@@ -1171,6 +1179,25 @@ class Report { ...@@ -1171,6 +1179,25 @@ class Report {
return ($columnValue); return ($columnValue);
} }
/**
* Checks if a token 'y' is given. If not, prepend one.
*
* @param $columnName
* @param $columnValue
* @return string
* @throws UserFormException
*/
private function doYank($columnName, $columnValue) {
$token = KeyValueStringParser::parse($columnValue, PARAM_TOKEN_DELIMITER, PARAM_DELIMITER);
if (!isset($token[TOKEN_COPY_TO_CLIPBOARD])) {
$columnValue = TOKEN_COPY_TO_CLIPBOARD . PARAM_DELIMITER . $columnValue;
}
return $columnValue;
}
/** /**
* Renders _download: extract token and determine if any default value has to be applied * Renders _download: extract token and determine if any default value has to be applied
* [d:<exportFilename][U:<params>][u:<url>][f:file][t:<text>][a:<message>]|[o:<tooltip>]|[c:<class>]|[r:<render * [d:<exportFilename][U:<params>][u:<url>][f:file][t:<text>][a:<message>]|[o:<tooltip>]|[c:<class>]|[r:<render
......
This diff is collapsed.
...@@ -129,12 +129,11 @@ var QfqNS = QfqNS || {}; ...@@ -129,12 +129,11 @@ var QfqNS = QfqNS || {};
*/ */
n.Alert.prototype.makeAlertContainerSingleton = function () { n.Alert.prototype.makeAlertContainerSingleton = function () {
var alertContainer = $(n.Alert.constants.alertContainerSelector); var alertContainer = $(n.Alert.constants.alertContainerSelector);
if (alertContainer.length === 0) { alertContainer.remove();
// No container so far, create one // No container so far, create one
alertContainer = $("<div>").attr("id", n.Alert.constants.alertContainerId); alertContainer = $("<div>").attr("id", n.Alert.constants.alertContainerId);
$("body").append(alertContainer); $("body").append(alertContainer);
}
return alertContainer; return alertContainer;
}; };
...@@ -220,6 +219,7 @@ var QfqNS = QfqNS || {}; ...@@ -220,6 +219,7 @@ var QfqNS = QfqNS || {};
* @public * @public
*/ */
n.Alert.prototype.show = function () { n.Alert.prototype.show = function () {
$(".removeMe").remove();
var $alertContainer; var $alertContainer;
if (this.shown) { if (this.shown) {
// We only allow showing once // We only allow showing once
...@@ -268,6 +268,7 @@ var QfqNS = QfqNS || {}; ...@@ -268,6 +268,7 @@ var QfqNS = QfqNS || {};
} else { } else {
this.$alertDiv.addClass("alert-side"); this.$alertDiv.addClass("alert-side");
} }
this.$alertDiv.addClass("removeMe");
var buttons = this.getButtons(); var buttons = this.getButtons();
if (buttons) { if (buttons) {
...@@ -310,6 +311,7 @@ var QfqNS = QfqNS || {}; ...@@ -310,6 +311,7 @@ var QfqNS = QfqNS || {};
* @private * @private
*/ */
n.Alert.prototype.removeAlert = function () { n.Alert.prototype.removeAlert = function () {
// In case we have an armed timer (or expired timer, for that matter), disarm it. // In case we have an armed timer (or expired timer, for that matter), disarm it.
if (this.timerId) { if (this.timerId) {
window.clearTimeout(this.timerId); window.clearTimeout(this.timerId);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
/* global EventEmitter */ /* global EventEmitter */
/* @depend QfqEvents.js */ /* @depend QfqEvents.js */
/* @depend Alert.js */ /* @depend Alert.js */
/* @depend ElementUpdate.js */
/** /**
* Qfq Namespace * Qfq Namespace
...@@ -258,11 +259,9 @@ var QfqNS = QfqNS || {}; ...@@ -258,11 +259,9 @@ var QfqNS = QfqNS || {};
console.error(data.message); console.error(data.message);
} else { } else {
console.log("status:" + data.status + " message: " + data.message); console.log("status:" + data.status + " message: " + data.message);
if (data.elementUpdate) { if (data['element-update']) {
if (!this.elementUpdate) { var configuration = data['element-update'];
this.elementUpdate = new n.ElementUpdate(); n.ElementUpdate.updateAll(configuration);
}
this.elementUpdate.updateAll(data.elementUpdate);
} }
} }
}; };
......
...@@ -146,7 +146,13 @@ select.qfq-locked:invalid { ...@@ -146,7 +146,13 @@ select.qfq-locked:invalid {
padding-top: 4px; padding-top: 4px;
} }
.qfq-form-title { .qfq-subrecord-table {
margin-left: 10px;
margin-right: 10px;
width: calc(~"100% - 20px");
}
.qfq-form-title, .qfq-subrecord-title {
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0;
background-image: linear-gradient(to bottom, #fefefe 0, #dedede 100%); background-image: linear-gradient(to bottom, #fefefe 0, #dedede 100%);
...@@ -157,6 +163,44 @@ select.qfq-locked:invalid { ...@@ -157,6 +163,44 @@ select.qfq-locked:invalid {
font-weight: bold; font-weight: bold;
} }
.qfq-subrecord-title {
color: #333;
padding: 10px 12px;
}
.qfq-subrecord-table .btn {
padding: 5px 10px;
}
.qfq-subrecord-head {
background-color: #dedede;
border: 1px solid #ccc;
border-top: none;
}
.qfq-subrecord-head th, .qfq-subrecord-table td {
padding: 3px !important;
vertical-align: middle !important;
border-bottom: 1px solid #ccc !important;
}
.qfq-subrecord-table tbody {
border: 1px solid #ccc;
border-radius: 0 0 3px 3px;
}
.qfq-subrecord-table>tbody>tr {
background-color: #ededed;
}
.qfq-subrecord-table>tbody>tr:hover {
background-color: #efefef;
}
.qfq-table-button-width {
width: 44px;
}
.nav-pills>li>a { .nav-pills>li>a {
border-radius: 0; border-radius: 0;
} }
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<form class="form-horizontal"> <form class="form-horizontal clearfix">
<div class="col-md-12 qfq-form-body qfq-color-grey-2"> <div class="col-md-12 qfq-form-body qfq-color-grey-2">
<div class="form-group clearfix"> <div class="form-group clearfix">
<div class="col-md-3 qfq-label"> <div class="col-md-3 qfq-label">
...@@ -99,11 +99,77 @@ ...@@ -99,11 +99,77 @@
<div class="col-md-6"><input class="form-control" type="text"></div> <div class="col-md-6"><input class="form-control" type="text"></div>
<div class="col-md-3"></div> <div class="col-md-3"></div>
</div> </div>
<!-- Start Subrecords -->
<div class="form-group clearfix">
<table class="table qfq-subrecord-table">
<caption class="qfq-subrecord-title">
Subrecords Title
</caption>
<thead>
<tr class="qfq-subrecord-head">
<th class="qfq-table-button-width">
<a class="btn btn-default" href="#" title="New"><span class="glyphicon glyphicon-plus"></span></a>
</th>
<th>
#
</th>
<th>
Name
</th>
<th>
Date
</th>
<th class="qfq-table-button-width">
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a class="btn btn-default" href="#" title="Edit"><span class="glyphicon glyphicon-pencil"></span></a>
</td>
<td>1</td>
<td>Test</td>
<td>01.07.18</td>
<td><button type="button" class="record-delete btn btn-default" data-sip="5b6d9eb7c18aa" title="Delete"><span class="glyphicon glyphicon-trash"></span></button></td>
</tr>
<tr>
<td>
<a class="btn btn-default" href="#" title="Edit"><span class="glyphicon glyphicon-pencil"></span></a>
</td>
<td>2</td>
<td>Test</td>
<td>01.07.18</td>
<td><button type="button" class="record-delete btn btn-default" data-sip="5b6d9eb7c18aa" title="Delete"><span class="glyphicon glyphicon-trash"></span></button></td>
</tr>
<tr>
<td>
<a class="btn btn-default" href="#" title="Edit"><span class="glyphicon glyphicon-pencil"></span></a>
</td>
<td>3</td>
<td>Test</td>
<td>01.07.18</td>
<td><button type="button" class="record-delete btn btn-default" data-sip="5b6d9eb7c18aa" title="Delete"><span class="glyphicon glyphicon-trash"></span></button></td>
</tr>
<tr>
<td>
<a class="btn btn-default" href="#" title="Edit"><span class="glyphicon glyphicon-pencil"></span></a>
</td>
<td>4</td>
<td>Test</td>
<td>01.07.18</td>
<td><button type="button" class="record-delete btn btn-default" data-sip="5b6d9eb7c18aa" title="Delete"><span class="glyphicon glyphicon-trash"></span></button></td>
</tr>
</tbody>
</table>
</div>
<!-- End Subrecords -->
</div> </div>
</form> </form>
<p style="margin-bottom: 40px;"><br>&nbsp;</p> <p style="height: 40px;"></p>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
......
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