⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 list.pm

📁 一个论文管理系统
💻 PM
📖 第 1 页 / 共 3 页
字号:
	$href_type = 'href_search_replacitive';	push @nonmain, $section = 'linked';      }      elsif ($text eq 'Related') {	$text = 'Related '.lc($heading);	$href_type = 'href_search_global';	push @nonmain, $section = 'related';      }      $add->($cgi->h3({class => 'sectiontitle'}, $text.':')) unless $self->options->{noheading};      $add->($cgi->div({class => 'toggles'}, $links)) if $links;    }    else {      (my $id = $_->table.'_'.$_->unique_value) =~ s/\W/_/g;      push @memory_scores, [$_->label, $_->memory_score, $id] if $create_memory_scores;      $add->("\n".$cgi->div({class => ($main ? 'content-mybookmark' : 'content-side'), id => $id},			    scalar $_->html_content($bibliotech, $class, $verbose, $main, $href_type)));    }  }  $javascript_block = $self->html_content_memory_scores_javascript(\@memory_scores) if @memory_scores;  $add_main_top->($self->html_content_heading($main)) unless $self->options->{noheading};  $add_main_nonmain->();  $add_main->($self->html_content_status_line) if $main and $verbose;  return $self->memcache_save(new Bibliotech::Page::HTML_Content ({html_parts => \%output,								   javascript_block => $javascript_block}));}sub rss_content {  my ($self, $verbose) = @_;  my $bibliotech = $self->bibliotech;  my @output;  my $iterator = $self->list(main => 1) or return ();  my $obj = $iterator->first;  while (defined $obj) {    push @output, scalar $obj->rss_content($bibliotech, $verbose);    $obj = $iterator->next;  }  return @output;}sub ris_content {  my ($self, $verbose) = @_;  my $bibliotech = $self->bibliotech;  my @output;  my $iterator = $self->list(main => 1) or return ();  my $obj = $iterator->first;  while (defined $obj) {    push @output, scalar $obj->ris_content($bibliotech, $verbose);    $obj = $iterator->next;  }  return @output;}sub geo_content {  my ($self, $verbose) = @_;  my $bibliotech = $self->bibliotech;  my @output;  my $iterator = $self->list(main => 1) or return ();  my $obj = $iterator->first;  while (defined $obj) {    push @output, scalar $obj->geo_content($bibliotech, $verbose);    $obj = $iterator->next;  }  return @output;}package Bibliotech::Component::ListOfBookmarks;use base 'Bibliotech::Component::List';sub heading {  'Bookmarks';}sub list {  shift->bibliotech->query->bookmarks(@_);}package Bibliotech::Component::ListOfUsers;use base 'Bibliotech::Component::List';sub heading {  'Users';}sub list {  my $self = shift;  my %options = @_;  return $self->list_multipart_from_user_bookmarks('Bibliotech::User') unless $options{main};  return $self->bibliotech->query->users(sortdir => 'DESC', %options);}package Bibliotech::Component::ListOfActiveUsers;use base 'Bibliotech::Component::ListOfUsers';sub heading {  'Active Users';}sub last_updated_basis {  ('DBI');}sub list_old {  my ($self, %options) = @_;  return $self->bibliotech->query->users(forcegroup => 'ub.user', sort => 'COUNT(DISTINCT ub.bookmark)', having => [sortvalue => {'>', 1}], noquery => 1, start => 0, num => 25, %options);}sub list {  #Bibliotech::User->search_most_active();  Bibliotech::User->search_most_active_in_window();}sub lazy_update {  1;}package Bibliotech::Component::ListOfGangs;use base 'Bibliotech::Component::List';sub heading {  'Groups';}sub list {  my $self = shift;  my %options = @_;  return $self->list_multipart_from_user_bookmarks('Bibliotech::Gang') unless $options{main};  return $self->bibliotech->query->gangs(sortdir => 'DESC', %options);}package Bibliotech::Component::ListOfMyGangs;use base 'Bibliotech::Component::List';sub heading {  'My groups';}sub list {  my $self = shift;  my $user = $self->bibliotech->user or return ();  return Bibliotech::Gang->search(owner => $user);}package Bibliotech::Component::ListOfGangPeers;use base 'Bibliotech::Component::List';sub heading {  'Members';}sub html_content {  my ($self, $class, $verbose, $main) = @_;  my $cgi = $self->bibliotech->cgi;  my $heading = $self->heading;  my $href_type = 'href_search_replacitive';  my @output;  foreach ($self->list(main => $main || 0)) {    push @output, $cgi->div({class => "content-side"}, scalar $_->html_content($self->bibliotech, $class, $verbose, $main, $href_type));  }  return Bibliotech::Page::HTML_Content->blank unless @output;  my $gang_ref = $self->bibliotech->command->gang or return ();  @{$gang_ref} == 1 or return ();  my $gang_name = $gang_ref->[0];  $heading .= ' of group '.$gang_name.':';  unshift @output, $cgi->h3({class => 'sectiontitle'}, $heading) unless $self->options->{noheading};  return Bibliotech::Page::HTML_Content->simple(\@output);}sub list {  my $self = shift;  my $gang_ref = $self->bibliotech->command->gang or return ();  @{$gang_ref} == 1 or return ();  my $gang_name = $gang_ref->[0];  my $gang = new Bibliotech::Gang ($gang_name) or return ();  return map($_->user, Bibliotech::User_Gang->search(gang => $gang));}package Bibliotech::Component::ListOfTags;use base 'Bibliotech::Component::List';sub heading {  'Tags';}sub list {  my $self = shift;  my %options = @_;  return $self->list_multipart_from_user_bookmarks('Bibliotech::Tag') unless $options{main};  return $self->bibliotech->query->tags(sortdir => 'DESC', %options);}package Bibliotech::Component::ListOfActiveTags;use base 'Bibliotech::Component::ListOfTags';sub heading {  'Active Tags';}sub list_old {  my ($self, %options) = @_;  return $self->bibliotech->query->tags(forcegroup => 'ubt.tag', sort => 'COUNT(DISTINCT ub.user_bookmark_id)', having => [sortvalue => {'>', 1}], noquery => 1, start => 0, num => 25, %options);}sub list {  #Bibliotech::Tag->search_most_active();  Bibliotech::Tag->search_most_active_in_window();}sub lazy_update {  1;}package Bibliotech::Component::ListOfRecent;use base 'Bibliotech::Component::List';sub heading {  'Bookmarks';}sub list {  shift->bibliotech->query->recent(@_);}package Bibliotech::Component::ListOfPopular;use base 'Bibliotech::Component::List';sub heading {  'Bookmarks';}sub last_updated_basis {  ('DBI', 'USER');}sub list {  my ($self, %options) = @_;  $self->bibliotech->query->popular($self->bibliotech->command->user ? () : (having => [sortvalue => {'>', 1}]), %options);}sub lazy_update {  1;}package Bibliotech::Component::Comments;use base 'Bibliotech::Component::List';use Bibliotech::Const;use Bibliotech::Component::AddCommentForm;sub heading {  'Comments';}sub list {  shift->bibliotech->query->bookmarks(@_);}sub html_content {  my ($self, $class, $verbose, $main, $just_comments) = @_;  my $bibliotech = $self->bibliotech;  my $command = $bibliotech->command;  my $popup = $command->is_popup;  my $cgi = $bibliotech->cgi;  my $location = $bibliotech->location;  my $activeuser = $bibliotech->user;  my $uri;  if ($uri = $cgi->param('uri')) {    # hack to avoid /uri/xxx?bookmarklet=yyy because /uri/http://... must be the last thing on the url    my $bookmark_filter = $command->bookmark;    defined $bookmark_filter ? $bookmark_filter->push($uri) : $command->bookmark(new Bibliotech::Parser::NamePartSet ($uri));    $bibliotech->query->accept_command($command, 'bookmark');               # update query object as well    $cgi->Delete('uri');  }  else {    my $bookmark_filter = $command->bookmark;    $uri = $bookmark_filter->[0] if $bookmark_filter;  }  my $make_add_link = sub {    # uses $popup, $activeuser, and $cgi from outer sub    # optionally pass in a $bookmark, otherwise uses $uri from outer sub    my $bookmark = shift;    return undef if !defined($bookmark) and Bibliotech::Bookmark::is_hash_format($uri);    my $new_uri = defined $bookmark ? $bookmark->hash : $uri;    my $comments = 'comments'.($popup ? 'popup' : '');    my ($href, $text);    if (defined $activeuser) {      my $add = 'add'.($popup ? 'popup' : '');      $href = "$location$add?continue=$comments&uri=$new_uri";      $text = 'Add this '.URI_TERM.' to your library';    }    else {      my $comments = 'comments'.($popup ? 'popup' : '');      my $login = 'login'.($popup ? 'popup' : '');      my $lpath = URI->new($location)->path;      $href = "$location$login?dest=$lpath$comments?continue=confirm_AMP_uri=$new_uri";      $text = 'Login to add or comment on this '.URI_TERM;    }    return $cgi->a({href => $href}, $text);  };  my @output;  push @output, $cgi->h1($self->heading_dynamic($main)) unless $just_comments;  my @bookmarks = $self->list(main => $main || 0);  if (@bookmarks) {    foreach my $bookmark (@bookmarks) {      push @output, $cgi->div(scalar $bookmark->html_content($bibliotech, $class, 1, $main)) unless $just_comments;      if (my @user_bookmark_comments = $bookmark->user_bookmark_comments) {	foreach my $user_bookmark_comment (@user_bookmark_comments) {	  my $user_bookmark = $user_bookmark_comment->user_bookmark;	  my $user = $user_bookmark->user;	  my $comment = $user_bookmark_comment->comment;	  push @output, $cgi->div({class => 'commentdisplay'},				  $cgi->div({class => 'commentbyline'},					    $user->link($bibliotech, 'commentator', 'href_search_global', undef, $verbose),					    'said on',					    $comment->created->link($bibliotech, 'commentdate', 'href_search_global', undef, $verbose).':'),				  scalar $comment->html_content($bibliotech, 'comment', $verbose, $main));	}      }      else {	push @output, $cgi->p('There are currently no comments for this '.URI_TERM.'.');      }      unless ($just_comments) {	# if logged in, show AddCommentForm if user has the bookmark linked, or an add link; if not logged in, just show add link	if ($bookmark->is_linked_by($activeuser)) {  # the fact that $activeuser may be undef is ok	  my $save_uri = $cgi->param('uri');	  my $save_continue = $cgi->param('continue');	  $cgi->param(uri => $bookmark->hash);	  $cgi->param('continue' => 'comments'.($popup ? 'popup' : ''));	  my $addcomment_component = new Bibliotech::Component::AddCommentForm ({bibliotech => $bibliotech});	  push @output, $addcomment_component->html_content($class.'addcomment', 0, 0)->content;	  $save_uri ? $cgi->param(uri => $save_uri) : $cgi->Delete('uri');	  $save_continue ? $cgi->param('continue' => $save_continue) : $cgi->Delete('continue');	}	else {	  push @output, $cgi->p($make_add_link->($bookmark));	}      }    }  }  else {    my $sitename = $bibliotech->sitename;    push @output, $cgi->p(['This '.URI_TERM." has not yet been added to $sitename.", $make_add_link->()]);  }  unless ($just_comments) {    my $continue = $cgi->param('continue') || 'none';    if ($continue eq 'return') {      push @output, $cgi->p($cgi->a({href => $uri}, 'Return to '.URI_TERM)) if $uri;    }    elsif ($continue eq 'close' or $continue eq 'confirm' or $popup) {      push @output, $cgi->p({class => 'closebutton'},			    $cgi->button(-value => 'Close',					 -class => 'buttonctl',					 -onclick => 'window.close()'));    }  }  return Bibliotech::Page::HTML_Content->simple(\@output);}1;__END__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -