[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.30, Fri Oct 23 12:32:31 2009 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 36  Line 37 
37  sub output {  sub output {
38    my ( $self ) = @_;    my ( $self ) = @_;
39    
40    use Data::Dumper;    my $fig = $self->application->data_handle( 'FIG' );
   
   my $fig = new FIG;  
41    my $cgi = $self->application->cgi;    my $cgi = $self->application->cgi;
42    
43    # subsystem name and 'nice name' #    # subsystem name and 'nice name' #
44    my $name = $cgi->param( 'subsystem' );    my $name = $cgi->param( 'subsystem' );
45      $name = uri_unescape( $name );
46      $name =~ s/&#39/'/g;
47    my $ssname = $name;    my $ssname = $name;
48    $ssname =~ s/\_/ /g;    $ssname =~ s/\_/ /g;
49    
# Line 50  Line 51 
51    my $can_alter = 0;    my $can_alter = 0;
52    my $user = $self->application->session->user;    my $user = $self->application->session->user;
53    
54    my $dbmaster = DBMaster->new( -database => 'WebAppBackend' );    my $dbmaster = $self->application->dbmaster;
55    my $ppoapplication = $dbmaster->Backend->init( { name => 'SubsystemEditor' } );    my $ppoapplication = $self->application->backend;
56    
57    # get a seeduser #    # get a seeduser #
58    my $seeduser = '';    my $seeduser = '';
# Line 64  Line 65 
65      }      }
66    }    }
67    
68    if ( $user && $user->has_right( $self->application, 'edit', 'subsystem', $name ) ) {    if ( $user ) {
69        if ( $user->has_right( $self->application, 'edit', 'subsystem', $name ) ) {
70          $can_alter = 1;
71          $fig->set_user( $seeduser );
72        }
73        else {
74          # we might have the problem that the user has not yet got the right for editing the
75          # subsystem due to that it was created in the old seed or what do I know where.
76          my $curatorOfSS = $fig->subsystem_curator( $name );
77          my $su = lc( $seeduser );
78          my $cu = lc( $curatorOfSS );
79          if ( $su eq $cu ) {
80            # now set the rights...
81            my $right = $dbmaster->Rights->create( { name => 'edit',
82                                                     scope => $user->get_user_scope,
83                                                     data_type => 'subsystem',
84                                                     data_id => $name,
85                                                     granted => 1,
86                                                     delegated => 0 } );
87            if ( $right ) {
88      $can_alter = 1;      $can_alter = 1;
89      $fig->set_user( $seeduser );      $fig->set_user( $seeduser );
90    }    }
91          }
92        }
93      }
94    
95    ######################    ######################
96    # Construct the menu #    # Construct the menu #
97    ######################    ######################
98    
99    my $menu = $self->application->menu();    my $menu = $self->application->menu();
100    
101      my $esc_name = uri_escape($name);
102    
103    # Build nice tab menu here    # Build nice tab menu here
104    $menu->add_category( 'Subsystem Info', "SubsysEditor.cgi?page=ShowSubsystem&subsystem=$name" );    $menu->add_category( 'Subsystem Info', "SubsysEditor.cgi?page=ShowSubsystem&subsystem=$esc_name" );
105    $menu->add_category( 'Functional Roles', "SubsysEditor.cgi?page=ShowFunctionalRoles&subsystem=$name" );    $menu->add_category( 'Functional Roles', "SubsysEditor.cgi?page=ShowFunctionalRoles&subsystem=$esc_name" );
106    $menu->add_category( 'Subsystem Diagram', "SubsysEditor.cgi?page=ShowDiagram&subsystem=$name" );    $menu->add_category( 'Subsets', "SubsysEditor.cgi?page=ShowSubsets&subsystem=$esc_name" );
107    $menu->add_category( 'Subsystem Spreadsheet', "SubsysEditor.cgi?page=ShowSpreadsheet&subsystem=$name" );    $menu->add_category( 'Diagram', "SubsysEditor.cgi?page=ShowDiagram&subsystem=$esc_name" );
108    $menu->add_category( 'Subsystem Check', "SubsysEditor.cgi?page=ShowCheck&subsystem=$name" );    $menu->add_category( 'Illustrations', "SubsysEditor.cgi?page=ShowIllustrations&subsystem=$esc_name" );
109    $menu->add_category( 'Subsystem Tree', "SubsysEditor.cgi?page=ShowTree&subsystem=$name" );    $menu->add_category( 'Spreadsheet', "SubsysEditor.cgi?page=ShowSpreadsheet&subsystem=$esc_name" );
110      $menu->add_category( 'Show Check', "SubsysEditor.cgi?page=ShowCheck&subsystem=$esc_name" );
111      $menu->add_category( 'Show Connections', "SubsysEditor.cgi?page=ShowTree&subsystem=$esc_name" );
112    
113    
114    ##############################    ##############################
# Line 143  Line 171 
171      }      }
172      $subsystem->set_classification( [ $class1, $class2 ] );      $subsystem->set_classification( [ $class1, $class2 ] );
173    
174        my $litstoset = $cgi->param( 'SUBSYSLIT' );
175        $litstoset =~ s/ //g;
176        my @lits = split( ',', $litstoset );
177        setLiteratures( $fig, $name, \@lits );
178    
179        my $wlstoset = $cgi->param( 'SUBSYSWL' );
180        if ( defined( $wlstoset ) && $wlstoset =~ /.+\s+.+/ ) {
181          my @wls = split( '\n', $wlstoset );
182          setWeblinks( $fig, $name, \@wls );
183        }
184    
185      # here we really edit the files in the subsystem directory #      # here we really edit the files in the subsystem directory #
186      $subsystem->incr_version();      $subsystem->incr_version();
187      $subsystem->db_sync();      $subsystem->db_sync();
188      $subsystem->write_subsystem();      $subsystem->write_subsystem();
189    }    }
190      elsif ( defined( $cgi->param( 'GrantRightButton' ) ) ) {
191        if ( $can_alter && $user->has_right( undef, 'edit', 'subsystem', $name, 1 ) ) {
192          my ($newAnno, $readable_name) = split(/|/, $cgi->param( 'ANNOBOX' ));
193          my $thisScopes = $dbmaster->Scope->get_objects( { _id => $newAnno } );
194          if ( defined( $thisScopes->[0]) ) {
195    
196            my $rights = $dbmaster->Rights->get_objects( { name => 'edit',
197                                                           data_type => 'subsystem',
198                                                           data_id => $name,
199                                                           scope => $thisScopes->[0] } );
200            if ( defined( $rights->[0] ) ) {
201              $self->application->add_message( 'warning', "$readable_name already has the right to edit this subsystem." );
202            }
203            else {
204              my $right = $dbmaster->Rights->create( { granted => 1,
205                                                       delegated => 1,
206                                                       name => 'edit',
207                                                       data_type => 'subsystem',
208                                                       data_id => $name,
209                                                       scope => $thisScopes->[0] } );
210              if ( $right ) {
211                $self->application->add_message( 'info', "$readable_name can now edit this subsystem" );
212              }
213              else {
214                $self->application->add_message( 'warning', "Could not create right to edit the subsystem for $readable_name" );
215              }
216            }
217          }
218        }
219        else {
220          $self->application->add_message( 'warning', "You do not have the right to share the subsystem." );
221        }
222      }
223      elsif ( defined( $cgi->param( 'RevokeRightButton' ) ) ) {
224        if ( $can_alter && $user->has_right( undef, 'edit', 'subsystem', $name, 1 ) ) {
225          my ($newAnno, $readable_name) = split(/|/, $cgi->param( 'ALANNOBOX' ));
226          my $thisScopes = $dbmaster->Scope->get_objects( { _id => $newAnno } );
227          my $rights = $dbmaster->Rights->get_objects( { name => 'edit',
228                                                         data_type => 'subsystem',
229                                                         data_id => $name,
230                                                         scope => $thisScopes->[0] } );
231    
232          my $thisRight = $rights->[0];
233          if ( defined( $thisRight ) && $thisRight->delegated ) {
234            $thisRight->delete();
235    
236            $self->application->add_message( 'info', "$readable_name cannot edit this subsystem any more." );
237          }
238          else {
239            $self->application->add_message( 'warning', "You can't revoke the right of $readable_name to edit this subsystem." );
240          }
241        }
242        else {
243          $self->application->add_message( 'warning', "You do not have the right to revoke rights for this subsystem." );
244        }
245      }
246    
247    $subsystem = new Subsystem( $name, $fig, 0 );    $subsystem = new Subsystem( $name, $fig, 0 );
248    
# Line 156  Line 251 
251    my ( $ssversion, $sscurator, $pedigree, $ssroles ) = $fig->subsystem_info( $name );    my ( $ssversion, $sscurator, $pedigree, $ssroles ) = $fig->subsystem_info( $name );
252    
253    my $versionlink = '';    my $versionlink = '';
254  print STDERR $can_alter." CANALTER\n";  
255    if ( $can_alter ) {    if ( $can_alter ) {
256      $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>";
     print STDERR $versionlink . " VL\n";  
257    }    }
258    
259    my $mod_time = get_mod_time( $name );    my $mod_time = get_mod_time( $name );
# Line 184  Line 278 
278      $classification_stuff .= "<TR><TH></TH><TD>$class->[1]</TD></TR>";      $classification_stuff .= "<TR><TH></TH><TD>$class->[1]</TD></TR>";
279    }    }
280    
281      print STDERR $versionlink . " VL\n";    my $infotable = "<TABLE><TR><TH>Name:</TH><TD>$ssname</TD></TR>";
   my $infotable = "<TABLE><TR><TH>Name:</TH><TD>$ssname</TD><TR>";  
282    $infotable .= "<TR><TH>Author:</TH><TD>$sscurator</TD></TR>";    $infotable .= "<TR><TH>Author:</TH><TD>$sscurator</TD></TR>";
283      if ( $can_alter && $user->has_right( undef, 'edit', 'subsystem', $name, 1 ) && !$self->application->{anonymous_mode}) {
284    
285        my $annoGrp = $dbmaster->Scope->get_objects( { name => 'Annotators' } );
286        my $annoScope = $dbmaster->UserHasScope->get_objects( { scope => $annoGrp->[0] } );
287        my $annoMems = [];
288        foreach my $aS ( @$annoScope ) {
289          push @$annoMems, $aS->user();
290        }
291        @$annoMems = sort { $a->lastname cmp $b->lastname || $a->firstname cmp $b->firstname } @$annoMems;
292    
293        my $editRightButton = "<INPUT TYPE=SUBMIT ID='GrantRightButton' NAME='GrantRightButton' VALUE='Grant Right'>";
294        my $revokeRightButton = "<INPUT TYPE=SUBMIT ID='RevokeRightButton' NAME='RevokeRightButton' VALUE='Revoke Right'>";
295    
296        my $user_has_scopes = $dbmaster->UserHasScope->get_objects( { user => $user });
297        my $user_groups_have_right = [];
298        my $user_groups_not_have_right = [];
299        foreach my $user_has_scope (@$user_has_scopes) {
300          my $scope = $user_has_scope->scope();
301          next if $scope->name() =~ /^user:/;
302          next if $scope->name() =~/^Public/;
303          if (scalar(@{$dbmaster->Rights->get_objects( { name => 'edit',
304                                                         data_type => 'subsystem',
305                                                         data_id => $name,
306                                                         scope => $scope } )})) {
307            push(@$user_groups_have_right, [ $scope->_id, $scope->name ]);
308          } else {
309            push(@$user_groups_not_have_right, [ $scope->_id, $scope->name ]);
310          }
311        }
312    
313        my $annotatorsBox = "<SELECT NAME='ANNOBOX' ID='ANNOBOX'>";
314        my $alreadyAnnotatorsBox = "<SELECT NAME='ALANNOBOX' ID='ALANNOBOX'>";
315        foreach my $a ( @$user_groups_have_right ) {
316          $alreadyAnnotatorsBox .= "<OPTION VALUE='".$a->[0]."|group ".$a->[1]."'>group ".$a->[1]."</OPTION>";
317        }
318        foreach my $a ( @$user_groups_not_have_right ) {
319          $annotatorsBox .= "<OPTION VALUE='".$a->[0]."|group ".$a->[1]."'>group ".$a->[1]."</OPTION>";
320        }
321        foreach my $a ( @$annoMems ) {
322          unless ( $a->has_right( undef, 'edit', 'subsystem', $name ) ) {
323            $annotatorsBox .= "<OPTION VALUE='".$a->get_user_scope->_id."|".$a->firstname." ".$a->lastname."'>".$a->firstname.' '.$a->lastname.' ( '.$a->login." )</OPTION>";
324          }
325          else {
326            if ( $a->login() ne $user->login() && ( ! $a->has_right( undef, 'edit', 'subsystem', '*' ) ) ) {
327              $alreadyAnnotatorsBox .= "<OPTION VALUE='".$a->get_user_scope->_id."|".$a->firstname." ".$a->lastname."'>".$a->firstname.' '.$a->lastname.' ( '.$a->login." )</OPTION>";
328            }
329          }
330        }
331        $annotatorsBox .= "</SELECT>";
332        $alreadyAnnotatorsBox .= "</SELECT>";
333    
334        $infotable .= "<TR><TH>Grant Right To Edit To:</TH><TD>$annotatorsBox $editRightButton</TD></TR>";
335        $infotable .= "<TR><TH>Revoke Right To Edit From:</TH><TD>$alreadyAnnotatorsBox $revokeRightButton</TD></TR>";
336      }
337    $infotable .= "<TR><TH>Version:</TH><TD>$ssversion $versionlink</TD></TR>";    $infotable .= "<TR><TH>Version:</TH><TD>$ssversion $versionlink</TD></TR>";
338    $infotable .= "<TR><TH>Last Modified:</TH><TD>$mod_time</TD></TR>";    $infotable .= "<TR><TH>Last Modified:</TH><TD>$mod_time</TD></TR>";
339    
340      # Literature #
341      my $lit = getLiteratures( $fig, $name );
342      my $litstring = '';
343      my $litvoid = '';
344      if ( defined( $lit ) && scalar( @$lit ) > 0 ) {
345        my @litlinks;
346        foreach my $l ( @$lit ) {
347          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>";
348          push @litlinks, $thislink;
349        }
350        $litstring = join( ', ', @litlinks );
351        $litvoid = join( ', ', @$lit );
352      }
353    
354      # Weblinks #
355      my ( $wl, $wlvoid ) = getLinks( $fig, $name );
356    
357      my $variants = $subsystem->get_variants();
358    
359    if ( $can_alter ) {    if ( $can_alter ) {
360      $infotable .= "<TR><TH>Description</TH><TD><TEXTAREA NAME='SSDESC' ROWS=6 STYLE='width: 772px;'>$ssdesc</TEXTAREA></TD></TR>";  
361      $infotable .= "<TR><TH>Notes</TH><TD><TEXTAREA NAME='SSNOTES' ROWS=6 STYLE='width: 772px;'>$ssnotes</TEXTAREA></TD></TR>";      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\" );'>";
362        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\" );'>";
363    
364        $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>";
365        $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>";
366        $infotable .= "<TR><TH>Description</TH><TD><TEXTAREA NAME='SSDESC' ROWS=15 STYLE='width: 772px;'>$ssdesc</TEXTAREA></TD></TR>";
367        $infotable .= "<TR><TH>Notes</TH><TD><TEXTAREA NAME='SSNOTES' ROWS=15 STYLE='width: 772px;'>$ssnotes</TEXTAREA></TD></TR>";
368    }    }
369    else {    else {
370      # 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 201  Line 374 
374      my $ssnotes_brs = $ssnotes;      my $ssnotes_brs = $ssnotes;
375      $ssnotes_brs =~ s/(\n\s)+/\n/g;      $ssnotes_brs =~ s/(\n\s)+/\n/g;
376      $ssnotes_brs =~ s/\n/<BR>/g;      $ssnotes_brs =~ s/\n/<BR>/g;
377        $infotable .= "<TR><TH>Literature</TH><TD>$litstring</TD></TR>";
378        $infotable .= "<TR><TH>Websites</TH><TD>$wl</TD></TR>";
379      $infotable .= "<TR><TH>Description</TH><TD>$ssdesc_brs</TD></TR>";      $infotable .= "<TR><TH>Description</TH><TD>$ssdesc_brs</TD></TR>";
380      $infotable .= "<TR><TH>Notes</TH><TD>$ssnotes_brs</TD></TR>";      $infotable .= "<TR><TH>Notes</TH><TD>$ssnotes_brs</TD></TR>";
381    }    }
382      # variants
383      my $vartable = $self->application->component( 'VarDescTable' );
384      $vartable->columns( [ { name => "Variant" }, { name => "Description" } ] );
385    
386      my $vardata;
387      my $has_variants = 0;
388      foreach my $kv ( sort keys %$variants ) {
389        $has_variants = 1;
390        push @$vardata, [ $kv, $variants->{ $kv } ];
391      }
392      $vartable->data( $vardata );
393      $infotable .= "<TR><TH>Variants</TH><TD>";
394      if ( $has_variants ) {
395        $infotable .= $vartable->output();
396      }
397    
398      if ( $can_alter ) {
399        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\" )'>";
400      $infotable .= $variant_outside;
401      }
402    
403      $infotable .= "</TD</TR>";
404    
405    $infotable .= $classification_stuff;    $infotable .= $classification_stuff;
406    $infotable .= "</TABLE>";    $infotable .= "</TABLE>";
407    
408    if ( $can_alter ) {    if ( $can_alter ) {
409      $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;'>";
410    }    }
411    
412      if ( $can_alter ) {
413        $content .= "<INPUT TYPE=SUBMIT VALUE='Save Changes' ID='SUBMIT' NAME='SUBMIT'  STYLE='background-color: red;'>";
414      }
415    $content .= $infotable;    $content .= $infotable;
416    $content .= $self->end_form();    $content .= $self->end_form();
417    
# Line 281  Line 482 
482    my @ssclassifications = $fig->all_subsystem_classifications();    my @ssclassifications = $fig->all_subsystem_classifications();
483    my $ssclass;    my $ssclass;
484    foreach my $ssc ( @ssclassifications ) {    foreach my $ssc ( @ssclassifications ) {
485      next if ( ( !defined( $ssc->[0] ) ) || ( !defined( $ssc->[1] ) ) );      if ( !defined( $ssc->[1] ) ) {
486      next if ( ( $ssc->[0] eq '' ) || ( $ssc->[1] eq '' ) );        $ssc->[1] = '';
487        }
488    #    next if ( ( !defined( $ssc->[0] ) ) || ( !defined( $ssc->[1] ) ) );
489        next if ( !defined( $ssc->[0] ) );
490        next if ( $ssc->[0] eq '' );
491    #    next if ( ( $ssc->[0] eq '' ) || ( $ssc->[1] eq '' ) );
492      next if ( ( $ssc->[0] =~ /^\s+$/ ) || ( $ssc->[1] =~ /^\s+$/ ) );      next if ( ( $ssc->[0] =~ /^\s+$/ ) || ( $ssc->[1] =~ /^\s+$/ ) );
493      push @{ $ssclass->{ $ssc->[0] } }, $ssc->[1];      push @{ $ssclass->{ $ssc->[0] } }, $ssc->[1];
494    }    }
# Line 293  Line 499 
499      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'>";
500      my $optstring = '';      my $optstring = '';
501      foreach my $secc ( sort @{ $ssclass->{ $firstc } } ) {      foreach my $secc ( sort @{ $ssclass->{ $firstc } } ) {
502        if ( defined( $SUBSYSH2 ) && $SUBSYSH2 eq $secc ) {        if ( defined( $SUBSYSH2 ) && $SUBSYSH2 eq $secc && $SUBSYSH1 eq $firstc ) {
503          $optstring .= "<OPTION SELECTED VALUE='$secc'>$secc</OPTION>";          $optstring .= "<OPTION SELECTED VALUE='$secc'>$secc</OPTION>";
504          # we have to show the selectbox if there is a selected value          # we have to show the selectbox if there is a selected value
505          $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 547 
547    return $sdContent;    return $sdContent;
548  }  }
549    
550    ########################################
551    # get Literature-string for subsystems #
552    ########################################
553    sub getLiteratures {
554      my ( $fig, $name ) = @_;
555    
556      my $esc_name = uri_escape($name);
557    
558      my $frpubs;
559      my @rel_lit_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_PUBMED_RELEVANT" );
560    
561      foreach my $k ( @rel_lit_num ) {
562        my ( $ss, $key, $value ) = @$k;
563        push @$frpubs, $value;
564      }
565    
566      return $frpubs;
567    }
568    
569    ######################################
570    # get Weblinks-string for subsystems #
571    ######################################
572    sub getLinks {
573      my ( $fig, $name ) = @_;
574    
575      my $esc_name = uri_escape($name);
576    
577      my $links;
578      my $linksstring = '';
579      my $linksvoid = '';
580      my @rel_link_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_WEBLINKS" );
581    
582      foreach my $k ( @rel_link_num ) {
583        my ( $ss, $key, @value ) = @$k;
584        $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>";
585        $linksvoid .= $value[0]." ".$value[1]."\n";
586      }
587    
588      return ( $linksstring, $linksvoid );
589    }
590    
591    ########################################
592    # set Literature-string for subsystems #
593    ########################################
594    sub setLiteratures {
595      my ( $fig, $name, $newpubs ) = @_;
596    
597      my $esc_name = uri_escape($name);
598    
599      my @values;
600      my @rel_lit_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_PUBMED_RELEVANT" );
601    
602      foreach my $k ( @rel_lit_num ) {
603        my ( $ss, $key, $value ) = @$k;
604        $fig->delete_matching_attributes( "Subsystem:$name", "SUBSYSTEM_PUBMED_RELEVANT" );
605      }
606    
607      foreach my $np ( @$newpubs ) {
608        $fig->add_attribute( "Subsystem:$name", "SUBSYSTEM_PUBMED_RELEVANT", $np );
609      }
610    }
611    
612    ########################################
613    # set Literature-string for subsystems #
614    ########################################
615    sub setWeblinks {
616      my ( $fig, $name, $newpubs ) = @_;
617    
618      my $esc_name = uri_escape($name);
619    
620      my @values;
621      my @rel_lit_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_WEBLINKS" );
622    
623      foreach my $k ( @rel_lit_num ) {
624        my ( $ss, $key, $value ) = @$k;
625        $fig->delete_matching_attributes( "Subsystem:$name", "SUBSYSTEM_WEBLINKS" );
626      }
627    
628      foreach my $np ( @$newpubs ) {
629        my @h = split( /\s+/, $np );
630        $fig->add_attribute( "Subsystem:$name", "SUBSYSTEM_WEBLINKS", @h );
631      }
632    }
633    
634  sub supported_rights {  sub supported_rights {
635    
636    return [ [ 'edit', 'subsystem', '*' ] ];    return [ [ 'edit', 'subsystem', '*' ] ];

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3