[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.35, Sat Jan 29 22:28:01 2011 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( 'Diagrams and Illustrations' );
108    $menu->add_category( 'Subsystem Check', "SubsysEditor.cgi?page=ShowCheck&subsystem=$name" );    $menu->add_entry( 'Diagrams and Illustrations', 'Diagram', "SubsysEditor.cgi?page=ShowDiagram&subsystem=$esc_name" );
109    $menu->add_category( 'Subsystem Tree', "SubsysEditor.cgi?page=ShowTree&subsystem=$name" );    $menu->add_entry( 'Diagrams and Illustrations', 'Illustrations', "SubsysEditor.cgi?page=ShowIllustrations&subsystem=$esc_name" );
110      $menu->add_category( 'Spreadsheet', "SubsysEditor.cgi?page=ShowSpreadsheet&subsystem=$esc_name" );
111      $menu->add_category( 'Show Check', "SubsysEditor.cgi?page=ShowCheck&subsystem=$esc_name" );
112      $menu->add_category( 'Show Connections', "SubsysEditor.cgi?page=ShowTree&subsystem=$esc_name" );
113    
114    
115    ##############################    ##############################
# Line 143  Line 172 
172      }      }
173      $subsystem->set_classification( [ $class1, $class2 ] );      $subsystem->set_classification( [ $class1, $class2 ] );
174    
175        my $litstoset = $cgi->param( 'SUBSYSLIT' );
176        $litstoset =~ s/ //g;
177        my @lits = split( ',', $litstoset );
178        setLiteratures( $fig, $name, \@lits );
179    
180        my $wlstoset = $cgi->param( 'SUBSYSWL' );
181        if ( defined( $wlstoset ) && $wlstoset =~ /.+\s+.+/ ) {
182          my @wls = split( '\n', $wlstoset );
183          setWeblinks( $fig, $name, \@wls );
184        }
185    
186      # here we really edit the files in the subsystem directory #      # here we really edit the files in the subsystem directory #
187      $subsystem->incr_version();      $subsystem->incr_version();
188      $subsystem->db_sync();      $subsystem->db_sync();
189      $subsystem->write_subsystem();      $subsystem->write_subsystem();
190    }    }
191      elsif ( defined( $cgi->param( 'GrantRightButton' ) ) ) {
192        if ( $can_alter && $user->has_right( undef, 'edit', 'subsystem', $name, 1 ) ) {
193          my ($newAnno, $readable_name) = split(/\|/, $cgi->param( 'ANNOBOX' ));
194          my $thisScopes = $dbmaster->Scope->get_objects( { _id => $newAnno } );
195          if ( defined( $thisScopes->[0]) ) {
196    
197            my $rights = $dbmaster->Rights->get_objects( { name => 'edit',
198                                                           data_type => 'subsystem',
199                                                           data_id => $name,
200                                                           scope => $thisScopes->[0] } );
201            if ( defined( $rights->[0] ) ) {
202              $self->application->add_message( 'warning', "$readable_name already has the right to edit this subsystem." );
203            }
204            else {
205              my $right = $dbmaster->Rights->create( { granted => 1,
206                                                       delegated => 1,
207                                                       name => 'edit',
208                                                       data_type => 'subsystem',
209                                                       data_id => $name,
210                                                       scope => $thisScopes->[0] } );
211              if ( $right ) {
212                $self->application->add_message( 'info', "$readable_name can now edit this subsystem" );
213              }
214              else {
215                $self->application->add_message( 'warning', "Could not create right to edit the subsystem for $readable_name" );
216              }
217            }
218          }
219        }
220        else {
221          $self->application->add_message( 'warning', "You do not have the right to share the subsystem." );
222        }
223      }
224      elsif ( defined( $cgi->param( 'RevokeRightButton' ) ) ) {
225        if ( $can_alter && $user->has_right( undef, 'edit', 'subsystem', $name, 1 ) ) {
226          my ($newAnno, $readable_name) = split(/\|/, $cgi->param( 'ALANNOBOX' ));
227          my $thisScopes = $dbmaster->Scope->get_objects( { _id => $newAnno } );
228          my $rights = $dbmaster->Rights->get_objects( { name => 'edit',
229                                                         data_type => 'subsystem',
230                                                         data_id => $name,
231                                                         scope => $thisScopes->[0] } );
232    
233          my $thisRight = $rights->[0];
234          if ( defined( $thisRight ) && $thisRight->delegated ) {
235            $thisRight->delete();
236    
237            $self->application->add_message( 'info', "$readable_name cannot edit this subsystem any more." );
238          }
239          else {
240            $self->application->add_message( 'warning', "You can't revoke the right of $readable_name to edit this subsystem." );
241          }
242        }
243        else {
244          $self->application->add_message( 'warning', "You do not have the right to revoke rights for this subsystem." );
245        }
246      }
247    
248    $subsystem = new Subsystem( $name, $fig, 0 );    $subsystem = new Subsystem( $name, $fig, 0 );
249    
# Line 156  Line 252 
252    my ( $ssversion, $sscurator, $pedigree, $ssroles ) = $fig->subsystem_info( $name );    my ( $ssversion, $sscurator, $pedigree, $ssroles ) = $fig->subsystem_info( $name );
253    
254    my $versionlink = '';    my $versionlink = '';
255  print STDERR $can_alter." CANALTER\n";  
256    if ( $can_alter ) {    if ( $can_alter ) {
257      $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";  
258    }    }
259    
260    my $mod_time = get_mod_time( $name );    my $mod_time = get_mod_time( $name );
# Line 184  Line 279 
279      $classification_stuff .= "<TR><TH></TH><TD>$class->[1]</TD></TR>";      $classification_stuff .= "<TR><TH></TH><TD>$class->[1]</TD></TR>";
280    }    }
281    
282      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>";  
283    $infotable .= "<TR><TH>Author:</TH><TD>$sscurator</TD></TR>";    $infotable .= "<TR><TH>Author:</TH><TD>$sscurator</TD></TR>";
284      if ( $can_alter && $user->has_right( undef, 'edit', 'subsystem', $name, 1 ) && !$self->application->{anonymous_mode}) {
285    
286        my $annoGrp = $dbmaster->Scope->get_objects( { name => 'Annotators' } );
287        my $annoScope = $dbmaster->UserHasScope->get_objects( { scope => $annoGrp->[0] } );
288        my $annoMems = [];
289        foreach my $aS ( @$annoScope ) {
290          push @$annoMems, $aS->user();
291        }
292        @$annoMems = sort { $a->lastname cmp $b->lastname || $a->firstname cmp $b->firstname } @$annoMems;
293    
294        my $editRightButton = "<INPUT TYPE=SUBMIT ID='GrantRightButton' NAME='GrantRightButton' VALUE='Grant Right'>";
295        my $revokeRightButton = "<INPUT TYPE=SUBMIT ID='RevokeRightButton' NAME='RevokeRightButton' VALUE='Revoke Right'>";
296    
297        my $user_has_scopes = $dbmaster->UserHasScope->get_objects( { user => $user });
298        my $available_groups = {};
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          $available_groups->{$scope->{_id}} = $scope;
304        }
305        my $all_ss_edit_rights = $dbmaster->Rights->get_objects( { name => 'edit',
306                                                                   data_type => 'subsystem',
307                                                                   data_id => $name } );
308        my $user_groups_have_right = [];
309        my $user_groups_not_have_right = [];
310        foreach my $r (@$all_ss_edit_rights) {
311          my $scope = $r->scope;
312          next if $scope->name() =~ /^user:/;
313          next if $scope->name() =~/^Public/;
314          push(@$user_groups_have_right, [ $scope->_id, $scope->name ]);
315          delete $available_groups->{$scope->{_id}};
316        }
317        foreach my $key (sort(keys(%$available_groups))) {
318          my $scope = $available_groups->{$key};
319          push(@$user_groups_not_have_right, [ $scope->_id, $scope->name ]);
320        }
321    
322        my $annotatorsBox = "<SELECT NAME='ANNOBOX' ID='ANNOBOX'>";
323        my $alreadyAnnotatorsBox = "<SELECT NAME='ALANNOBOX' ID='ALANNOBOX'>";
324        foreach my $a ( @$user_groups_have_right ) {
325          $alreadyAnnotatorsBox .= "<OPTION VALUE='".$a->[0]."|group ".$a->[1]."'>group ".$a->[1]."</OPTION>";
326        }
327        foreach my $a ( @$user_groups_not_have_right ) {
328          $annotatorsBox .= "<OPTION VALUE='".$a->[0]."|group ".$a->[1]."'>group ".$a->[1]."</OPTION>";
329        }
330        foreach my $a ( @$annoMems ) {
331          my $r = $dbmaster->Rights->get_objects( { name => 'edit',
332                                                    scope => $a->get_user_scope,
333                                                    data_type => 'subsystem',
334                                                    data_id => $name } );
335          unless ( scalar(@$r) ) {
336            $annotatorsBox .= "<OPTION VALUE='".$a->get_user_scope->_id."|".$a->firstname." ".$a->lastname."'>".$a->firstname.' '.$a->lastname.' ( '.$a->login." )</OPTION>";
337          }
338          else {
339            if ( $a->login() ne $user->login() && ( ! $a->has_right( undef, 'edit', 'subsystem', '*' ) ) ) {
340              $alreadyAnnotatorsBox .= "<OPTION VALUE='".$a->get_user_scope->_id."|".$a->firstname." ".$a->lastname."'>".$a->firstname.' '.$a->lastname.' ( '.$a->login." )</OPTION>";
341            }
342          }
343        }
344        $annotatorsBox .= "</SELECT>";
345        $alreadyAnnotatorsBox .= "</SELECT>";
346    
347        $infotable .= "<TR><TH>Grant Right To Edit To:</TH><TD>$annotatorsBox $editRightButton</TD></TR>";
348        $infotable .= "<TR><TH>Revoke Right To Edit From:</TH><TD>$alreadyAnnotatorsBox $revokeRightButton</TD></TR>";
349      }
350    $infotable .= "<TR><TH>Version:</TH><TD>$ssversion $versionlink</TD></TR>";    $infotable .= "<TR><TH>Version:</TH><TD>$ssversion $versionlink</TD></TR>";
351    $infotable .= "<TR><TH>Last Modified:</TH><TD>$mod_time</TD></TR>";    $infotable .= "<TR><TH>Last Modified:</TH><TD>$mod_time</TD></TR>";
352    
353      # Literature #
354      my $lit = getLiteratures( $fig, $name );
355      my $litstring = '';
356      my $litvoid = '';
357      if ( defined( $lit ) && scalar( @$lit ) > 0 ) {
358        my @litlinks;
359        foreach my $l ( @$lit ) {
360          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>";
361          push @litlinks, $thislink;
362        }
363        $litstring = join( ', ', @litlinks );
364        $litvoid = join( ', ', @$lit );
365      }
366    
367      # Weblinks #
368      my ( $wl, $wlvoid ) = getLinks( $fig, $name );
369    
370      my $variants = $subsystem->get_variants();
371    
372    if ( $can_alter ) {    if ( $can_alter ) {
373      $infotable .= "<TR><TH>Description</TH><TD><TEXTAREA NAME='SSDESC' ROWS=6 STYLE='width: 772px;'>$ssdesc</TEXTAREA></TD></TR>";  
374      $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\" );'>";
375        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\" );'>";
376    
377        $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;'>Please enter the PubMed ID (PMID), and we will automatically get the paper information. Multiple PMIDs should be separated by \', \'</SPAN></TD></TR></TABLE></TD></TR>";
378        $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>Description of the first web page http://www.xyz.org/...<BR>Description of the second web page http://www.xzy.de/...</SPAN></TD></TR></TABLE></TD></TR>";
379        $infotable .= "<TR><TH>Description</TH><TD><TEXTAREA NAME='SSDESC' ROWS=15 STYLE='width: 772px;'>$ssdesc</TEXTAREA></TD></TR>";
380        $infotable .= "<TR><TH>Notes</TH><TD><TEXTAREA NAME='SSNOTES' ROWS=15 STYLE='width: 772px;'>$ssnotes</TEXTAREA></TD></TR>";
381    }    }
382    else {    else {
383      # 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 387 
387      my $ssnotes_brs = $ssnotes;      my $ssnotes_brs = $ssnotes;
388      $ssnotes_brs =~ s/(\n\s)+/\n/g;      $ssnotes_brs =~ s/(\n\s)+/\n/g;
389      $ssnotes_brs =~ s/\n/<BR>/g;      $ssnotes_brs =~ s/\n/<BR>/g;
390        $infotable .= "<TR><TH>Literature</TH><TD>$litstring</TD></TR>";
391        $infotable .= "<TR><TH>Websites</TH><TD>$wl</TD></TR>";
392      $infotable .= "<TR><TH>Description</TH><TD>$ssdesc_brs</TD></TR>";      $infotable .= "<TR><TH>Description</TH><TD>$ssdesc_brs</TD></TR>";
393      $infotable .= "<TR><TH>Notes</TH><TD>$ssnotes_brs</TD></TR>";      $infotable .= "<TR><TH>Notes</TH><TD>$ssnotes_brs</TD></TR>";
394    }    }
395      # variants
396      my $vartable = $self->application->component( 'VarDescTable' );
397      $vartable->columns( [ { name => "Variant" }, { name => "Description" } ] );
398    
399      my $vardata;
400      my $has_variants = 0;
401      foreach my $kv ( sort keys %$variants ) {
402        $has_variants = 1;
403        push @$vardata, [ $kv, $variants->{ $kv } ];
404      }
405      $vartable->data( $vardata );
406      $infotable .= "<TR><TH>Variants</TH><TD>";
407      if ( $has_variants ) {
408        $infotable .= $vartable->output();
409      }
410    
411      if ( $can_alter ) {
412        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\" )'>";
413      $infotable .= $variant_outside;
414      }
415    
416      $infotable .= "</TD</TR>";
417    
418    $infotable .= $classification_stuff;    $infotable .= $classification_stuff;
419    $infotable .= "</TABLE>";    $infotable .= "</TABLE>";
420    
421    if ( $can_alter ) {    if ( $can_alter ) {
422      $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;'>";
423    }    }
424    
425      if ( $can_alter ) {
426        $content .= "<INPUT TYPE=SUBMIT VALUE='Save Changes' ID='SUBMIT' NAME='SUBMIT'  STYLE='background-color: red;'>";
427      }
428    $content .= $infotable;    $content .= $infotable;
429    $content .= $self->end_form();    $content .= $self->end_form();
430    
# Line 281  Line 495 
495    my @ssclassifications = $fig->all_subsystem_classifications();    my @ssclassifications = $fig->all_subsystem_classifications();
496    my $ssclass;    my $ssclass;
497    foreach my $ssc ( @ssclassifications ) {    foreach my $ssc ( @ssclassifications ) {
498      next if ( ( !defined( $ssc->[0] ) ) || ( !defined( $ssc->[1] ) ) );      if ( !defined( $ssc->[1] ) ) {
499      next if ( ( $ssc->[0] eq '' ) || ( $ssc->[1] eq '' ) );        $ssc->[1] = '';
500        }
501    #    next if ( ( !defined( $ssc->[0] ) ) || ( !defined( $ssc->[1] ) ) );
502        next if ( !defined( $ssc->[0] ) );
503        next if ( $ssc->[0] eq '' );
504    #    next if ( ( $ssc->[0] eq '' ) || ( $ssc->[1] eq '' ) );
505      next if ( ( $ssc->[0] =~ /^\s+$/ ) || ( $ssc->[1] =~ /^\s+$/ ) );      next if ( ( $ssc->[0] =~ /^\s+$/ ) || ( $ssc->[1] =~ /^\s+$/ ) );
506      push @{ $ssclass->{ $ssc->[0] } }, $ssc->[1];      push @{ $ssclass->{ $ssc->[0] } }, $ssc->[1];
507    }    }
# Line 293  Line 512 
512      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'>";
513      my $optstring = '';      my $optstring = '';
514      foreach my $secc ( sort @{ $ssclass->{ $firstc } } ) {      foreach my $secc ( sort @{ $ssclass->{ $firstc } } ) {
515        if ( defined( $SUBSYSH2 ) && $SUBSYSH2 eq $secc ) {        if ( defined( $SUBSYSH2 ) && $SUBSYSH2 eq $secc && $SUBSYSH1 eq $firstc ) {
516          $optstring .= "<OPTION SELECTED VALUE='$secc'>$secc</OPTION>";          $optstring .= "<OPTION SELECTED VALUE='$secc'>$secc</OPTION>";
517          # we have to show the selectbox if there is a selected value          # we have to show the selectbox if there is a selected value
518          $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 560 
560    return $sdContent;    return $sdContent;
561  }  }
562    
563    ########################################
564    # get Literature-string for subsystems #
565    ########################################
566    sub getLiteratures {
567      my ( $fig, $name ) = @_;
568    
569      my $esc_name = uri_escape($name);
570    
571      my $frpubs;
572      my @rel_lit_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_PUBMED_RELEVANT" );
573    
574      foreach my $k ( @rel_lit_num ) {
575        my ( $ss, $key, $value ) = @$k;
576        push @$frpubs, $value;
577      }
578    
579      return $frpubs;
580    }
581    
582    ######################################
583    # get Weblinks-string for subsystems #
584    ######################################
585    sub getLinks {
586      my ( $fig, $name ) = @_;
587    
588      my $esc_name = uri_escape($name);
589    
590      my $links;
591      my $linksstring = '';
592      my $linksvoid = '';
593      my @rel_link_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_WEBLINKS" );
594    
595      foreach my $k ( @rel_link_num ) {
596        my ( $ss, $key, @value ) = @$k;
597        $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>";
598        $linksvoid .= $value[0]." ".$value[1]."\n";
599      }
600    
601      return ( $linksstring, $linksvoid );
602    }
603    
604    ########################################
605    # set Literature-string for subsystems #
606    ########################################
607    sub setLiteratures {
608      my ( $fig, $name, $newpubs ) = @_;
609    
610      my $esc_name = uri_escape($name);
611    
612      my @values;
613      my @rel_lit_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_PUBMED_RELEVANT" );
614    
615      foreach my $k ( @rel_lit_num ) {
616        my ( $ss, $key, $value ) = @$k;
617        $fig->delete_matching_attributes( "Subsystem:$name", "SUBSYSTEM_PUBMED_RELEVANT" );
618      }
619    
620      foreach my $np ( @$newpubs ) {
621        $fig->add_attribute( "Subsystem:$name", "SUBSYSTEM_PUBMED_RELEVANT", $np );
622      }
623    }
624    
625    ########################################
626    # set Literature-string for subsystems #
627    ########################################
628    sub setWeblinks {
629      my ( $fig, $name, $newpubs ) = @_;
630    
631      my $esc_name = uri_escape($name);
632    
633      my @values;
634      my @rel_lit_num = $fig->get_attributes( 'Subsystem:'.$name, "SUBSYSTEM_WEBLINKS" );
635    
636      foreach my $k ( @rel_lit_num ) {
637        my ( $ss, $key, $value ) = @$k;
638        $fig->delete_matching_attributes( "Subsystem:$name", "SUBSYSTEM_WEBLINKS" );
639      }
640    
641      foreach my $np ( @$newpubs ) {
642        #my @h = split( /\s+/, $np );
643        $np =~ s/\s*(http\S+)\s*//;
644        my $link=$1;
645        if ($np =~ /^\s*$/) {$np = "webpage"}
646        $fig->add_attribute( "Subsystem:$name", "SUBSYSTEM_WEBLINKS", $np, $link );
647        print STDERR "Adding attribute 'Subsystem:$name' 'SUBSYSTEM_WEBLINKS', '$np', '$link'\n";
648      }
649    }
650    
651  sub supported_rights {  sub supported_rights {
652    
653    return [ [ 'edit', 'subsystem', '*' ] ];    return [ [ 'edit', 'subsystem', '*' ] ];

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3