CGI-Bus

 view release on metacpan or  search on metacpan

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

 $s->SUPER::cmdqry(@_);
 $s
}


sub cmdhtm { # Common HTML
  my $s =shift;
  if ($s->{-cmde} && $s->{-acd} && $s->{-fsd} && $s->cmd('-frm') && $s->cmdg('-sel')) {
     $s->cmdsel(undef,'-pxpv') if !$s->cmd('-sel');
     $s->acltest('-sel','')    if  $s->cmd('-sel');
     $s->{-cmde} =eval{$s->acltest('-upd','-pxpv')};
  }
  elsif ($s->{-acd} && $s->cmd('-sel')) {
     $s->acltest('-sel','');
     $s->{-cmde} =eval{$s->acltest('-upd','-pxpv')} if $s->{-cmde};
  }
  $s->SUPER::cmdhtm(@_);
  $s
}


sub cmdfrm { # Record form for Query or Edit
 my $s =shift;
 $s->SUPER::cmdfrm(@_);
 my $p =$s->parent;
 my $ed=$s->{-cmde} && $s->cmdg(qw(-sel -crt -frm));

 if (!$s->cmdg('-qry') && $s->{-fsd} && -d $s->fspath) {
  # $p->print->text('<br />');
    my $ed = $ed && (!$s->{-vsd} 
                 || ($s->{-vsd}->{-cvd} ? (&{$s->{-vsd}->{-cvd}}($s))
                    :$s->{-vsd}->{-svd} ? $s->{-vsd}->{-svd} eq $s->qparampv($s->{-vsd}->{-sf})
                    :0));
    $p->print->htmlfsdir({-name=>$s->pxsw('files'), -class=>'Form'}
	, $ed, $ed && $s->cmd('-frm')
        , $s->fspath, $s->fsurl, $s->fsurf, '20%','100%');
    $p->print("\n");
  # $p->print->text('<hr />')
  #   if $s->cmd('-sel') && $s->{-vsd} && $s->{-vsd}->{-npf};
 }

 if ($s->cmd('-sel') && $s->{-vsd} && $s->{-vsd}->{-npf} && ($s->qparamsw('MIN')||'') !~/v/) {
     $s->_cmdfrmv();
 }

 if ($s->cmdg('-qry')) {
     my $vw =$s->{-lists} ? $s->{-lists}->{$s->qlst} : undef;
     my $vwf=($vw && $vw->{-fields} ? $s->htmlescape(join(', ',@{$vw->{-fields}})):'');
     my $vww=$vw ? ($vw->{-where} || $vw->{-filter} ||'') : '';
        $vww=$s->htmlescape(ref($vww) ? &$vww($s) : $vww);
     my $vwo=($vw && $vw->{-orderby} ? $vw->{-orderby} :'');
        $vwo=$s->htmlescape(ref($vwo) 
                  ? join(',', map {ref($_) ? join(' ',@$_): $_} @$vwo)
                  : $vwo);
     $p->print('<hr />');
     $p->print('<table>');
    if ($s->{-lists}) {
     $p->print('<tr>');
     $p->print->th({-align=>'left',-valign=>'top',-class=>'Form'},$s->lng(0,'LIST'));
     $p->print->td({-valign=>'top',-class=>'Form'}
			,$p->popup_menu(-name=>$s->pxsw('LIST')
			,-title =>$s->lng(1,'LIST')
			,-values=>$s->qlstnmes
			,-labels=>$s->qlstlbls
			,-default=>$s->qlst
			,-class=>'Form')
                  . ($vwf ? "<font style=\"font-size: smaller;\"> ($vwf)</font>" :''));
     $p->print('</tr>');
    }
     $p->print('<tr>');
     $p->print->th({-align=>'left',-valign=>'top',-class=>'Form'},$s->lng(0,'WHERE'));
     $p->print->td({-valign=>'top',-class=>'Form'}
                  ,$p->htmltextarea(-name =>$s->pxsw('WHERE')
				,-title=>$s->lng(1,'WHERE')
				,-class=>'Form'
				,-arows=>2,-cols=>68)
                  .($vw && $vw->{-wherepar} && !$s->qparamsw('WHERE')
                    ? ('<font style="font-size: smaller;"> [ AND (' .$p->htmlescape($vw->{-wherepar}) .') ]</font>') 
                    : '')
                  .($vww ? "<font style=\"font-size: smaller;\"> AND ($vww)</font>" :''));
     $p->print('</tr><tr>');
    if ($s->{-ftext}) {
     $p->print->th({-align=>'left',-valign=>'top',-class=>'Form'},$s->lng(0,'F-TEXT'));
     $p->print->td({-valign=>'top',-class=>'Form'}
                  ,$p->textfield(-name =>$s->pxsw('FTEXT')
				,-title=>$s->lng(1,'F-TEXT')
				,-class=>'Form'
				,-size =>88));
     $p->print('</tr><tr>');
    }
     $p->print->th({-align=>'left',-valign=>'top',-class=>'Form'},$s->lng(0,'ORDER BY'));
     $p->print->td({-valign=>'top',-class=>'Form'}
                  ,$p->textfield(-name =>$s->pxsw('ORDER_BY')
				,-title=>$s->lng(1,'ORDER BY')
				,-class=>'Form'
				,-size =>88) 
                  .($vwo ? "<font style=\"font-size: smaller;\"> ($vwo)</font>" : ''));
     $p->print('</tr><tr>');
     $p->print->th({-align=>'left',-valign=>'top',-class=>'Form'},$s->lng(0,'LIMIT ROWS'));
     $p->print->td({-valign=>'top',-class=>'Form'}
                  ,$p->textfield(-name=>$s->pxsw('LIMIT')
			,-class=>'Form'
			,-title=>$s->lng(1,'LIMIT ROWS')) 
                  .'<font style="font-size: smaller;"> (' .($s->{-listrnm}||'') .')</font>');
     $p->print('</tr>');
     $p->print('</table>');
     $p->print->text('<font style="font-size: smaller;">'
     ."Use <code>expr LIKE 'pattern'</code> for simple match comparison, where "
     ."'%' matches any number of characters (even zero), "
     ."'_'  matches exactly one character, "
     ."'\\' is escape char."
     .'</font>');
     $p->print->text('<br /><font style="font-size: smaller;">Self URL may be useful: ' 
	# .$p->cgi->self_url 
	.$p->qurl() .'?' .join(';', map {$p->urlescape($_) .'=' .$p->urlescape($p->cgi->param($_))} grep {defined($p->cgi->param($_)) && $p->cgi->param($_) ne '' && $_ =~/^(_tsw|_tcb|[^_])/ && $_ !~/^(_tsw_REFERER|_tsw_FRMCOUNT|_tcb_frm)/} $p->cgi->param)
	.'</font>');

     if ($s->{-acd} && eval{$s->acltest('-sys')}) { # System Actions
        print "<hr />\n<strong>System Actions:</strong> ";
        if ($s->{-fsd}) { # FS Scan
           $p->print->submit(-name=>$s->pxcb('fsscan')



( run in 0.570 second using v1.01-cache-2.11-cpan-364913b4093 )