CGI-Bus

 view release on metacpan or  search on metacpan

lib/CGI/Bus.pod  view on Meta::CPAN

text area formatting improved with '&nbsp;' signs and '<code>' tags as needed;
'<br />' and '<a href=' tags; 
URLs; 
relative URLs marked with 'host://' and 'url://' protocols.


=item htmlfsdir ( name, edit?, allow edit?, files path, URL, ?filesystemURL, ?rows, ?cols )

Generate filesystem directory editor HTML.
This may be IE HTML IFRAME tag pointed to filesystem,
URLs, or filefield for upload files and checkboxes to delete.
Name is used as the common part of names of the HTML widgets.
Implemented in L<CGI::Bus::wg|CGI/Bus/wg>.


=item htmlstart (?parameters) -> start html string

Start HTML string using C<CGI::start_html>(?parameters) call.
Default parameters are given from C<-htmlstart> slot.


lib/CGI/Bus/lngbase/CGI_Bus_wg.pm  view on Meta::CPAN


sub lngbase {
 ('ddlbopen'    =>['...',   'open']
 ,'ddlbfind'    =>['..',    'find']
 ,'ddlbclose'   =>['x',     'close']
 ,'ddlbsetvalue'=>['<',     'set value']
 ,'Files'       =>['Files', 'Files attached']
 ,'+|-'         =>['+/-',   'Add / Close / Delete']
 ,'fsopens'	=>['...',   'Files opened']
 ,'fsclose'	=>['Close', 'Close files choosen']
 ,'fsbrowse'	=>['Browse','Choose file to upload']
 ,'fsdelmrk'	=>['DelMark','Mark to delete']
 )
}

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

			: 'Form'
	   , $rfr
           ? ($p->{-htpgstart} ? %{$p->{-htpgstart}} :()
             ,-head=>(($p->{-htpgstart} && $p->{-htpgstart}->{-head}) 
                    ||($p->{-htmlstart} && $p->{-htmlstart}->{-head})
                    ||'')
             ."<meta http-equiv=\"refresh\" content=$rfr>")
           : $s->cmd('-lst') ||$s->cmd('-hlp')
           ? %{$p->{-htpgstart}}
           : %{$p->{-htpfstart}}});
 # !!!Multipart forms should be escaped as possible: used only for file uploads
 $p->print( $s->{-fsd} && $s->{-fsd}->{-url} 
          && $s->cmdg !~/lst|qry/i
          && !($ENV{MOD_PERL} && $p->cgi->user_agent =~/Lotus-Notes|StarOffice/i)
          ? $s->start_multipart_form(-method=>$rfr ? 'get' : 'post', -action=>$s->qurl, -acceptcharset=>$p->{-httpheader} ?$p->{-httpheader}->{-charset} :undef)
          : $s->startform(-method=>$rfr ? 'get' : 'post', -action=>$s->qurl, -acceptcharset=>$p->{-httpheader} ?$p->{-httpheader}->{-charset} :undef));
 })} if !$s->{-cmdhtm};
 $p->print->htpfstart(undef, {-class=>'Help', %{$p->{-htpgstart}}}) 
		if $s->cmd('-hlp');
 $s->eval();
 $p->print->htpfend if $p->{-cache}->{-htmlstart} ||!$s->cmd('-lst');

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

	#.' ondblclick="{window.clipboardData.setData(\'Text\',' .$p->htmlescape($fs) .'\'); return(false)}" '
	# window.event.srcElement
	# document.selection.empty(); 
	.' title="' .$p->htmlescape($s->lng(1,'Files') .' ') .'" '
	.'><sub>' 
	.$p->htmlescape($fs) ."</sub></span>"
    }
    $r .="<br />\n";
  # !!! filefield may be useful to attach files, but file creation time will not be saved !!!
  # $r .=$p->cgi->filefield(-name=>$nmu);
  # $s->_fsdirupload($nmu, $fp) if $ea && $p->cgi->param($nmu);
    $r .='<iframe scrolling="auto" src="' .$p->htmlescape($fr) .'"';
    $r .=' application="yes"';
    $r .=' height="' .$sr .'"' if $sr;
    $r .=' width="'  .$sc .'"' if $sc;
    $r .='> </iframe>';
    return $r;
 }
 my $fb =$p->urfcnd && $ed ? ($fr ||$fu) : ($fu ||$fr);
 if (!$ed) {
    my $fl =join(",\n"

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

     #  $fd ='<embed scr="' ."$fb/$fn" .'" height=100% width=100% />';
     #  $fd ='<iframe scroling="auto" src="' .$p->htmlescape("$fb/$fn") .'" width=100% height=100%></iframe>';
        $fd =$p->fut->fload('-b',$fd);
        $fd =$' if $fd =~m/<body\b[^>]*>/i;
        $fd =$` if $fd =~m/<\/body\b/i;
        $fd ='<base href="' .($fb =~/:\/\// ? $fb : $p->surl($fb)) .'/" />' .$fd if $fd !~m/<base\b/i; # !!! May be a problem
        $r .='<hr />' .$fd .'<br />';
    }
 }
 elsif ($ed) {
    $s->_fsdirupload($nmu, $fp) if $ea && $p->cgi->param($nmu);
    if ($ea && $p->cgi->param($nma)) {
       foreach my $fn ($p->cgi->param($nml)) {
         $p->fut->delete('-r',"$fp/$fn");
       }
    }
    $r .=$p->cgi->filefield(($x ? (%$x) : ()), -name=>$nmu, -title=>$s->lng(1,'fsbrowse'));
    $r .=$p->cgi->submit(($x ? (%$x) : ()), -name=>$nma, -value=>$s->lng(0,'+|-'), -title=>$s->lng(1,'+|-'));
    $r .=$p->cgi->submit(($x ? (%$x) : ()), -name=>$nmo, -value=>$s->lng(0,'fsopens'), -title=>$s->lng(1,'fsopens'))
		if !$fo && $^O eq 'MSWin32';
    $r .=$p->cgi->scrolling_list(($x ? (%$x) : ())

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

    foreach my $fn (eval{$p->fut->globn("$fp/*")}) {
       $r .=$p->cgi->a({-href=>"$fb/$fn", -target=>'_blank'}
           ,$p->cgi->checkbox(($x ? (%$x) : ()), -name=>$nml, -value=>$fn, -label=>$fn, -title=>$s->lng(1,'fsdelmrk')))
          ."&nbsp;&nbsp;&nbsp;\n";
    }
 }
 $r
}


sub _fsdirupload { # Filesystem dir field file upload
 my ($s, $nmu, $fp) =@_;
 my $fa =$s->cgi->param($nmu);
 if ($fa) {
    my $fn =$fa =~/[\\\/]([^\\\/]+)$/ ? $1 : $fa;
    my $fh =$s->cgi->upload($nmu);
    if ($fh) {
       $s->pushmsg("upload '$fn' from '$fa'");
       binmode($fh);
       eval('use File::Copy');
       File::Copy::copy($fh, "$fp/$fn")
       ||$s->die("Upload '$fn' from '$fa': $!\n");
       close($fh);
    }
    else {
      $s->die("Empty filehandle '$fn' from '$fa': " .($!||$@||'') ."\n");
    }
 }

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

Other arguments are field names to fill with values.
Field names with leading "\t" corresponds to multivalue fields,
leading "\tmsab\t" hints to try Microsoft Address Book before if possible.



=item fsdir ( name, edit?, allow edit?, files path, URL, ?filesystemURL, ?rows, ?cols )

Generate filesystem directory editor HTML.
This may be IE HTML IFRAME tag pointed to filesystem,
URLs, or filefield for upload files and checkboxes to delete.
Name is used as the common part of names of the HTML widgets.
'index.html' or 'index.htm' file may be embedded below file list 
when view mode.



=item textarea (-name=>...,-arows=>min, -hrefs=>1,...) -> textarea HTML

Like C<CGI::textarea> call, but with additional attributes:
-arows=>min autosizes widget to it's content.



( run in 1.670 second using v1.01-cache-2.11-cpan-b16cb0d3907 )