Commit 06f4f860 authored by bbaer's avatar bbaer
Browse files

Merge branch 'master' of git.math.uzh.ch:typo3/qfq

parents 911bda04 fef1a122
/.python_virtualenv
/.plantuml_install
# Created by .ignore support plugin (hsz.mobi)
.python_virtualenv/
.virtual_env
.bowerpackages
.doc_plantuml
.idea
.npmpackages
.phpdocinstall
.plantuml
.plantuml_install
.python_virtualenv
.sonar_scanner
.support
.support_plantuml
.support_sonar
test.json
test.php
*.autosave
/bower_components
/composer.phar
/css
/dist/
/doc/*.pdf
/.doc_plantuml
/.support
/.support_plantuml
/.plantuml
/doc/jsdoc
/doc/phpdoc
/doc/plantuml
/extension/Documentation/_make/build
/doc/phpdoc
/.idea
/extension/Documentation/html
/extension/Resources/Private/vendor
/extension/Resources/Public/Css
/extension/Resources/Public/fonts
/extension/Resources/Public/JavaScript
/fonts
/js
/node_modules
/packages
/bower_components
# Created by .ignore support plugin (hsz.mobi)
/.bowerpackages
/.npmpackages
/.phpdocinstall
/js
/css
/fonts
/qfq.flowchart.dia.autosave
/support
/extension/Resources/Public/fonts
/extension/Resources/Public/JavaScript
/extension/Resources/Public/Css
/doc/jsdoc
/dist/
.python_virtualenv/
.virtual_env
/.support_sonar
/.sonar_scanner
/extension/Documentation/html
\ No newline at end of file
/vendor
......@@ -22,6 +22,7 @@ maintainer-clean:
archive: clean qfq.zip
qfq.zip:
cd extension/Resources/Private/vendor/phpoffice; rm -rf phpspreadsheet/{C*,bin,c*,d*,m*,p*,sa*,.g*,.p*,.s*,.t*}
cd extension; zip -r ../$@ $(EXTENSION_CONTENT)
clean:
......@@ -73,10 +74,13 @@ plantuml:
bootstrap: .npmpackages .plantuml_install .virtual_env
npm update
grunt default
composer update
cd extension/Resources/Private; composer update
basic: .npmpackages .virtual_env
npm update
grunt default
cd extension/Resources/Private; composer update; cd vendor/phpoffice/phpspreadsheet; rm -rf .github bin docs samples .g* .s* .t* C* c* m* p*
.plantuml_install: .support_plantuml
wget --no-check-certificate -O support/plantuml/plantuml.jar 'https://downloads.sourceforge.net/project/plantuml/plantuml.jar'
......
{
"require-dev": {
"phpunit/phpunit": "^6.5"
}
}
This diff is collapsed.
......@@ -397,9 +397,10 @@ A download might be:
* an export of several files as a ZIP archive,
* an export of a T3-'XML'-Page converted to Excel,
* a converted HTML page to PDF,
* a PDF file, concatenated on single PDF files and/or converted HTML page to PDF.
* a thumbnail, streamed from cache dir of if not present/recent rendered on request.
* a file to monitor constantly.
* a PDF file, concatenated on single PDF files and/or converted HTML page to PDF,
* a thumbnail, streamed from cache dir of if not present/recent rendered on request,
* a file to monitor constantly,
* a file, delivered as a JSON structure, used in 'copy to clipboard',
'api/download.php' will be called with a SIP (no other vars used). The SIP contains:
* DOWNLOAD_EXPORT_FILENAME - any target filename, if none given take DOWNLOAD_OUTPUT_PDF ('output.pdf').
......@@ -444,13 +445,18 @@ A download might be:
* append: 0|1
The retrieved lines are outputted without any conversion.
* DOWNLOAD_OUTPUT_FORMAT: raw (default), json
* If this parameter is missing, 'raw' ist meant.
* 'json' is used for 'copy to clipboard'.
* The base64 encoding is necessary:
* to deliver multiple elements with the same token (e.g. multiple PDF files to concatenate).
* special parameter names, like 'id', should not force the regular interpretation of 'id' during conversion to a SIP.
During preparing and delivering the download ()file / pdf / excel / zip), a popup shows a spinning gear by default. The
During preparing and delivering the download (file / pdf / excel / zip), a popup shows a spinning gear by default. The
popup itself will display an individual message. The popup needs some HTML code (only once per T3 page).
Download links might be generated in `report` as well as in `subrecords of forms`. To trigger the generation of the HTML
popup code, a variable DOWNLOAD_POPUP_REQUEST in STORE_SYSTEM will be set to 'true' (string) in class Link(), as soon as
......
mod.wizards.newContentElement
{
wizardItems
{
special.elements
{
qfq_element
{
icon = icon
goes
here
title = QFQ Content Element
Content
Element
description = Quick Form Query (QFQ) offers a Form Editor and a SQL based Report Language.
info
goes
here
tt_content_defValues
{
CType = qfq_qfq
}
}
}
special.show
:
= addToList(qfq_element)
mod.wizards.newContentElement.wizardItems.special.elements.qfq_qfq {
icon = EXT:qfq/ext_icon_lg.png
title = QFQ Content Element
description = Quick Form Query(QFQ) offers a Form Editor and a SQL based Report Language.
tt_content_defValues {
CType = qfq_qfq
}
}
mod.wizards.newContentElement.wizardItems.special.show := addToList(qfq_qfq)
\ No newline at end of file
This diff is collapsed.
{
"require": {
"phpoffice/phpspreadsheet": "^1.3"
}
}
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "cef6f65f63451da68119df4277175b18",
"packages": [
{
"name": "phpoffice/phpspreadsheet",
"version": "1.3.1",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "aa5b0d0236c907fd8dba0883f3ceb97cc52e46ec"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/aa5b0d0236c907fd8dba0883f3ceb97cc52e46ec",
"reference": "aa5b0d0236c907fd8dba0883f3ceb97cc52e46ec",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-dom": "*",
"ext-gd": "*",
"ext-iconv": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"ext-xmlreader": "*",
"ext-xmlwriter": "*",
"ext-zip": "*",
"ext-zlib": "*",
"php": "^5.6|^7.0",
"psr/simple-cache": "^1.0"
},
"require-dev": {
"dompdf/dompdf": "^0.8.0",
"friendsofphp/php-cs-fixer": "@stable",
"jpgraph/jpgraph": "^4.0",
"mpdf/mpdf": "^7.0.0",
"phpunit/phpunit": "^5.7",
"squizlabs/php_codesniffer": "^2.7",
"tecnickcom/tcpdf": "^6.2"
},
"suggest": {
"dompdf/dompdf": "Option for rendering PDF with PDF Writer",
"jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers",
"mpdf/mpdf": "Option for rendering PDF with PDF Writer",
"tecnick.com/tcpdf": "Option for rendering PDF with PDF Writer"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "http://blog.maartenballiauw.be"
},
{
"name": "Erik Tilt"
},
{
"name": "Franck Lefevre",
"homepage": "http://rootslabs.net"
},
{
"name": "Mark Baker",
"homepage": "http://markbakeruk.net"
}
],
"description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "https://github.com/PHPOffice/PhpSpreadsheet",
"keywords": [
"OpenXML",
"excel",
"gnumeric",
"ods",
"php",
"spreadsheet",
"xls",
"xlsx"
],
"time": "2018-06-12T13:40:21+00:00"
},
{
"name": "psr/simple-cache",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/simple-cache.git",
"reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
"reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\SimpleCache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interfaces for simple caching",
"keywords": [
"cache",
"caching",
"psr",
"psr-16",
"simple-cache"
],
"time": "2017-10-23T01:57:42+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
......@@ -45,6 +45,17 @@
"toggleElement": "",
"icon": "glyphicon-stop"
},
{
"name": "write",
"selector": "add-text",
"requiresDrawing": false,
"requiresSelection": false,
"isToggle": false,
"toggle": "",
"hasToggleElement": false,
"toggleElement": "",
"icon": "glyphicon-text-height"
},
{
"name": "move",
"selector": "move-mode",
......
extension/ext_icon.png

675 Bytes | W: | H:

extension/ext_icon.png

660 Bytes | W: | H:

extension/ext_icon.png
extension/ext_icon.png
extension/ext_icon.png
extension/ext_icon.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -11,14 +11,39 @@ if (!defined('TYPO3_MODE')) {
'IMATHUZH.' . $_EXTKEY,
'Qfq',
'QFQ Element',
'typo3conf/ext/qfq/ext_icon.png'
'EXT:qfq/ext_icon.png'
);
/*
* The type name is generated by combining the extension key and plugin name, all lowercase and concatenated with `_'
*/
$GLOBALS['TCA']['tt_content']['types']['qfq_qfq'] = array(
'showitem' => 'hidden, CType, header, header_position, bodytext;;;nowrap, layout, deleted, starttime, endtime, colPos, spaceBefore, spaceAfter, fe_group, header_layout, sectionIndex, linkToTop, section_frame, sys_language_uid'
$GLOBALS['TCA']['tt_content']['palettes']['introheader']['showitem'] = 'header, CType';
$GLOBALS['TCA']['tt_content']['palettes']['startendtime']['showitem'] = 'starttime, endtime';
$GLOBALS['TCA']['tt_content']['palettes']['layoutpalette1']['showitem'] = 'colPos, header_position, sys_language_uid';
$GLOBALS['TCA']['tt_content']['palettes']['layoutpalette2']['showitem'] = 'layout, header_layout';
$GLOBALS['TCA']['tt_content']['palettes']['spacearound']['showitem'] = 'spaceBefore, spaceAfter';
);
$GLOBALS['TCA']['tt_content']['types']['qfq_qfq'] = array(
'showitem' => '
--div--;General,
--palette--;;introheader,
custom,
bodytext;Code:;;nowrap,
--div--;Access,
hidden, fe_group, deleted, --palette--;;startendtime,
--div--;Appearance,
--palette--;;layoutpalette1,
--palette--;;layoutpalette2,
--palette--;;spacearound,
linkToTop, section_frame, sectionIndex',
'columnsOverrides' => [
'bodytext' => [
'config' => [
'renderType' => 't3editor',
'format' => 'sparql',
'rows' => 100
]
]
]
);
\ No newline at end of file
......@@ -73,70 +73,74 @@ $modeAnswer = false;
$flagSuccess = false;
try {
try {
$qfq = new \qfq\QuickFormQuery(['bodytext' => '']);
$qfq = new \qfq\QuickFormQuery(['bodytext' => '']);
$answer = $qfq->delete();
$answer = $qfq->delete();
// in case everything is fine, an empty string is returned. Else an Array.
$flagSuccess = ($answer === '');
// in case everything is fine, an empty string is returned. Else an Array.
$flagSuccess = ($answer === '');
$targetUrl = Store::getVar(SIP_TARGET_URL, STORE_SIP);
$modeAnswer = Store::getVar(SIP_MODE_ANSWER, STORE_SIP);
$targetUrl = Store::getVar(SIP_TARGET_URL, STORE_SIP);
$modeAnswer = Store::getVar(SIP_MODE_ANSWER, STORE_SIP);
switch ($modeAnswer) {
case MODE_JSON:
$answer = array();
if ($flagSuccess) {
$answer[API_MESSAGE] = 'Deleted';
$answer[API_REDIRECT] = API_ANSWER_REDIRECT_AUTO;
$answer[API_STATUS] = API_ANSWER_STATUS_SUCCESS;
} else {
$answer[API_STATUS] = API_ANSWER_STATUS_ERROR;
}
switch ($modeAnswer) {
case MODE_JSON:
$answer = array();
if ($flagSuccess) {
$answer[API_MESSAGE] = 'Deleted';
$answer[API_REDIRECT] = API_ANSWER_REDIRECT_AUTO;
$answer[API_STATUS] = API_ANSWER_STATUS_SUCCESS;
} else {
$answer[API_STATUS] = API_ANSWER_STATUS_ERROR;
}
break;
break;
case MODE_HTML:
if ($targetUrl === false || $targetUrl === '') {
throw new CodeException('Missing target URL', ERROR_MISSING_VALUE);
}
case MODE_HTML:
if ($targetUrl === false || $targetUrl === '') {
throw new CodeException('Missing target URL', ERROR_MISSING_VALUE);
}
if ($flagSuccess) {
$result[MSG_HEADER] = "Location: $targetUrl";
}
break;
if ($flagSuccess) {
$result[MSG_HEADER] = "Location: $targetUrl";
}
break;
default:
throw new CodeException('Unknown mode: ' . $modeAnswer, ERROR_UNKNOWN_MODE);
break;
}
default:
throw new CodeException('Unknown mode: ' . $modeAnswer, ERROR_UNKNOWN_MODE);
break;
}
} catch (qfq\UserFormException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\UserFormException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
$val = Store::getVar(SYSTEM_FORM_ELEMENT, STORE_SYSTEM);
if ($val !== false) {
$answer[API_FIELD_NAME] = $val;
$val = Store::getVar(SYSTEM_FORM_ELEMENT, STORE_SYSTEM);
if ($val !== false) {
$answer[API_FIELD_NAME] = $val;
}
$val = Store::getVar(SYSTEM_FORM_ELEMENT_MESSAGE, STORE_SYSTEM);
if ($val !== false) {
$answer[API_FIELD_MESSAGE] = $val;
}
} catch (qfq\CodeException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\DbException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
}
$val = Store::getVar(SYSTEM_FORM_ELEMENT_MESSAGE, STORE_SYSTEM);
if ($val !== false) {
$answer[API_FIELD_MESSAGE] = $val;
// In case $modeAnswer is still missing: try to get it again - maybe the SIP store has been initialized before the exception has been thrown.
if ($modeAnswer === false) {
$modeAnswer = Store::getVar(SIP_MODE_ANSWER, STORE_SIP);
}
} catch (qfq\CodeException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\DbException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (\Exception $e) {
$answer[API_MESSAGE] = "Generic Exception: " . $e->getMessage();
}
// In case $modeAnswer is still missing: try to get it again - maybe the SIP store has been initialized before the exception has been thrown.
if ($modeAnswer === false) {
$modeAnswer = Store::getVar(SIP_MODE_ANSWER, STORE_SIP);
}
if ($modeAnswer === MODE_JSON) {
// JSON
......
......@@ -22,24 +22,24 @@ require_once(__DIR__ . '/../qfq/exceptions/ErrorHandler.php');
set_error_handler("\\qfq\\ErrorHandler::exception_error_handler");
$data = '';
$error = '';
try {
try {
$download = new \qfq\Download();
$download = new Download();
// If all is fine - 'process()' never returns! The output file is delivered and PHP is stopped after that.
$data = $download->process(STORE_SIP, OUTPUT_MODE_DIRECT);
// If all is fine: process() will output file via print() !!
$error = $download->process(STORE_SIP, OUTPUT_MODE_DIRECT);
} catch (qfq\CodeException $e) {
$data = $e->formatMessage();
$error = $e->formatMessage();
} catch (qfq\DbException $e) {
$data = $e->formatMessage();
$error = $e->formatMessage();
} catch (qfq\DownloadException $e) {
$data = $e->formatMessage();
$error = $e->formatMessage();
}
} catch (\Exception $e) {
$data = "Exception: " . $e->getMessage();
$error = "Exception: " . $e->getMessage();
}
echo $data;
echo $error;
......@@ -55,22 +55,24 @@ $answer[API_STATUS] = API_ANSWER_STATUS_ERROR;
$answer[API_MESSAGE] = '';
try {
$qfq = new QuickFormQuery(['bodytext' => '']);
try {
$qfq = new QuickFormQuery(['bodytext' => '']);
$data = $qfq->dragAndDrop();
$data = $qfq->dragAndDrop();
$answer[API_STATUS] = API_ANSWER_STATUS_SUCCESS;
$answer[API_MESSAGE] = 'reorder: success';
$answer[API_STATUS] = API_ANSWER_STATUS_SUCCESS;
$answer[API_MESSAGE] = 'reorder: success';
// $answer[API_FORM_UPDATE] = $data[API_FORM_UPDATE];
// $answer[API_ELEMENT_UPDATE] = $data[API_ELEMENT_UPDATE];
// unset($answer[API_FORM_UPDATE][API_ELEMENT_UPDATE]);
} catch (qfq\UserFormException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\CodeException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\DbException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\UserFormException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\CodeException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\DbException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
}
} catch (\Exception $e) {
$answer[API_MESSAGE] = "Generic Exception: " . $e->getMessage();
}
......
......@@ -54,41 +54,43 @@ $answer[API_STATUS] = API_ANSWER_STATUS_ERROR;
$answer[API_MESSAGE] = '';
try {
$qfq = new QuickFormQuery(['bodytext' => ""]);
$data = $qfq->saveForm();
$arr = $qfq->getForwardMode();
$answer[API_REDIRECT] = $arr[API_REDIRECT];
$answer[API_REDIRECT_URL] = $arr[API_REDIRECT_URL];
$answer[API_STATUS] = API_ANSWER_STATUS_SUCCESS;
$answer[API_MESSAGE] = 'Saved';
if (isset($data[API_ELEMENT_UPDATE])) {
$answer[API_ELEMENT_UPDATE] = $data[API_ELEMENT_UPDATE];
try {
$qfq = new QuickFormQuery(['bodytext' => ""]);
$data = $qfq->saveForm();
$arr = $qfq->getForwardMode();