$c->{plugins}{"EPrintSneep"}{params}{disable} = 0; $c->{plugins}{"TagCloud"}{params}{disable} = 0; $c->{plugins}{"Screen::EPrint::Box::Sneep"}{params}{disable} = 0; $c->{render_sneep} = sub { my( $session, $eprint, $type) = @_; my $comment = $session->make_element( "div", class=>"ep_sneep", id=>'ep_sneep_'.$type ); my $comment_link = $session->make_element( "a", href=> $session->get_repository->get_conf( "rel_path" ).'/cgi/sneep/sneep_page?eprintid='.$eprint->get_id."&type=".$type ); $comment_link->appendChild( $session->html_phrase( "sneep_".$type."_link" ) ); $comment->appendChild( $comment_link ); return $comment; }; $c->{render_sneep_input} = sub { my( $session, $eprint, $type, $sneepid, $content, $title) = @_; my $doc_frag = $session->make_doc_fragment(); unless( defined $eprint ) { print STDERR "render_sneep_input requires an eprint. Given: $eprint\n"; return $doc_frag; } unless( defined $type ) { print STDERR "render_sneep_input requires a type. Given: $type\n"; return $doc_frag; } unless( $type eq "tag" || $type eq "comment" || $type eq "note" ) { print STDERR "render_sneep_input requires a type. Given: $type\n"; return $doc_frag; } my $form; if( EPrints::Utils::is_set( $sneepid ) ) { #if we are editing then... $form = $session->make_element( "form", id=>"ep_sneep_".$type."_form", method=>'post', action=>$session->get_repository->get_conf( "rel_path" ).'/cgi/sneep/edit_sneep' ); } else { $form = $session->make_element( "form", id=>"ep_sneep_".$type."_form", method=>'post', action=>$session->get_repository->get_conf( "rel_path" ).'/cgi/sneep/add_sneep' ); } my $div = $session->make_element( "div", class=>"ep_sneep_".$type."_form_container" ); $form->appendChild($div); my $eprintid_hidden = $session->make_element( "input", type=>'hidden', name=>'eprintid', value=>$eprint->get_id ); $div->appendChild( $eprintid_hidden ); my $type_hidden = $session->make_element( "input", type=>'hidden', name=>'type', value=>$type ); $div->appendChild( $type_hidden ); if( EPrints::Utils::is_set( $sneepid ) ) { my $sneepid_hidden = $session->make_element( "input", type=>'hidden', name=>'sneepid', value=>$sneepid ); $div->appendChild( $sneepid_hidden ); } if($type ne "comment") { my $title_group = $session->make_element( "p" ); my $title_label = $session->make_element( "label", for=>"title" ); $title_label->appendChild( $session->html_phrase( "sneep_".$type."_title" ) ); $title_group->appendChild( $title_label ); $title_group->appendChild( $session->make_element( "br" ) ); my $title_input = $session->make_element( "input", type=>"text", name=>"title", value=>$title, class=>"ep_sneep_input" ); $title_group->appendChild( $title_input ); $div->appendChild( $title_group ); $div->appendChild( $session->make_element( "br" ) ); } if($type ne "tag") { my $content_group = $session->make_element( "div", align=>"left"); my $content_label = $session->make_element( "label", for=>"content" ); $content_label->appendChild( $session->html_phrase( "sneep_".$type."_content" ) ); $content_group->appendChild( $content_label ); $div->appendChild( $content_group ); # my $content_input = $session->make_element( "textarea", name=>'content', class=>"ep_sneep_input ep_sneep_input_content"); $div->appendChild( $session->make_element( "textarea", style=>"margin-bottom: -5px;",name=>'content', class=>"ep_sneep_input ep_sneep_input_content") ); # my $content_text = $session->make_text($content); # $content_input->appendChild($content_text); # $content_group->appendChild( $session->make_element( "br" ) ); # $content_group->appendChild( $content_input ); # $div->appendChild( $content_group ); } # my $submit_group = $session->make_element( "div", style=>"float:right;" ); # $div->appendChild( $submit_group ); my $submit = $session->make_element( "input", id=>'sneep_'.$type.'_submit', type=>'submit', value=>$session->phrase( "sneep_".$type."_submit" ) ); $div->appendChild( $submit ); $form->appendChild( $session->make_element( "br" ) ); return $form; };