Пример #1
0
    /**
     * Create the content of the module:
     *
     * @param	string		Object string
     * @param	integer		Pointing to an entry in static_tsconfig_help to show.
     * @return	string		HTML
     */
    function browseTSprop($mode, $show)
    {
        global $LANG;
        // Get object tree:
        $objTree = $this->getObjTree();
        // Show single element, if show is set.
        $out = '';
        if ($show) {
            // Get the entry data:
            $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'static_tsconfig_help', 'uid=' . intval($show));
            $rec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
            $table = unserialize($rec['appdata']);
            $obj_string = strtr($this->objString, '()', '[]');
            // Title:
            // Title and description:
            $out .= '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('show' => ''))) . '" class="typo3-goBack">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-back') . htmlspecialchars($obj_string) . '</a><br />';
            if ($rec['title']) {
                $out .= '<strong>' . htmlspecialchars($rec['title']) . ': </strong>';
            }
            if ($rec['description']) {
                $out .= nl2br(htmlspecialchars(trim($rec['description']))) . '<br />';
            }
            // Printing the content:
            $out .= '<br />' . $this->printTable($table, $obj_string, $objTree[$mode . '.']);
            $out .= '<hr />';
            // Printing the "mixer-field":
            if (!$this->onlyProperty) {
                $links = array();
                $links[] = '<a href="#" onclick="mixerField(\'Indent\');return false;">' . $LANG->getLL('tsprop_mixer_indent', 1) . '</a>';
                $links[] = '<a href="#" onclick="mixerField(\'Outdent\');return false;">' . $LANG->getLL('tsprop_mixer_outdent', 1) . '</a>';
                $links[] = '<a href="#" onclick="mixerField(\'Wrap\',unescape(\'' . rawurlencode($obj_string) . '\'));return false;">' . $LANG->getLL('tsprop_mixer_wrap', 1) . '</a>';
                $links[] = '<a href="#" onclick="mixerField(\'Transfer\');return false;">' . $LANG->getLL('tsprop_mixer_transfer', 1) . '</a>';
                $out .= '<textarea rows="5" name="mixer" wrap="off"' . $this->doc->formWidthText(48, '', 'off') . ' class="fixed-font enable-tab"></textarea>';
                $out .= '<br /><strong>' . implode('&nbsp; | &nbsp;', $links) . '</strong>';
                $out .= '<hr />';
            }
        }
        // SECTION: Showing property tree:
        $tmpl = t3lib_div::makeInstance('ext_TSparser');
        $tmpl->tt_track = 0;
        // Do not log time-performance information
        $tmpl->fixedLgd = 0;
        $tmpl->linkObjects = 0;
        $tmpl->bType = '';
        $tmpl->ext_expandAllNotes = 1;
        $tmpl->ext_noPMicons = 1;
        $tmpl->ext_noSpecialCharsOnLabels = 1;
        if (is_array($objTree[$mode . '.'])) {
            $out .= '


			<!--
				TSconfig, object tree:
			-->
				<table border="0" cellpadding="0" cellspacing="0" class="t3-tree t3-tree-config" id="typo3-objtree">
					<tr class="t3-row-header"><td>TSref</td></tr>
					<tr>
						<td nowrap="nowrap">' . $tmpl->ext_getObjTree($this->removePointerObjects($objTree[$mode . '.']), '', '', '', '', '1') . '</td>
					</tr>
				</table>';
        }
        return $out;
    }
Пример #2
0
    /**
     * Creates the HTML for the Form Wizard:
     *
     * @param	string		Form config array
     * @param	array		Current parent record array
     * @return	string		HTML for the form wizard
     * @access private
     */
    function getFormHTML($formCfgArray, $row)
    {
        global $LANG;
        // Initialize variables:
        $specParts = array();
        $hiddenFields = array();
        $tRows = array();
        // Set header row:
        $cells = array($LANG->getLL('forms_preview', 1) . ':', $LANG->getLL('forms_element', 1) . ':', $LANG->getLL('forms_config', 1) . ':');
        $tRows[] = '
			<tr class="bgColor2" id="typo3-formWizardHeader">
				<td>&nbsp;</td>
				<td>' . implode('</td>
				<td>', $cells) . '</td>
			</tr>';
        // Traverse the number of form elements:
        $k = 0;
        foreach ($formCfgArray as $confData) {
            // Initialize:
            $cells = array();
            // If there is a configuration line which is active, then render it:
            if (!isset($confData['comment'])) {
                // Special parts:
                if ($this->special == 'formtype_mail' && t3lib_div::inList('formtype_mail,subject,html_enabled', $confData['fieldname'])) {
                    $specParts[$confData['fieldname']] = $confData['default'];
                } else {
                    // Render title/field preview COLUMN
                    $cells[] = $confData['type'] != 'hidden' ? '<strong>' . htmlspecialchars($confData['label']) . '</strong>' : '';
                    // Render general type/title COLUMN:
                    $temp_cells = array();
                    // Field type selector:
                    $opt = array();
                    $opt[] = '<option value=""></option>';
                    $types = explode(',', 'input,textarea,select,check,radio,password,file,hidden,submit,property,label');
                    foreach ($types as $t) {
                        $opt[] = '
								<option value="' . $t . '"' . ($confData['type'] == $t ? ' selected="selected"' : '') . '>' . $LANG->getLL('forms_type_' . $t, 1) . '</option>';
                    }
                    $temp_cells[$LANG->getLL('forms_type')] = '
							<select name="FORMCFG[c][' . ($k + 1) * 2 . '][type]">
								' . implode('
								', $opt) . '
							</select>';
                    // Title field:
                    if (!t3lib_div::inList('hidden,submit', $confData['type'])) {
                        $temp_cells[$LANG->getLL('forms_label')] = '<input type="text"' . $this->doc->formWidth(15) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][label]" value="' . htmlspecialchars($confData['label']) . '" />';
                    }
                    // Required checkbox:
                    if (!t3lib_div::inList('check,hidden,submit,label', $confData['type'])) {
                        $temp_cells[$LANG->getLL('forms_required')] = '<input type="checkbox" name="FORMCFG[c][' . ($k + 1) * 2 . '][required]" value="1"' . ($confData['required'] ? ' checked="checked"' : '') . ' title="' . $LANG->getLL('forms_required', 1) . '" />';
                    }
                    // Put sub-items together into table cell:
                    $cells[] = $this->formatCells($temp_cells);
                    // Render specific field configuration COLUMN:
                    $temp_cells = array();
                    // Fieldname
                    if ($this->special == 'formtype_mail' && $confData['type'] == 'file') {
                        $confData['fieldname'] = 'attachment' . ++$this->attachmentCounter;
                    }
                    if (!t3lib_div::inList('label', $confData['type'])) {
                        $temp_cells[$LANG->getLL('forms_fieldName')] = '<input type="text"' . $this->doc->formWidth(10) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][fieldname]" value="' . htmlspecialchars($confData['fieldname']) . '" title="' . $LANG->getLL('forms_fieldName', 1) . '" />';
                    }
                    // Field configuration depending on the fields type:
                    switch ((string) $confData['type']) {
                        case 'textarea':
                            $temp_cells[$LANG->getLL('forms_cols')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][cols]" value="' . htmlspecialchars($confData['cols']) . '" title="' . $LANG->getLL('forms_cols', 1) . '" />';
                            $temp_cells[$LANG->getLL('forms_rows')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][rows]" value="' . htmlspecialchars($confData['rows']) . '" title="' . $LANG->getLL('forms_rows', 1) . '" />';
                            $temp_cells[$LANG->getLL('forms_extra')] = '<input type="checkbox" name="FORMCFG[c][' . ($k + 1) * 2 . '][extra]" value="OFF"' . ($confData['extra'] == 'OFF' ? ' checked="checked"' : '') . ' title="' . $LANG->getLL('forms_extra', 1) . '" />';
                            break;
                        case 'input':
                        case 'password':
                            $temp_cells[$LANG->getLL('forms_size')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][size]" value="' . htmlspecialchars($confData['size']) . '" title="' . $LANG->getLL('forms_size', 1) . '" />';
                            $temp_cells[$LANG->getLL('forms_max')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][max]" value="' . htmlspecialchars($confData['max']) . '" title="' . $LANG->getLL('forms_max', 1) . '" />';
                            break;
                        case 'file':
                            $temp_cells[$LANG->getLL('forms_size')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][size]" value="' . htmlspecialchars($confData['size']) . '" title="' . $LANG->getLL('forms_size', 1) . '" />';
                            break;
                        case 'select':
                            $temp_cells[$LANG->getLL('forms_size')] = '<input type="text"' . $this->doc->formWidth(5) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][size]" value="' . htmlspecialchars($confData['size']) . '" title="' . $LANG->getLL('forms_size', 1) . '" />';
                            $temp_cells[$LANG->getLL('forms_autosize')] = '<input type="checkbox" name="FORMCFG[c][' . ($k + 1) * 2 . '][autosize]" value="1"' . ($confData['autosize'] ? ' checked="checked"' : '') . ' title="' . $LANG->getLL('forms_autosize', 1) . '" />';
                            $temp_cells[$LANG->getLL('forms_multiple')] = '<input type="checkbox" name="FORMCFG[c][' . ($k + 1) * 2 . '][multiple]" value="1"' . ($confData['multiple'] ? ' checked="checked"' : '') . ' title="' . $LANG->getLL('forms_multiple', 1) . '" />';
                            break;
                    }
                    // Field configuration depending on the fields type:
                    switch ((string) $confData['type']) {
                        case 'textarea':
                        case 'input':
                        case 'password':
                            if (strlen(trim($confData['specialEval']))) {
                                $hiddenFields[] = '<input type="hidden" name="FORMCFG[c][' . ($k + 1) * 2 . '][specialEval]" value="' . htmlspecialchars($confData['specialEval']) . '" />';
                            }
                            break;
                    }
                    // Default data
                    if ($confData['type'] == 'select' || $confData['type'] == 'radio') {
                        $temp_cells[$LANG->getLL('forms_options')] = '<textarea ' . $this->doc->formWidthText(15) . ' rows="4" name="FORMCFG[c][' . ($k + 1) * 2 . '][options]" title="' . $LANG->getLL('forms_options', 1) . '">' . t3lib_div::formatForTextarea($confData['default']) . '</textarea>';
                    } elseif ($confData['type'] == 'check') {
                        $temp_cells[$LANG->getLL('forms_checked')] = '<input type="checkbox" name="FORMCFG[c][' . ($k + 1) * 2 . '][default]" value="1"' . (trim($confData['default']) ? ' checked="checked"' : '') . ' title="' . $LANG->getLL('forms_checked', 1) . '" />';
                    } elseif ($confData['type'] && $confData['type'] != 'file') {
                        $temp_cells[$LANG->getLL('forms_default')] = '<input type="text"' . $this->doc->formWidth(15) . ' name="FORMCFG[c][' . ($k + 1) * 2 . '][default]" value="' . htmlspecialchars($confData['default']) . '" title="' . $LANG->getLL('forms_default', 1) . '" />';
                    }
                    $cells[] = $confData['type'] ? $this->formatCells($temp_cells) : '';
                    // CTRL panel for an item (move up/down/around):
                    $ctrl = '';
                    $onClick = "document.wizardForm.action+='#ANC_" . (($k + 1) * 2 - 2) . "';";
                    $onClick = ' onclick="' . htmlspecialchars($onClick) . '"';
                    // FIXME $inputStyle undefined
                    $brTag = $inputStyle ? '' : '<br />';
                    if ($k != 0) {
                        $ctrl .= '<input type="image" name="FORMCFG[row_up][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/pil2up.gif', '') . $onClick . ' title="' . $LANG->getLL('table_up', 1) . '" />' . $brTag;
                    } else {
                        $ctrl .= '<input type="image" name="FORMCFG[row_bottom][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/turn_up.gif', '') . $onClick . ' title="' . $LANG->getLL('table_bottom', 1) . '" />' . $brTag;
                    }
                    $ctrl .= '<input type="image" name="FORMCFG[row_remove][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/garbage.gif', '') . $onClick . ' title="' . $LANG->getLL('table_removeRow', 1) . '" />' . $brTag;
                    // FIXME $tLines undefined
                    if ($k + 1 != count($tLines)) {
                        $ctrl .= '<input type="image" name="FORMCFG[row_down][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/pil2down.gif', '') . $onClick . ' title="' . $LANG->getLL('table_down', 1) . '" />' . $brTag;
                    } else {
                        $ctrl .= '<input type="image" name="FORMCFG[row_top][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/turn_down.gif', '') . $onClick . ' title="' . $LANG->getLL('table_top', 1) . '" />' . $brTag;
                    }
                    $ctrl .= '<input type="image" name="FORMCFG[row_add][' . ($k + 1) * 2 . ']"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/add.gif', '') . $onClick . ' title="' . $LANG->getLL('table_addRow', 1) . '" />' . $brTag;
                    $ctrl = '<span class="c-wizButtonsV">' . $ctrl . '</span>';
                    // Finally, put together the full row from the generated content above:
                    $bgC = $confData['type'] ? ' class="bgColor5"' : '';
                    $tRows[] = '
						<tr' . $bgC . '>
							<td><a name="ANC_' . ($k + 1) * 2 . '"></a>' . $ctrl . '</td>
							<td class="bgColor4">' . implode('</td>
							<td valign="top">', $cells) . '</td>
						</tr>';
                }
            } else {
                $hiddenFields[] = '<input type="hidden" name="FORMCFG[c][' . ($k + 1) * 2 . '][comment]" value="' . htmlspecialchars($confData['comment']) . '" />';
            }
            // Increment counter:
            $k++;
        }
        // If the form is of the special type "formtype_mail" (used for tt_content elements):
        if ($this->special == 'formtype_mail') {
            // Blank spacer:
            $tRows[] = '
				<tr>
					<td colspan="4">&nbsp;</td>
				</tr>';
            // Header:
            $tRows[] = '
				<tr>
					<td colspan="2" class="bgColor2">&nbsp;</td>
					<td colspan="2" class="bgColor2"><strong>' . $LANG->getLL('forms_special_eform', 1) . ':</strong>' . t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'wizard_forms_wiz_formmail_info', $GLOBALS['BACK_PATH'], '') . '</td>
				</tr>';
            // "FORM type":
            $tRows[] = '
				<tr class="bgColor5">
					<td>&nbsp;</td>
					<td class="bgColor4">&nbsp;</td>
					<td>' . $LANG->getLL('forms_eform_formtype_mail', 1) . ':</td>
					<td>
						<input type="hidden" name="FORMCFG[c][' . 1000 * 2 . '][fieldname]" value="formtype_mail" />
						<input type="hidden" name="FORMCFG[c][' . 1000 * 2 . '][type]" value="submit" />
						<input type="text"' . $this->doc->formWidth(15) . ' name="FORMCFG[c][' . 1000 * 2 . '][default]" value="' . htmlspecialchars($specParts['formtype_mail']) . '" />
					</td>
				</tr>';
            // "Send HTML mail":
            $tRows[] = '
				<tr class="bgColor5">
					<td>&nbsp;</td>
					<td class="bgColor4">&nbsp;</td>
					<td>' . $LANG->getLL('forms_eform_html_enabled', 1) . ':</td>
					<td>
						<input type="hidden" name="FORMCFG[c][' . 1001 * 2 . '][fieldname]" value="html_enabled" />
						<input type="hidden" name="FORMCFG[c][' . 1001 * 2 . '][type]" value="hidden" />
						<input type="checkbox" name="FORMCFG[c][' . 1001 * 2 . '][default]" value="1"' . ($specParts['html_enabled'] ? ' checked="checked"' : '') . ' />
					</td>
				</tr>';
            // "Subject":
            $tRows[] = '
				<tr class="bgColor5">
					<td>&nbsp;</td>
					<td class="bgColor4">&nbsp;</td>
					<td>' . $LANG->getLL('forms_eform_subject', 1) . ':</td>
					<td>
						<input type="hidden" name="FORMCFG[c][' . 1002 * 2 . '][fieldname]" value="subject" />
						<input type="hidden" name="FORMCFG[c][' . 1002 * 2 . '][type]" value="hidden" />
						<input type="text"' . $this->doc->formWidth(15) . ' name="FORMCFG[c][' . 1002 * 2 . '][default]" value="' . htmlspecialchars($specParts['subject']) . '" />
					</td>
				</tr>';
            // Recipient:
            $tRows[] = '
				<tr class="bgColor5">
					<td>&nbsp;</td>
					<td class="bgColor4">&nbsp;</td>
					<td>' . $LANG->getLL('forms_eform_recipient', 1) . ':</td>
					<td>
						<input type="text"' . $this->doc->formWidth(15) . ' name="FORMCFG[recipient]" value="' . htmlspecialchars($row['subheader']) . '" />
					</td>
				</tr>';
        }
        $content = '';
        // Implode all table rows into a string, wrapped in table tags.
        $content .= '

			<!--
				Form wizard
			-->
			<table border="0" cellpadding="1" cellspacing="1" id="typo3-formwizard">
				' . implode('', $tRows) . '
			</table>';
        // Add hidden fields:
        $content .= implode('', $hiddenFields);
        // Return content:
        return $content;
    }