[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.4, Thu Dec 13 21:17:21 2007 UTC revision 1.10, Thu Mar 13 19:36:58 2008 UTC
# Line 36  Line 36 
36  sub output {  sub output {
37    my ( $self ) = @_;    my ( $self ) = @_;
38    
   use Data::Dumper;  
   
39    my $fig = new FIG;    my $fig = new FIG;
40    my $cgi = $self->application->cgi;    my $cgi = $self->application->cgi;
41    
# Line 64  Line 62 
62      }      }
63    }    }
64    
65    if ( $user && $user->has_right( $self->application, 'edit', 'subsystem', $name ) ) {    if ( $user ) {
66        if ( $user->has_right( $self->application, 'edit', 'subsystem', $name ) ) {
67          $can_alter = 1;
68          $fig->set_user( $seeduser );
69        }
70        else {
71          # we might have the problem that the user has not yet got the right for editing the
72          # subsystem due to that it was created in the old seed or what do I know where.
73          my $curatorOfSS = $fig->subsystem_curator( $name );
74          my $su = lc( $seeduser );
75          my $cu = lc( $curatorOfSS );
76          if ( $su eq $cu ) {
77            # now set the rights...
78            my $right = $dbmaster->Rights->create( { name => 'edit',
79                                                     scope => $user->get_user_scope,
80                                                     data_type => 'subsystem',
81                                                     data_id => $name,
82                                                     granted => 1,
83                                                     delegated => 0 } );
84            if ( $right ) {
85      $can_alter = 1;      $can_alter = 1;
86      $fig->set_user( $seeduser );      $fig->set_user( $seeduser );
87    }    }
88          }
89        }
90      }
91    
92    ######################    ######################
93    # Construct the menu #    # Construct the menu #
94    ######################    ######################
# Line 77  Line 98 
98    # Build nice tab menu here    # Build nice tab menu here
99    $menu->add_category( 'Subsystem Info', "SubsysEditor.cgi?page=ShowSubsystem&subsystem=$name" );    $menu->add_category( 'Subsystem Info', "SubsysEditor.cgi?page=ShowSubsystem&subsystem=$name" );
100    $menu->add_category( 'Functional Roles', "SubsysEditor.cgi?page=ShowFunctionalRoles&subsystem=$name" );    $menu->add_category( 'Functional Roles', "SubsysEditor.cgi?page=ShowFunctionalRoles&subsystem=$name" );
101    $menu->add_category( 'Subsystem Diagram', "SubsysEditor.cgi?page=ShowDiagram&subsystem=$name" );    $menu->add_category( 'Diagram', "SubsysEditor.cgi?page=ShowDiagram&subsystem=$name" );
102    $menu->add_category( 'Subsystem Spreadsheet', "SubsysEditor.cgi?page=ShowSpreadsheet&subsystem=$name" );    $menu->add_category( 'Illustrations', "SubsysEditor.cgi?page=ShowIllustrations&subsystem=$name" );
103    $menu->add_category( 'Subsystem Check', "SubsysEditor.cgi?page=ShowCheck&subsystem=$name" );    $menu->add_category( 'Spreadsheet', "SubsysEditor.cgi?page=ShowSpreadsheet&subsystem=$name" );
104    $menu->add_category( 'Subsystem Tree', "SubsysEditor.cgi?page=ShowTree&subsystem=$name" );    $menu->add_category( 'Show Check', "SubsysEditor.cgi?page=ShowCheck&subsystem=$name" );
105      $menu->add_category( 'Show Tree', "SubsysEditor.cgi?page=ShowTree&subsystem=$name" );
106    
107    
108    ##############################    ##############################
# Line 143  Line 165 
165      }      }
166      $subsystem->set_classification( [ $class1, $class2 ] );      $subsystem->set_classification( [ $class1, $class2 ] );
167    
168        my $litstoset = $cgi->param( 'SUBSYSLIT' );
169        my @lits = split( ', ', $litstoset );
170        setLiteratures( $fig, $name, \@lits );
171    
172      # here we really edit the files in the subsystem directory #      # here we really edit the files in the subsystem directory #
173      $subsystem->incr_version();      $subsystem->incr_version();
174      $subsystem->db_sync();      $subsystem->db_sync();
# Line 156  Line 182 
182    my ( $ssversion, $sscurator, $pedigree, $ssroles ) = $fig->subsystem_info( $name );    my ( $ssversion, $sscurator, $pedigree, $ssroles ) = $fig->subsystem_info( $name );
183    
184    my $versionlink = '';    my $versionlink = '';
185  print STDERR $can_alter." CANALTER\n";  
186    if ( $can_alter ) {    if ( $can_alter ) {
187      $versionlink = " -- <A HREF='".$self->application->url()."?page=ResetSubsystem&subsystem=$name'>Reset to Previous Timestamp</A>";      $versionlink = " -- <A HREF='".$self->application->url()."?page=ResetSubsystem&subsystem=$name'>Reset to Previous Timestamp</A>";
     print STDERR $versionlink . " VL\n";  
188    }    }
189    
190    my $mod_time = get_mod_time( $name );    my $mod_time = get_mod_time( $name );
# Line 184  Line 209 
209      $classification_stuff .= "<TR><TH></TH><TD>$class->[1]</TD></TR>";      $classification_stuff .= "<TR><TH></TH><TD>$class->[1]</TD></TR>";
210    }    }
211    
     print STDERR $versionlink . " VL\n";  
212    my $infotable = "<TABLE><TR><TH>Name:</TH><TD>$ssname</TD><TR>";    my $infotable = "<TABLE><TR><TH>Name:</TH><TD>$ssname</TD><TR>";
213    $infotable .= "<TR><TH>Author:</TH><TD>$sscurator</TD></TR>";    $infotable .= "<TR><TH>Author:</TH><TD>$sscurator</TD></TR>";
214    $infotable .= "<TR><TH>Version:</TH><TD>$ssversion $versionlink</TD></TR>";    $infotable .= "<TR><TH>Version:</TH><TD>$ssversion $versionlink</TD></TR>";
215    $infotable .= "<TR><TH>Last Modified:</TH><TD>$mod_time</TD></TR>";    $infotable .= "<TR><TH>Last Modified:</TH><TD>$mod_time</TD></TR>";
216    
217      my $lit = getLiteratures( $fig, $name );
218      my $litstring = '';
219      my $litvoid = '';
220      if ( defined( $lit ) && scalar( @$lit ) > 0 ) {
221        my @litlinks;
222        foreach my $l ( @$lit ) {
223          my $thislink = "<a href=\"javascript:void(0)\"onclick=\"window.open('http://www.ncbi.nlm.nih.gov/sites/entrez?cmd=retrieve&db=pubmed&list_uids=" . $l ."')\">$l</a>";
224          push @litlinks, $thislink;
225        }
226        $litstring = join( ', ', @litlinks );
227        $litvoid = join( ', ', @$lit );
228      }
229    
230    if ( $can_alter ) {    if ( $can_alter ) {
231    
232        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\" );'>";
233        $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>";
234      $infotable .= "<TR><TH>Description</TH><TD><TEXTAREA NAME='SSDESC' ROWS=6 STYLE='width: 772px;'>$ssdesc</TEXTAREA></TD></TR>";      $infotable .= "<TR><TH>Description</TH><TD><TEXTAREA NAME='SSDESC' ROWS=6 STYLE='width: 772px;'>$ssdesc</TEXTAREA></TD></TR>";
235      $infotable .= "<TR><TH>Notes</TH><TD><TEXTAREA NAME='SSNOTES' ROWS=6 STYLE='width: 772px;'>$ssnotes</TEXTAREA></TD></TR>";      $infotable .= "<TR><TH>Notes</TH><TD><TEXTAREA NAME='SSNOTES' ROWS=6 STYLE='width: 772px;'>$ssnotes</TEXTAREA></TD></TR>";
236    }    }
# Line 293  Line 334 
334      my $opt = "<SELECT SIZE=5 ID='$firstc' NAME='SUBSYSH2' STYLE='width: 386px;' class='hideme'>";      my $opt = "<SELECT SIZE=5 ID='$firstc' NAME='SUBSYSH2' STYLE='width: 386px;' class='hideme'>";
335      my $optstring = '';      my $optstring = '';
336      foreach my $secc ( sort @{ $ssclass->{ $firstc } } ) {      foreach my $secc ( sort @{ $ssclass->{ $firstc } } ) {
337        if ( defined( $SUBSYSH2 ) && $SUBSYSH2 eq $secc ) {        if ( defined( $SUBSYSH2 ) && $SUBSYSH2 eq $secc && $SUBSYSH1 eq $firstc ) {
338          $optstring .= "<OPTION SELECTED VALUE='$secc'>$secc</OPTION>";          $optstring .= "<OPTION SELECTED VALUE='$secc'>$secc</OPTION>";
339          # we have to show the selectbox if there is a selected value          # we have to show the selectbox if there is a selected value
340          $opt = "<SELECT SIZE=5 ID='$firstc' NAME='SUBSYSH2' STYLE='width: 386px;' class='showme'>";          $opt = "<SELECT SIZE=5 ID='$firstc' NAME='SUBSYSH2' STYLE='width: 386px;' class='showme'>";
# Line 341  Line 382 
382    return $sdContent;    return $sdContent;
383  }  }
384    
385    ########################################
386    # get Literature-string for subsystems #
387    ########################################
388    sub getLiteratures {
389      my ( $fig, $name ) = @_;
390    
391      my $frpubs;
392      my @rel_lit_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_PUBMED_RELEVANT" );
393    
394      foreach my $k ( @rel_lit_num ) {
395        my ( $ss, $key, $value ) = @$k;
396        push @$frpubs, $value;
397      }
398    
399      return $frpubs;
400    }
401    
402    ########################################
403    # set Literature-string for subsystems #
404    ########################################
405    sub setLiteratures {
406      my ( $fig, $name, $newpubs ) = @_;
407    
408      my @values;
409      my @rel_lit_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_PUBMED_RELEVANT" );
410    
411      foreach my $k ( @rel_lit_num ) {
412        my ( $ss, $key, $value ) = @$k;
413        $fig->delete_matching_attributes( "Subsystem:$name", "SUBSYSTEM_PUBMED_RELEVANT", $value );
414      }
415    
416      foreach my $np ( @$newpubs ) {
417        $fig->add_attribute( "Subsystem:$name", "SUBSYSTEM_PUBMED_RELEVANT", $np );
418      }
419    }
420    
421  sub supported_rights {  sub supported_rights {
422    
423    return [ [ 'edit', 'subsystem', '*' ] ];    return [ [ 'edit', 'subsystem', '*' ] ];

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3