From: Kyoshiro <mib...@us...> - 2004-09-27 14:59:51
|
Update of /cvsroot/ngetsuite/ngetsuite/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23534/web Modified Files: group.rhtml queueview.rhtml release.rhtml top.rhtml Added Files: search.rhtml Log Message: sampleconfig: add httpd error and access log entries web/ top.rhtml: add (*) pseudo group to remove group filtering release.rhtml: remove non working pretty_date release.rhtml: add release view by filter queueview.rhtml: increase queue_add regex maxlength queueview.rhtml: add sort links to queue's columns headers queueview.rhtml: reorganize queue columns queueview.rhtml: replace regex input field with link to articles list (release view by filter) group.rhtml: remove non working pretty_date search.rhtml: add file, allow searching with web interface ngetsuite/ web.rb: add some form attributes recognition web.rb: add start_html, end_html, urlencode methods queue.rb: add shortgroup method, enhance output (more \n) nfo.rb: add getnfobyregex method nfo.rb: add search method downloader.rb: remove db locks ngetsuite.rb, specif.txt, core.rb: add --search-nfo-by-subject (-N) and --search-nfo (-F) options which work like -g and -G daemon.rb: add mime types handling to make webrick send text/html for .rhtml files daemon.rb: make webrick log access/errors into files instead of output mime.types: contains css and rhtml type definitions... Index: release.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/release.rhtml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** release.rhtml 21 Feb 2004 15:58:34 -0000 1.4 --- release.rhtml 27 Sep 2004 14:59:41 -0000 1.5 *************** *** 15,30 **** attr_reader :articles, :nfos ! def initialize(groupindex,artindex,date) @articles = Array.new @nfos = Array.new ! @rls = NgetSuite::Release.new(groupindex,artindex,true) if artindex ! artq = "select * from `articles` a left join `nfos` n using (`artindex`) " ! artq += "where a.groupindex='#{groupindex}' and `rlsartindex`='#{artindex}'" ! artq += "and DATE_FORMAT(`time`, '%Y-%m-%d')='#{date}' " if date != "any" ! artq += "order by `subject`" - puts artq @sth = NgetSuite::Db.dbh.execute artq --- 15,36 ---- attr_reader :articles, :nfos ! def initialize(groupindex,artindex,filter,date) @articles = Array.new @nfos = Array.new ! if (artindex) ! @rls = NgetSuite::Release.new(groupindex,artindex,true) if artindex ! artq = "select * from `articles` a left join `nfos` n using (`artindex`) " ! artq += "where a.groupindex='#{groupindex}' and `rlsartindex`='#{artindex}' " ! artq += "and DATE_FORMAT(`time`, '%Y-%m-%d')='#{date}' " if date != "any" ! artq += "order by `subject`" ! else ! artq = "select * from `articles` a left join `nfos` n using (`artindex`) " ! artq += "where a.groupindex='#{groupindex}' and a.subject RLIKE '#{filter}' " ! artq += "and DATE_FORMAT(`time`, '%Y-%m-%d')='#{date}' " if date != "any" ! artq += "order by `subject`" ! end @sth = NgetSuite::Db.dbh.execute artq *************** *** 46,55 **** <body> ! <% rls = ReleaseArticles.new(web.group._groupindex, web.rlsartind, web.date) %> ! - <% if web.rlsartind %> <a name="top"></a> <h1>Release details</h1> --- 52,69 ---- <body> ! <% ! if (web.group != nil and web.group != "") ! idx = web.group._groupindex ! elsif (web.groupindex != nil and web.groupindex != "") ! idx = web.groupindex ! else ! raise NoSuchGroupException(nil) ! end ! rls = ReleaseArticles.new(idx, web.rlsartind, web.filter, web.date) + if web.rlsartind || web.filter + %> <a name="top"></a> <h1>Release details</h1> *************** *** 91,95 **** <% rls.articles.each { |art| %> <tr class="article"> ! <td class="time"><%= NgetSuite::Utils.pretty_date(art["time"]) %></td> <td class="subject"><%= art["subject"] %></td> <td class="size"><%= NgetSuite::Utils.pretty_size(art["size"]) %></td> --- 105,109 ---- <% rls.articles.each { |art| %> <tr class="article"> ! <td class="time"><%= art["time"] %></td> <td class="subject"><%= art["subject"] %></td> <td class="size"><%= NgetSuite::Utils.pretty_size(art["size"]) %></td> Index: queueview.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/queueview.rhtml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** queueview.rhtml 20 Feb 2004 23:35:17 -0000 1.4 --- queueview.rhtml 27 Sep 2004 14:59:40 -0000 1.5 *************** *** 1,4 **** <% - require 'ngetsuite/db' require 'ngetsuite/utils' --- 1,3 ---- *************** *** 38,42 **** <%= web.offset_input %> <%= web.group_input %> ! <input class='regexp' type='text' name='regexp_to_add' size='15' maxlength='15'> subdir: <input class='regexp' type='text' name='subdir' size='20'> --- 37,41 ---- <%= web.offset_input %> <%= web.group_input %> ! <input class='regexp' type='text' name='regexp_to_add' size='15' maxlength='25'> subdir: <input class='regexp' type='text' name='subdir' size='20'> *************** *** 50,54 **** </form> </div> ! <% end %> <form method='post' name='queue'> --- 49,55 ---- </form> </div> ! <% ! end ! %> <form method='post' name='queue'> *************** *** 58,64 **** <tr class='headers'> <th><input type='checkbox' name="markall" onClick="CA(document.queue);"></th> ! <th>Queue index</th><th>Group</th><th>Value</th> ! <th>Priority</th><th>Status</th><th>Added</th> ! <th>Started</th><th>Finished</th><th>Delete</th> </tr> --- 59,72 ---- <tr class='headers'> <th><input type='checkbox' name="markall" onClick="CA(document.queue);"></th> ! <th>Del</th> ! <% # TODO in sort links, avoid losing other get values such as group... %> ! <th><a href="?sort=queueindex">Idx</a></th> ! <th><a href="?sort=groupindex">Group</a></th> ! <th><a href="?sort=value">Filter</a></th> ! <th><a href="?sort=priority">Prio</a></th> ! <th><a href="?sort=status">Status</a></th> ! <th><a href="?sort=date_added">Added</a></th> ! <th><a href="?sort=date_started">Started</a></th> ! <th><a href="?sort=date_finished">Finished</a></th> </tr> *************** *** 68,72 **** filter += " where `groupindex` = '#{web.group._groupindex}'" end ! filter += ' order by `priority` desc' NgetSuite::QueueList.new(filter).each { |q| --- 76,87 ---- filter += " where `groupindex` = '#{web.group._groupindex}'" end ! if web.sort == 'groupindex' or web.sort == 'queueindex' or web.sort == ! 'value' or web.sort == 'status' or ! web.sort == 'date_added' or web.sort == 'date_started' or ! web.sort == 'date_finished' ! filter += ' order by `'+web.sort+'` asc' ! else ! filter += ' order by `priority` desc' ! end NgetSuite::QueueList.new(filter).each { |q| *************** *** 76,82 **** <tr class='<%= q._status %>'> <td><input type='checkbox' name='selected' value='<%= q._queueindex %>'></td> <td class='id'><%= q._queueindex %></td> ! <td class='group'><a href='?group=<%= q.group %>'><%= q.group %></a></td> ! <td class='value'><input type='text' name='value' value='<%= q._value %>'></td> <td class='prio'><select name='prio'> <% for i in 1..10 %> --- 91,100 ---- <tr class='<%= q._status %>'> <td><input type='checkbox' name='selected' value='<%= q._queueindex %>'></td> + <td><input type='checkbox' name='toremove' value='<%= q._queueindex %>'></td> <td class='id'><%= q._queueindex %></td> ! <td class='group'><a target="_top" href='index.rhtml?group=<%= q.group %>'><%= q.group %></a></td> ! <!--td class='value'><input type='text' name='value' value='<%= q._value %>'></td--> ! <td class='value'><a target="left" href="release.rhtml?group=<%= q.group ! %>&filter=<%= web.urlencode(q._value) %>"><%= q._value %></a></td> <td class='prio'><select name='prio'> <% for i in 1..10 %> *************** *** 92,96 **** <td><%= q._date_started ? q._date_started.strftime("%d/%m/%y %H:%M") : "N/A" %></td> <td><%= q._date_finished ? q._date_finished.strftime("%d/%m/%y %H:%M") : "N/A" %></td> - <td><input type='checkbox' name='toremove' value='<%= q._queueindex %>'></td> </tr> --- 110,113 ---- --- NEW FILE: search.rhtml --- <% require 'ngetsuite/db' require 'ngetsuite/utils' require 'ngetsuite/group' require 'ngetsuite/web' web = NgetSuite::Web.new(servlet_request) web.handle_args web.update_queue class SearchInfo attr_reader :articles, :nfos def initialize(groups,want_release,filter,age_max) @articles = Array.new @nfos = Array.new groups.collect! { |x| NgetSuite::Group.getgroup(x)._groupindex} if (! groups.empty? ) if (want_release == "1") artq = "select r.*,a.`subject` from `releases` r " artq += "left join `articles` a on r.artindex=a.artindex " artq += "where 1 " artq += "and r.`groupindex` IN ('"+groups.join("', '")+"') " if (! groups.empty? ) artq += "and r.`time` > DATE_SUB(NOW(), INTERVAL #{age_max}) " if age_max artq += "and a.subject RLIKE '#{filter}' " if filter artq += "order by `completeness` desc, `nbactual` desc, r.`time` desc limit 100" @sth = NgetSuite::Db.dbh.execute artq else artq = "select * from `articles` where 1 " artq += "and `groupindex` IN ('"+groups.join("', '")+"') " if (! groups.empty? ) artq += "and `subject` RLIKE '#{filter}' " if filter artq += "and `time` > DATE_SUB(NOW(), INTERVAL #{age_max}) " if age_max artq += "order by `subject` limit 100" @sth = NgetSuite::Db.dbh.execute artq @sth.fetch_hash { |row| @articles.push row } end end def each return unless @sth @sth.fetch_hash { |row| row["graphmap"] = "<div class=\"rlsmap\">#{row["nbactual"]}/#{row["nbexpected"]} " if row["rlsmap"] and row["rlsmap"] != "" for i in 0..row["rlsmap"].size-1 if row["rlsmap"][i] == "#"[0] then row["graphmap"] += "<img src=\"green.png\" width=\"3\" height=\"5\">" else row["graphmap"] += "<img src=\"red.png\" width=\"3\" height=\"5\">" end end else for i in 1..row["nbactual"] row["graphmap"] += "<img src=\"cyan.png\" width=\"3\" height=\"5\">" end end row["graphmap"] += "</div>" yield row } end end %> <%= web.start_html("Release/Article search") %> <% if web.filter == nil %> <h3>Search releases/articles</h3> <div class="search_form"> <form method='post' name='search' target="left"> Filter <input class='regexp' type='text' name="filter" size='30' maxlength='50' /> <br /> <input type='radio' name='want_release' value="1" checked="checked" /> Search for releases <br /> <input type='radio' name='want_release' value="0" /> Search for articles <br /> <input type="text" name="aging" size="5" maxlength="5" /> <select name="aging_unit" /> <option value="w">weeks</option> <option value="d" selected="selected">days</option> <option value="h">hours</option> </select> old articles only <br /> Limit search to these groups : <select name="groups" multiple="multiple" size="8" /> <% NgetSuite::GroupList.new("order by `shortname`").each { |group| %> <%= '<option selected="selected">'+group._shortname+"</option>\n" %> <% } %> </select> <br /> <br /> <input type='submit' value='Search now!'> </form> </div> <% else rls = SearchInfo.new(web.groups, web.want_release, web.filter, web.age_max) if (web.want_release == "1") %> <h3>Search results</h3> <table class='articles'> <tr class='headers'> <th>Date/Size</th><th>Subject</th> </tr> <% rls.each { |rlss| %> <tr class="article"> <td class="time"><i><%= rlss["time"] %></i><br> <b><%= NgetSuite::Utils.pretty_size(rlss["size"]) %><b></td> <td class="subject"> <a class="rlslink" target="right" href="release.rhtml?groupindex=<%= rlss["groupindex"] %> &rlsartind=<%= rlss["artindex"].to_s %>"><%= rlss["subject"] %></a><br> <%= rlss["graphmap"] %> </tr> <% } %> </table> <% else %> <a name="top"></a> <h1>Files found</h1> <ul> <% if !rls.nfos.empty? %> <li><a href="#nfos"><%= rls.nfos.size %> viewable text file(s)</a></li> <% end %> <li><a href="#artlist">View articles list</a></li> </ul> <a name="artlist"></a> <div class="sectiontitle">Articles list</div> <table class="articles"> <tr class="headers"> <th>Date</th><th>Subject</th><th>Size</th> </tr> <% rls.articles.each { |art| %> <tr class="article"> <td class="time"><%= art["time"] %></td> <td class="subject"><%= art["subject"] %></td> <td class="size"><%= NgetSuite::Utils.pretty_size(art["size"]) %></td> </tr> <% } %> </table> <% end end #<%= web.end_html() %> <% NgetSuite::Db.dbh.disconnect %> Index: group.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/group.rhtml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** group.rhtml 16 Mar 2004 22:21:40 -0000 1.7 --- group.rhtml 27 Sep 2004 14:59:40 -0000 1.8 *************** *** 78,82 **** <% releases.each { |rls| %> <tr class="article"> ! <td class="time"><i><%= NgetSuite::Utils.pretty_date(rls["time"]).split(" ")[1] %></i><br> <b><%= NgetSuite::Utils.pretty_size(rls["size"]) %><b></td> <td class="subject"><a class="rlslink" target="right" href="release.rhtml?group=<%= web.group._fullname %>&rlsartind=<%= rls["artindex"].to_s %>"><%= rls["subject"] %></a><br> --- 78,82 ---- <% releases.each { |rls| %> <tr class="article"> ! <td class="time"><i><%= rls["time"] %></i><br> <b><%= NgetSuite::Utils.pretty_size(rls["size"]) %><b></td> <td class="subject"><a class="rlslink" target="right" href="release.rhtml?group=<%= web.group._fullname %>&rlsartind=<%= rls["artindex"].to_s %>"><%= rls["subject"] %></a><br> Index: top.rhtml =================================================================== RCS file: /cvsroot/ngetsuite/ngetsuite/web/top.rhtml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** top.rhtml 16 Mar 2004 22:21:43 -0000 1.3 --- top.rhtml 27 Sep 2004 14:59:41 -0000 1.4 *************** *** 58,61 **** --- 58,62 ---- <table> <tr> + <td class="grouptab"><a href="index.rhtml" target="_top">*</a></td> <% NgetSuite::GroupList.new("order by `shortname`").each { |group| %> <td class="<%= (servlet_request.query["group"] == group._fullname) ? "grouptabsel" : "grouptab" %>"><a href="index.rhtml?group=<%= group._fullname %>" target="_top"><%= group._shortname %></a></td> |