Commit 070368ce authored by Carsten  Rose's avatar Carsten Rose
Browse files

AbstractBuildForm: Fixed broken href in formEditLink().Added some phpdoc.

BuildFormTable: Added formEditLink
Constants: changed: pageId > id, pageType > type, pageLanguage > L
parent 1dd18b80
...@@ -39,6 +39,13 @@ abstract class AbstractBuildForm { ...@@ -39,6 +39,13 @@ abstract class AbstractBuildForm {
private $formId = null; private $formId = null;
/**
* AbstractBuildForm constructor.
*
* @param array $formSpec
* @param array $feSpecAction
* @param array $feSpecNative
*/
public function __construct(array $formSpec, array $feSpecAction, array $feSpecNative) { public function __construct(array $formSpec, array $feSpecAction, array $feSpecNative) {
$this->formSpec = $formSpec; $this->formSpec = $formSpec;
$this->feSpecAction = $feSpecAction; $this->feSpecAction = $feSpecAction;
...@@ -103,6 +110,7 @@ abstract class AbstractBuildForm { ...@@ -103,6 +110,7 @@ abstract class AbstractBuildForm {
*/ */
public function process() { public function process() {
// <form>
$html = $this->head(); $html = $this->head();
$filter = $this->getProcessFilter(); $filter = $this->getProcessFilter();
...@@ -118,17 +126,18 @@ abstract class AbstractBuildForm { ...@@ -118,17 +126,18 @@ abstract class AbstractBuildForm {
$html .= $this->elements($this->store->getVar(SIP_RECORD_ID, STORE_SIP), $filter); $html .= $this->elements($this->store->getVar(SIP_RECORD_ID, STORE_SIP), $filter);
} }
// close the form // </form>
$html .= $this->tail(); $html .= $this->tail();
$html .= $this->doSubrecords(); $html .= $this->doSubrecords();
return $html; return $html;
} }
/** /**
* @return string * If SHOW_DEBUG_INFO=yes: create a link (incl. SIP) to edit the current form. Show also the hidden content of the SIP.
*
* @return string String: <a href="?pageId&sip=....">Edit</a> <small>[sip:..., r:..., urlparam:..., ...]</small>
*/ */
public function formEditLink() { public function formEditLink() {
...@@ -137,6 +146,7 @@ abstract class AbstractBuildForm { ...@@ -137,6 +146,7 @@ abstract class AbstractBuildForm {
} }
$queryStringArray = [ $queryStringArray = [
'id' => $this->store->getVar(CLIENT_PAGE_ID, STORE_CLIENT),
'form' => 'form', 'form' => 'form',
'r' => $this->formSpec['id'] 'r' => $this->formSpec['id']
]; ];
...@@ -163,7 +173,6 @@ abstract class AbstractBuildForm { ...@@ -163,7 +173,6 @@ abstract class AbstractBuildForm {
// Logged in BE User will see a FormEdit Link // Logged in BE User will see a FormEdit Link
$html .= $this->formEditLink(); $html .= $this->formEditLink();
// $html .= $this->showSipParam();
$html .= $this->wrapItem(WRAP_SETUP_TITLE, $this->formSpec['title'], true); $html .= $this->wrapItem(WRAP_SETUP_TITLE, $this->formSpec['title'], true);
...@@ -187,7 +196,7 @@ abstract class AbstractBuildForm { ...@@ -187,7 +196,7 @@ abstract class AbstractBuildForm {
} }
/** /**
* Returns complete '<form ...>'-tag * Returns '<form ...>'-tag with various attributes.
* *
* @return string * @return string
*/ */
...@@ -201,7 +210,7 @@ abstract class AbstractBuildForm { ...@@ -201,7 +210,7 @@ abstract class AbstractBuildForm {
/** /**
* Build an assoc array with standard form attributes. * Build an assoc array with standard form attributes.
* *
* @return mixed * @return array
*/ */
public function getFormTagAtrributes() { public function getFormTagAtrributes() {
...@@ -237,13 +246,8 @@ abstract class AbstractBuildForm { ...@@ -237,13 +246,8 @@ abstract class AbstractBuildForm {
* @throws DbException * @throws DbException
*/ */
public function getActionUrl() { public function getActionUrl() {
return 'typo3conf/ext/qfq/qfq/api/save.php';
$queryStringArray = array();
Support::appendTypo3ParameterToArray($queryStringArray);
return basename($_SERVER['SCRIPT_NAME']) . "?" . Support::arrayToQueryString($queryStringArray); return 'typo3conf/ext/qfq/qfq/api/save.php';
} }
/** /**
...@@ -264,6 +268,8 @@ abstract class AbstractBuildForm { ...@@ -264,6 +268,8 @@ abstract class AbstractBuildForm {
abstract public function getProcessFilter(); abstract public function getProcessFilter();
/** /**
* Process all FormElements: build corresponding HTML code. Collect and return all HTML code.
*
* @param $recordId * @param $recordId
* @param string $filter FORM_ELEMENTS_NATIVE | FORM_ELEMENTS_SUBRECORD | FORM_ELEMENTS_NATIVE_SUBRECORD * @param string $filter FORM_ELEMENTS_NATIVE | FORM_ELEMENTS_SUBRECORD | FORM_ELEMENTS_NATIVE_SUBRECORD
* @param int $feIdContainer * @param int $feIdContainer
...@@ -314,11 +320,6 @@ abstract class AbstractBuildForm { ...@@ -314,11 +320,6 @@ abstract class AbstractBuildForm {
$elementHtml = Support::appendTooltip($elementHtml, implode("\n", OnArray::htmlentitiesOnArray($debugStack))); $elementHtml = Support::appendTooltip($elementHtml, implode("\n", OnArray::htmlentitiesOnArray($debugStack)));
} }
// e.g.: <div class="radio">
// if(isset($this->feDivClass[$formElement['type']]) && $this->feDivClass[$formElement['type']] != '') {
// $elementHtml = Support::wrapTag('<div class="' . $this->feDivClass[$formElement['type']] .'">', $elementHtml);
// }
// Construct Marshaller Name // Construct Marshaller Name
$buildRowName = 'buildRow' . $this->buildRowName[$formElement['type']]; $buildRowName = 'buildRow' . $this->buildRowName[$formElement['type']];
...@@ -434,14 +435,17 @@ abstract class AbstractBuildForm { ...@@ -434,14 +435,17 @@ abstract class AbstractBuildForm {
} }
/** /**
* Get column spec from tabledefinition and parse size of it. If nothing defined, return false.
*
* @param $column * @param $column
* @return bool|int|string * @return bool|int
*/ */
private function getColumnSize($column) { private function getColumnSize($column) {
$matches = array(); $matches = array();
$typeSpec = $this->store->getVar($column, STORE_TABLE_COLUMN_TYPES); $typeSpec = $this->store->getVar($column, STORE_TABLE_COLUMN_TYPES);
// e.g.: string(64), enum('yes','no')
if (1 === preg_match('/\((.+)\)/', $typeSpec, $matches)) { if (1 === preg_match('/\((.+)\)/', $typeSpec, $matches)) {
if (is_numeric($matches[1])) if (is_numeric($matches[1]))
return $matches[1]; return $matches[1];
...@@ -766,7 +770,7 @@ abstract class AbstractBuildForm { ...@@ -766,7 +770,7 @@ abstract class AbstractBuildForm {
} }
/** /**
* Builds a real HTML hidden form element. Usefull for Checkboxes, Multiple-Select and Radios. * Builds a real HTML hidden form element. Useful for checkboxes, Multiple-Select and Radios.
* *
* @param $htmlFormElementId * @param $htmlFormElementId
* @param $value * @param $value
...@@ -1110,7 +1114,6 @@ abstract class AbstractBuildForm { ...@@ -1110,7 +1114,6 @@ abstract class AbstractBuildForm {
$url = $sip->queryStringToSip($queryString); $url = $sip->queryStringToSip($queryString);
return "<a href='$url'><span class='glyphicon glyphicon-pencil'></span></a>"; return "<a href='$url'><span class='glyphicon glyphicon-pencil'></span></a>";
} }
/** /**
...@@ -1155,7 +1158,7 @@ abstract class AbstractBuildForm { ...@@ -1155,7 +1158,7 @@ abstract class AbstractBuildForm {
} }
/** /**
* Builts an Upload (File) Button. * Builds an Upload (File) Button.
* *
* @param array $formElement * @param array $formElement
* @param $htmlFormElementId * @param $htmlFormElementId
...@@ -1174,6 +1177,8 @@ abstract class AbstractBuildForm { ...@@ -1174,6 +1177,8 @@ abstract class AbstractBuildForm {
} }
/** /**
* Build Date JQW element.
*
* @param array $formElement * @param array $formElement
* @param $htmlFormElementId * @param $htmlFormElementId
* @param $value * @param $value
...@@ -1185,6 +1190,8 @@ abstract class AbstractBuildForm { ...@@ -1185,6 +1190,8 @@ abstract class AbstractBuildForm {
} }
/** /**
* Build Grid JQW element.
*
* @param array $formElement * @param array $formElement
* @param $htmlFormElementId * @param $htmlFormElementId
* @param $value * @param $value
...@@ -1196,6 +1203,8 @@ abstract class AbstractBuildForm { ...@@ -1196,6 +1203,8 @@ abstract class AbstractBuildForm {
} }
/** /**
* Build Note.
*
* @param array $formElement * @param array $formElement
* @param $htmlFormElementId * @param $htmlFormElementId
* @param $value * @param $value
...@@ -1206,6 +1215,8 @@ abstract class AbstractBuildForm { ...@@ -1206,6 +1215,8 @@ abstract class AbstractBuildForm {
} }
/** /**
* Build Pill
*
* @param array $formElement * @param array $formElement
* @param $htmlFormElementId * @param $htmlFormElementId
* @param $value * @param $value
......
...@@ -66,6 +66,7 @@ class BuildFormTable extends AbstractBuildForm { ...@@ -66,6 +66,7 @@ class BuildFormTable extends AbstractBuildForm {
$html = ''; $html = '';
$html .= '<div ' . $this->getAttribute('class', $this->formSpec['class'], TRUE) . '>'; // main <div class=...> around everything $html .= '<div ' . $this->getAttribute('class', $this->formSpec['class'], TRUE) . '>'; // main <div class=...> around everything
$html .= $this->formEditLink();
$html .= $this->wrapItem(WRAP_SETUP_TITLE, $this->formSpec['title'], true); $html .= $this->wrapItem(WRAP_SETUP_TITLE, $this->formSpec['title'], true);
$html .= $this->getFormTag(); $html .= $this->getFormTag();
$html .= '<table>'; $html .= '<table>';
......
...@@ -163,9 +163,9 @@ const CLIENT_SIP = 's'; ...@@ -163,9 +163,9 @@ const CLIENT_SIP = 's';
const CLIENT_RECORD_ID = 'r'; const CLIENT_RECORD_ID = 'r';
const CLIENT_KEY_SEM_ID = 'keySemId'; const CLIENT_KEY_SEM_ID = 'keySemId';
const CLIENT_KEY_SEM_ID_USER = 'keySemIdUser'; const CLIENT_KEY_SEM_ID_USER = 'keySemIdUser';
const CLIENT_PAGE_ID = 'pageId'; const CLIENT_PAGE_ID = 'id';
const CLIENT_PAGE_TYPE = 'pageType'; const CLIENT_PAGE_TYPE = 'type';
const CLIENT_PAGE_LANGUAGE = 'pageLanguage'; const CLIENT_PAGE_LANGUAGE = 'L';
// ALL $_SERVER variables: http://php.net/manual/en/reserved.variables.server.php // ALL $_SERVER variables: http://php.net/manual/en/reserved.variables.server.php
// The following exist and might be the most used ones. // The following exist and might be the most used ones.
......
Markdown is supported
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