CGI-Bus

 view release on metacpan or  search on metacpan

lib/CGI/Bus/wg.pm  view on Meta::CPAN

		if Err = 0 or Err <> 0 then
			For each item in Users1
				if len(field.value) <> 0 then
					field.value =field.value & \", \" & item.SMTPAddress
				else
					field.value =item.SMTPAddress
				end if
			Next
			rem MsgBox(field.value)
			${n}_O_O =\"fldnme\"
		else
			MsgBox(\"Error=\" & Err.Description)
			Err.Clear
		end if
	end if
	End function"
	."</script><script language=\"jscript\"></script>"
    if ($fn =~/msab\t/) && $g->user_agent('MSIE');
    $r .=$g->submit(($x ? (%$x) : ())
		,-name=>($n .'_B')
		,-value=>$s->lng(0,'ddlbopen')
		,-title=>$s->lng(1,'ddlbopen')
		,($fn =~/msab\t/) && $g->user_agent('MSIE')
			? (-OnClick=>"if(${n}_O_O('$wn')) {return(false)};")
			: ()
		);
    $r .='<script for="window" event="onload">{'
	.'window.document.forms[0].' .$n .'_B.focus();}</script>'
	if ($g->param($n .'_S') ||$g->param($n .'_C'));
 }
 $r
}


sub textfield {# Text filed with autosizing
 my $s =shift;
 my %a =@_;
 my $v =exists($a{-default}) ? $a{-default} : $s->qparam($a{-name});
    $v ='' if !defined($v);
 if ($a{-asize}) {
     $a{-size} =($a{-asize} >length($v) ? $a{-asize} :length($v));
     delete $a{-asize};
 }
 $s->cgi->textfield(%a)
}


sub textarea { # Text Area with autorowing and hrefs
 my $s =shift;
 my %a =@_;
 my $r ='';
 my $r1='';
 my $v =exists($a{-default}) ? $a{-default} : $s->qparam($a{-name});
    $v ='' if !defined($v);
 if ($a{-htmlopt}) {
	delete $a{-htmlopt};
	my $n =$a{-name};
#	$r1 .="<input type=\"submit\" name=\"${n}__b\" value=\"R\" "
#		."title=\"Rich/Text edit: ^Bold, ^Italic, ^Underline, ^Link, Enter/shift-Enter, ^(shift)T ident, ^Z undo, ^Y redo.\nSwitch to 'T'ext before saving!!!\" "
#		."style=\"font-style: italic;\" "
#			# ; font-weight: bold; font-family: fantasy
#		."onclick=\"{if(${n}__b.value=='R') {${n}__b.value='T'; ${n}__r.DocumentHTML=$n.value ? $n.value : ''; $n.style.display='none'; ${n}__r.style.display='inline'; ${n}__r.width='100%'; ${n}__r.height=250 }\n"
#		."else {var r; ${n}__b.value='R'; r=${n}__r.DocumentHTML.match(/&lt;BODY&gt;[\\s]*([\\s\\S]*)[\\s]*&lt;\\/BODY&gt;/); "
#		."$n.value=r ? r[1] : ${n}__r.DocumentHTML; ${n}__r.style.display='none'; $n.style.display='inline';};\n"
#		." return(false)}\" />\n"
#		."<object classid=\"clsid:2D360201-FFF5-11d1-8D03-00A0C959BC0A\" id=${n}__r height=\"100%\" width=\"250\" style=\"display: none;\" name=\"${n}__r\" title=\"DHTML Editing Component\"></object>\n"
#		#DHTML Edit Control for IE5, DHTML Editing Component, HTMLRichtextElement:
#		#http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnaredcom/html/dhtmledit.asp
#		if $n && ($ENV{HTTP_USER_AGENT}||'') =~/MSIE/;
#	$r1 .="<input type=\"submit\" name=\"${n}__b\" value=\"R\" "
#		."title=\"Rich/Text edit: ^Bold, ^Italic, ^Underline, ^Link, Enter/shift-Enter, ^(shift)T ident, ^Z undo, ^Y redo.\nSwitch to 'T'ext before saving!!!\" "
#		."style=\"font-style: italic;\" "
#			# ; font-weight: bold; font-family: fantasy
#		."onclick=\"{if(${n}__b.value=='R') {$n.rows='1'; ${n}__b.value='T'; "
#		."\n var r; r =document.createElement('<object classid=&quot;clsid:2D360201-FFF5-11d1-8D03-00A0C959BC0A&quot; id=&quot;${n}__r&quot; height=&quot;250&quot; width=&quot;100%&quot; name=&quot;${n}__r&quot; title=&quot;DHTML Editing Component&quot ><...
#		."r.normalize; r.Refresh; r.DocumentHTML=$n.value ? $n.value : '';}\n"
#		."else {var r; ${n}__b.value='R'; r=${n}__r.DocumentHTML.match(/&lt;BODY&gt;[\\s]*([\\s\\S]*)[\\s]*&lt;\\/BODY&gt;/); "
#		."$n.value=r ? r[1] : ${n}__r.DocumentHTML; ${n}__r.removeNode(true); $n.rows='6'};\n"
#		." return(false)}\" />\n"
#		#DHTML Edit Control for IE5, DHTML Editing Component, HTMLRichtextElement:
#		#http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnaredcom/html/dhtmledit.asp
#		if $n && ($ENV{HTTP_USER_AGENT}||'') =~/MSIE/;
	$r1 .="<input type=\"submit\" name=\"${n}__b\" value=\"R\" "
		.($a{-class} ? 'class="' .$a{-class} .'" ' : '')
		."title=\"Rich/Text edit: ^Bold, ^Italic, ^Underline, ^hyperlinK, Enter/shift-Enter, ^(shift)T ident, ^Z undo, ^Y redo.\" "
		."style=\"font-style: italic;\" "
		."onclick=\"{if(${n}__b.value=='R') {${n}__b.value='T'; $n.style.display='none'; "
		."\n var r; r =document.createElement('<span contenteditable=true id=&quot;${n}__r&quot; title=&quot;MSHTML Editing Component&quot; ondeactivate=&quot;{$n.value=${n}__r.innerHTML}&quot;></span>'); ${n}__b.parentNode.insertBefore(r,$n);\n"
		# r.execCommand('Font', 1)
		."r.contentEditable='true'; r.style.borderStyle='inset'; r.style.borderWidth='thin'; r.normalize; r.innerHTML =$n.value ? $n.value : ' '; r.focus();}\n"
		."else {${n}__b.value='R'; $n.value=${n}__r.innerHTML ? ${n}__r.innerHTML : ''; ${n}__r.removeNode(true); $n.style.display='inline'; $n.focus();};\n"
		." return(false)}\" />\n"
		#MSHTML Edit Control for IE5.5
		if $n && ($ENV{HTTP_USER_AGENT}||'') =~/MSIE/;
 }	
 if ($a{-arows}) {
    my $h =0;
    $a{-cols} =20 if !$a{-cols};
    if ($a{-wrap} && lc($a{-wrap}) eq 'off') {
          my @a =split /\n/, $v;
          $h =scalar(@a)
    }
    else {
       foreach my $r (split /\n/, $v) {
          $h +=1 +(length($r) >$a{-cols} ? int(length($r)/$a{-cols}) +1 :0);
       }
    }
    $a{-rows} =($a{-arows} >$h ? $a{-arows} : $h);
    $a{-rows} =30 if $a{-rows} >30;
    delete $a{-arows}
 }
 if (defined($a{-hrefs})) {
    my $v =$v;
    my @h;
    while ($v =~/\b([\w-]{3,7}:\/\/[^\s\t,()<>\[\]"']+[^\s\t.,;()<>\[\]"'])/) {
       my $t =$1;
       $v =$';
       $t =~s/^(host|urlh):\/\//\//;
       $t =~s/^(url|urlr):\/\//$s->url(-relative=>1)/e;
       push @h, $t;
    }
    $r .=join(';&nbsp; '
		,map {$s->a({-href=>$_, -target=>'_blank', -title=>$_}
			,$s->htmlescape(length() >49 ? substr($_,0,47) .'...' : $_))
			} @h);
    $r .='<br />' if $r;
    delete $a{-hrefs};
 }
 $r .=$s->cgi->textarea(%a);
 $r .=$r1;
 $r
}



( run in 2.104 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )