[Bio] / FigWebServices / SearchSkeleton.cgi Repository:
ViewVC logotype

Diff of /FigWebServices/SearchSkeleton.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Tue Sep 26 13:41:00 2006 UTC revision 1.2, Wed Sep 27 16:57:24 2006 UTC
# Line 102  Line 102 
102      # Get the search class.      # Get the search class.
103      my $class = $cgi->param("Class");      my $class = $cgi->param("Class");
104      if (! $class) {      if (! $class) {
105          # No class specified, so we simply generate all the search forms.          Trace("Producing index of search tools.") if T(3);
106          # First, make sure the template knows there are no search results.          # No class specified, so we simply generate an index of the
107            # searches. First, make sure the template knows there are no search results.
108          $varHash->{result_count} = 0;          $varHash->{result_count} = 0;
109          # Loop through the search classes, building search forms and a table          Trace("Building URL.") if T(3);
110          # of contents.          # Get a copy of our URL. Note we include the query fields so that any
111            # tracing parameters are preserved.
112            my $selfURL = $cgi->url(-relative => 1, -query => 1);
113            # Append a question mark or ampersand to the URL, depending on whether or not
114            # there's already a question mark present.
115            $selfURL .= ($selfURL =~ /\?/ ? '&' : '?');
116            # Loop through the search classes building a table of contents.
117          my @contents = ();          my @contents = ();
         my @forms = ();  
118          for my $className (@advancedClasses) {          for my $className (@advancedClasses) {
119                Trace("Processing $className") if T(3);
120              my $shelp = GetHelper($cgi, $className);              my $shelp = GetHelper($cgi, $className);
121              push @forms, $shelp->Form();              push @contents, "<a href=\"${selfURL}Class=$className\">$className</a>: " . $shelp->Description();
             my $formURL = "#" . $shelp->FormName();  
             push @contents, "<a href=\"$formURL\">$className</a>: " . $shelp->Description();  
122          }          }
123          # Create the table of contents.          # Create the table of contents.
124          my $index = $cgi->h3("Index") .          Trace("Building index.") if T(3);
125            my $index = $cgi->h3("Index of Search Tools") .
126                      $cgi->ul($cgi->li(\@contents));                      $cgi->ul($cgi->li(\@contents));
127          # Assemble it with the forms.          # Store it as the form.
128          $varHash->{form} = join("\n<hr />\n", $index, @forms);          $varHash->{form} = $index;
129            # Tell the template we don't have a class.
130            $varHash->{class} = "";
131            Trace("Index built.") if T(3);
132      } else {      } else {
133            Trace("Class $class detected.") if T(3);
134          # Here we have a class, so we're working with a single type of search.          # Here we have a class, so we're working with a single type of search.
135          my $shelp = GetHelper($cgi, $class);          my $shelp = GetHelper($cgi, $class);
136            # Tell the template what the class is.
137            $varHash->{class} = $class;
138          # Display the form, if desired.          # Display the form, if desired.
139          if (! $cgi->param("NoForm")) {          if (! $cgi->param("NoForm")) {
140              $varHash->{form} = $shelp->Form();              $varHash->{form} = $shelp->Form();
# Line 150  Line 162 
162              $cgi->param(-name => "ResultCount", -value => 0);              $cgi->param(-name => "ResultCount", -value => 0);
163              my $result_count = $shelp->Find();              my $result_count = $shelp->Find();
164              # Check to see what kind of results we got.              # Check to see what kind of results we got.
165              if ($result_count < 0) {              if (! defined($result_count)) {
166                  # Here an error occurred, so we display the error message.                  # Here an error occurred, so we display the error message.
167                  $varHash->{results} = $cgi->h3("ERROR: " . $shelp->Message());                  $varHash->{results} = $cgi->h3("ERROR: " . $shelp->Message());
168              } elsif ($result_count == 0) {              } elsif ($result_count == 0) {

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3