ASNMTAP

 view release on metacpan or  search on metacpan

applications/htmlroot/cgi-bin/getHelpPlugin.pl  view on Meta::CPAN

# Debug information
print "<pre>pagedir   : $pagedir<br>pageset   : $pageset<br>debug     : $debug<br>CGISESSID : $sessionID<br>catalog ID: $CcatalogID<br>uKey      : $uKey<br>URL ...   : $urlAccessParameters</pre>" if ( $debug eq 'T' );

unless ( defined $errorUserAccessControl ) {
  my ($htmlHelpPluginTitle, $htmlHelpPluginFilename, $fileHelpPluginFilename);
  $htmlHelpPluginTitle = $htmlHelpPluginFilename = $fileHelpPluginFilename = '<NIHIL>';

  my $sql = "select concat( LTRIM(SUBSTRING_INDEX(title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ), helpPluginFilename from $SERVERTABLPLUGINS, $SERVERTABLENVIRONMENT where catalogID = '$CcatalogID' and uKey = '$uKey' and $SERVERTABLPLUGIN...

  my $rv  = 1;
  my $dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADONLY:$SERVERPORTREADONLY", "$SERVERUSERREADONLY", "$SERVERPASSREADONLY" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlHelpPluginTitle...

  if ($dbh and $rv) {
    my $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlHelpPluginTitle, $subTitle, 3600, '', $sessionID);
    $sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlHelpPluginTitle, $subTitle, 3600, '', $sessionID) if $rv;

    if ( $rv ) {
      while (my ($title, $helpPluginFilename) = $sth->fetchrow_array()) {
        $htmlHelpPluginTitle = $title;
        $htmlHelpPluginFilename = $helpPluginFilename;
      }

      $sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlHelpPluginTitle, $subTitle, 3600, '', $sessionID);

      if (defined $htmlHelpPluginFilename and $htmlHelpPluginFilename ne '<NIHIL>') {
        if ($htmlHelpPluginFilename =~ /^http(s)?\:\/\//) {
          $fileHelpPluginFilename = $htmlHelpPluginFilename;
        } else {
          $fileHelpPluginFilename = $PDPHELPPATH .'/'. $htmlHelpPluginFilename;
          $htmlHelpPluginFilename = $PDPHELPURL .'/'. $htmlHelpPluginFilename;

          if (open(PDF, "$fileHelpPluginFilename")) {
            close(PDF);
          } else {
            $fileHelpPluginFilename = '<NIHIL>';
            $htmlHelpPluginFilename = "Wanted helpfile: '$htmlHelpPluginFilename'";
          }		
        }		
      } else {
        $htmlHelpPluginFilename = "There is no helpfile defined into the plugin database!";
      }

      print_header (*STDOUT, $pagedir, $pageset, $htmlHelpPluginTitle, $subTitle, 3600, '', 'F', '', $sessionID);

      print '<br>', "\n", '<table WIDTH="100%" border=0><tr><td class="HelpPluginFilename">', "\n";

      if (! defined $fileHelpPluginFilename or $fileHelpPluginFilename eq '<NIHIL>') {
        print '<IMG SRC="', $IMAGESURL, '/404.jpg"><br><br>', $htmlHelpPluginFilename, "\n";
#     } elsif ($fileHelpPluginFilename =~ /^http(s)?\:\/\//) {
#        print <<HTML
#  <script type="text/javascript">
#    <!--
#    function openHelpPluginFilename(theUrl){
#      location.href = theUrl;
#    }
#    //-->
#  </script>
#  <a href="javascript:openHelpPluginFilename('$htmlHelpPluginFilename');" target="_blank">$htmlHelpPluginFilename</a>
#HTML
      } else {
        print '<iframe src="', $htmlHelpPluginFilename, '" width="100%" height="1214" more="" ATTRIBUTES=""></iframe>', "\n";
      }

      print '</td></tr></table>', "\n";
    }

    $dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlHelpPluginTitle, $subTitle, 3600, '', $sessionID);
  }

  print '<BR>', "\n";
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

print_legend (*STDOUT);
print '</BODY>', "\n", '</HTML>', "\n";

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



( run in 0.946 second using v1.01-cache-2.11-cpan-501a3233654 )