From d6703392ef44bd2646be9f8f6893c51093a43488 Mon Sep 17 00:00:00 2001 From: Michal Vaner Date: Mon, 1 Sep 2008 12:13:28 +0200 Subject: [PATCH] Place a jump input at some places --- PciIds/Html/Changes.pm | 10 +++++----- PciIds/Html/Jump.pm | 13 +++++++++++++ PciIds/Html/List.pm | 2 +- PciIds/Html/Notifications.pm | 2 +- PciIds/Html/Util.pm | 16 +++++++++++----- static/screen.css | 13 ++++++++++--- 6 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 PciIds/Html/Jump.pm diff --git a/PciIds/Html/Changes.pm b/PciIds/Html/Changes.pm index 378bb0c..b5306eb 100644 --- a/PciIds/Html/Changes.pm +++ b/PciIds/Html/Changes.pm @@ -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 "
$error
\n" if( defined $error ); - print "
hostname().$req->uri().buildExcept( 'action', $args ).'?action=newitem' : '' )."'>\n"; + print "\n
"; 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 '

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 "

$error
\n" if( defined $error ); - print "hostname().$req->uri().buildExcept( 'action', $args ).'?action=newhistory' : '' )."'>\n
"; + print "\n
"; 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 index 0000000..58f7f2a --- /dev/null +++ b/PciIds/Html/Jump.pm @@ -0,0 +1,13 @@ +use strict; +use warnings; +use base 'Exporter'; + +our @EXPORT = qw(&jumpWindow); + +sub jumpWindow( $$ ) { + my( $req, $args ) = @_; + print "{'action'} ? "?origin=".$args->{'action'} : "" )."'>\n"; + print "

\n"; + print "\n"; + print "\n"; +} diff --git a/PciIds/Html/List.pm b/PciIds/Html/List.pm index 04a52ff..911e9f8 100644 --- a/PciIds/Html/List.pm +++ b/PciIds/Html/List.pm @@ -26,7 +26,7 @@ sub list( $$$$ ) { genHtmlHead( $req, $id, "\n" ); print "

\n"; print '

'.encode( $id ).'

'; - 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 "
\n"; print ""; genPath( $req, $address, 0 ); diff --git a/PciIds/Html/Notifications.pm b/PciIds/Html/Notifications.pm index 4e440b7..32cbbed 100644 --- a/PciIds/Html/Notifications.pm +++ b/PciIds/Html/Notifications.pm @@ -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 "
$error
\n" if( defined $error ); my $uri = $addr->get(); my $notifs = $tables->notificationsUser( $auth->{'authid'} ); diff --git a/PciIds/Html/Util.pm b/PciIds/Html/Util.pm index cbfa33f..e912ef7 100644 --- a/PciIds/Html/Util.pm +++ b/PciIds/Html/Util.pm @@ -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 "
    \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 "
  • \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 "
\n"; } diff --git a/static/screen.css b/static/screen.css index dd67e24..c41a7f7 100644 --- a/static/screen.css +++ b/static/screen.css @@ -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; +} -- 2.39.5