]> mj.ucw.cz Git - pciids.git/commitdiff
Place a jump input at some places
authorMichal Vaner <vorner@ucw.cz>
Mon, 1 Sep 2008 10:13:28 +0000 (12:13 +0200)
committerMichal Vaner <vorner@ucw.cz>
Mon, 1 Sep 2008 10:13:28 +0000 (12:13 +0200)
PciIds/Html/Changes.pm
PciIds/Html/Jump.pm [new file with mode: 0644]
PciIds/Html/List.pm
PciIds/Html/Notifications.pm
PciIds/Html/Util.pm
static/screen.css

index 378bb0cae3e28999d1c8092468b281c8221aed2e..b5306eb4b59bdf29ff81032d76bd7b36a6a31608 100644 (file)
@@ -15,9 +15,9 @@ sub genNewItemForm( $$$$$$ ) {
        return NOT_FOUND unless( $ok );
        my $prettyAddr = encode( $address->pretty() );
        genHtmlHead( $req, "$prettyAddr - add new item", undef );
-       genCustomHead( $req, $args, $address, "$prettyAddr - add new item", [ $address->canDiscuss() ? [ 'Discuss', 'newhistory' ] : (), [ 'Help', 'help', 'newitem' ], [ 'ID syntax', 'help', $address->helpName() ] ], [ logItem( $auth ), [ 'Notifications', 'notifications' ] ] );
+       genCustomHead( $req, $args, $address, "$prettyAddr - add new item", [ $address->canDiscuss() ? [ 'Discuss', 'newhistory' ] : (), [ 'Help', 'help', 'newitem' ], [ 'ID syntax', 'help', $address->helpName() ], [ '', 'jump' ] ], [ logItem( $auth ), [ 'Notifications', 'notifications' ] ] );
        print "<div class='error'>$error</div>\n" if( defined $error );
-       print "<form name='newitem' id='newitem' method='POST' action='".( $args->{'full_links'} ? 'http://'.$req->hostname().$req->uri().buildExcept( 'action', $args ).'?action=newitem' : '' )."'>\n<table>";
+       print "<form name='newitem' id='newitem' method='POST' action=''>\n<table>";
        genFormEx( [ [ 'input', 'ID:', 'text', 'id', 'maxlength="'.$address->subIdSize().'"' ],
                [ 'input', 'Name:', 'text', 'name', 'maxlength="200"' ],
                [ 'input', 'Note:', 'text', 'note', 'maxlength="1024"' ],
@@ -73,7 +73,7 @@ sub newItemSubmit( $$$$ ) {
                if( $result eq 'exists' ) {
                        genHtmlHead( $req, 'ID collision', undef );
                        my $addr = PciIds::Address::new( $req->uri() );
-                       genCustomHead( $req, $args, $addr, 'ID collision', [ [ 'Add other item', 'newitem' ], $addr->canDiscuss() ? [ 'Discuss', 'newhistory' ] : () ], [ logItem( $auth ) ] );
+                       genCustomHead( $req, $args, $addr, 'ID collision', [ [ 'Add other item', 'newitem' ], $addr->canDiscuss() ? [ 'Discuss', 'newhistory' ] : (), [ '', 'jump' ] ], [ logItem( $auth ) ] );
                        print '<p>Sorry, this ID already exists.';
                        genHtmlTail();
                        return OK;
@@ -94,9 +94,9 @@ sub genNewHistoryForm( $$$$$$ ) {
        return NOT_FOUND unless( $ok );
        my $prettyAddr = encode( $address->pretty() );
        genHtmlHead( $req, "$prettyAddr - discuss", undef );
-       genCustomHead( $req, $args, $address, "$prettyAddr - discuss", [ $address->canAddItem() ? [ 'Add item', 'newitem' ] : (), [ 'Help', 'help', 'newhistory' ] ], [ logItem( $auth ),  [ 'Notifications', 'notifications' ] ] );
+       genCustomHead( $req, $args, $address, "$prettyAddr - discuss", [ $address->canAddItem() ? [ 'Add item', 'newitem' ] : (), [ 'Help', 'help', 'newhistory' ], [ '', 'jump' ] ], [ logItem( $auth ),  [ 'Notifications', 'notifications' ] ] );
        print "<div class='error'>$error</div>\n" if( defined $error );
-       print "<form name='newhistory' id='newhistory' method='POST' action='".( $args->{'full_links'} ? 'http://'.$req->hostname().$req->uri().buildExcept( 'action', $args ).'?action=newhistory' : '' )."'>\n<table>";
+       print "<form name='newhistory' id='newhistory' method='POST' action=''>\n<table>";
        genFormEx( [ [ 'textarea', 'Text:', undef, 'text', 'rows="5" cols="50"' ],
                [ 'input', 'Request deletion', 'checkbox', 'delete', 'value="delete"' ],
                [ 'input', 'Name:', 'text', 'name', 'maxlength="200"' ],
diff --git a/PciIds/Html/Jump.pm b/PciIds/Html/Jump.pm
new file mode 100644 (file)
index 0000000..58f7f2a
--- /dev/null
@@ -0,0 +1,13 @@
+use strict;
+use warnings;
+use base 'Exporter';
+
+our @EXPORT = qw(&jumpWindow);
+
+sub jumpWindow( $$ ) {
+       my( $req, $args ) = @_;
+       print "<form id='jump' class='jump' name='jump' method='POST' action='".buildExcept( 'action', $args )."?action=jump".( defined $args->{'action'} ? "?origin=".$args->{'action'} : "" )."'>\n";
+       print "<p>\n";
+       print "<input type='text' class='jump' name='where'><input type='submit' value='Jump'>\n";
+       print "</form>\n";
+}
index 04a52ffb85c305eac89cd38cdfdee61d2d7c1a91..911e9f80c6060e7b7ebab8b0d9b13e2ef518abed 100644 (file)
@@ -26,7 +26,7 @@ sub list( $$$$ ) {
        genHtmlHead( $req, $id, "<style type='text/css' media='screen,print'>col.id-col { width: ".$address->subIdSize()*1.25."ex; }</style>\n" );
        print "<div class='top'>\n";
        print '<h1>'.encode( $id ).'</h1>';
-       genMenu( $req, $address, $args, $auth, [ [ 'Help', 'help', 'list' ], $address->helpName() ? [ 'ID syntax', 'help', $address->helpName() ] : () ] );
+       genMenu( $req, $address, $args, $auth, [ [ 'Help', 'help', 'list' ], $address->helpName() ? [ 'ID syntax', 'help', $address->helpName() ] : (), [ '', 'jump' ] ] );
        print "<div class='clear'></div>\n";
        print "</div\n>";
        genPath( $req, $address, 0 );
index 4e440b7ea208b76f104d70a62afb052cbdac579a..32cbbed68218a6717ba3c65733dd03c43bf246dc 100644 (file)
@@ -11,7 +11,7 @@ sub genNotifForm( $$$$$$ ) {
        my( $req, $args, $tables, $auth, $error, $data ) = @_;
        my $addr = PciIds::Address::new( $req->uri() );
        genHtmlHead( $req, $addr->pretty().' - notifications', undef );
-       genCustomHead( $req, $args, $addr, $addr->pretty()." - notifications", [ $addr->canAddItem() ? [ 'New item', 'newitem' ] : (), $addr->canDiscuss ? [ 'Discuss', 'newhistory' ] : (), [ 'Help', 'help', 'notifications' ] ], [ logItem( $auth ), [ 'Profile', 'profile' ] ] );
+       genCustomHead( $req, $args, $addr, $addr->pretty()." - notifications", [ $addr->canAddItem() ? [ 'New item', 'newitem' ] : (), $addr->canDiscuss ? [ 'Discuss', 'newhistory' ] : (), [ 'Help', 'help', 'notifications' ], [ '', 'jump' ] ], [ logItem( $auth ), [ 'Profile', 'profile' ] ] );
        print "<div class='error'>$error</div>\n" if( defined $error );
        my $uri = $addr->get();
        my $notifs = $tables->notificationsUser( $auth->{'authid'} );
index cbfa33fa2d4e52e1ef6940dd7c738e092cc22d2e..e912ef72724bce88e5ff6bfdafa65087a7df08df 100644 (file)
@@ -4,6 +4,7 @@ use warnings;
 use HTML::Entities;
 use base 'Exporter';
 use PciIds::Users;
+use PciIds::Html::Jump;
 use Apache2::Const qw(:common :http);
 use APR::Table;
 
@@ -50,11 +51,16 @@ sub genCustomMenu( $$$$ ) {
        print "<ul>\n";
        foreach( @{$list} ) {
                my( $label, $action, $param ) = @{$_};
-               my $prefix = '/mods';
-               $prefix = '/read' if( !defined( $action ) or ( $action eq 'list' ) or ( $action eq '' ) or ( $action eq 'help' ) );
-               my $suffix = '';
-               $suffix = '?help='.$param if( $action eq 'help' );
-               item( 'http://'.$req->hostname().$prefix.$url.$action.$suffix, $label );
+               if( $action eq 'jump' ) {
+                       print "<li>\n";
+                       jumpWindow( $req, $args );
+               } else {
+                       my $prefix = '/mods';
+                       $prefix = '/read' if( !defined( $action ) or ( $action eq 'list' ) or ( $action eq '' ) or ( $action eq 'help' ) );
+                       my $suffix = '';
+                       $suffix = '?help='.$param if( $action eq 'help' );
+                       item( 'http://'.$req->hostname().$prefix.$url.$action.$suffix, $label );
+               }
        }
        print "</ul>\n";
 }
index dd67e240be668d1c7b7744a708b7ff61cc09a9b4..c41a7f7c8b76af31061a1ddcf5ac9dd4eb260466 100644 (file)
@@ -90,12 +90,11 @@ col.name-col
 {
        width: 60%;
 }
-form table
-col.label
+form table col.label
 {
        width: 15%;
 }
-col.edit
+form table col.edit
 {
        width: 85%;
 }
@@ -105,3 +104,11 @@ textarea
 {
        width: 100%;
 }
+input.jump
+{
+       width: 8em;
+}
+form.jump p
+{
+       margin-top: 0px;
+}