From: Michal Vaner Date: Wed, 3 Sep 2008 21:45:25 +0000 (+0200) Subject: Administration interface X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=aea246fe2480c100db12a960ee46c931995748e7;p=pciids.git Administration interface Submiting does not work The combos for pre-select answes is not there yet --- diff --git a/PciIds/DBQ.pm b/PciIds/DBQ.pm index 6df3380..5d1ee3f 100644 --- a/PciIds/DBQ.pm +++ b/PciIds/DBQ.pm @@ -31,8 +31,8 @@ sub new( $ ) { 'newhistory' => 'INSERT INTO history (location, owner, discussion, nodename, nodenote) VALUES(?, ?, ?, ?, ?)', 'history' => 'SELECT history.id, history.discussion, history.time, history.nodename, history.nodenote, history.seen, users.login, users.email FROM history LEFT OUTER JOIN users ON history.owner = users.id WHERE history.location = ? ORDER BY history.time', 'admindump' => 'SELECT - locations.id, locations.name, locations.note, locations.mainhistory, musers.email, main.discussion, - history.id, history.discussion, history.nodename, history.nodenote, users.email + locations.id, locations.name, locations.note, locations.mainhistory, musers.email, musers.login, main.discussion, main.time, + history.id, history.discussion, history.nodename, history.nodenote, users.email, users.login, history.time FROM locations INNER JOIN history ON history.location = locations.id LEFT OUTER JOIN users ON history.owner = users.id diff --git a/PciIds/Html/Admin.pm b/PciIds/Html/Admin.pm index 61a0291..7408792 100644 --- a/PciIds/Html/Admin.pm +++ b/PciIds/Html/Admin.pm @@ -16,10 +16,38 @@ sub safeEncode( $ ) { return ''; } -sub mailEncode( $ ) { - my( $email ) = @_; +sub mailEncode( $$ ) { + my( $email, $user ) = @_; return '' unless defined $email; - return "".encode( $email ).""; + ( $user ) = $email =~ /^(.*)@/ unless( defined $user ); + return "".encode( $user ).""; +} + +sub genHist( $$$$$$$$$$$ ) { + my( $class, $email, $login, $time, $name, $note, $disc, $selname, $selvalue, $delname, $delvalue ) = @_; + print ""; + print "".mailEncode( $email, $login )."
" if( defined $email ); + print "".safeEncode( $time ).""; + print ""; + if( defined $name ) { + if( $name eq '' ) { + print "Deletion request
"; + } else { + print "Name: ".encode( $name )."
"; + } + } + print "Note: ".encode( $note )."
" if defined $note && $note ne ''; + print safeEncode( $disc ); + print "\n"; + print "\n" if defined $delname +} + +sub genNewForm( $ ) { + my( $num ) = @_; + print "TODO combo"; + print "Name: Note:
\n"; + print "\n"; + print "\n"; } sub genNewAdminForm( $$$$$ ) { @@ -38,59 +66,45 @@ sub genNewAdminForm( $$$$$ ) { my $cnt = 0; my $hiscnt = 0; my $subcnt; - print "

Any action approves all discussion\n"; - print "\n"; - print "\n"; - print "
IDNameNoteDiscussionAuthorOkSelDel\n"; foreach( @{$tables->adminDump( $prefix )} ) { - my( $locId, $actName, $actNote, $actHist, $actUser, $actDisc, - $hist, $disc, $name, $note, $user ) = @{$_}; + my( $locId, $actName, $actNote, $actHist, $actEmail, $actLogin, $actDisc, $actTime, + $hist, $disc, $name, $note, $email, $login, $time ) = @{$_}; if( !defined( $lastId ) || ( $lastId ne $locId ) ) { last if( $hiscnt > 80 ); $lastId = $locId; - $started = 1; + if( $started ) { + genNewForm( $cnt ); + print "
\n"; + } else { + $started = 1; + } my $addr = PciIds::Address::new( $locId ); if( defined( $actHist ) ) { - print ""; + print "\n"; } else { - print ""; + print "
\n"; } - print "\n"; + print "

\n"; + print "

".encode( $addr->pretty() )."".safeEncode( $actName )."".safeEncode( $actNote )."".safeEncode( $actDisc )."".mailEncode( $actUser ); - + print "
"; + genPathBare( $req, $addr, 0, 0, 0 ); print "" if( $subcnt ); $subcnt = 0; - $cnt++; - print "\n"; - print ""; - print ""; - if( hasRight( $auth->{'accrights'}, 'prune' ) || ( !defined $actHist && !$tables->hasChildren( $addr->get() ) ) ) { - print "\n"; - } else { - print ""; - } - print "
New:\n"; - print ""; - genPathBare( $req, $addr, 0, 0, 0 ); - print "\n"; + $cnt ++; + print ""; + print "" if hasRight( $auth->{'accrights'}, 'prune' ) || ( !defined $actHist && !$tables->hasChildren( $addr->get() ) ); + genHist( 'main-history', $actEmail, $actLogin, $actTime, $actName, $actNote, $actDisc, "loc-$cnt-sel", 'seen', undef, undef ) if( defined $actHist ); } - print "
".safeEncode( ( defined $name && $name eq '' ) ? 'Deletion request' : $name )."".safeEncode( $note )."".safeEncode( $disc )."".mailEncode( $user ); $hiscnt ++; $subcnt ++; - print ""; - print ""; - if( defined $name ) { - print ""; - } else { - print ""; - } - print ""; - print "\n"; + genHist( 'unseen-history', $email, $login, $time, $name, $note, $disc, "loc-$cnt-sel", $hist, "del-$hiscnt", "del-$hist" ); } - print "
\n"; print "\n" if( defined( $subcnt ) ); if( $started ) { - print "" if( $subcnt ); + genNewForm( $cnt ); + print "\n"; print "

\n"; + print "" if( $subcnt ); print "\n"; } else { print "

No pending items.\n"; diff --git a/static/screen.css b/static/screen.css index 69315d8..3e7c650 100644 --- a/static/screen.css +++ b/static/screen.css @@ -3,31 +3,20 @@ body color: black; background: #DDDDFF; } +form.admin table.unnamedItem tr.label, .unnamedItem, .unseen-history { background: #D5D5D5; } -.item, .history, -table.admin .unseen-history +form.admin table.item tr.label, +.item, .history { background: #F0F0F0; } -.main-history, -table.admin .item, -table.admin .new +.main-history { background: #DDFFDD; } -table.admin .empty -{ - background: #DDDDFF; -} -table.admin .unnamedItem td, -table.admin .item td -{ - padding-top: 1ex; - padding-bottom: 1ex; -} .help-example { background: #BBBBFF; @@ -126,18 +115,27 @@ form.jump p { margin-top: 0px; } -table.admin col.id-col, -table.admin col.name-col, -table.admin col.note-col, -table.admin col.disc-col, -table.admin col.auth-col +form.admin col.author +{ + width: 20%; +} +form.admin col.main { - width: 18%; + width: 74%; } -table.admin col.control-col +form.admin col.controls { width: 3%; } +form.admin table { - background: #DDFFDD; + background: #BBBBFF; +} +form.admin tr.label td.deletes +{ + background: red; +} +form.admin .newhistory +{ + background: #FFFFCC; }