Commit b528360b51c1940ae4434b8f1caec060624722af

Authored by Valessio Soares de Brito
1 parent 1faea87f
Exists in master and in 1 other branch add_vagrant

opis.. send others style up bar.. and pog @tiagovaz on data.py and $me on server.py

src/data.py
... ... @@ -167,8 +167,10 @@ class PopconXapianIndex(xapian.WritableDatabase):
167 167 logging.info("Opening existing popcon xapian index at \'%s\'"
168 168 % self.path)
169 169 xapian.Database.__init__(self,self.path)
  170 + return True
170 171 except xapian.DatabaseError:
171 172 logging.info("Could not open popcon index.")
  173 + return True
172 174 return 0
173 175  
174 176 def build_index(self):
... ...
src/web/server.py
... ... @@ -39,6 +39,10 @@ class Thanks:
39 39 def POST(self):
40 40 return render.thanks()
41 41  
  42 +class Support:
  43 + def POST(self):
  44 + return render.support()
  45 +
42 46 class Package:
43 47 def GET(self, pkg):
44 48 json_source = "http://dde.debian.net/dde/q/udd/packages/all/%s?t=json" % pkg #FIXME: url goes to config
... ... @@ -271,10 +275,11 @@ def add_global_hook():
271 275 render = web.template.render('templates/', base='layout')
272 276 render_plain = web.template.render('templates/')
273 277  
274   -urls = ('/', 'Index',
275   - '/apprec', 'AppRecommender',
  278 +urls = ('/', 'Index',
  279 + '/apprec', 'AppRecommender',
276 280 '/thanks', 'Thanks',
277   - '/about', 'About',
  281 + '/support', 'Support',
  282 + '/about', 'About',
278 283 '/package/(.*)', 'Package'
279 284 )
280 285  
... ...
src/web/static/css/apprec.css
... ... @@ -84,3 +84,7 @@ margin-top: 20px;
84 84 margin-bottom: 4px;
85 85 }
86 86  
  87 +#details_box li {
  88 +margin-bottom: 10px;
  89 +}
  90 +
... ...
src/web/static/css/style.css
... ... @@ -60,10 +60,9 @@ background-image: url('../images/pattern.gif');
60 60 }
61 61  
62 62 #wrap {
63   -position:relative;
64 63 min-width: 470px;
65 64 max-width: 960px;
66   -margin-top: 0px;
  65 +margin-top: 100px;
67 66 margin-right: auto;
68 67 margin-bottom: 0px;
69 68 margin-left: auto;
... ... @@ -71,7 +70,29 @@ background-color: white;
71 70 }
72 71  
73 72 #header {
  73 +position: absolute;
  74 +top: 0px;
  75 +left: -310px;
  76 +margin-left: 50%;
  77 +width: 620px;
  78 +height: 60px;
  79 +border-radius: 0 0 10px 10px;
74 80 padding: 15px;
  81 +background: #000;
  82 +filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#babdb6', endColorstr='#000000');
  83 +background: -webkit-gradient(linear, left top, left bottom, from(#babdb6), to(#000000));
  84 +background: -moz-linear-gradient(top, #babdb6, #000000);
  85 +}
  86 +
  87 +#logo span { display: none; }
  88 +#logo {
  89 +background: url('../images/icon45.png') no-repeat;
  90 +width: 45px;
  91 +height: 45px;
  92 +margin: 0px;
  93 +margin-top: 5px;
  94 +display: block;
  95 +float: right;
75 96 }
76 97  
77 98 #navbar {
... ... @@ -79,8 +100,7 @@ list-style: none;
79 100 height: 20px;
80 101 width: 100%;
81 102 padding:0;
82   -margin:0;
83   -border: 1px solid gray;
  103 +margin:10px;
84 104 }
85 105  
86 106 #navbar li {
... ... @@ -98,8 +118,12 @@ margin-left: -1px;
98 118 position: relative;
99 119 left: 1px;
100 120 text-decoration: none;
  121 +border: 1px solid gray;
101 122 }
102 123  
  124 +#navbar li a:hover {
  125 +color: red;
  126 +}
103 127  
104 128 #sidebar {
105 129 width: 370px;
... ... @@ -224,6 +248,7 @@ background-color: #dfdfdf;
224 248 border-radius: 5px;
225 249 font-size: 0.8;
226 250 padding: 5px;
  251 +box-shadow: 0 1px 2px gray;
227 252 }
228 253  
229 254  
... ... @@ -267,13 +292,15 @@ background-image: url('../images/admon-note.png');
267 292 /* Recommender BOX */
268 293  
269 294 #recommender-box {
270   -margin-top: 0px;
271   -margin-right: auto;
272   -margin-bottom: 0px;
273   -margin-left: auto;
274   -width: 560px;
275 295 position: relative;
  296 +margin:0;
  297 +width: 560px;
276 298 vertical-align: top;
  299 +border: 1px solid #888a85;
  300 +border-radius: 4px;
  301 +box-shadow: 0 1px 4px gray inset;
  302 +background: white;
  303 +z-index: 3;
277 304 }
278 305  
279 306 #recommender-box label {
... ... @@ -304,6 +331,11 @@ width: 410px;
304 331 font-size: 13px;
305 332 font-family: Arial, Verdana, Sans-serif;
306 333 color: gray;
  334 +border: 0 none;
  335 +margin: 0;
  336 +outline: 0 none;
  337 +padding: 3px;
  338 +background: none;
307 339 }
308 340  
309 341 #pkgs_list:hover, #pkgs_list:active, #pkgs_list:focus {
... ... @@ -314,21 +346,75 @@ color: black;
314 346 float: right;
315 347 display: block;
316 348 width: 135px;
317   -text-align: center;
  349 +height: 45px;
  350 +overflow: hidden;
  351 +position: relative;
318 352 }
319 353  
320   -#submit-box input {
321   -font-size: 14px;
322   -margin: 5px;
  354 +#submit-button {
  355 +border: 1px solid #888a85;
  356 +box-shadow: 0 1px 4px gray inset;
  357 +border-radius: 0;
  358 +background: #ffffff; /* for non-css3 browsers */
  359 +filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#d3d7cf'); /* for IE */
  360 +background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#d3d7cf)); /* for webkit browsers */
  361 +background: -moz-linear-gradient(top, #ffffff, #d3d7cf); /* for firefox 3.6+ */
  362 +color: #585C60;
  363 +font-size: 12px;
  364 +font-weight: 600;
  365 +width: 135px;
  366 +height: 30px;
  367 +line-height: 14px;
  368 +margin: 0;
  369 +padding: 5px;
  370 +position: absolute;
  371 +right: -1px;
  372 +top: -1px;
  373 +text-shadow: 0 1px 0 gray;
  374 +z-index: 2;
  375 +cursor: pointer;
323 376 }
324 377  
325   -/* Advance Query */
  378 +#submit-button:hover {
  379 +background: #d3d7cf;
  380 +filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#d3d7cf', endColorstr='#d3d7cf');
  381 +background: -webkit-gradient(linear, left top, left bottom, from(#d3d7cf), to(#d3d7cf));
  382 +background: -moz-linear-gradient(top, #d3d7cf, #d3d7cf);
  383 +}
  384 +
  385 +#advanced-button {
  386 +color: #888a85;
  387 +font-size: 10px;
  388 +font-weight: 600;
  389 +height: 15px;
  390 +width: 135px;
  391 +line-height: 14px;
  392 +margin: 0;
  393 +position: absolute;
  394 +right: -1px;
  395 +text-shadow: 0 1px 0 gray;
  396 +text-align: center;
  397 +bottom: -1px;
  398 +z-index: 2;
  399 +cursor: pointer;
  400 +}
326 401  
  402 +#advanced-button:hover { color: black; }
327 403  
328   -#content-form, #colaborative-form { display: none; }
329 404  
330   -#content-form:target, #colaborative-form:target, #hybrid-form:target { z-index: 1; display: block; }
  405 +/* Advance Query */
331 406  
  407 +#advanced-slide { display: none; }
  408 +
  409 +#advanced-slide legend {
  410 +font-weight: bold;
  411 +}
  412 +#advanced-slide fieldset {
  413 +boder: 1px solid gray;
  414 +font-size: 0.9em;
  415 +padding: 5px;
  416 +margin: 10px;
  417 +}
332 418  
333 419  
334 420  
... ...
src/web/static/css/thickbox.css
... ... @@ -1,161 +0,0 @@
1   -/* ----------------------------------------------------------------------------------------------------------------*/
2   -/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/
3   -/* ----------------------------------------------------------------------------------------------------------------*/
4   -*{padding: 0; margin: 0;}
5   -
6   -/* ----------------------------------------------------------------------------------------------------------------*/
7   -/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
8   -/* ----------------------------------------------------------------------------------------------------------------*/
9   -#TB_window {
10   - font: 12px Arial, Helvetica, sans-serif;
11   - color: #333333;
12   -}
13   -
14   -#TB_secondLine {
15   - font: 10px Arial, Helvetica, sans-serif;
16   - color:#666666;
17   -}
18   -
19   -#TB_window a:link {color: #666666;}
20   -#TB_window a:visited {color: #666666;}
21   -#TB_window a:hover {color: #000;}
22   -#TB_window a:active {color: #666666;}
23   -#TB_window a:focus{color: #666666;}
24   -
25   -/* ----------------------------------------------------------------------------------------------------------------*/
26   -/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
27   -/* ----------------------------------------------------------------------------------------------------------------*/
28   -#TB_overlay {
29   - position: fixed;
30   - z-index:100;
31   - top: 0px;
32   - left: 0px;
33   - height:100%;
34   - width:100%;
35   -}
36   -
37   -.TB_overlayMacFFBGHack {background: url(/static/images/macFFBgHack.png) repeat;}
38   -.TB_overlayBG {
39   - background-color:#000;
40   - filter:alpha(opacity=75);
41   - -moz-opacity: 0.75;
42   - opacity: 0.75;
43   -}
44   -
45   -* html #TB_overlay { /* ie6 hack */
46   - position: absolute;
47   - height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
48   -}
49   -
50   -#TB_window {
51   - position: fixed;
52   - background: #ffffff;
53   - z-index: 102;
54   - color:#000000;
55   - display:none;
56   - border: 4px solid #525252;
57   - text-align:left;
58   - top:50%;
59   - left:50%;
60   -}
61   -
62   -* html #TB_window { /* ie6 hack */
63   -position: absolute;
64   -margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
65   -}
66   -
67   -#TB_window img#TB_Image {
68   - display:block;
69   - margin: 15px 0 0 15px;
70   - border-right: 1px solid #ccc;
71   - border-bottom: 1px solid #ccc;
72   - border-top: 1px solid #666;
73   - border-left: 1px solid #666;
74   -}
75   -
76   -#TB_caption{
77   - height:25px;
78   - padding:7px 30px 10px 25px;
79   - float:left;
80   -}
81   -
82   -#TB_closeWindow{
83   - height:25px;
84   - padding:11px 25px 10px 0;
85   - float:right;
86   -}
87   -
88   -#TB_closeAjaxWindow{
89   - padding:7px 10px 5px 0;
90   - margin-bottom:1px;
91   - text-align:right;
92   - float:right;
93   -}
94   -
95   -#TB_ajaxWindowTitle{
96   - float:left;
97   - padding:7px 0 5px 10px;
98   - margin-bottom:1px;
99   -}
100   -
101   -#TB_title{
102   -}
103   -
104   -#TB_ajaxContent{
105   - clear:both;
106   - padding:2px 15px 15px 15px;
107   - overflow:auto;
108   - text-align:left;
109   - line-height:1.4em;
110   -}
111   -
112   -#TB_ajaxContent.TB_modal{
113   - padding:15px;
114   -}
115   -
116   -#TB_ajaxContent p{
117   - padding:5px 0px 5px 0px;
118   -}
119   -
120   -#TB_load{
121   - position: fixed;
122   - display:none;
123   - height:13px;
124   - width:208px;
125   - z-index:103;
126   - top: 50%;
127   - left: 50%;
128   - margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
129   -}
130   -
131   -* html #TB_load { /* ie6 hack */
132   -position: absolute;
133   -margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
134   -}
135   -
136   -#TB_HideSelect{
137   - z-index:99;
138   - position:fixed;
139   - top: 0;
140   - left: 0;
141   - background-color:#fff;
142   - border:none;
143   - filter:alpha(opacity=0);
144   - -moz-opacity: 0;
145   - opacity: 0;
146   - height:100%;
147   - width:100%;
148   -}
149   -
150   -* html #TB_HideSelect { /* ie6 hack */
151   - position: absolute;
152   - height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
153   -}
154   -
155   -#TB_iframeContent{
156   - clear:both;
157   - border:none;
158   - margin-bottom:-1px;
159   - margin-top:1px;
160   - _margin-bottom:1px;
161   -}
src/web/static/js/thickbox.js
... ... @@ -1,319 +0,0 @@
1   -/*
2   - * Thickbox 3.1 - One Box To Rule Them All.
3   - * By Cody Lindley (http://www.codylindley.com)
4   - * Copyright (c) 2007 cody lindley
5   - * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
6   -*/
7   -
8   -var tb_pathToImage = "/static/images/loadingAnimation.gif";
9   -
10   -/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
11   -
12   -//on page load call tb_init
13   -$(document).ready(function(){
14   - tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
15   - imgLoader = new Image();// preload image
16   - imgLoader.src = tb_pathToImage;
17   -});
18   -
19   -//add thickbox to href & area elements that have a class of .thickbox
20   -function tb_init(domChunk){
21   - $(domChunk).click(function(){
22   - var t = this.title || this.name || null;
23   - var a = this.href || this.alt;
24   - var g = this.rel || false;
25   - tb_show(t,a,g);
26   - this.blur();
27   - return false;
28   - });
29   -}
30   -
31   -function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
32   -
33   - try {
34   - if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
35   - $("body","html").css({height: "100%", width: "100%"});
36   - $("html").css("overflow","hidden");
37   - if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
38   - $("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
39   - $("#TB_overlay").click(tb_remove);
40   - }
41   - }else{//all others
42   - if(document.getElementById("TB_overlay") === null){
43   - $("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
44   - $("#TB_overlay").click(tb_remove);
45   - }
46   - }
47   -
48   - if(tb_detectMacXFF()){
49   - $("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
50   - }else{
51   - $("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
52   - }
53   -
54   - if(caption===null){caption="";}
55   - $("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
56   - $('#TB_load').show();//show loader
57   -
58   - var baseURL;
59   - if(url.indexOf("?")!==-1){ //ff there is a query string involved
60   - baseURL = url.substr(0, url.indexOf("?"));
61   - }else{
62   - baseURL = url;
63   - }
64   -
65   - var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
66   - var urlType = baseURL.toLowerCase().match(urlString);
67   -
68   - if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
69   -
70   - TB_PrevCaption = "";
71   - TB_PrevURL = "";
72   - TB_PrevHTML = "";
73   - TB_NextCaption = "";
74   - TB_NextURL = "";
75   - TB_NextHTML = "";
76   - TB_imageCount = "";
77   - TB_FoundURL = false;
78   - if(imageGroup){
79   - TB_TempArray = $("a[@rel="+imageGroup+"]").get();
80   - for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
81   - var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
82   - if (!(TB_TempArray[TB_Counter].href == url)) {
83   - if (TB_FoundURL) {
84   - TB_NextCaption = TB_TempArray[TB_Counter].title;
85   - TB_NextURL = TB_TempArray[TB_Counter].href;
86   - TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
87   - } else {
88   - TB_PrevCaption = TB_TempArray[TB_Counter].title;
89   - TB_PrevURL = TB_TempArray[TB_Counter].href;
90   - TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
91   - }
92   - } else {
93   - TB_FoundURL = true;
94   - TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);
95   - }
96   - }
97   - }
98   -
99   - imgPreloader = new Image();
100   - imgPreloader.onload = function(){
101   - imgPreloader.onload = null;
102   -
103   - // Resizing large images - orginal by Christian Montoya edited by me.
104   - var pagesize = tb_getPageSize();
105   - var x = pagesize[0] - 150;
106   - var y = pagesize[1] - 150;
107   - var imageWidth = imgPreloader.width;
108   - var imageHeight = imgPreloader.height;
109   - if (imageWidth > x) {
110   - imageHeight = imageHeight * (x / imageWidth);
111   - imageWidth = x;
112   - if (imageHeight > y) {
113   - imageWidth = imageWidth * (y / imageHeight);
114   - imageHeight = y;
115   - }
116   - } else if (imageHeight > y) {
117   - imageWidth = imageWidth * (y / imageHeight);
118   - imageHeight = y;
119   - if (imageWidth > x) {
120   - imageHeight = imageHeight * (x / imageWidth);
121   - imageWidth = x;
122   - }
123   - }
124   - // End Resizing
125   -
126   - TB_WIDTH = imageWidth + 30;
127   - TB_HEIGHT = imageHeight + 60;
128   - $("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>");
129   -
130   - $("#TB_closeWindowButton").click(tb_remove);
131   -
132   - if (!(TB_PrevHTML === "")) {
133   - function goPrev(){
134   - if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}
135   - $("#TB_window").remove();
136   - $("body").append("<div id='TB_window'></div>");
137   - tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
138   - return false;
139   - }
140   - $("#TB_prev").click(goPrev);
141   - }
142   -
143   - if (!(TB_NextHTML === "")) {
144   - function goNext(){
145   - $("#TB_window").remove();
146   - $("body").append("<div id='TB_window'></div>");
147   - tb_show(TB_NextCaption, TB_NextURL, imageGroup);
148   - return false;
149   - }
150   - $("#TB_next").click(goNext);
151   -
152   - }
153   -
154   - document.onkeydown = function(e){
155   - if (e == null) { // ie
156   - keycode = event.keyCode;
157   - } else { // mozilla
158   - keycode = e.which;
159   - }
160   - if(keycode == 27){ // close
161   - tb_remove();
162   - } else if(keycode == 190){ // display previous image
163   - if(!(TB_NextHTML == "")){
164   - document.onkeydown = "";
165   - goNext();
166   - }
167   - } else if(keycode == 188){ // display next image
168   - if(!(TB_PrevHTML == "")){
169   - document.onkeydown = "";
170   - goPrev();
171   - }
172   - }
173   - };
174   -
175   - tb_position();
176   - $("#TB_load").remove();
177   - $("#TB_ImageOff").click(tb_remove);
178   - $("#TB_window").css({display:"block"}); //for safari using css instead of show
179   - };
180   -
181   - imgPreloader.src = url;
182   - }else{//code to show html
183   -
184   - var queryString = url.replace(/^[^\?]+\??/,'');
185   - var params = tb_parseQuery( queryString );
186   -
187   - TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
188   - TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
189   - ajaxContentW = TB_WIDTH - 30;
190   - ajaxContentH = TB_HEIGHT - 45;
191   -
192   - if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window
193   - urlNoQuery = url.split('TB_');
194   - $("#TB_iframeContent").remove();
195   - if(params['modal'] != "true"){//iframe no modal
196   - $("#TB_window").append("<div id='TB_title'><h1 id='TB_ajaxWindowTitle'>"+caption+"</h1><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
197   - }else{//iframe modal
198   - $("#TB_overlay").unbind();
199   - $("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
200   - }
201   - }else{// not an iframe, ajax
202   - if($("#TB_window").css("display") != "block"){
203   - if(params['modal'] != "true"){//ajax no modal
204   - $("#TB_window").append("<div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>");
205   - }else{//ajax modal
206   - $("#TB_overlay").unbind();
207   - $("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
208   - }
209   - }else{//this means the window is already up, we are just loading new content via ajax
210   - $("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
211   - $("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
212   - $("#TB_ajaxContent")[0].scrollTop = 0;
213   - $("#TB_ajaxWindowTitle").html(caption);
214   - }
215   - }
216   -
217   - $("#TB_closeWindowButton").click(tb_remove);
218   -
219   - if(url.indexOf('TB_inline') != -1){
220   - $("#TB_ajaxContent").append($('#' + params['inlineId']).children());
221   - $("#TB_window").unload(function () {
222   - $('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished
223   - });
224   - tb_position();
225   - $("#TB_load").remove();
226   - $("#TB_window").css({display:"block"});
227   - }else if(url.indexOf('TB_iframe') != -1){
228   - tb_position();
229   - if($.browser.safari){//safari needs help because it will not fire iframe onload
230   - $("#TB_load").remove();
231   - $("#TB_window").css({display:"block"});
232   - }
233   - }else{
234   - $("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
235   - tb_position();
236   - $("#TB_load").remove();
237   - tb_init("#TB_ajaxContent a.thickbox");
238   - $("#TB_window").css({display:"block"});
239   - });
240   - }
241   -
242   - }
243   -
244   - if(!params['modal']){
245   - document.onkeyup = function(e){
246   - if (e == null) { // ie
247   - keycode = event.keyCode;
248   - } else { // mozilla
249   - keycode = e.which;
250   - }
251   - if(keycode == 27){ // close
252   - tb_remove();
253   - }
254   - };
255   - }
256   -
257   - } catch(e) {
258   - //nothing here
259   - }
260   -}
261   -
262   -//helper functions below
263   -function tb_showIframe(){
264   - $("#TB_load").remove();
265   - $("#TB_window").css({display:"block"});
266   -}
267   -
268   -function tb_remove() {
269   - $("#TB_imageOff").unbind("click");
270   - $("#TB_closeWindowButton").unbind("click");
271   - $("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
272   - $("#TB_load").remove();
273   - if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
274   - $("body","html").css({height: "auto", width: "auto"});
275   - $("html").css("overflow","");
276   - }
277   - document.onkeydown = "";
278   - document.onkeyup = "";
279   - return false;
280   -}
281   -
282   -function tb_position() {
283   -$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
284   - if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
285   - $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
286   - }
287   -}
288   -
289   -function tb_parseQuery ( query ) {
290   - var Params = {};
291   - if ( ! query ) {return Params;}// return empty object
292   - var Pairs = query.split(/[;&]/);
293   - for ( var i = 0; i < Pairs.length; i++ ) {
294   - var KeyVal = Pairs[i].split('=');
295   - if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
296   - var key = unescape( KeyVal[0] );
297   - var val = unescape( KeyVal[1] );
298   - val = val.replace(/\+/g, ' ');
299   - Params[key] = val;
300   - }
301   - return Params;
302   -}
303   -
304   -function tb_getPageSize(){
305   - var de = document.documentElement;
306   - var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
307   - var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
308   - arrayPageSize = [w,h];
309   - return arrayPageSize;
310   -}
311   -
312   -function tb_detectMacXFF() {
313   - var userAgent = navigator.userAgent.toLowerCase();
314   - if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
315   - return true;
316   - }
317   -}
318   -
319   -
src/web/templates/apprec.html
... ... @@ -2,7 +2,7 @@ $def with (recommends, pkg_summaries, form, request)
2 2 $var title: Feedback
3 3 $var mod = 'feedback';
4 4 $var cssfiles: static/css/apprec.css static/css/facebox.css static/css/voting.css
5   -$var jsfiles: static/js/facebox.js static/js/jquery.simplerss.js
  5 +$var jsfiles: static/js/facebox.js
6 6  
7 7 <script type="application/x-javascript">
8 8 $$(document).ready(function() {
... ...
src/web/templates/layout.html
... ... @@ -17,24 +17,39 @@ $ url_base = &quot;http://localhost:8080&quot;
17 17 <link href="$css" rel="stylesheet" type="text/css" media="screen" charset="utf-8"/>
18 18  
19 19 <script src="/static/js/jquery.js" type="text/javascript"></script>
  20 + <script src="/static/js/FormManager.js" type="text/javascript"></script>
20 21  
21 22 $if content.jsfiles:
22 23 $for js in content.jsfiles.split():
23 24 <script src="$js" type="text/javascript"></script>
24 25  
  26 +<!-- Dynamic form -->
  27 +<script type="text/javascript">
  28 +window.onload = function() {
  29 + setupDependencies('weboptions'); //name of form(s). Seperate each with a comma (ie: 'weboptions', 'myotherform' )
  30 + };
  31 +</script>
  32 +<script type="text/javascript">
  33 + $$(document).ready(function() {
  34 + $$("#advanced-button").click(function () {
  35 + $$("#advanced-slide").toggle("slow");
  36 + });
  37 + });
  38 +</script>
  39 +
25 40 </head>
26 41  
27 42 <body class="$content.mod">
28 43  
29 44 <div id="wrap">
30 45 <div id="header">
31   -
32   -<form action="apprec" enctype="multipart/form-data" method="post" name="recommenderbox-form">
33   - <fieldset>
  46 + <a href="$url_base" title="AppRecommender"><h1 id="logo"><span>AppRecommender</span></h1></a>
34 47 <div id="recommender-box">
  48 + <form action="apprec" enctype="multipart/form-data" method="post" name="weboptions">
  49 + <fieldset>
35 50 <div id="submit-box">
36   - <input type="submit" value="Recommender!"><br />
37   - [<a href="#advancedquery" rel="facebox">advanced query</a>]
  51 + <input type="submit" value="RECOMMENDER" id="submit-button"><br />
  52 + <a id="advanced-button">advanced query?</a>
38 53 </div>
39 54 <div id="input-box">
40 55 <a href="#attachfile" rel="facebox" id="upfile"><span style="display: none;">Upload a file.</span></a>
... ... @@ -43,23 +58,71 @@ $ url_base = &quot;http://localhost:8080&quot;
43 58 if(/^\s*$$/.test(this.value)){ this.value='Write your list App here or send a file list this icon:';
44 59 this.form.className='clean' }" rows="2" cols="55" name="pkgs_list" id="pkgs_list"
45 60 >Write your list App here or send a file list this icon:</textarea></label>
  61 + </div>
  62 + </fieldset>
  63 +
  64 + <div id="advanced-slide">
  65 + <fieldset>
  66 + <legend>General</legend>
  67 + <div>
  68 + <label><input type="hidden">Profile size:</label>
  69 + <label class="special"><input type="text" name="profile_size" value="10" size="4"></label>
  70 + <label><input type="hidden">Recommendations:</label>
  71 + <label class="special"><input type="text" name="limit" value="10" size="4"></label>
  72 + </div>
  73 + <div>
  74 + <label><input type="hidden">Weighting:</label>
  75 + <label class="special"><input type="radio" name="weight" value="BM25" checked="checked"> BM25</label>
  76 + <label class="special"><input type="radio" name="weight" value="trad"> Traditional</label>
  77 + </div>
  78 + <div>
  79 + <label><input type="hidden">Strategy:</label>
  80 + <label class="special"><input type="radio" name="strategy" value="content" checked="checked"> Content-based</label>
  81 + <label class="special"><input type="radio" name="strategy" value="collab"> Collaborative</label>
  82 + <label class="special"><input type="radio" name="strategy" value="hybrid"> Hybrid</label>
  83 + </div>
  84 + </fieldset>
  85 + <fieldset>
  86 + <legend>Tuning up</legend>
  87 + <div id="content-form" class="group-form group-hybrid">
  88 + <label><input type="hidden" class="DEPENDS ON strategy BEING content OR strategy BEING hybrid">Content representation:</label>
  89 + <label class="special"><input type="radio" name="content" value="tag" class="DEPENDS ON strategy BEING content OR strategy BEING hybrid"> tag</label>
  90 + <label class="special"><input type="radio" name="content" value="desc" class="DEPENDS ON strategy BEING content OR strategy BEING hybrid"> description</label>
  91 + <label class="special"><input type="radio" name="content" value="full" class="DEPENDS ON strategy BEING content OR strategy BEING hybrid"> both</label>
  92 + </div>
  93 + <div id="colaborative-form" class="group-form group-hybrid">
  94 + <label><input type="hidden">Clustering:</label>
  95 + <label class="special"><input type="radio" name="cluster" value="yes"> yes</label>
  96 + <label class="special"><input type="radio" name="cluster" value="no"> no</label>
  97 + </div>
  98 + <div id="hybrid-form" class="group-form group-hybrid">
  99 + <label><input type="hidden" class="DEPENDS ON strategy BEING hybrid">Neighborhood:</label>
  100 + <label class="special"><input type="text" name="neighbours" class="DEPENDS ON strategy BEING hybrid" value="50" size="4"></label>
  101 + <label><input type="hidden" class="DEPENDS ON strategy BEING hybrid">Personal profile:</label>
  102 + <label class=special><input type="checkbox" name="profile_desktop" class="DEPENDS ON strategy BEING hybrid" > Desktop</label>
  103 + <label class=special><input type="checkbox" name="profile_admin" class="DEPENDS ON strategy BEING hybrid" > Admin</label>
  104 + <label class=special><input type="checkbox" name="profile_devel" class="DEPENDS ON strategy BEING hybrid" > Devel</label>
  105 + <label class=special><input type="checkbox" name="profile_science" class="DEPENDS ON strategy BEING hybrid" > Science</label>
  106 + <label class=special><input type="checkbox" name="profile_arts" class="DEPENDS ON strategy BEING hybrid" > Arts</label>
46 107 </div>
  108 + </fieldset>
  109 + <fieldset>
  110 + <legend>Your packages</legend>
  111 + <div>
  112 + <label>Upload file<input type="file" id="pkgs_file" name="pkgs_file" size="18"/></label>
  113 + </div>
  114 + </fieldset>
  115 + </div><!-- id="advanced-slide" -->
  116 +
  117 + </form>
47 118 </div>
48   - <input type="file" name="pkgs_file" size="18" style="display: none;" />
49   - <input type="hidden" name="weight" value="BM25" checked="checked">
50   - <input type="hidden" name="strategy" value="content" checked="checked">
51   - <input type="hidden" name="profile_size" value="10" size="4">
52   - <input type="hidden" name="limit" value="10" size="4">
53   - <input type="hidden" name="neighbours" class="DEPENDS ON strategy BEING hybrid" value="50" size="4">
54   - </fieldset>
55   -</form>
56 119  
57 120  
58 121  
59 122 <!-- BOX ATTACHMENT FILE -->
60 123 <div id="attachfile" style="display: none;">
61 124 <h2>Recommendation with file list</h2>
62   -<form action="apprec" enctype="multipart/form-data" method="post" name="uploadbox-form">
  125 +<form action="apprec" enctype="multipart/form-data" method="post" name="uploadform">
63 126 <fieldset>
64 127 <label title="Upload file">Upload file: <input type="file" name="pkgs_file" size="18"/></label>
65 128 <p>
... ... @@ -81,89 +144,6 @@ You can use file &lt;strong&gt;/var/log/popularity-contest&lt;/strong&gt; or create a with &lt;
81 144 </div><!-- id="attachfile" -->
82 145 <!-- END BOX ATTACHMENT FILE -->
83 146  
84   -<!-- Dynamic form -->
85   -<script type="application/javascript">
86   -window.onload = function() {
87   - setupDependencies('weboptions'); //name of form(s). Seperate each with a comma (ie: 'weboptions', 'myotherform' )
88   - };
89   -</script>
90   -
91   -<div id="advancedquery" style="display: none">
92   -<form action="apprec" enctype="multipart/form-data" method="post" name="weboptions">
93   -
94   - <fieldset>
95   - <legend>General</legend>
96   -<div>
97   - <label><input type="hidden">Profile size:</label>
98   - <label class="special"><input type="text" name="profile_size" value="10" size="4"></label>
99   - <label><input type="hidden">Recommendations:</label>
100   - <label class="special"><input type="text" name="limit" value="10" size="4"></label>
101   -</div><div>
102   - <label><input type="hidden">Weighting:</label>
103   - <label class="special"><input type="radio" name="weight" value="BM25" checked="checked"> BM25</label>
104   - <label class="special"><input type="radio" name="weight" value="trad"> Traditional</label>
105   -</div><div>
106   - <label><input type="hidden">Strategy:</label>
107   -<div id="tab-area">
108   - <ul id="list-tabs">
109   - <li class="tab-one"><a href="#content-form">
110   - <label class="special"><input type="radio" name="strategy" value="content" id="strategy-content"> Content-based</label>
111   - </a></li>
112   - <li class="tab-two"><a href="#colaborative-form">
113   - <label class="special"><input type="radio" name="strategy" value="collab" id="strategy-collaborative"> Collaborative</label>
114   - </a></li>
115   - <li class="tab-three"><a href="#hybrid-form">
116   - <label class="special"><input type="radio" name="strategy" value="hybrid" id="strategy-hybrid"> Hybrid</label>
117   - </a></li>
118   - </ul>
119   - </div>
120   -
121   -</div>
122   - </fieldset>
123   - <fieldset>
124   - <legend>Tuning up</legend>
125   - <div id="content-form" class="group-form group-hybrid">
126   - <label><input type="hidden" class="DEPENDS ON strategy BEING content OR strategy BEING hybrid">Content representation:</label>
127   - <label class="special"><input type="radio" name="content" value="tag" class="DEPENDS ON strategy BEING content OR strategy BEING hybrid"> tag</label>
128   - <label class="special"><input type="radio" name="content" value="desc" class="DEPENDS ON strategy BEING content OR strategy BEING hybrid"> description</label> <label class="special"><input type="radio" name="content" value="full" class="DEPENDS ON strategy BEING content OR strategy BEING hybrid"> both</label>
129   - </div>
130   - <div id="colaborative-form" class="group-form group-hybrid">
131   - <label><input type="hidden">Clustering:</label>
132   - <label class="special"><input type="radio" name="cluster" value="yes"> yes</label>
133   - <label class="special"><input type="radio" name="cluster" value="no"> no</label>
134   - </div>
135   - <div id="hybrid-form" class="group-form group-hybrid">
136   - <label><input type="hidden" class="DEPENDS ON strategy BEING hybrid">Neighborhood:</label>
137   - <label class="special"><input type="text" name="neighbours" class="DEPENDS ON strategy BEING hybrid" value="50" size="4"></label>
138   - <label><input type="hidden" class="DEPENDS ON strategy BEING hybrid">Personal profile:</label>
139   - <label class=special><input type="checkbox" name="profile_desktop" class="DEPENDS ON strategy BEING hybrid" > Desktop</label>
140   - <label class=special><input type="checkbox" name="profile_admin" class="DEPENDS ON strategy BEING hybrid" > Admin</label>
141   - <label class=special><input type="checkbox" name="profile_devel" class="DEPENDS ON strategy BEING hybrid" > Devel</label>
142   - <label class=special><input type="checkbox" name="profile_science" class="DEPENDS ON strategy BEING hybrid" > Science</label>
143   - <label class=special><input type="checkbox" name="profile_arts" class="DEPENDS ON strategy BEING hybrid" > Arts</label>
144   - </div>
145   - </fieldset>
146   - <fieldset>
147   - <legend>Your packages</legend>
148   - <div>
149   - <label>Packages list<textarea rows="2" cols="33" name="pkgs_list" id="pkgs_list"></textarea></label>
150   - <label>Upload file<input type="file" id="pkgs_file" name="pkgs_file" size="18"/></label>
151   - </div>
152   - </fieldset>
153   -<div style="text-align: right;"><input type="submit"></div>
154   -</form>
155   -
156   -
157   -</div><!-- id="advancedquery" -->
158   -
159   - <div id="navbar">
160   - <ul>
161   - <li><a href="$url_base">Home</a></li>
162   - <li><a href="$url_base/about">About</a></li>
163   - <li><a href="$url_base/support">Support</a></li>
164   - <li><a href="http://github.com/tassia/AppRecommender">Development</a></li>
165   - </ul>
166   - </div><!-- id="navbar" -->
167 147  
168 148 </div><!-- id="header" -->
169 149 <div id="content">
... ...