From: <ssc...@us...> - 2003-04-26 04:21:37
|
Update of /cvsroot/popfile/engine/UI In directory sc8-pr-cvs1:/tmp/cvs-serv15210 Modified Files: HTML.pm Log Message: fix several magnet display issues Index: HTML.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v retrieving revision 1.144 retrieving revision 1.145 diff -C2 -d -r1.144 -r1.145 *** HTML.pm 21 Apr 2003 20:54:00 -0000 1.144 --- HTML.pm 26 Apr 2003 04:21:31 -0000 1.145 *************** *** 1318,1325 **** --- 1318,1333 ---- # to validate, must replace & with & # stan todo note: come up with a smarter regex, this one's a bludgeon + # another todo: Move this stuff into a function to make text + # safe for inclusion in a form field my $validatingMagnet = $magnet; $validatingMagnet =~ s/&/&/g; $validatingMagnet =~ s/</</g; $validatingMagnet =~ s/>/>/g; + + # escape quotation characters to avoid orphan data within tags + # todo: function to make arbitrary data safe for inclusion within + # a html tag attribute (inside double-quotes) + + $validatingMagnet =~ s/\"/\"\;/g; $body .= ">\n<td><select name=\"type$i\" id=\"magnetsAddType\">\n"; *************** *** 1328,1332 **** $body .= "<option value=\"$mtype\" $selected>\n$self->{language__}{$magnet_types{$mtype}}</option>\n"; } ! $body .= "</select>: <input type=\"text\" name=\"text$i\" value=\"$validatingMagnet\" /></td>\n"; $body .= "<td><select name=\"bucket$i\" id=\"magnetsAddBucket\">\n"; --- 1336,1340 ---- $body .= "<option value=\"$mtype\" $selected>\n$self->{language__}{$magnet_types{$mtype}}</option>\n"; } ! $body .= "</select>: <input type=\"text\" name=\"text$i\" value=\"$validatingMagnet\" size=\"" . length($magnet) . "\" /></td>\n"; $body .= "<td><select name=\"bucket$i\" id=\"magnetsAddBucket\">\n"; *************** *** 2837,2841 **** $body .= "</select>\n"; } else { ! $body .= " ($self->{language__}{History_MagnetUsed}: $self->{history__}{$mail_file}{magnet})"; } } --- 2845,2849 ---- $body .= "</select>\n"; } else { ! $body .= " ($self->{language__}{History_MagnetUsed}: " . splitline( $self->{history__}{$mail_file}{magnet}, 0 ) . ")"; } } *************** *** 2937,2940 **** --- 2945,2953 ---- } + $body .= "</td>\n"; + + $body .= "<td class=\"openMessageCloser\">"; + $body .= "<a class=\"messageLink\" href=\"/history?start_message=$start_message&session=$self->{session_key__}&sort=$self->{form_}{sort}&search=$self->{form_}{search}&filter=$self->{form_}{filter}\">\n"; + $body .= "<span class=\"historyLabel\">$self->{language__}{Close}</span>\n</a>\n"; $body .= "</td>\n</tr>\n</table>\n"; *************** *** 2943,2953 **** $body .= "<table class=\"openMessageTable\" cellpadding=\"10%\" cellspacing=\"0\" width=\"100%\" summary=\"$self->{language__}{History_OpenMessageSummary}\">\n"; - # Close button - - # $body .= "<tr>\n<td class=\"openMessageCloser\">"; - # $body .= "<a class=\"messageLink\" href=\"/history?start_message=$start_message&session=$self->{session_key__}&sort=$self->{form_}{sort}&search=$self->{form_}{search}&filter=$self->{form_}{filter}\">\n"; - # $body .= "<span class=\"historyLabel\">$self->{language__}{Close}</span>\n</a>\n"; - # $body .= "</td>\n</tr>\n"; - $body .= "<tr><td>"; $body .= "<form id=\"HistoryMainForm\" action=\"/history\" method=\"POST\">\n"; --- 2956,2959 ---- *************** *** 2979,2983 **** $body .= "</select>\n<input type=\"submit\" class=\"reclassifyButton\" name=\"change\" value=\"$self->{language__}{Reclassify}\" />"; } else { ! $body .= " ($self->{language__}{History_MagnetUsed}: $self->{history__}{$mail_file}{magnet})"; } } --- 2985,2989 ---- $body .= "</select>\n<input type=\"submit\" class=\"reclassifyButton\" name=\"change\" value=\"$self->{language__}{Reclassify}\" />"; } else { ! $body .= " ($self->{language__}{History_MagnetUsed}: " . splitline( $self->{history__}{$mail_file}{magnet} , 0) . ")"; } } *************** *** 3370,3373 **** --- 3376,3407 ---- $self->{dynamic_ui__}{$type}{$name} = $object; + } + + # --------------------------------------------------------------------------------------------- + # + # splitline - Escapes characters so a line will print as plain-text within a HTML document. + # + # $line The line to escape + # $encoding The value of any current encoding scheme + # + # --------------------------------------------------------------------------------------------- + + sub splitline + { + my ($line, $encoding) = @_; + $line =~ s/([^\r\n]{100,120} )/$1\r\n/g; + $line =~ s/([^ \r\n]{120})/$1\r\n/g; + + $line =~ s/</</g; + $line =~ s/>/>/g; + + if ( $encoding =~ /quoted\-printable/i ) { + $line =~ s/=3C/</g; + $line =~ s/=3E/>/g; + } + + $line =~ s/\t/ /g; + + return $line; } |