]> mj.ucw.cz Git - pciids.git/commitdiff
Merge branch 'master' of /home/vorner/pciids
authorThe PCI ID Mail Robot <pciids@ucw.cz>
Mon, 13 Oct 2008 20:17:53 +0000 (22:17 +0200)
committerThe PCI ID Mail Robot <pciids@ucw.cz>
Mon, 13 Oct 2008 20:17:53 +0000 (22:17 +0200)
Conflicts:

cf/config

PciIds/DBQ.pm
PciIds/Html/Admin.pm
PciIds/Html/Jump.pm
PciIds/Html/Notifications.pm
cf/config
index.html

index 44f16149f41077609115a0def15b48f11e2b0ba8..cb82576474e7eaf34fccef321cc1a8900d1124f5 100644 (file)
@@ -217,6 +217,15 @@ sub history( $$ ) {
        return $self->query( 'history', [ $addr ] );
 }
 
+sub spaceNorm( $ ) {
+       $_ = shift;
+       return undef unless defined $_;
+       s/[ \t]+/ /g;
+       s/^\s//;
+       s/\s$//;
+       return $_;
+}
+
 sub submitItem( $$$ ) {
        my( $self, $data, $auth ) = @_;
        my( $addr ) = ( $data->{'address'} );
@@ -227,7 +236,7 @@ sub submitItem( $$$ ) {
        return( 'exists', undef ) if( defined( $self->item( $addr->get(), 0 ) ) );
        eval {
                $self->command( 'newitem', [ $addr->get(), $addr->parent()->get() ] );
-               $self->command( 'newhistory', [ $addr->get(), $auth->{'authid'}, $data->{'discussion'}, $data->{'name'}, $data->{'note'} ] );
+               $self->command( 'newhistory', [ $addr->get(), $auth->{'authid'}, spaceNorm( $data->{'discussion'} ), spaceNorm( $data->{'name'} ), spaceNorm( $data->{'note'} ) ] );
        };
        if( $@ ) {
                $self->rollback();
@@ -239,10 +248,10 @@ sub submitItem( $$$ ) {
 sub submitHistory( $$$$ ) {
        my( $self, $data, $auth, $address ) = @_;
        if( $data->{'delete'} ) {
-               $self->command( 'newhistory', [ $address->get(), $auth->{'authid'}, $data->{'text'}, '', $data->{'note'} ], 1 );
+               $self->command( 'newhistory', [ $address->get(), $auth->{'authid'}, spaceNorm( $data->{'text'} ), '', '' ], 1 );
        } else {
                $data->{'name'} = undef if defined $data->{'name'} && $data->{'name'} eq '';
-               $self->command( 'newhistory', [ $address->get(), $auth->{'authid'}, $data->{'text'}, $data->{'name'}, $data->{'note'} ], 1 );
+               $self->command( 'newhistory', [ $address->get(), $auth->{'authid'}, spaceNorm( $data->{'text'} ), spaceNorm( $data->{'name'} ), spaceNorm( $data->{'note'} ) ], 1 );
        }
        return $self->last();
 }
index 8f344ec6b97ef3981674895433a4eeb1c05f4f71..6b90c7c2015345dd00572629249cda3f6588190e 100644 (file)
@@ -31,8 +31,10 @@ use Apache2::Const qw(:common :http);
 
 sub safeEncode( $ ) {
        my( $text ) = @_;
-       return encode( $text ) if defined $text;
-       return '';
+       return '' unless defined $text;
+       $text = encode( $text );
+       $text =~ s/\n/<br>/s;
+       return $text;
 }
 
 sub mailEncode( $$ ) {
index 35eb093adb3582c3e9a9665277b3a7af2b69afea..973a22178203eab2270ff8aaf41eea7ac6435cf8 100644 (file)
@@ -40,7 +40,7 @@ sub jumpWindow( $$ ) {
 sub redirect( $$$$ ) {
        my( $req, $args, $addr, $hasSSL ) = @_;
        my $prefix = ( !defined $args->{'action'} || $args->{'action'} eq '' || $args->{'action'} eq 'list' ) ? 'read' : 'mods';
-       my $url = protoName( $hasSSL )."://".$req->hostname()."/$prefix/$addr".buildArgs( $args );
+       my $url = protoName( $hasSSL )."://".$req->hostname()."/$prefix/$addr";
        return HTTPRedirect( $req, $url );
 }
 
@@ -90,11 +90,10 @@ sub jump( $$$$ ) {
                        print "<h2>Found items</h2>\n";
                        genTableHead( 'found', [ 'ID', 'Name', 'Parent' ], [] );
                        my $prefix = '/'.( ( !defined $args->{'action'} || $args->{'action'} eq '' || $args->{'action'} eq 'list' ) ? 'read/' : 'mods/' );
-                       my $suffix = buildArgs( $args );
                        htmlFormatTable( $result, 3, [], [ sub {
                                my $addr = shift;
                                my $address = PciIds::Address::new( $addr );
-                               return "<a href='$prefix".$address->get()."$suffix'>".encode( $address->fullPretty() )."</a>";
+                               return "<a href='$prefix".$address->get()."'>".encode( $address->fullPretty() )."</a>";
                        } ], sub { 1; }, sub { ' class="item"'; } );
                        genTableTail();
                        genHtmlFooter( 1, $req, $args );
index 9aa18260709de7707925d9a93327d7e927dc048c..fc20e1cef2bb0aa484e148088f2b9e6ee6ddbb09 100644 (file)
@@ -23,6 +23,7 @@ use PciIds::Html::Util;
 use PciIds::Html::Forms;
 use PciIds::Html::Users;
 use PciIds::Address;
+use PciIds::Config;
 use Apache2::Const qw(:common :http);
 
 sub genNotifForm( $$$$$$ ) {
@@ -70,6 +71,7 @@ sub genNotifForm( $$$$$$ ) {
 
 sub notifForm( $$$$ ) {
        my( $req, $args, $tables, $auth ) = @_;
+       return HTTPRedirect( $req, '/mods/'.$config{'default_uri'}.'?action=notifications' ) if $req->uri() =~ /^(\/(read|mods))?\/?$/;
        if( defined $auth->{'authid'} ) {
                return genNotifForm( $req, $args, $tables, $auth, undef, $tables->getNotifData( $auth->{'authid'}, PciIds::Address::new( $req->uri() )->get() ) );
        } else {
@@ -102,4 +104,6 @@ sub notifFormSubmit( $$$$ ) {
        return HTTPRedirect( $req, setAddrPrefix( $req->uri(), 'read' ).buildExcept( 'action', $args )."?action=list" );
 }
 
+checkConf( [ 'default_uri' ] );
+
 1;
index d732b04b4eac22a733c41cf2b45d44882af2f3c2..31434f2fb8ea1a1563df2e1130196cac952632e4 100644 (file)
--- a/cf/config
+++ b/cf/config
@@ -11,3 +11,4 @@ hostname = pci-ids.ucw.cz
 jelnet = /home/pciids/ids/perl/scripts/jelnet
 xmpp_passwd = IorekByrnison
 xmpp_name = pci-ids@ucw.cz
+default_uri = PC/
index d21cae4f71fa9d9c08c710aa72f62e356ab55839..6d43d7daee7c3db6b37c90343789b7aac40f3c18 100644 (file)
@@ -29,6 +29,8 @@ entries or to update the existing ones:
        <li><a href="/read/PD/">PCI device classes</a>
 </ul>
 
+<p>Or you can go directly to your <a href='/mods/?action=profile'>profile</a> or <a href='/mods/?action=notifications'>notification list</a>.
+
 <p>You may want to read <a href="/read/?action=help?help=index">help</a> before you start using the
 web interface.