[Bio] / SubsystemEditor / WebPage / ShowSubsystem.pm Repository:
ViewVC logotype

Diff of /SubsystemEditor/WebPage/ShowSubsystem.pm

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

revision 1.10, Thu Mar 13 19:36:58 2008 UTC revision 1.21, Tue Oct 7 09:37:32 2008 UTC
# Line 19  Line 19 
19    my ( $self ) = @_;    my ( $self ) = @_;
20    
21    $self->application->register_component( 'Table', 'sstable'  );    $self->application->register_component( 'Table', 'sstable'  );
22      $self->application->register_component(  'Table', 'VarDescTable'  );
23  }  }
24    
25  #################################  #################################
# Line 95  Line 96 
96    
97    my $menu = $self->application->menu();    my $menu = $self->application->menu();
98    
99      my $esc_name = uri_escape($name);
100    
101    # Build nice tab menu here    # Build nice tab menu here
102    $menu->add_category( 'Subsystem Info', "SubsysEditor.cgi?page=ShowSubsystem&subsystem=$name" );    $menu->add_category( 'Subsystem Info', "SubsysEditor.cgi?page=ShowSubsystem&subsystem=$esc_name" );
103    $menu->add_category( 'Functional Roles', "SubsysEditor.cgi?page=ShowFunctionalRoles&subsystem=$name" );    $menu->add_category( 'Functional Roles', "SubsysEditor.cgi?page=ShowFunctionalRoles&subsystem=$esc_name" );
104    $menu->add_category( 'Diagram', "SubsysEditor.cgi?page=ShowDiagram&subsystem=$name" );    $menu->add_category( 'Subsets', "SubsysEditor.cgi?page=ShowSubsets&subsystem=$esc_name" );
105    $menu->add_category( 'Illustrations', "SubsysEditor.cgi?page=ShowIllustrations&subsystem=$name" );    $menu->add_category( 'Diagram', "SubsysEditor.cgi?page=ShowDiagram&subsystem=$esc_name" );
106    $menu->add_category( 'Spreadsheet', "SubsysEditor.cgi?page=ShowSpreadsheet&subsystem=$name" );    $menu->add_category( 'Illustrations', "SubsysEditor.cgi?page=ShowIllustrations&subsystem=$esc_name" );
107    $menu->add_category( 'Show Check', "SubsysEditor.cgi?page=ShowCheck&subsystem=$name" );    $menu->add_category( 'Spreadsheet', "SubsysEditor.cgi?page=ShowSpreadsheet&subsystem=$esc_name" );
108    $menu->add_category( 'Show Tree', "SubsysEditor.cgi?page=ShowTree&subsystem=$name" );    $menu->add_category( 'Show Check', "SubsysEditor.cgi?page=ShowCheck&subsystem=$esc_name" );
109      $menu->add_category( 'Show Connections', "SubsysEditor.cgi?page=ShowTree&subsystem=$esc_name" );
110    
111    
112    ##############################    ##############################
# Line 169  Line 173 
173      my @lits = split( ', ', $litstoset );      my @lits = split( ', ', $litstoset );
174      setLiteratures( $fig, $name, \@lits );      setLiteratures( $fig, $name, \@lits );
175    
176        my $wlstoset = $cgi->param( 'SUBSYSWL' );
177        if ( defined( $wlstoset ) && $wlstoset =~ /.+\s+.+/ ) {
178          my @wls = split( '\n', $wlstoset );
179          setWeblinks( $fig, $name, \@wls );
180        }
181    
182      # here we really edit the files in the subsystem directory #      # here we really edit the files in the subsystem directory #
183      $subsystem->incr_version();      $subsystem->incr_version();
184      $subsystem->db_sync();      $subsystem->db_sync();
# Line 184  Line 194 
194    my $versionlink = '';    my $versionlink = '';
195    
196    if ( $can_alter ) {    if ( $can_alter ) {
197      $versionlink = " -- <A HREF='".$self->application->url()."?page=ResetSubsystem&subsystem=$name'>Reset to Previous Timestamp</A>";      $versionlink = " -- <A HREF='".$self->application->url()."?page=ResetSubsystem&subsystem=$esc_name'>Reset to Previous Timestamp</A>";
198    }    }
199    
200    my $mod_time = get_mod_time( $name );    my $mod_time = get_mod_time( $name );
# Line 209  Line 219 
219      $classification_stuff .= "<TR><TH></TH><TD>$class->[1]</TD></TR>";      $classification_stuff .= "<TR><TH></TH><TD>$class->[1]</TD></TR>";
220    }    }
221    
222    my $infotable = "<TABLE><TR><TH>Name:</TH><TD>$ssname</TD><TR>";    my $infotable = "<TABLE><TR><TH>Name:</TH><TD>$ssname</TD></TR>";
223    $infotable .= "<TR><TH>Author:</TH><TD>$sscurator</TD></TR>";    $infotable .= "<TR><TH>Author:</TH><TD>$sscurator</TD></TR>";
224    $infotable .= "<TR><TH>Version:</TH><TD>$ssversion $versionlink</TD></TR>";    $infotable .= "<TR><TH>Version:</TH><TD>$ssversion $versionlink</TD></TR>";
225    $infotable .= "<TR><TH>Last Modified:</TH><TD>$mod_time</TD></TR>";    $infotable .= "<TR><TH>Last Modified:</TH><TD>$mod_time</TD></TR>";
226    
227      # Literature #
228    my $lit = getLiteratures( $fig, $name );    my $lit = getLiteratures( $fig, $name );
229    my $litstring = '';    my $litstring = '';
230    my $litvoid = '';    my $litvoid = '';
# Line 227  Line 238 
238      $litvoid = join( ', ', @$lit );      $litvoid = join( ', ', @$lit );
239    }    }
240    
241      # Weblinks #
242      my ( $wl, $wlvoid ) = getLinks( $fig, $name );
243    
244      my $variants = $subsystem->get_variants();
245    
246    if ( $can_alter ) {    if ( $can_alter ) {
247    
248      my $editLitButton = "<INPUT TYPE=BUTTON ID='EditLitButton' VALUE='Edit Literature' ONCLICK='MakeEditableLit( \"0\" );'><INPUT TYPE=BUTTON ID='ShowLitButton' VALUE='Show Links' STYLE='display: none;' ONCLICK='MakeEditableLit( \"1\" );'>";      my $editLitButton = "<INPUT TYPE=BUTTON ID='EditLitButton' VALUE='Edit Literature' ONCLICK='MakeEditableLit( \"0\" );'><INPUT TYPE=BUTTON ID='ShowLitButton' VALUE='Show Links' STYLE='display: none;' ONCLICK='MakeEditableLit( \"1\" );'>";
249        my $editWLButton = "<INPUT TYPE=BUTTON ID='EditWLButton' VALUE='Edit Weblinks' ONCLICK='MakeEditableWL( \"0\" );'><INPUT TYPE=BUTTON ID='ShowWLButton' VALUE='Show Weblinks' STYLE='display: none;' ONCLICK='MakeEditableWL( \"1\" );'>";
250    
251      $infotable .= "<TR><TH>Literature</TH><TD><TABLE><TR><TD><SPAN ID='LitSpan'>$litstring</SPAN></TD><TD>$editLitButton</TD><TD><INPUT TYPE=TEXT STYLE='width: 200px; display: none;' NAME='SUBSYSLIT' ID='SUBSYSLIT' VALUE='$litvoid'></TD><TD><SPAN ID='TEXTSPAN' STYLE='display: none;'>Multiple PMIDs should be separated by \', \'</SPAN></TD></TR></TABLE></TD></TR>";      $infotable .= "<TR><TH>Literature</TH><TD><TABLE><TR><TD><SPAN ID='LitSpan'>$litstring</SPAN></TD><TD>$editLitButton</TD><TD><INPUT TYPE=TEXT STYLE='width: 200px; display: none;' NAME='SUBSYSLIT' ID='SUBSYSLIT' VALUE='$litvoid'></TD><TD><SPAN ID='TEXTSPAN' STYLE='display: none;'>Multiple PMIDs should be separated by \', \'</SPAN></TD></TR></TABLE></TD></TR>";
252      $infotable .= "<TR><TH>Description</TH><TD><TEXTAREA NAME='SSDESC' ROWS=6 STYLE='width: 772px;'>$ssdesc</TEXTAREA></TD></TR>";      $infotable .= "<TR><TH>Websites</TH><TD><TABLE><TR><TD><SPAN ID='WLSpan'>$wl</SPAN></TD><TD>$editWLButton</TD><TD><TEXTAREA ROWS=3 STYLE='width: 400px; display: none;' NAME='SUBSYSWL' ID='SUBSYSWL'>$wlvoid</TEXTAREA></TD><TD><SPAN ID='AREASPAN' STYLE='display: none;'>Please use the following format:<BR>Description1 http://www.xyz.org/...<BR>Description2 http://www.xzy.de/...</SPAN></TD></TR></TABLE></TD></TR>";
253      $infotable .= "<TR><TH>Notes</TH><TD><TEXTAREA NAME='SSNOTES' ROWS=6 STYLE='width: 772px;'>$ssnotes</TEXTAREA></TD></TR>";      $infotable .= "<TR><TH>Description</TH><TD><TEXTAREA NAME='SSDESC' ROWS=15 STYLE='width: 772px;'>$ssdesc</TEXTAREA></TD></TR>";
254        $infotable .= "<TR><TH>Notes</TH><TD><TEXTAREA NAME='SSNOTES' ROWS=15 STYLE='width: 772px;'>$ssnotes</TEXTAREA></TD></TR>";
255    }    }
256    else {    else {
257      # do a little formating because the notes often contain many many blanks and newlines      # do a little formating because the notes often contain many many blanks and newlines
# Line 242  Line 261 
261      my $ssnotes_brs = $ssnotes;      my $ssnotes_brs = $ssnotes;
262      $ssnotes_brs =~ s/(\n\s)+/\n/g;      $ssnotes_brs =~ s/(\n\s)+/\n/g;
263      $ssnotes_brs =~ s/\n/<BR>/g;      $ssnotes_brs =~ s/\n/<BR>/g;
264        $infotable .= "<TR><TH>Literature</TH><TD>$litstring</TD></TR>";
265        $infotable .= "<TR><TH>Websites</TH><TD>$wl</TD></TR>";
266      $infotable .= "<TR><TH>Description</TH><TD>$ssdesc_brs</TD></TR>";      $infotable .= "<TR><TH>Description</TH><TD>$ssdesc_brs</TD></TR>";
267      $infotable .= "<TR><TH>Notes</TH><TD>$ssnotes_brs</TD></TR>";      $infotable .= "<TR><TH>Notes</TH><TD>$ssnotes_brs</TD></TR>";
268    }    }
269      # variants
270      my $vartable = $self->application->component( 'VarDescTable' );
271      $vartable->columns( [ { name => "Variant" }, { name => "Description" } ] );
272    
273      my $vardata;
274      my $has_variants = 0;
275      foreach my $kv ( sort keys %$variants ) {
276        $has_variants = 1;
277        push @$vardata, [ $kv, $variants->{ $kv } ];
278      }
279      $vartable->data( $vardata );
280      $infotable .= "<TR><TH>Variants</TH><TD>";
281      if ( $has_variants ) {
282        $infotable .= $vartable->output();
283      }
284    
285      if ( $can_alter ) {
286        my $variant_outside = "<INPUT TYPE=BUTTON VALUE='Edit Variants in Variant Overview' NAME='EditVariantsOverview' ID='EditVariantsOverview' ONCLICK='window.open( \"".$self->application->url()."?page=ShowVariants&subsystem=$name\" )'>";
287      $infotable .= $variant_outside;
288      }
289    
290      $infotable .= "</TD</TR>";
291    
292    $infotable .= $classification_stuff;    $infotable .= $classification_stuff;
293    $infotable .= "</TABLE>";    $infotable .= "</TABLE>";
294    
295    if ( $can_alter ) {    if ( $can_alter ) {
296      $infotable .= "<INPUT TYPE=SUBMIT VALUE='Save Changes' ID='SUBMIT' NAME='SUBMIT'>";      $infotable .= "<INPUT TYPE=SUBMIT VALUE='Save Changes' ID='SUBMIT' NAME='SUBMIT' STYLE='background-color: red;'>";
297    }    }
298    
299      if ( $can_alter ) {
300        $content .= "<INPUT TYPE=SUBMIT VALUE='Save Changes' ID='SUBMIT' NAME='SUBMIT'  STYLE='background-color: red;'>";
301      }
302    $content .= $infotable;    $content .= $infotable;
303    $content .= $self->end_form();    $content .= $self->end_form();
304    
# Line 388  Line 435 
435  sub getLiteratures {  sub getLiteratures {
436    my ( $fig, $name ) = @_;    my ( $fig, $name ) = @_;
437    
438      my $esc_name = uri_escape($name);
439    
440    my $frpubs;    my $frpubs;
441    my @rel_lit_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_PUBMED_RELEVANT" );    my @rel_lit_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_PUBMED_RELEVANT" );
442    
# Line 399  Line 448 
448    return $frpubs;    return $frpubs;
449  }  }
450    
451    ######################################
452    # get Weblinks-string for subsystems #
453    ######################################
454    sub getLinks {
455      my ( $fig, $name ) = @_;
456    
457      my $esc_name = uri_escape($name);
458    
459      my $links;
460      my $linksstring = '';
461      my $linksvoid = '';
462      my @rel_link_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_WEBLINKS" );
463    
464      foreach my $k ( @rel_link_num ) {
465        my ( $ss, $key, @value ) = @$k;
466        $linksstring .= $value[0].": <a href=\"javascript:void(0)\"onclick=\"window.open('".$value[1]."','height=640,width=800,scrollbars=yes,toolbar=yes,status=yes')\">". $value[1]."</a><BR>";
467        $linksvoid .= $value[0]." ".$value[1]."\n";
468      }
469    
470      return ( $linksstring, $linksvoid );
471    }
472    
473  ########################################  ########################################
474  # set Literature-string for subsystems #  # set Literature-string for subsystems #
475  ########################################  ########################################
476  sub setLiteratures {  sub setLiteratures {
477    my ( $fig, $name, $newpubs ) = @_;    my ( $fig, $name, $newpubs ) = @_;
478    
479      my $esc_name = uri_escape($name);
480    
481    my @values;    my @values;
482    my @rel_lit_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_PUBMED_RELEVANT" );    my @rel_lit_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_PUBMED_RELEVANT" );
483    
484    foreach my $k ( @rel_lit_num ) {    foreach my $k ( @rel_lit_num ) {
485      my ( $ss, $key, $value ) = @$k;      my ( $ss, $key, $value ) = @$k;
486      $fig->delete_matching_attributes( "Subsystem:$name", "SUBSYSTEM_PUBMED_RELEVANT", $value );      $fig->delete_matching_attributes( "Subsystem:$name", "SUBSYSTEM_PUBMED_RELEVANT" );
487    }    }
488    
489    foreach my $np ( @$newpubs ) {    foreach my $np ( @$newpubs ) {
# Line 418  Line 491 
491    }    }
492  }  }
493    
494    ########################################
495    # set Literature-string for subsystems #
496    ########################################
497    sub setWeblinks {
498      my ( $fig, $name, $newpubs ) = @_;
499    
500      my $esc_name = uri_escape($name);
501    
502      my @values;
503      my @rel_lit_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_WEBLINKS" );
504    
505      foreach my $k ( @rel_lit_num ) {
506        my ( $ss, $key, $value ) = @$k;
507        $fig->delete_matching_attributes( "Subsystem:$name", "SUBSYSTEM_WEBLINKS" );
508      }
509    
510      foreach my $np ( @$newpubs ) {
511        my @h = split( /\s+/, $np );
512        $fig->add_attribute( "Subsystem:$name", "SUBSYSTEM_WEBLINKS", @h );
513      }
514    }
515    
516  sub supported_rights {  sub supported_rights {
517    
518    return [ [ 'edit', 'subsystem', '*' ] ];    return [ [ 'edit', 'subsystem', '*' ] ];

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.21

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3