anpera.net
https://anpera.dyndns.org/phpbb3/

Vorschau des geschriebenes Text und größers Schreibfeld
https://anpera.dyndns.org/phpbb3/viewtopic.php?f=34&t=4042
Seite 1 von 1

Autor:  Varius [ Mi 03 Okt, 2007 14:25 ]
Betreff des Beitrags:  Vorschau des geschriebenes Text und größers Schreibfeld

Da mich das schmale Schreibfeld gestört hat hab ich dort das größere eingebaut. Das war ich eingebaut hab hab ich mit /Textarea kommentiert. Nun hab ich folgendes Problem :

Die Vorschau geht nicht mehr und unter den den hinzufügen Button steht :

id="comin" onkeyup="com_prev();this.focus();" >

mit einen 2. Hinzufügen Button. Was wohl von diesen Output kommt :

if($session['user']['prefs']['preview']) {
output(' id="comin" onkeyup="com_prev();this.focus();"',true);
}

Einer der Experten eie Idee was ich machen kann um ein größeres Schreibfeld und eine Vorschau zu haben ??? ?

:wink:


[php]
function viewcommentary($section,
$message="Kommentar hinzufügen?",
$limit=10,
$talkline="sagt",
$showdate=false,
$show_addform=true,
$specialfuncs=false,
$long_posting=true,
$only_rpg=false,
$linkbios=true,
$su_min=1) {
global $session,$REQUEST_URI,$doublepost,$BOOL_COMMENTAREA,$BOOL_POPUP,$allownonnav,$SCRIPT_NAME;

$BOOL_COMMENTAREA = true;

if ($doublepost) {
output("`\$`bDoppelpost?`b`0`n");
}

// Wenn Voreinstellung für Kommentaranzahl in den Prefs
if(isset($session['user']['prefs']['commentlimit'][$section]) && (int)$session['user']['prefs']['commentlimit'][$section] > 0) {

// Überschreibe Vorgabe
$limit = $session['user']['prefs']['commentlimit'][$section];

}


$com=(int)$_GET[comscroll];
$sql = "SELECT commentary.*,
accounts.name,
accounts.login,
accounts.acctid,
accounts.loggedin,
accounts.location,
accounts.laston,
accounts.superuser,
accounts.activated
FROM commentary
INNER JOIN accounts
ON accounts.acctid = commentary.author AND accounts.locked=0
WHERE section = '$section' ".($session['disable_npc_comment'] && $only_rpg ? 'AND self=1' : '')."
ORDER BY commentid DESC
LIMIT ".($com*$limit).",$limit";


$result = db_query($sql) or die(db_error(LINK));
$counttoday=0;

if(su_check(SU_RIGHT_COMMENT)) {
if(($message=="X") || ($message==" ")) {
$req = 'su_comment.php?op=del_comment&return='.urlencode($REQUEST_URI);
output('<form action="'.$req.'" method="POST">',true);
}
}

$count = db_num_rows($result);

for ($i=0;$i < $count;$i++) {
$row = db_fetch_assoc($result);

// Alle Tags bis auf erlaubte Farben raus
$row['comment'] = preg_replace('/[`][^'.regex_appoencode(1,false).']/','',$row['comment']);

$commentids[$i] = $row[commentid];

$date = ($showdate || $message == 'X') ? "`3(".date('d.m.y',strtotime($row['postdate'])).") " : "";

$x=0;
$ft='';

/**
*Timestamps eingefügt, aber nur wenn das Datum nicht gezeigt wird (Ausnahme: Admin)
*/
$timestamp='';
if(!$showdate)
{
if ($session['user']['prefs']['timestamps'] || $message == 'X') $timestamp='`0['.date('H:i',strtotime($row['postdate'])).'] ';
}

$comment_length = strlen($row['comment']);

for ($x=0;strlen($ft)<3 && $x<$comment_length;$x++){
if (substr($row[comment],$x,1)=="`" && strlen($ft)==0) {
$x++;
}else{
$ft.=substr($row[comment],$x,1);
}
}

if(substr($row['comment'],0,4)=='/msg') {

$op[$i] .= $timestamp.$date.'`b`7'.str_replace('&amp;','&',HTMLEntities(substr($row[comment],4)))
.'`b`0`n';
if ($message=='X') {$op[$i]='`0('.$row['section'].') '.$op[$i];}
}
else {

$link = 'bio.php?id='.$row['acctid'] . '&ret='.URLEncode($_SERVER['REQUEST_URI']);
if (substr($ft,0,2)=='::') {$ft = substr($ft,0,2);}
else {
if (substr($ft,0,1)==':') {$ft = substr($ft,0,1);}
}
if ($ft=='::' || $ft=='/me' || $ft==':'){
$x = strpos($row[comment],$ft);
if ($x!==false){

if ($linkbios) {
$op[$i] .= $timestamp.$date.str_replace('&amp;','&',HTMLEntities(substr($row[comment],0,$x)))
.'`0<a href="'.$link.'" style="text-decoration: none">`&'.$row['name'].'`0</a>`& '
.str_replace('&amp;','&',HTMLEntities(substr($row[comment],$x+strlen($ft))))
.'`0`n';
addnav('',$link);
}
else {
$op[$i] .= $timestamp.$date.str_replace('&amp;','&',HTMLEntities(substr($row[comment],0,$x)))
.'`0`&'.$row['name'].'`0`& '
.str_replace('&amp;','&',HTMLEntities(substr($row[comment],$x+strlen($ft))))
.'`0`n';

}
}
}

if ($op[$i]=='') {

if ($linkbios) {
$op[$i] .= $timestamp.$date.'`0<a href="'.$link.'" style="text-decoration: none">`&'.$row['name'].'`0</a>`3 sagt: "`#'
.str_replace('&amp;','&',HTMLEntities($row[comment])).'`3"`0`n';
addnav('',$link);
}
else {
$op[$i] .= $timestamp.$date.'`0`&'.$row['name'].'`0`3 sagt: "`#'
.str_replace('&amp;','&',HTMLEntities($row[comment])).'`3"`0`n';
}

}

if ($message=='X') {$op[$i]='`0('.$row['section'].') '.$op[$i];}
$loggedin=user_get_online(0,$row);
if ($row['postdate']>=$session['user']['recentcomments'] && !$mail_ver) {$op[$i]=($loggedin?'<img src="images/new-online.gif" alt="&gt;" width="3" height="5" align="absmiddle"> ':'<img src="images/new.gif" alt="&gt;" width="3" height="5" align="absmiddle"> ').$op[$i];}

} // END if keine /msg
}
$i--;
$outputcomments=array();
$sect="x";
for (;$i>=0;$i--){
$out="";
if (su_check(SU_RIGHT_COMMENT) && ($message=="X") || ($message==" ")) {

$out .= '`0<input type="checkbox" name="commentid[]" value="'.$commentids[$i].'">&nbsp;&nbsp;';

$out.="[ <a href='su_comment.php?op=del_comment&commentid=$commentids[$i]&return=".urlencode($REQUEST_URI)."'>Löschen</a> ]&nbsp;";

$matches=array();

preg_match("/[(][^)]*[)]/",$op[$i],$matches);
$sect=$matches[0];
}

$out.=$op[$i];
if (!is_array($outputcomments[$sect])) $outputcomments[$sect]=array();
array_push($outputcomments[$sect],$out);
}
ksort($outputcomments);
reset($outputcomments);
while (list($sec,$v)=each($outputcomments)){

if (($sec!="x") && ($sec!="g")) output("`n`b$sec`b`n");
output(implode('',$v),true);

}

if($session['user']['activated'] == USER_ACTIVATED_MUTE_AUTO && $session['user']['loggedin'] && $show_addform) {

output('`^`bNoch hast du dich noch nicht als würdig erwiesen, hier etwas zu schreiben. Falls du dies ändern willst, wende deine
Schritte gen `iDrachenbücherei`i auf dem Dorfplatz und durchschreite dort die Prüfung, die dich zum Bürger '.getsetting('townname','Atrahor').'s machen wird!`b`0`n');

}

if ($session[user][loggedin] && $show_addform && $session['user']['activated'] != USER_ACTIVATED_MUTE && $session['user']['activated'] != USER_ACTIVATED_MUTE_AUTO) {

if (($message!="X") && ($message!="O")) {
if ($talkline!="says") {$tll = strlen($talkline)+11;
} else $tll=0;

// Vorschaufunktion by talion
if ($session['user']['prefs']['preview']) {
rawoutput('<script type="text/javascript" language="JavaScript" src="templates/chat_prev.js">
</script><script type="text/javascript" language="JavaScript">
var name = \''.appoencode(addslashes($session['user']['name'])).'\';
var ecol = \''.$session['user']['prefs']['commentemotecolor'].'\';
var tcol = \''.$session['user']['prefs']['commenttalkcolor'].'\';
var reg = \''.regex_appoencode(1,false).'\';
var verb = \''.$talkline.'\';
var mx = \''.getsetting('maxcolors',10).'\';
</script>');
output('<hr><br><b>`&Vorschau: // </b><span id="comprev"></span>',true);
}
if ($long_posting==true)
{ $max_length=9600; }
else
{ $max_length=9800; }

// Zu erlaubten Kommentarsektionen hinzufügen
if($allownonnav[$SCRIPT_NAME]) {
unset($session['user']['prefs']['comsection_nonav']);
$session['user']['prefs']['comsection_nonav'][$section] = $su_min;
}
else {
unset($session['user']['prefs']['comsection_nav']);
$session['user']['prefs']['comsection_nav'][$section] = $su_min;
}

// schmales Feld
// output('<form action="'.$REQUEST_URI.'" method="POST">`@'.$message.'`n
// <input name="insertcommentary['.$section.']" size="180" maxlength="'.($max_length-$tll).'" ',true);
//Textarea
output("<p><form action=\"$REQUEST_URI\" method='POST'>`@$message`n<textarea cols='110' rows='6' class='input' name='insertcommentary[$section]' maxlength='".(1)."' onkeyup=\"document.getElementById('chatpreview').innerHTML = appoencode(this.value);\" style='width: 500px;'></textarea></p><input type='hidden' name='talkline' value='$talkline'><input type='hidden' name='section' value='$section'><br /><input type='submit' class='button' value='Hinzufügen'><span id='chatpreview'></span>`n".(round($limit/2,0)-$counttoday<3?"`)(Du hast noch ".(round($limit/2,0)-$counttoday)." Beiträge für heute übrig)":"")."`0`n</form>",true);
if($session['user']['prefs']['preview']) {
output(' id="comin" onkeyup="com_prev();this.focus();"',true);
}

output(' >
<input type="hidden" name="talkline" value="'.$talkline.'">
<input type="hidden" name="section" value="'.$section.'">
<input type="submit" class="button" value="Hinzufügen">`n`0`n</form>',true);

addnav("",$REQUEST_URI);

}

}

$req = preg_replace("'[&]?c(omscroll)?=([[:digit:]-])*'","",$REQUEST_URI)."&comscroll=";
$req = str_replace("?&","?",$req);
if (!strpos($req,"?")) $req = str_replace("&","?",$req);

if ($count>=$limit){
$str_lnk = $req . ($com+1);
output("<a href=\"$str_lnk\">&lt;&lt; Vorherige</a>",true);
addnav("",$str_lnk);
}

$str_lnk = $req . '0';
output("&nbsp;<a href=\"$str_lnk\">Aktualisieren</a>&nbsp;",true);
addnav("",$str_lnk);

if ($com>0){
$str_lnk = $req.($com-1);

output(" <a href=\"$str_lnk\">Nächste &gt;&gt;</a>",true);
addnav("",$str_lnk);
}

if(su_check(SU_RIGHT_COMMENT)) {
if(($message!="X") && ($message!=" ")) {
$req = 'su_comment.php?op=single_section&section='.$section;
output('&nbsp;&nbsp;&nbsp; `&[ <a href="#" target="_blank" onClick="'.popup($req).';return false;" >Admin</a> ]',true);
}
else {
output('`n`n<input type="submit" value="Markierte Löschen">',true);
output('`n`n<input type="hidden" value="1" name="commentback"><input type="submit" value="Markierte in Beweissicherung verschieben"></form>',true);
}
}

if($session['user']['loggedin'] && getsetting('enable_commentemail',0)) {
output('&nbsp;&nbsp; `&[ <a href="#" target="_blank" onClick="'.popup('comment_funcs.php?comment_sendmail=1&section='.$section.'&limit='.$limit.'&com='.$com.'').';return false;" >An EMail</a> ]',true);
}

if($session['user']['prefs']['template'] == 'dragonslayer_1.html' && $session['user']['loggedin'] && !$BOOL_POPUP) {

$link = 'comment_funcs.php?vitalchange=1&ret='.urlencode($REQUEST_URI);
addnav('',$link);
output('&nbsp;&nbsp; [ <a href="'.$link.'">Vollbild '.($session['disablevital'] ? 'aus':'ein').'!</a> ]',true);

}

if($only_rpg) {
$link = 'comment_funcs.php?npc_off=1&ret='.urlencode($REQUEST_URI);
addnav('',$link);
output('&nbsp;&nbsp; [ <a href="'.$link.'">NichtRPG '.($session['disable_npc_comment'] ? 'ein':'aus').'!</a> ]',true);
}

if(time() - $session['modcalled'] >= 300 && getsetting('enable_modcall',0) && $session['user']['loggedin']) {
$req = 'comment_funcs.php?callmod=1&section='.$section.'&ret='.urlencode($REQUEST_URI);
addnav('',$req);
output("&nbsp;&nbsp;&nbsp;&nbsp;`&[<a href=\"$req\" onClick='return confirm(\"Wirklich Mod rufen?\");'>Spam melden</a>]",true);
}

if($session['user']['loggedin'] && $message != 'X') {

$link = 'comment_funcs.php?section='.$section.'&ret='.urlencode($REQUEST_URI);
addnav("",$link);
output('<div align="right"><form method="POST" action="'.$link.'">
Kommentare pro Seite:
<select name="commentlimit" onchange="this.form.submit()">
<option value="'.$limit.'"> '.$limit.' </option>
<option value="10" '.($limit==10 ? 'selected' : '').'> 10 </option>
<option value="25" '.($limit==25 ? 'selected' : '').'> 25 </option>
<option value="50" '.($limit==50 ? 'selected' : '').'> 50 </option>
<option value="75" '.($limit==75 ? 'selected' : '').'> 75 </option>
</select></form></div>',true);
}

db_free_result($result);
//letzten Beitrag editieren
$editlink="chat_edit.php?backto=".URLEncode($_SERVER['REQUEST_URI'])."&section=".$section;
output(" <a href=\"$editlink\" style=\"color: blue;\" onClick='return confirm(\"Letzten Post wirklich editieren? \");'>Letzten Post editieren</a>",true);
addnav("",$editlink);
//Beitrag editieren Ende
// letzten Beitrag löschen
$dellink="chat_delete.php?return=".$REQUEST_URI."&section=".$section;
output(" <a href=\"$dellink\" style=\"color: red;\">Letzten Post löschen</a>",true);
addnav("",$dellink);
// ende
}
[/php]

Autor:  Eliwood [ Mi 03 Okt, 2007 16:04 ]
Betreff des Beitrags:  Re: Vorschau des geschriebenes Text und größers Schreibfeld

[php]/ schmales Feld
// output('<form action="'.$REQUEST_URI.'" method="POST">`@'.$message.'`n
// <input name="insertcommentary['.$section.']" size="180" maxlength="'.($max_length-$tll).'" ',true);
//Textarea
output("<p><form action=\"$REQUEST_URI\" method='POST'>`@$message`n<textarea cols='110' rows='6' class='input' name='insertcommentary[$section]' maxlength='".(1)."' onkeyup=\"document.getElementById('chatpreview').innerHTML = appoencode(this.value);\" style='width: 500px;'></textarea></p><input type='hidden' name='talkline' value='$talkline'><input type='hidden' name='section' value='$section'><br /><input type='submit' class='button' value='Hinzufügen'><span id='chatpreview'></span>`n".(round($limit/2,0)-$counttoday<3?"`)(Du hast noch ".(round($limit/2,0)-$counttoday)." Beiträge für heute übrig)":"")."`0`n</form>",true);
if($session['user']['prefs']['preview']) {
output(' id="comin" onkeyup="com_prev();this.focus();"',true);
} [/php]

Sollte sein:

[php]<?

// schmales Feld
// output('<form action="'.$REQUEST_URI.'" method="POST">`@'.$message.'`n
// <input name="insertcommentary['.$section.']" size="180" maxlength="'.($max_length-$tll).'" ',true);
//Textarea
output("<p>
<form action=\"$REQUEST_URI\" method='POST'>`@$message`n
<textarea cols='110' rows='6' class='input' name='insertcommentary[$section]' style='width: 500px;'",true);
if($session['user']['prefs']['preview']) {
output(' id="comin" onkeyup="com_prev();this.focus();"',true);
}
output(' ></textarea>
<input type="hidden" name="talkline" value="'.$talkline.'">
<input type="hidden" name="section" value="'.$section.'">
<input type="submit" class="button" value="Hinzufügen">`n`0`n</form>',true); [/php]

Keine Garantie, wie immer.
Wo du das auch immer her hast - Passend zur Slayer ist es auf jeden Fall nicht von Haus aus. Etwas interpretation des Codes hätte allerdings genügt, um die richtige Transkription hinzubekommen.

Autor:  Varius [ Mi 03 Okt, 2007 16:21 ]
Betreff des Beitrags: 

Da hat es bei mir an der interpretation des Codes wohl gehapert.

Abwer Deine Lösung geht

1000 Dank :)

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/