Ejemplo n.º 1
0
function outTableTextArea(&$session, $prefix, $name, $content, $width, $height)
{
    if ($prefix != null) {
        outTableCell($prefix);
    }
    echo TAG_TABLE_DELIM;
    outTextArea($session, $name, $content, $width, $height);
    echo TAG_TABLE_DELIM_END;
}
Ejemplo n.º 2
0
function baseEditPage(&$session, $mode, $message = null, $message2 = null, $type = M_Undef, $name = null)
{
    if ($mode == C_New) {
        $pageid = 0;
        $textid = 0;
        $pagename = $name == null ? "" : $name;
        $content = $name != null && strpos($pagename, 'ategorie') == 1 ? "<?plugin BackLinks?>\n----\nKategorieKategorie" : "";
        $changedby = $session->fUserName;
        $changedat = "";
        $mimetype = $type;
        $textidpred = 0;
    } elseif ($mode == C_Change) {
        $pagename = $session->fPageURL;
        list($pageid, $texttype) = dbGetRecordByClause($session, T_Page, 'id,type', 'name=' . dbSqlString($session, $pagename));
        $mimetype = textTypeToMime($texttype);
        $textidpred = dbGetLastText($session, $pageid);
        list($content, $changedat, $changedby) = dbGetRecordById($session, T_Text, $textidpred, 'text,createdat,createdby');
        $textid = null;
    } else {
        $pagename = $_POST['edit_pagename'];
        $pageid = $_POST['edit_pageid'];
        $textid = $_POST['edit_textid'];
        $content = textAreaToWiki($session, $_POST['edit_content']);
        $changedby = $_POST['edit_changedby'];
        $changedat = $_POST['edit_changedat'];
        $mimetype = $_POST['edit_mimetype'];
        $textidpred = $_POST['edit_textidpred'];
    }
    $session->setPageData(empty($pagename) ? 'Neue Seite' : $pagename, $changedat, $changedby);
    if ($pageid <= 0) {
        $mode = C_New;
    }
    if ($mode == C_New) {
        $header = empty($pagename) ? 'Neue Seite' : $pagename . ' (Neu)';
    } else {
        $header = $pagename . ' (in Bearbeitung)';
    }
    if ($mimetype == M_Wiki) {
        guiStandardHeader($session, $header, Th_EditHeaderWiki, Th_EditStartWiki);
    } else {
        guiStandardHeader($session, $header, Th_EditHeaderHTML, Th_EditStartHTML);
    }
    if (isset($_POST['edit_preview']) || isset($_POST['edit_previewandsave'])) {
        echo guiParam($session, Th_PreviewStart, '<h1>Vorschau von ' . $session->fPageURL . '</h1><p>Warnung: Der Text ist noch nicht gesichert!</p>');
        guiFormatPage($session, $mimetype, $content);
        echo guiParam($session, Th_PreviewEnd, '<h1>Ende der Vorschau</h1>');
    }
    echo '<form enctype="multipart/form-data" action="' . $session->fScriptURL . '" method="post">' . "\n";
    outDivision($session);
    outHiddenField($session, 'edit_pageid', $pageid);
    outHiddenField($session, 'edit_textid', $textid);
    outHiddenField($session, 'edit_textidpred', $textidpred);
    outHiddenField($session, 'edit_changedat', $changedat);
    outHiddenField($session, 'edit_changedby', $changedby);
    outDivisionEnd($session);
    if (!empty($message)) {
        outParagraph($session);
        outStrong(htmlentities($message));
        outParagraphEnd($session);
    }
    if (!empty($message2)) {
        outParagraph($session);
        outStrong(htmlentities($message2));
        outParagraphEnd($session);
    }
    outDivision($session);
    if ($mode != C_New) {
        outHiddenField($session, 'edit_pagename', $pagename);
    }
    outTable();
    outTableRecordAndDelim();
    outTable();
    if ($mode == C_New) {
        outTableRecord();
        outTableTextField($session, 'Name:', 'edit_pagename', $pagename, 43, 64);
        outTableRecordEnd();
    }
    outTableRecord();
    if ($mode == C_New && $type == M_Undef) {
        outTableComboBox($session, 'Typ', 'edit_mimetype', array(M_Wiki, M_HTML), null, 0);
    } else {
        outTableDelim();
        echo 'Typ:';
        echo htmlentities($mimetype);
        outHiddenField($session, 'edit_mimetype', $mimetype);
        outTableDelimEnd();
    }
    if ($mode == C_New) {
        $templates = dbColumnList($session, T_Page, 'name', 'name like ' . dbSqlString($session, 'Vorlage%'));
        if (count($templates) > 0) {
            outTableAndRecord();
            outTableCell('Seitenvorlage:');
            outTableDelim();
            outComboBox($session, 'edit_template', $templates, null);
            echo ' ';
            outButton($session, 'edit_appendtemplate', 'Vorlage einkopieren');
            outTableDelimAndRecordEnd();
        }
    }
    outTableEnd();
    outTableDelimAndRecordEnd();
    outTableRecordAndDelim();
    getTextareaSize($session, $width, $height);
    outTextArea($session, 'edit_content', $content, $width, $height);
    outTableDelimAndRecordEnd();
    outTableRecordAndDelim();
    outTable(0, '100%');
    outTableRecord();
    outTableButton($session, null, 'edit_save', 'Speichern (fertig)');
    outTableDelim(AL_Justify);
    outButton($session, 'edit_previewandsave', 'Zwischenspeichern');
    echo ' ';
    outButton($session, 'edit_preview', ' Vorschau');
    outTableCellDelim();
    outButton($session, 'edit_cancel', ' Verwerfen');
    if (!$session->testFeature(FEATURE_UPLOAD_ALLOWED)) {
        echo ' Breite: ';
        outTextField($session, U_TextAreaWidth, null, 3, 3);
        echo ' H&ouml;he: ';
    } else {
        outTableDelimEnd();
        outTableTextField($session, 'Breite:', 'textarea_width', null, 3, 3);
        outTableRecordEnd();
        outTableRecord();
        outTableCell('Bild einf&uuml;gen:');
        outHiddenField($session, 'MAX_FILE_SIZE', MAX_UPLOAD_FILESIZE);
        outTableDelim(AL_Justify);
        outFileField($session, TEXTFIELD_UPLOAD);
        outTableDelimEnd();
        outTableButton($session, null, 'edit_upload', 'Hochladen');
        outTableCell('H&ouml;he:');
        outTableDelim();
    }
    outTextField($session, U_TextAreaHeight, null, 3, 3);
    outTableAndRecordEnd();
    outTableDelimEnd();
    outTableAndRecordEnd();
    outDivisionEnd($session);
    guiFinishForm($session, $session);
    outNewline();
    guiStandardBodyEnd($session, $mimetype == M_Wiki ? Th_EditEndWiki : Th_EditEndHTML);
}