From 30c136a1d8f433ea9a47336584ad6c88191f4fb7 Mon Sep 17 00:00:00 2001 From: josch Date: Sat, 27 Oct 2007 11:59:23 +0000 Subject: [PATCH] added account.pl with video list capabilities, inserted edit button for own videos in result list git-svn-id: http://yolanda.mister-muffin.de/svn@145 7eef14d0-6ed0-489d-bf55-20463b2d70db --- trunk/account.pl | 154 +++++++++++++++++++++++++ trunk/images/tango/video-x-generic.png | Bin 0 -> 12940 bytes trunk/search.pl | 22 ++-- trunk/video.pl | 6 +- trunk/xsl/xhtml.xsl | 56 ++++++--- 5 files changed, 211 insertions(+), 27 deletions(-) create mode 100644 trunk/account.pl create mode 100644 trunk/images/tango/video-x-generic.png diff --git a/trunk/account.pl b/trunk/account.pl new file mode 100644 index 0000000..7eee746 --- /dev/null +++ b/trunk/account.pl @@ -0,0 +1,154 @@ +#!/usr/bin/perl +require "include.pl"; +require "functions.pl"; + +#initialize session data +CGI::Session->name($session_name); +$query = new CGI; +$session = new CGI::Session; + +$username = get_username_from_sid($session->id); + +%page = (); + +$page->{'username'} = $username; +$page->{'locale'} = $locale; +$page->{'stylesheet'} = $stylesheet; +$page->{'xmlns:dc'} = $xmlns_dc; +$page->{'xmlns:cc'} = $xmlns_cc; +$page->{'xmlns:rdf'} = $xmlns_rdf; + +if($username) +{ + if($query->param('show') eq 'settings') + { + #results per page + #language + #cortado or plugin + } + elsif($query->param('show') eq 'uploads') + { + $page->{'results'}->{'scriptname'} = 'account.pl'; + $page->{'results'}->{'argument'} = 'show'; + $page->{'results'}->{'value'} = 'uploads'; + $page->{'results'}->{'orderby'} = $query->param('orderby'); + $page->{'results'}->{'sort'} = $query->param('sort'); + + #connect to db + my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass) or die $dbh->errstr; + + #build mysql query + $dbquery = "(select v.id, v.title, u.username, from_unixtime( v.timestamp ) as timestamp, v.duration, v.viewcount + from videos as v, users as u where v.userid = u.id and u.sid = ?) + union + (select v.id, v.title, u.username, from_unixtime( v.timestamp ) as timestamp, 0, 0 + from uploaded as v, users as u where v.userid = u.id and u.sid = ?)"; + + if($query->param('orderby')) + { + if($query->param('orderby') eq 'filesize') + { + $dbquery .= " order by filesize"; + } + elsif($query->param('orderby') eq 'duration') + { + $dbquery .= " order by duration"; + } + elsif($query->param('orderby') eq 'viewcount') + { + $dbquery .= " order by viewcount"; + } + elsif($query->param('orderby') eq 'timestamp') + { + $dbquery .= " order by timestamp"; + } + else + { + $dbquery .= " order by id"; + } + + if($query->param('sort') eq "asc") + { + $dbquery .= " asc" + } + else + { + $dbquery .= " desc" + } + } + + #prepare query + my $sth = $dbh->prepare($dbquery) or die $dbh->errstr; + + #execute it + $resultcount = $sth->execute($session->id, $session->id) or die $dbh->errstr; + + $rowsperpage = 2; + + #rediculous but funny round up, will fail with 1000000000000000 results per page + #on 0.00000000000001% of all queries - this is a risk we can handle + $lastpage = int($resultcount/$rowsperpage+0.999999999999999); + + $currentpage = $query->param('page') or $currentpage = 1; + + $dbquery .= " limit ".($currentpage-1)*$rowsperpage.", ".$rowsperpage; + + #prepare query + $sth = $dbh->prepare($dbquery) or die $dbh->errstr; + + #execute it + $sth->execute($session->id, $session->id) or die $dbquery; + + $page->{'results'}->{'lastpage'} = $lastpage; + $page->{'results'}->{'currentpage'} = $currentpage; + $page->{'results'}->{'resultcount'} = $resultcount; + + #get every returned value + while (my ($id, $title, $publisher, $timestamp, $duration, $viewcount) = $sth->fetchrow_array()) + { + #before code cleanup, this was a really obfuscated array/hash creation + push @{ $page->{'results'}->{'result'} }, + { + 'thumbnail' => $duration == 0 ? "/images/tango/video-x-generic.png" : "/video-stills/$id", + 'duration' => $duration, + 'viewcount' => $viewcount, + 'edit' => $username eq $publisher ? "true" : "false", + 'rdf:RDF' => + { + 'cc:Work' => + { + 'dc:title' => [$title], + 'dc:date' => [$timestamp], + 'dc:identifier' => ["$domain/video/$title/$id" . ($duration == 0 ? "/edit=true" : "") ], + 'dc:publisher' => [$publisher] + }, + 'cc:License' => + { + 'rdf:about' => 'http://creativecommons.org/licenses/GPL/2.0/' + } + } + }; + } + + #finish query + $sth->finish() or die $dbh->errstr; + + #close db + $dbh->disconnect() or die $dbh->errstr; + } + else + { + $page->{'account'} = ['']; + } +} +else +{ + $page->{'message'}->{'type'} = "error"; + $page->{'message'}->{'text'} = "error_202c"; +} + +#print xml http header along with session cookie +print $session->header(-type=>'text/xml', -charset=>'UTF-8'); + +#print xml +print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page', AttrIndent => '1'); diff --git a/trunk/images/tango/video-x-generic.png b/trunk/images/tango/video-x-generic.png new file mode 100644 index 0000000000000000000000000000000000000000..c0d079aefa658f903733590dde6360cd4608a270 GIT binary patch literal 12940 zcmaJ|hdW%|*EQ-8VsufW_Y%=N84UZDY zAMkmeF=n1?&bj-nv-aL=orzRemBYiKz(GMl!Bdcb3j?0>frlp;6Zq{`_|Fk|LU)BK zXn}zrU+||0;5D|Byq+s?{mg$45R^5`6L|9lTvivZ>1YA>Fm*9U@$m5Awsx>}{b=fB z&h6-8nRO&ifr3JdqVV>OmS^^1msc{?jMwr*hxVU8cNYg7f!|TcomfDGjICBB%0r1Y z0=!%U4b>l&nh)d~xG;i(H(jfR!_fNNKLt2v_n&!GGfrC!5}GqjK_iJHLdEE!W-Y(s zTA=)%Uqar&+Px zB4f2tYYPi>nO4~;qW+&hd4Q`aVkLY$JV0n;wtfTt-wHD@`h#|5jmX@OW(B;KByVid z*UQ)l8!V5HMtc_m!-Gaye}tyiM@EBa^>=)|hbO7(+Zg}YpOj|Mxtg+c@F zk9zM94>f!FSb1Nf=idP#ai(z z@{so)Uw^z+;kUPDuQz8~PZ=Q%g$8}1AG)|8)=miiSs5knnb--i=;593k zO@TAGpzDLBu9r9Vt25=}E5YAs?d|R1Zf?ls3DxQfY!%~lE7EIip{<9ptmbxgw4mj^Q4pt|`Z~X| zg2)uGwYIk(pyAmzwA3R_wNDr^&&bH7d#R?*PBOut<0Sl6n2MPSd*k|!>~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Erx9_A2Fs;!W2N^|Of7dNy@y0==2ZN}i!r^1Uy z251DLh|vLj8Sc$8yyH3Bw%G%wyVdCK)np}H!Uux#REczWc9ITR4=9K!(pY6)^4sR%SwFyB4x@%Fj=5JsZ|fb)@*km{ee!-@mbkelRn3M zyMHgstMetv2zrIXkP?PoN9}KSF-S}Mj*Z?9_IW(i@N^oCp#p>VL79*EqT4G*uJ;>b zr>|a}_$c*y)ZDkx!Oj4nhet_vsww_+8(i^V;o&L~_ldnGWsO9lQ6<5+y@ud){T}LL z8y0NlXD)|it#T~G`M*$$T!LC_AcbV+19uufCq(qN<=_{cpnNovLlK7UI~mG2N_#M- zxbc!%cT35lQejvwGP;S##$JrgHjyL*5}*I;dg@Oi;vW@JdHKZFyrIchlyS8oDU+-Y zzk@ugAb3BJ28XUYSP{&l?ma1|-ag;+;bu~sGejHJNCd{(x1IDmw6CF@GfhpAO{epl zUSz8VyjL)pn{VDq;-|C3H#BCR_i9fc22wV{Xjj>dI{w=)Ri3e?DS=g1tnaZ~qr%po aux>?DVl>icI)HDEpeV?yzO99t1pgl~hDEgi literal 0 HcmV?d00001 diff --git a/trunk/search.pl b/trunk/search.pl index 6e74128..95d6c82 100644 --- a/trunk/search.pl +++ b/trunk/search.pl @@ -6,10 +6,11 @@ CGI::Session->name($session_name); $query = new CGI; $session = new CGI::Session; +$username = get_username_from_sid($session->id); + %page = (); - -#if a username is associated with session id, username is nonempty -$page->{'username'} = get_username_from_sid($session->id); + +$page->{'username'} = $username; $page->{'locale'} = $locale; $page->{'stylesheet'} = $stylesheet; $page->{'xmlns:dc'} = $xmlns_dc; @@ -19,9 +20,11 @@ $page->{'xmlns:rdf'} = $xmlns_rdf; #check if query is set if($query->param('query') or $query->param('orderby')) { - $page->{results}->{query} = $query->param('query'); - $page->{results}->{orderby} = $query->param('orderby'); - $page->{results}->{sort} = $query->param('sort'); + $page->{'results'}->{'scriptname'} = 'search.pl'; + $page->{'results'}->{'argument'} = 'query'; + $page->{'results'}->{'value'} = $query->param('query'); + $page->{'results'}->{'orderby'} = $query->param('orderby'); + $page->{'results'}->{'sort'} = $query->param('sort'); #connect to db my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass) or die $dbh->errstr; @@ -88,7 +91,7 @@ if($query->param('query') or $query->param('orderby')) my $sth = $dbh->prepare($dbquery) or die $dbh->errstr; #execute it - $resultcount = $sth->execute(@args) or die $dbquery; + $resultcount = $sth->execute(@args) or die $dbh->errstr; $rowsperpage = 2; @@ -111,7 +114,7 @@ if($query->param('query') or $query->param('orderby')) $page->{'results'}->{'resultcount'} = $resultcount; #get every returned value - while (my ($id, $title, $creator, $description, $username, $timestamp, $duration, $viewcount, $relevance) = $sth->fetchrow_array()) + while (my ($id, $title, $creator, $description, $publisher, $timestamp, $duration, $viewcount, $relevance) = $sth->fetchrow_array()) { #before code cleanup, this was a really obfuscated array/hash creation push @{ $page->{'results'}->{'result'} }, @@ -119,6 +122,7 @@ if($query->param('query') or $query->param('orderby')) 'thumbnail' => "./video-stills/$id", 'duration' => $duration, 'viewcount' => $viewcount, + 'edit' => $username eq $publisher ? "true" : "false", 'rdf:RDF' => { 'cc:Work' => @@ -128,7 +132,7 @@ if($query->param('query') or $query->param('orderby')) 'dc:creator' => [$creator], 'dc:date' => [$timestamp], 'dc:identifier' => ["$domain/video/$title/$id"], - 'dc:publisher' => [$username] + 'dc:publisher' => [$publisher] }, 'cc:License' => { diff --git a/trunk/video.pl b/trunk/video.pl index f3d4195..4f7f9ec 100644 --- a/trunk/video.pl +++ b/trunk/video.pl @@ -16,8 +16,12 @@ $page->{'xmlns:dc'} = $xmlns_dc; $page->{'xmlns:cc'} = $xmlns_cc; $page->{'xmlns:rdf'} = $xmlns_rdf; +if($query->url_param('edit') eq 'true' and $query->url_param('id')) +{ + $page->{'message'}->{'type'} = "information"; +} #check if id or title is passed -if($query->url_param('title') or $query->url_param('id')) +elsif($query->url_param('title') or $query->url_param('id')) { #connect to db my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass) or die $dbh->errstr; diff --git a/trunk/xsl/xhtml.xsl b/trunk/xsl/xhtml.xsl index 0e31d64..ac3507f 100755 --- a/trunk/xsl/xhtml.xsl +++ b/trunk/xsl/xhtml.xsl @@ -290,13 +290,13 @@ - + << - + < @@ -305,7 +305,7 @@ - + @@ -313,7 +313,7 @@ - + @@ -323,7 +323,7 @@ - + @@ -331,7 +331,7 @@ - + @@ -343,13 +343,13 @@ - + > - + >> @@ -479,12 +479,13 @@

- - - - - -

+ + + + + + + + + + + + + + + + + + + + edit + + @@ -514,11 +530,17 @@
-
+ + + +
- + + + + - + order by: