Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

First implementation of widgets using jquery-ui

  • Loading branch information...
commit 670e7d724aa70f9f264125a1c179f6e0b451c688 1 parent d6893dc
@rosario authored
Showing with 18,970 additions and 235 deletions.
  1. +3 −8 app/controllers/dashboard_controller.rb
  2. +27 −1 app/controllers/graphs_controller.rb
  3. +1 −1  app/controllers/javascripts_controller.rb
  4. +129 −9 app/controllers/projects_controller.rb
  5. +52 −0 app/controllers/referers_controller.rb
  6. +170 −0 app/models/project.rb
  7. +17 −7 app/models/tracker.rb
  8. +27 −0 app/views/graphs/bello.html.erb
  9. +118 −65 app/views/graphs/graph1.html.erb
  10. +7 −11 app/views/layouts/graphs.html.erb
  11. +5 −2 app/views/layouts/login.html.erb
  12. +113 −24 app/views/layouts/projects.html.erb
  13. +11 −1 app/views/layouts/referers.html.erb
  14. +130 −24 app/views/login/login.html.erb
  15. +5 −3 app/views/{graphs → projects}/_bar_graph.html.erb
  16. +5 −3 app/views/{graphs → projects}/_line_plot.html.erb
  17. +11 −0 app/views/projects/_portlet.html.erb
  18. +36 −0 app/views/projects/_portlet_table.html.erb
  19. +23 −0 app/views/projects/_table_panel.html.erb
  20. +22 −0 app/views/projects/_table_panel2.html.erb
  21. +46 −0 app/views/projects/_timeline_plot.html.erb
  22. +73 −0 app/views/projects/index.html.erb
  23. +66 −10 app/views/projects/overview.html.erb
  24. +139 −0 app/views/projects/prova.html.erb
  25. +43 −0 app/views/projects/referrers.html.erb
  26. +76 −0 app/views/projects/visitors.html.erb
  27. +0 −29 app/views/referers/_table_panel.html.erb
  28. +24 −0 app/views/referers/bello.html.erb
  29. +47 −33 app/views/referers/queries.html.erb
  30. +14 −4 config/routes.rb
  31. BIN  public/images/icons/first.png
  32. BIN  public/images/icons/last.png
  33. BIN  public/images/icons/next.png
  34. BIN  public/images/icons/prev.png
  35. +25 −0 public/javascripts/addons/pager/jquery.tablesorter.pager.css
  36. +184 −0 public/javascripts/addons/pager/jquery.tablesorter.pager.js
  37. +160 −0 public/javascripts/jquery-ui.js
  38. +1,860 −0 public/javascripts/jquery.flot.pie.js
  39. +5 −0 public/javascripts/jquery.flot.pie.pack.js
  40. +32 −0 public/javascripts/jquery.js
  41. +80 −0 public/javascripts/jquery.layout.min.js
  42. +2 −0  public/javascripts/jquery.tablesorter.min.js
  43. +19 −0 public/javascripts/jquery/jquery-1.3.2.min.js
  44. +273 −0 public/javascripts/jquery/jquery-ui-1.7.1.custom.min.js
  45. +1 −0  public/javascripts/jrails.js
  46. BIN  public/stylesheets/blue/asc.gif
  47. BIN  public/stylesheets/blue/bg.gif
  48. BIN  public/stylesheets/blue/desc.gif
  49. +39 −0 public/stylesheets/blue/style.css
  50. BIN  public/stylesheets/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
  51. BIN  public/stylesheets/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
  52. BIN  public/stylesheets/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
  53. BIN  public/stylesheets/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
  54. BIN  public/stylesheets/smoothness/images/ui-bg_glass_75_dadada_1x400.png
  55. BIN  public/stylesheets/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
  56. BIN  public/stylesheets/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
  57. BIN  public/stylesheets/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  58. BIN  public/stylesheets/smoothness/images/ui-icons_222222_256x240.png
  59. BIN  public/stylesheets/smoothness/images/ui-icons_2e83ff_256x240.png
  60. BIN  public/stylesheets/smoothness/images/ui-icons_454545_256x240.png
  61. BIN  public/stylesheets/smoothness/images/ui-icons_888888_256x240.png
  62. BIN  public/stylesheets/smoothness/images/ui-icons_cd0a0a_256x240.png
  63. +404 −0 public/stylesheets/smoothness/jquery-ui-1.7.1.custom.css
  64. +3 −0  tablesorter/.settings/org.eclipse.core.resources.prefs
  65. BIN  tablesorter/addons/pager/icons/first.png
  66. BIN  tablesorter/addons/pager/icons/last.png
  67. BIN  tablesorter/addons/pager/icons/next.png
  68. BIN  tablesorter/addons/pager/icons/prev.png
  69. +25 −0 tablesorter/addons/pager/jquery.tablesorter.pager.css
  70. +184 −0 tablesorter/addons/pager/jquery.tablesorter.pager.js
  71. +26 −0 tablesorter/build.xml
  72. +106 −0 tablesorter/build/ParseMaster.js
  73. BIN  tablesorter/build/js.jar
  74. +316 −0 tablesorter/build/jsmin.js
  75. +5 −0 tablesorter/build/min.js
  76. +5 −0 tablesorter/build/pack.js
  77. +316 −0 tablesorter/build/packer.js
  78. +19 −0 tablesorter/build/writeFile.js
  79. +41 −0 tablesorter/changelog
  80. +43 −0 tablesorter/docs/assets/ajax-content.html
  81. +28 −0 tablesorter/docs/css/jq.css
  82. +119 −0 tablesorter/docs/example-ajax.html
  83. +75 −0 tablesorter/docs/example-empty-table.html
  84. +109 −0 tablesorter/docs/example-extending-defaults.html
  85. +108 −0 tablesorter/docs/example-meta-headers.html
  86. +105 −0 tablesorter/docs/example-meta-parsers.html
  87. +107 −0 tablesorter/docs/example-meta-sort-list.html
  88. +116 −0 tablesorter/docs/example-option-debug.html
  89. +106 −0 tablesorter/docs/example-option-digits.html
  90. +107 −0 tablesorter/docs/example-option-sort-force.html
  91. +108 −0 tablesorter/docs/example-option-sort-key.html
  92. +108 −0 tablesorter/docs/example-option-sort-list.html
  93. +108 −0 tablesorter/docs/example-option-sort-order.html
  94. +85 −0 tablesorter/docs/example-option-text-extraction.html
  95. +118 −0 tablesorter/docs/example-options-headers.html
  96. +329 −0 tablesorter/docs/example-pager.html
  97. +112 −0 tablesorter/docs/example-parsers.html
  98. +113 −0 tablesorter/docs/example-trigger-sort.html
  99. +336 −0 tablesorter/docs/example-triggers.html
  100. +383 −0 tablesorter/docs/example-widgets.html
  101. BIN  tablesorter/docs/img/external.png
  102. +559 −0 tablesorter/docs/index.html
  103. +392 −0 tablesorter/docs/js/chili/chili-1.8b.js
  104. +1 −0  tablesorter/docs/js/chili/chili-1.8b.pack.js
  105. +18 −0 tablesorter/docs/js/chili/cplusplus.css
  106. +22 −0 tablesorter/docs/js/chili/cplusplus.js
  107. +17 −0 tablesorter/docs/js/chili/csharp.css
  108. +21 −0 tablesorter/docs/js/chili/csharp.js
  109. +17 −0 tablesorter/docs/js/chili/css.css
  110. +21 −0 tablesorter/docs/js/chili/css.js
  111. +17 −0 tablesorter/docs/js/chili/delphi.css
  112. +21 −0 tablesorter/docs/js/chili/delphi.js
  113. +17 −0 tablesorter/docs/js/chili/html.css
  114. +23 −0 tablesorter/docs/js/chili/html.js
  115. +17 −0 tablesorter/docs/js/chili/java.css
  116. +21 −0 tablesorter/docs/js/chili/java.js
  117. +18 −0 tablesorter/docs/js/chili/javascript.css
  118. +22 −0 tablesorter/docs/js/chili/javascript.js
  119. +1 −0  tablesorter/docs/js/chili/jquery-1.1.2.pack.js
  120. +30 −0 tablesorter/docs/js/chili/js-jquery/javascript.css
  121. +68 −0 tablesorter/docs/js/chili/js-jquery/javascript.js
  122. +20 −0 tablesorter/docs/js/chili/lotusscript.css
  123. +27 −0 tablesorter/docs/js/chili/lotusscript.js
  124. +22 −0 tablesorter/docs/js/chili/mysql.css
  125. +32 −0 tablesorter/docs/js/chili/mysql.js
  126. +24 −0 tablesorter/docs/js/chili/php.css
  127. +31 −0 tablesorter/docs/js/chili/php.js
  128. +64 −0 tablesorter/docs/js/chili/recipes.css
  129. +98 −0 tablesorter/docs/js/chili/recipes.js
  130. +23 −0 tablesorter/docs/js/docs.js
  131. +29 −0 tablesorter/docs/js/examples.js
  132. +32 −0 tablesorter/jquery-latest.js
  133. +122 −0 tablesorter/jquery.metadata.js
  134. +852 −0 tablesorter/jquery.tablesorter.js
  135. +2 −0  tablesorter/jquery.tablesorter.min.js
  136. +28 −0 tablesorter/tests/assets/ajax-content.html
  137. +74 −0 tablesorter/tests/assets/css/default.css
  138. +20 −0 tablesorter/tests/assets/css/jquery.tabs-ie.css
  139. +97 −0 tablesorter/tests/assets/css/jquery.tabs.css
  140. BIN  tablesorter/tests/assets/img/header-asc.png
  141. BIN  tablesorter/tests/assets/img/header-bg.png
  142. BIN  tablesorter/tests/assets/img/header-desc.png
  143. BIN  tablesorter/tests/assets/img/small.gif
  144. BIN  tablesorter/tests/assets/img/small_asc.gif
  145. BIN  tablesorter/tests/assets/img/small_desc.gif
  146. BIN  tablesorter/tests/assets/img/tab.png
  147. +117 −0 tablesorter/tests/cell.metadata.html
  148. +83 −0 tablesorter/tests/checkbox.html
  149. +148 −0 tablesorter/tests/colspan.html
  150. +352 −0 tablesorter/tests/demo.html
  151. +22 −0 tablesorter/tests/index.html
  152. +30 −0 tablesorter/tests/large.html
  153. +320 −0 tablesorter/tests/metadata.html
  154. +309 −0 tablesorter/tests/pager.html
  155. BIN  tablesorter/themes/blue/asc.gif
  156. BIN  tablesorter/themes/blue/bg.gif
  157. BIN  tablesorter/themes/blue/blue.zip
  158. BIN  tablesorter/themes/blue/desc.gif
  159. +39 −0 tablesorter/themes/blue/style.css
  160. BIN  tablesorter/themes/green/asc.png
  161. BIN  tablesorter/themes/green/bg.png
  162. BIN  tablesorter/themes/green/desc.png
  163. BIN  tablesorter/themes/green/green.zip
  164. +39 −0 tablesorter/themes/green/style.css
  165. BIN  ui/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
  166. BIN  ui/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
  167. BIN  ui/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
  168. BIN  ui/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
  169. BIN  ui/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png
  170. BIN  ui/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
  171. BIN  ui/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
  172. BIN  ui/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  173. BIN  ui/css/smoothness/images/ui-icons_222222_256x240.png
  174. BIN  ui/css/smoothness/images/ui-icons_2e83ff_256x240.png
  175. BIN  ui/css/smoothness/images/ui-icons_454545_256x240.png
  176. BIN  ui/css/smoothness/images/ui-icons_888888_256x240.png
  177. BIN  ui/css/smoothness/images/ui-icons_cd0a0a_256x240.png
  178. +404 −0 ui/css/smoothness/jquery-ui-1.7.1.custom.css
  179. +30 −0 ui/development-bundle/AUTHORS.txt
  180. +278 −0 ui/development-bundle/GPL-LICENSE.txt
  181. +25 −0 ui/development-bundle/MIT-LICENSE.txt
  182. +58 −0 ui/development-bundle/demos/accordion/collapsible.html
  183. +60 −0 ui/development-bundle/demos/accordion/custom-icons.html
  184. +83 −0 ui/development-bundle/demos/accordion/default.html
  185. +76 −0 ui/development-bundle/demos/accordion/fillspace.html
  186. +20 −0 ui/development-bundle/demos/accordion/index.html
  187. +57 −0 ui/development-bundle/demos/accordion/mouseover.html
  188. +57 −0 ui/development-bundle/demos/accordion/no-auto-height.html
  189. +51 −0 ui/development-bundle/demos/addClass/default.html
  190. +17 −0 ui/development-bundle/demos/addClass/index.html
  191. +52 −0 ui/development-bundle/demos/animate/default.html
  192. +17 −0 ui/development-bundle/demos/animate/index.html
  193. +31 −0 ui/development-bundle/demos/datepicker/alt-field.html
  194. +33 −0 ui/development-bundle/demos/datepicker/buttonbar.html
  195. +43 −0 ui/development-bundle/demos/datepicker/date-formats.html
  196. +31 −0 ui/development-bundle/demos/datepicker/default.html
  197. +34 −0 ui/development-bundle/demos/datepicker/dropdown-month-year.html
  198. +31 −0 ui/development-bundle/demos/datepicker/icon-trigger.html
  199. BIN  ui/development-bundle/demos/datepicker/images/calendar.gif
  200. +26 −0 ui/development-bundle/demos/datepicker/index.html
  201. +31 −0 ui/development-bundle/demos/datepicker/inline.html
  202. +120 −0 ui/development-bundle/demos/datepicker/localization.html
  203. +31 −0 ui/development-bundle/demos/datepicker/min-max.html
  204. +34 −0 ui/development-bundle/demos/datepicker/multiple-calendars.html
  205. +334 −0 ui/development-bundle/demos/demos.css
  206. +51 −0 ui/development-bundle/demos/dialog/default.html
  207. +21 −0 ui/development-bundle/demos/dialog/index.html
  208. +67 −0 ui/development-bundle/demos/dialog/modal-confirmation.html
  209. +178 −0 ui/development-bundle/demos/dialog/modal-form.html
  210. +64 −0 ui/development-bundle/demos/dialog/modal-message.html
  211. +55 −0 ui/development-bundle/demos/dialog/modal.html
  212. +67 −0 ui/development-bundle/demos/draggable/constrain-movement.html
  213. +46 −0 ui/development-bundle/demos/draggable/cursor-style.html
  214. +38 −0 ui/development-bundle/demos/draggable/default.html
  215. +42 −0 ui/development-bundle/demos/draggable/delay-start.html
  216. +74 −0 ui/development-bundle/demos/draggable/events.html
  217. +45 −0 ui/development-bundle/demos/draggable/handle.html
  218. +27 −0 ui/development-bundle/demos/draggable/index.html
  219. +41 −0 ui/development-bundle/demos/draggable/revert.html
  220. +48 −0 ui/development-bundle/demos/draggable/scroll.html
  221. +67 −0 ui/development-bundle/demos/draggable/snap-to.html
  222. +54 −0 ui/development-bundle/demos/draggable/sortable.html
  223. +73 −0 ui/development-bundle/demos/draggable/visual-feedback.html
  224. +55 −0 ui/development-bundle/demos/droppable/accepted-elements.html
  225. +46 −0 ui/development-bundle/demos/droppable/default.html
  226. BIN  ui/development-bundle/demos/droppable/images/high_tatras.jpg
  227. BIN  ui/development-bundle/demos/droppable/images/high_tatras2.jpg
  228. BIN  ui/development-bundle/demos/droppable/images/high_tatras2_min.jpg
  229. BIN  ui/development-bundle/demos/droppable/images/high_tatras3.jpg
  230. BIN  ui/development-bundle/demos/droppable/images/high_tatras3_min.jpg
  231. BIN  ui/development-bundle/demos/droppable/images/high_tatras4.jpg
  232. BIN  ui/development-bundle/demos/droppable/images/high_tatras4_min.jpg
  233. BIN  ui/development-bundle/demos/droppable/images/high_tatras_min.jpg
  234. +22 −0 ui/development-bundle/demos/droppable/index.html
  235. +164 −0 ui/development-bundle/demos/droppable/photo-manager.html
  236. +71 −0 ui/development-bundle/demos/droppable/propagation.html
  237. +55 −0 ui/development-bundle/demos/droppable/revert.html
  238. +70 −0 ui/development-bundle/demos/droppable/visual-feedback.html
  239. +104 −0 ui/development-bundle/demos/effect/default.html
  240. +17 −0 ui/development-bundle/demos/effect/index.html
  241. +105 −0 ui/development-bundle/demos/hide/default.html
  242. +17 −0 ui/development-bundle/demos/hide/index.html
  243. BIN  ui/development-bundle/demos/images/calendar.gif
  244. BIN  ui/development-bundle/demos/images/demo-config-on-tile.gif
  245. BIN  ui/development-bundle/demos/images/demo-config-on.gif
  246. BIN  ui/development-bundle/demos/images/demo-spindown-closed.gif
  247. BIN  ui/development-bundle/demos/images/demo-spindown-open.gif
  248. BIN  ui/development-bundle/demos/images/icon-docs-info.gif
  249. BIN  ui/development-bundle/demos/images/pbar-ani.gif
  250. +292 −0 ui/development-bundle/demos/index.html
  251. +42 −0 ui/development-bundle/demos/progressbar/animated.html
  252. +37 −0 ui/development-bundle/demos/progressbar/default.html
  253. BIN  ui/development-bundle/demos/progressbar/images/pbar-ani.gif
  254. +19 −0 ui/development-bundle/demos/progressbar/index.html
  255. +37 −0 ui/development-bundle/demos/progressbar/resize.html
  256. +51 −0 ui/development-bundle/demos/removeClass/default.html
  257. +17 −0 ui/development-bundle/demos/removeClass/index.html
  258. +38 −0 ui/development-bundle/demos/resizable/animate.html
  259. +37 −0 ui/development-bundle/demos/resizable/aspect-ratio.html
  260. +42 −0 ui/development-bundle/demos/resizable/constrain-area.html
  261. +35 −0 ui/development-bundle/demos/resizable/default.html
  262. +49 −0 ui/development-bundle/demos/resizable/delay-start.html
  263. +25 −0 ui/development-bundle/demos/resizable/index.html
  264. +40 −0 ui/development-bundle/demos/resizable/max-min.html
  265. +37 −0 ui/development-bundle/demos/resizable/snap-to-grid.html
  266. +44 −0 ui/development-bundle/demos/resizable/synchronous-resize.html
  267. +38 −0 ui/development-bundle/demos/resizable/visual-feedback.html
  268. +45 −0 ui/development-bundle/demos/selectable/default.html
  269. +50 −0 ui/development-bundle/demos/selectable/display-grid.html
  270. +19 −0 ui/development-bundle/demos/selectable/index.html
  271. +56 −0 ui/development-bundle/demos/selectable/serialize.html
  272. +106 −0 ui/development-bundle/demos/show/default.html
  273. +17 −0 ui/development-bundle/demos/show/index.html
  274. +92 −0 ui/development-bundle/demos/slider/colorpicker.html
  275. +34 −0 ui/development-bundle/demos/slider/default.html
  276. +25 −0 ui/development-bundle/demos/slider/index.html
  277. +76 −0 ui/development-bundle/demos/slider/multiple-vertical.html
  278. +47 −0 ui/development-bundle/demos/slider/range-vertical.html
  279. +48 −0 ui/development-bundle/demos/slider/range.html
  280. +47 −0 ui/development-bundle/demos/slider/rangemax.html
  281. +48 −0 ui/development-bundle/demos/slider/rangemin.html
  282. +49 −0 ui/development-bundle/demos/slider/slider-vertical.html
  283. +48 −0 ui/development-bundle/demos/slider/steps.html
  284. +76 −0 ui/development-bundle/demos/sortable/connect-lists-through-tabs.html
  285. +55 −0 ui/development-bundle/demos/sortable/connect-lists.html
  286. +48 −0 ui/development-bundle/demos/sortable/default.html
  287. +64 −0 ui/development-bundle/demos/sortable/delay-start.html
  288. +51 −0 ui/development-bundle/demos/sortable/display-grid.html
  289. +66 −0 ui/development-bundle/demos/sortable/empty-lists.html
  290. +25 −0 ui/development-bundle/demos/sortable/index.html
  291. +68 −0 ui/development-bundle/demos/sortable/items.html
  292. +53 −0 ui/development-bundle/demos/sortable/placeholder.html
  293. +93 −0 ui/development-bundle/demos/sortable/portlets.html
  294. +47 −0 ui/development-bundle/demos/switchClass/default.html
  295. +17 −0 ui/development-bundle/demos/switchClass/index.html
Sorry, we could not display the entire diff because too many files (475) changed.
View
11 app/controllers/dashboard_controller.rb
@@ -12,7 +12,7 @@ def index
redirect_to :controller =>'dashboard', :action=> 'setup'
else
session[:project_id] = pid
- redirect_to project_overview_url(:id =>pid)
+ redirect_to project_index_url
end
end
@@ -26,12 +26,11 @@ def create
u = User.find(session[:user_id])
project_name = params[:project_name]
-
if u.project_id.nil?
p = Project.create(:name=>project_name)
u.project_id = p.id
u.save
-
+ #
# # Testing, add the actions
# urls = ["http://0.0.0.0:3000/website/page1",
# "http://0.0.0.0:3000/website/page2",
@@ -51,16 +50,12 @@ def create
# p.visitors << v
# end
-
-
else
p= Project.find(u.project_id)
end
session[:project_id]= p.id
-
-
- redirect_to project_overview_url(:id => p.id)
+ redirect_to project_index_url
end
end
View
28 app/controllers/graphs_controller.rb
@@ -1,9 +1,35 @@
class GraphsController < ApplicationController
before_filter :authorize
+ layout "graphs", :except => [:overview, :bello]
-
+ def bello
+ p = Project.find(session[:project_id])
+
+ @project = p
+ bod = Time.parse("2009-01-01").strftime("%Y-%m-%d %H:%M:%S")
+ #eod = Time.parse("2009-01-29").end_of_day.strftime("%Y-%m-%d %H:%M:%S")
+ eod = Time.now.end_of_day.strftime("%Y-%m-%d %H:%M:%S")
+
+ conditions = ["created_at > ? AND created_at < ?", "#{bod}", "#{eod}"]
+
+ vs = p.visitors.find(:all,:conditions=>conditions)
+
+ # This data is used to show how to use the line_plot partial
+ @example = [[0,0],[1,1],[2,2]]
+
+
+ # @total_clicks = p.visitors.count(:id,
+ # :group => 'strftime("%Y/%m/%d",created_at)',
+ # :conditions => conditions)
+
+ @total_clicks = vs.group_by { |v|
+ v.created_at.strftime("%Y/%m/%d")
+ }.map{|k,v| [k,v.size]}.sort_by {|date,x| date}
+
+
+ end
# Graphs are created in this method
View
2  app/controllers/javascripts_controller.rb
@@ -46,7 +46,7 @@ def log
hostname = URI.parse(params[:url]).host
if hostname.match(p.name)
puts " >>>>>>>>>>>>>>>>>> HOSTNAME MATCHES with the correct project_id"
- visitor_settings = Tracker.get_settings(params,request)
+ visitor_settings = Tracker.get_settings(params,request,p.name)
if session[:visitor_id]
# Se c''e il visitor_id allora e' conosciuto
# Vedo se l'ultima azione e' stata fatta in meno di mezzo'ora
View
138 app/controllers/projects_controller.rb
@@ -1,23 +1,143 @@
class ProjectsController < ApplicationController
before_filter :authorize
+ layout "projects", :except => [ :overview, :visitors,:referrers]
+
-
-
def index
- redirect_to project_overview_url :id=>session[:project_id]
+
+ @project = Project.find(session[:project_id])
+ p = @project
+ bod = Time.parse("2009-01-01").strftime("%Y-%m-%d %H:%M:%S")
+ eod = Time.now.end_of_day.strftime("%Y-%m-%d %H:%M:%S")
+
+ conditions = ["created_at > ? AND created_at < ?", "#{bod}", "#{eod}"]
+
+ vs = p.visitors.find(:all,:conditions=>conditions)
+ @total_clicks = p.total_clicks(vs)
+
+ @nvisits = vs.size
+ @page_views =p.page_views(vs)
+ if @page_views == 0
+ @avg_pageviews = 0
+ else
+ @avg_pageviews = "%.2f" % ((@page_views+0.0)/@nvisits)
+ end
+
+ @time_on_site = p.time_on_site(vs)
+ @bounce_rate = "%.2f" % (p.bounce_rate(vs) * 100)
+ @new_visits = "%.2f" % (p.new_visits(vs) * 100)
+ @data_website = p.website_list(vs).first(10)
+
+
+
end
- def overview
- if session[:project_id] == nil
- @project = nil
- else
- @project = Project.find(session[:project_id])
- end
+ # def overview
+ #
+ # redirect_to :action =>"index"
+ # # if session[:project_id] == nil
+ # # @project = nil
+ # # else
+ # # @project = Project.find(session[:project_id])
+ # # p = @project
+ # # bod = Time.parse("2009-01-01").strftime("%Y-%m-%d %H:%M:%S")
+ # # eod = Time.now.end_of_day.strftime("%Y-%m-%d %H:%M:%S")
+ # #
+ # # conditions = ["created_at > ? AND created_at < ?", "#{bod}", "#{eod}"]
+ # #
+ # # vs = p.visitors.find(:all,:conditions=>conditions)
+ # # @total_clicks = p.total_clicks(vs)
+ # #
+ # # @nvisits = vs.size
+ # # @page_views = p.page_views(vs)
+ # #
+ # # if @page_views == 0
+ # # @avg_pageviews = 0
+ # # else
+ # # @avg_pageviews = "%.2f" % ((@page_views+0.0)/@nvisits)
+ # # end
+ # #
+ # # @time_on_site = p.time_on_site(vs)
+ # # @bounce_rate = "%.2f" % (p.bounce_rate(vs) * 100)
+ # # @new_visits = "%.2f" % (p.new_visits(vs) * 100)
+ # #
+ # # @data_website = p.website_list(vs)
+ # #
+ # #
+ # # end
+ # end
+ def referrers
+ p = Project.find(session[:project_id])
+ @project = p
+ bod = Time.parse("2009-01-01").strftime("%Y-%m-%d %H:%M:%S")
+ eod = Time.now.end_of_day.strftime("%Y-%m-%d %H:%M:%S")
+
+ conditions = ["created_at > ? AND created_at < ?", "#{bod}", "#{eod}"]
+
+ vs = p.visitors.find(:all,:conditions=>conditions)
+ @data_website = p.website_list(vs)
+ @searched_keywords = p.search_engine_queries(vs)
+
+
+
end
+ def visitors
+ p = Project.find(session[:project_id])
+ @project = p
+ bod = Time.parse("2009-01-01").strftime("%Y-%m-%d %H:%M:%S")
+ eod = Time.now.end_of_day.strftime("%Y-%m-%d %H:%M:%S")
+ conditions = ["created_at > ? AND created_at < ?", "#{bod}", "#{eod}"]
+
+ vs = p.visitors.find(:all,:conditions=>conditions)
+
+
+
+ @config_os = p.config_os(vs)
+ @browsers = p.browsers(vs)
+ #@hours_by_servertime = p.hours_by_servertime(vs)
+ @config_resolution = p.config_resolution(vs).first(5)
+
+
+ end
+
+ def prova
+ p = Project.find(session[:project_id])
+
+ @project = p
+ bod = Time.parse("2009-01-01").strftime("%Y-%m-%d %H:%M:%S")
+ eod = Time.now.end_of_day.strftime("%Y-%m-%d %H:%M:%S")
+
+ conditions = ["created_at > ? AND created_at < ?", "#{bod}", "#{eod}"]
+
+ vs = p.visitors.find(:all,:conditions=>conditions)
+
+
+
+ @total_clicks = p.total_clicks(vs)
+ @config_os = p.config_os(vs)
+ @browsers = p.browsers(vs)
+ @actions = p.visitors_per_action
+ @search_engines = p.search_engines(vs)
+ @time_spent = p.time_spent(vs)
+ @hours_by_servertime = p.hours_by_servertime(vs)
+ @traffic_sources = p.traffic_sources(vs)
+
+
+ @data = p.search_engine_queries(vs)
+ @data_website = p.website_list(vs)
+
+ @nvisits = vs.size
+ @page_views = p.page_views(vs)
+ @avg_pageviews = "%.2f" % ((@page_views+0.0)/@nvisits)
+ @time_on_site = p.time_on_site(vs)
+ @bounce_rate = "%.2f" % (p.bounce_rate(vs) * 100)
+ @new_visits = "%.2f" % (p.new_visits(vs) * 100)
+
+ end
end
View
52 app/controllers/referers_controller.rb
@@ -1,6 +1,58 @@
class ReferersController < ApplicationController
before_filter :authorize
+ layout "referers", :except => [:bello]
+
+
+
+ def bello
+ @project = Project.find(session[:project_id])
+ @variabile = 1
+
+ p = @project
+
+
+ bod = Time.parse("2009-01-01").strftime("%Y-%m-%d %H:%M:%S")
+ # eod = Time.parse("2009-01-29").end_of_day.strftime("%Y-%m-%d %H:%M:%S")
+ eod = Time.now.end_of_day.strftime("%Y-%m-%d %H:%M:%S")
+
+ conditions = ["referer_type = ? AND created_at > ? AND created_at < ? AND referer_keyword IS NOT NULL",
+ "1", "#{bod}", "#{eod}"]
+
+
+
+ # @queries = p.visitors.count(:id,
+ # :group => 'referer_keyword',
+ # :conditions => conditions).sort_by{|x,y| y}.reverse
+
+ total_visits = p.visitors.find(:all, :conditions => conditions)
+
+ queries = total_visits.group_by{|v| v.referer_keyword}
+
+ list = []
+
+
+ queries.keys.each do |k|
+ vs = queries[k]
+ nvisitors = queries[k].size
+
+ total_actions = vs.inject(0){|total,v| total + v.total_actions}
+ total_time = vs.inject(0){|total,v| total + v.time_spent}
+ avg_time = (total_time/nvisitors).to_i
+ avg_time = [avg_time/60 % 60, avg_time % 60].map{|t| t.to_s.rjust(2,'0')}.join(':')
+ list << [k,
+ nvisitors,
+ "%.2f" % ((total_actions+0.0)/nvisitors),
+ avg_time
+
+ ]
+
+ end
+ @data = list.sort_by{|q,v,a,t| v}.reverse.first(25)
+
+
+ end
+
def queries
@project = Project.find(session[:project_id])
@variabile = 1
View
170 app/models/project.rb
@@ -5,6 +5,176 @@ class Project < ActiveRecord::Base
has_many :actions
+
+ def total_clicks(vs)
+ vs.group_by { |v|
+ v.created_at.strftime("%Y/%m/%d")
+ }.map{|k,v| [k,v.size]}.sort_by {|date,x| date}
+ end
+
+
+ def website_list(vs)
+ total_visits = vs.select{|v| v.referer_type == 3 and (not v.referer_name.nil?)}
+ queries = total_visits.group_by{|v| v.referer_name}
+
+ list = []
+ queries.keys.each do |k|
+ vs = queries[k]
+ nvisitors = queries[k].size
+
+ total_actions = vs.inject(0){|total,v| total + v.total_actions}
+ total_time = vs.inject(0){|total,v| total + v.time_spent}
+ avg_time = (total_time/nvisitors).to_i
+ avg_time = [avg_time/60 % 60, avg_time % 60].map{|t| t.to_s.rjust(2,'0')}.join(':')
+ list << [k,
+ nvisitors,
+ "%.2f" % ((total_actions+0.0)/nvisitors),
+ avg_time
+
+ ]
+
+ end
+
+ ls = list.sort_by{|q,v,p,t| v}.reverse.first(25)
+ return ls
+
+ end
+
+
+ def search_engine_queries(vs)
+
+ total_visits = vs.select{|v| v.referer_type == 1 and (not v.referer_keyword.nil?)}
+ queries = total_visits.group_by{|v| v.referer_keyword}
+
+ list = []
+
+
+ queries.keys.each do |k|
+ vs = queries[k]
+ nvisitors = queries[k].size
+
+ total_actions = vs.inject(0){|total,v| total + v.total_actions}
+ total_time = vs.inject(0){|total,v| total + v.time_spent}
+ avg_time = (total_time/nvisitors).to_i
+ avg_time = [avg_time/60 % 60, avg_time % 60].map{|t| t.to_s.rjust(2,'0')}.join(':')
+ list << [k,
+ nvisitors,
+ "%.2f" % ((total_actions+0.0)/nvisitors),
+ avg_time
+
+ ]
+
+
+
+ end
+ ls = list.sort_by{|q,v,a,t| v}.reverse.first(25)
+
+ return ls
+ end
+
+ def browsers(vs)
+ vs.group_by{|v| v.config_browser_name}.map{|k,v| [k,v.size]}.sort_by{|x,y| y}.reverse.first(9)
+ end
+
+
+
+ # @config_os = p.visitors.count(:id,
+ # :group =>:config_os,
+ # :conditions => conditions).sort_by{|x,y| y}.reverse
+ #
+ def config_os(vs)
+ vs.group_by{|v| v.config_os}.map{|k,v| [k,v.size]}.sort_by{|x,y| y}.reverse.first(9)
+ end
+
+ def config_resolution(vs)
+ vs.group_by{|v| v.config_resolution}.map{|k,v| [k,v.size]}.sort_by{|x,y| y}.reverse.first(9)
+
+ end
+
+
+
+ # @hours_by_servertime = p.visitors.count(:id,
+ # :group => 'strftime("%H",created_at)',
+ # :conditions => conditions)
+ def hours_by_servertime(vs)
+ vs.group_by{|v| v.created_at.strftime("%H")}.map{|k,v| [k,v.size]}.sort_by {|date,x| date}
+ end
+
+
+ def traffic_sources(vs)
+ ref_type = []
+ ref_type[0] = "Campaign"
+ ref_type[1] = "Search engine"
+ ref_type[2] = "Direct entry"
+ ref_type[3] = "Referring sites"
+
+ size = vs.size
+ vs.group_by{|v| v.referer_type}.map{|k,v| [k,v.size]}.sort_by{|x,y| y}.reverse.map{|k,v| [ref_type[k], "%.2f" % (((v+0.0)/size)*100)]}
+
+
+ end
+
+ # @search_engines = p.visitors.count(:id,
+ # :group => 'referer_name',
+ # :conditions => ["referer_type = ? AND created_at > ? AND created_at < ?", "1", "#{bod}", "#{eod}"] ).sort_by{|x,y| y}.reverse
+ def search_engines(vs)
+ vs.select{|v| v.referer_type == 1}.group_by{|v| v.referer_name}.map{|k,v| [k,v.size]}.sort_by{|x,y| y}.reverse
+ end
+
+
+ def time_spent(vs)
+ vs.group_by {|v|v.time_spent_in_words }.map{|k,v| [k,v.size]}.sort_by{|t,s| s}.reverse
+ end
+
+ def time_on_site(vs)
+ if vs.size == 0
+ return 0
+ else
+ secs =vs.inject(0){|sum,v| sum + v.time_spent.to_i}
+ secs = (secs)/vs.size
+ return [ secs/3600, secs / 60, secs % 60 ].map{ |t| t.to_s.rjust(2, '0') }.join(':')
+ #return secs
+ end
+
+
+ end
+
+ def visitors_per_action
+ as = self.actions
+ as.map{|a| [a.path,a.visitors.count(:group => :visitor_id).size]}.sort_by{|u,s| s}.reverse
+ end
+
+ def bounce_rate(vs)
+ if vs.size == 0
+ return 0
+ else
+ one_page_visitors = vs.select{|v| v.actions.size == 1}.size
+ return (one_page_visitors+0.0)/vs.size
+ end
+
+ end
+
+ def new_visits(vs)
+ if vs.size == 0
+ return 0
+ else
+ new_ones = vs.select{|v| v.was_here == 0}.size
+ return (new_ones+0.0)/vs.size
+ end
+
+ end
+
+ def page_views(vs)
+ if vs.size == 0
+ return 0
+ else
+ pages = vs.inject(0){|sum,v| sum + v.actions.size}
+ end
+
+ end
+
+
+
# Check if a visitor in this project was here today
def visitor_here_today?(user_settings)
md5config = user_settings[:config_md5config]
View
24 app/models/tracker.rb
@@ -6,6 +6,17 @@ class Tracker
REFERER_TYPE_DIRECT_ENTRY = 2
REFERER_TYPE_WEBSITE = 3
+ # def kakka
+ # for v in vs
+ # if (not v.referer_name.nil?) and v.referer_name.match(p.name)
+ # puts v.referer_name
+ # v.referer_type = 2
+ # v.save
+ # end
+ # end;0
+ #
+ #
+ # end
# Check if the query of the url contains "campaign_name" and "campaign_keyword"
def self.check_campaign(string)
@@ -31,12 +42,11 @@ def self.check_campaign(string)
# Get referer informations
- def self.referer_info(urlref)
+ def self.referer_info(urlref,domain_name)
- # This is the name of the domain running the analysis... at the moment is just localhost
- # Later it should be the name of the host that signed up
- actual_domain = "localhost"
+ #the name of the host that signed up
+ actual_domain = domain_name
urlref = URI.encode(urlref)
@@ -58,7 +68,7 @@ def self.referer_info(urlref)
referer_keyword = Parser::Keyword.get_terms(urlref)
puts referer_keyword
referer_name = search_engine
- elsif actual_domain == referer_name
+ elsif referer_name.match(actual_domain)
referer_type = REFERER_TYPE_DIRECT_ENTRY
referer_keyword = ""
else
@@ -79,7 +89,7 @@ def self.referer_info(urlref)
end
# Return a user_settings hash, containin the information extracted from params[] and request.env
- def self.get_settings(p,r)
+ def self.get_settings(p,r,domain_name)
# get user settings informations
@@ -105,7 +115,7 @@ def self.get_settings(p,r)
browserLang = r.env['HTTP_ACCEPT_LANGUAGE']
- refererinfo = referer_info(p[:urlref])
+ refererinfo = referer_info(p[:urlref],domain_name)
configuration_hash = Digest::MD5.hexdigest(
os +
View
27 app/views/graphs/bello.html.erb
@@ -0,0 +1,27 @@
+
+ <script type="text/javascript">
+ $(function() {
+ $(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
+ .find(".portlet-header")
+ .addClass("ui-widget-header ui-corner-all")
+ .prepend('<span class="ui-icon ui-icon-plusthick"></span>')
+ .end()
+ .find(".portlet-content");
+
+ $(".portlet-header .ui-icon").click(function() {
+ $(this).toggleClass("ui-icon-minusthick");
+ $(this).parents(".portlet:first").find(".portlet-content").toggle();
+ });
+
+ });
+ </script>
+ <div style="width:500px">
+ <%= render :partial =>"portlet",
+ :locals =>{ :data =>@total_clicks,
+ :placeholder =>"placeholder11234",
+ :legend =>"Total clicks",
+ :title => "Titolo di prova",
+ :graph_type => "timeline_plot"
+ }
+ %>
+ </div>
View
183 app/views/graphs/graph1.html.erb
@@ -1,75 +1,128 @@
+<style type="text/css">
+ .column { width: 500px; float: left; padding-bottom: 100px; }
+ .portlet { margin: 0 1em 1em 0; }
+ .portlet-header { margin: 0.3em; padding-bottom: 4px; padding-left: 0.2em; }
+ .portlet-header .ui-icon { float: right; }
+ .portlet-content { padding: 0.4em; }
+ .ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; height: 50px !important; }
+ .ui-sortable-placeholder * { visibility: hidden; }
+</style>
+<script type="text/javascript">
+$(function() {
+ $(".column").sortable({
+ connectWith: '.column'
+ });
+
+ $(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
+ .find(".portlet-header")
+ .addClass("ui-widget-header ui-corner-all")
+ .prepend('<span class="ui-icon ui-icon-plusthick"></span>')
+ .end()
+ .find(".portlet-content");
+
+ $(".portlet-header .ui-icon").click(function() {
+ $(this).toggleClass("ui-icon-minusthick");
+ $(this).parents(".portlet:first").find(".portlet-content").toggle();
+ });
+
+ $(".column").disableSelection();
+});
+</script>
+
+
+
+<div class="column">
+
+ <%= render :partial =>"portlet",
+ :locals =>{
+ :data =>@config_os,
+ :placeholder => "placeholder33",
+ :legend => "Operating Systems222",
+ :title => "Titolo di prova",
+ :graph_type => "bar_graph"
+ }
+ %>
+
+ <%= render :partial =>"portlet",
+ :locals =>{ :data =>@browsers,
+ :placeholder =>"placeholder2",
+ :legend =>"Browsers",
+ :title => "Titolo di prova",
+ :graph_type => "bar_graph"
+ }
+ %>
+
+
+ <%= render :partial =>"portlet",
+ :locals =>{ :data =>@actions,
+ :placeholder =>"placeholder8",
+ :legend =>"No. of visitors per page",
+ :title => "Titolo di prova",
+ :graph_type => "bar_graph"
+ }
+ %>
+
+
+
+</div>
+
+
+
+<div class="column">
+
+
+
+ <%= render :partial =>"portlet",
+ :locals =>{ :data =>@search_engines,
+ :placeholder =>"placeholder5",
+ :legend =>"Search Engines",
+ :title => "Titolo di prova",
+ :graph_type => "bar_graph"
+ }
+ %>
+
+
+
+ <%= render :partial =>"portlet",
+ :locals =>{ :data =>@time_spent,
+ :placeholder =>"placeholder6",
+ :legend =>"Time spent on site",
+ :title => "Titolo di prova",
+ :graph_type => "bar_graph"
+ }
+ %>
+
+
+ <%= render :partial =>"portlet",
+ :locals =>{ :data =>@hours_by_servertime,
+ :placeholder =>"placeholder4",
+ :legend =>"Hours by server time",
+ :title => "Titolo di prova",
+ :graph_type => "bar_graph"
+ }
+ %>
+
+
+ <%= render :partial =>"portlet",
+ :locals =>{ :data =>@total_clicks,
+ :placeholder =>"placeholder1",
+ :legend =>"Total clicks",
+ :title => "Titolo di prova",
+ :graph_type => "timeline_plot"
+ }
+ %>
+
+
+
+</div>
-<div id="panel">
-<table>
-
-<tbody>
-<tr>
-<td>
-<%= render :partial => "line_plot" ,
- :locals => {:data => @total_clicks,
- :legend => "Total clicks",
- :xaxis_mode => "time", # If this label is not present, a normal graph is plotted
- :placeholder => "placeholder1" }
-%>
-
-</td>
-<td>
- <%= render :partial => "bar_graph",
- :locals => {:data =>@actions,
- :placeholder => "placeholder8",
- :legend => "Number of visitors per page"}%>
-
-</td>
-</tr>
-<tr>
-<td>
-
-
- <%= render :partial => "bar_graph",
- :locals => {:data =>@browsers,
- :placeholder => "placeholder2",
- :legend => "Browsers" }%>
-</td>
-<td>
- <%= render :partial => "bar_graph",
- :locals => {:data =>@config_os,
- :placeholder => "placeholder3" ,
- :legend => "Operating Systems"}%>
-</td>
-</tr>
-<tr>
-<td>
-<%= render :partial => "bar_graph",
- :locals => {:data =>@hours_by_servertime,
- :placeholder => "placeholder4",
- :legend => "Hours by Server Time"}%>
-</td>
-<td>
-<%= render :partial => "bar_graph",
- :locals => {:data =>@search_engines,
- :placeholder => "placeholder5",
- :legend => "Search Engines"}%>
-</td>
-</tr>
-<tr>
-<td>
-<%= render :partial => "bar_graph",
- :locals => {:data =>@time_spent,
- :placeholder => "placeholder6",
- :legend => "Time Spent on Site"}%>
-</td>
-<td>
<%#= render :partial => "bar_graph",
:locals => {:data =>@actions,
:placeholder => "placeholder8",
:legend => "Number of visitors per page"}%>
-</td>
-</tr>
-</tbody>
-</thead>
-</div>
+
<%# Example. The data is plotted, with no "time" formatting %>
<%#= render :partial => "line_plot" ,
:locals => {:data => @example,
View
18 app/views/layouts/graphs.html.erb
@@ -5,8 +5,12 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title> Graphs </title>
- <%= stylesheet_link_tag 'screen2' %>
- <%= javascript_include_tag 'flot/jquery' %>
+ <%#= stylesheet_link_tag 'screen2' %>
+ <%#= javascript_include_tag 'flot/jquery' %>
+
+ <link type="text/css" href="/stylesheets/smoothness/jquery-ui-1.7.1.custom.css" rel="stylesheet" />
+ <script type="text/javascript" src="/javascripts/jquery/jquery-1.3.2.min.js"></script>
+ <script type="text/javascript" src="/javascripts/jquery/jquery-ui-1.7.1.custom.min.js"></script>
<%= javascript_include_tag 'flot/jquery.flot'%>
</head>
@@ -28,14 +32,6 @@
<%= yield %>
</div>
- <!-- <div id="header">
- This is header
- </div>
- <div id="main">
- <%#= yield %>
- </div>
- <div id="footer">
- This is footer
- </div> -->
+
</body>
</html>
View
7 app/views/layouts/login.html.erb
@@ -5,8 +5,11 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title> Login </title>
- <%= stylesheet_link_tag 'login' %>
- <%= javascript_include_tag :defaults %>
+ <%#= stylesheet_link_tag 'login' %>
+ <%#= javascript_include_tag :defaults %>
+ <link type="text/css" href="/stylesheets/smoothness/jquery-ui-1.7.1.custom.css" rel="stylesheet" />
+ <script type="text/javascript" src="/javascripts/jquery/jquery-1.3.2.min.js"></script>
+ <script type="text/javascript" src="/javascripts/jquery/jquery-ui-1.7.1.custom.min.js"></script>
</head>
<body>
View
137 app/views/layouts/projects.html.erb
@@ -1,49 +1,138 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title> Projects </title>
<%= stylesheet_link_tag 'screen2' %>
- <%= javascript_include_tag :defaults %>
+ <%#= javascript_include_tag :defaults %>
+ <link type="text/css" href="/stylesheets/smoothness/jquery-ui-1.7.1.custom.css" rel="stylesheet" />
- <%= yield(:head) %>
+
+ <script type="text/javascript" src="/javascripts/jquery/jquery-1.3.2.min.js"></script>
+ <script type="text/javascript" src="/javascripts/jquery/jquery-ui-1.7.1.custom.min.js"></script>
+ <script type="text/javascript" src="/javascripts/jquery.layout.min.js"></script>
+ <script type="text/javascript" src="/javascripts/jrails.js"></script>
+ <script type="text/javascript" src="/javascripts/jquery.tablesorter.min.js"></script>
+ <script type="text/javascript" src="/javascripts/addons/pager/jquery.tablesorter.pager.js"></script>
+
+ <link type="text/css" href="/stylesheets/blue/style.css" rel="stylesheet" />
+ <%#= javascript_include_tag 'jquery.flot.pie.pack'%>
+ <%= javascript_include_tag 'flot/jquery.flot'%>
+
+
+
+ <script type="text/javascript">
+
+ $(document).ready(function () {
+ $('body').layout({ applyDefaultStyles: true });
+ });
+ </script>
+ <%= yield(:head) %>
+ <script type="text/javascript">
+ $(function() {
+ $("#accordion").accordion({
+ autoHeight: false
+ });
+ });
+ </script>
+
+
+
+
</head>
<body>
+ <style type="text/css">
+ .column { width: 430px; float: left; padding-bottom: 100px; }
+ .column_large { width: 880px; }
+ .portlet { margin: 0 1em 1em 0; }
+ .portlet-header { margin: 0.3em; padding-bottom: 4px; padding-left: 0.2em; }
+ .portlet-header .ui-icon { float: right; }
+ .portlet-content { padding: 0.4em; }
+ .ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; height: 50px !important; }
+ .ui-sortable-placeholder * { visibility: hidden; }
+ </style>
+
+
+
+ <div class="ui-layout-center">
+
+ <div id="main_panel" style="margin-left:auto; margin-right:auto; width: 880px">
+
+
+ <%= yield %>
-<p style="color: green"><%= flash[:notice] %></p>
-<div id="container">
- <div id="header-container">
- <div id="header">
- <ul id="subnavigation">
- <li class="active"><%= link_to "Overview", project_overview_url(:id => @project ) %> </li>
- <li class="tab"><%= link_to "Graphs", project_graph1_url(@project) %> </li>
- <li class="tab"><%= link_to "Referers", referers_queries_url(@project) %> </li>
- <li class="tab"><%= link_to "Logout", :controller => 'login', :action => 'logout' %> </li>
- </ul>
- </div>
+ </div>
+
+
</div>
- <%= yield %>
+
+ <!-- <div class="ui-layout-north">
+ <#%= link_to "Overview", project_overview_url(:id => @project ) %>
+ <%#= link_to "Graphs", project_graph1_url(@project) %>
+ <%#= link_to "Referers", referers_queries_url(@project) %>
+ <%#= link_to "Logout", :controller => 'login', :action => 'logout' %>
+
+
+ </div> -->
-</div>
+ <div class="ui-layout-west">
+
- <!-- <div id="header">
- This is header
+ <div id="accordion">
+ <h3><a href="#">Dashboard (id <%= session[:project_id]%>)</a></h3>
+ <div>
+ <p>
+
+ <%= link_to 'Overview', :controller =>'projects', :action => 'index' %>
+
+
+ <br>
+
+
+
+ <%= link_to "Logout", :controller => 'login', :action => 'logout' %>
+
+ </p>
</div>
- <div id="main">
+ <h3><a href="#">Visitors</a></h3>
+ <div>
+ <p>
+
+ <%= link_to_remote 'Overview',
+ :url => {:controller =>'projects', :action => 'visitors'},
+ :update => 'main_panel' %>
- <%#= yield %>
-
+ </p>
</div>
- <div id="footer">
- This is footer
- </div> -->
+ <h3><a href="#">Referrers</a></h3>
+ <div>
+ <p>
+ <%= link_to_remote 'Overview',
+ :url => {:controller =>'projects', :action => 'referrers'},
+ :update => 'main_panel' %>
+ <br>
+
+ </div>
+
+ </div>
+
+ </div>
+
+
+ <!--div class="ui-layout-south">South</div-->
+ <!--div class="ui-layout-east">East</div-->
+
+
+
+
+
+
</body>
</html>
View
12 app/views/layouts/referers.html.erb
@@ -5,7 +5,17 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title> Referers </title>
- <%= stylesheet_link_tag 'screen2' %>
+ <%#= stylesheet_link_tag 'screen2' %>
+ <link type="text/css" href="/stylesheets/smoothness/jquery-ui-1.7.1.custom.css" rel="stylesheet" />
+ <script type="text/javascript" src="/javascripts/jquery/jquery-1.3.2.min.js"></script>
+ <script type="text/javascript" src="/javascripts/jquery/jquery-ui-1.7.1.custom.min.js"></script>
+ <script type="text/javascript" src="/javascripts/jquery.tablesorter.min.js"></script>
+ <script type="text/javascript" src="/javascripts/addons/pager/jquery.tablesorter.pager.js"></script>
+
+ <link type="text/css" href="/stylesheets/blue/style.css" rel="stylesheet" />
+
+
+
</head>
<body>
<p style="color: green"><%= flash[:notice] %></p>
View
154 app/views/login/login.html.erb
@@ -1,33 +1,139 @@
+<style>
+
+
+fieldset p span {
+ display: block;
+ background: #E9E9E9;
+ width: 205px;
+ padding: 2px;
+}
+
+fieldset p span input {
+ width:195px;
+}
+
+
+
+#wrapper {
+ display :block;
+ padding:4;
+// background-color:#408DFB;
+// background-color:#F5F5F5;
+// border:10px solid #60ADFB;
+ height:400px;
+ left:28%;
+
+ overflow:hidden;
+ position:fixed;
+ text-align:left;
+ top:5%;
+ width:400px;
+ z-index:1000;
+
+
+
+}
+
+input.button {
+ position: fixed;
+ margin-left: 200px;
+}
+
+
+.main p {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ line-height: 150%;
+ margin: 0 0 7px 0;
+}
+
+
+body {
+ background: #ECECEC;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 80.5%;
+ color: #000000;
+}
+
+fieldset {
+ border:medium none;
+ margin:0px 0 0;
+ padding-left:38px;
+ position:inherit;
+}
+
+body {
+ color:#000000;
+ font-family:Verdana,Arial,Helvetica,sans-serif;
+ font-size:62.5%;
+}
+
+fieldset p span input {
+ border:1px solid #A7A7A7;
+ font-family:Arial,Helvetica,sans-serif;
+ font-size:15px;
+ font-weight:bold;
+ padding:4px;
+}
+</style>
+
+<div class="ui-overlay">
+ <!--div class="ui-widget-overlay">
+
+ </div-->
+ <div class="ui-widget-shadow ui-corner-all"
+ style="position: absolute;width: 322px; height: 302px; left: 50px; top: 30px;">
+
+ </div>
+</div>
+
+<div style="position: absolute; width: 300px; height: 280px;left: 50px; top: 30px; padding: 10px;"
+ class="ui-widget ui-widget-content ui-corner-all">
+ <div class="ui-dialog-content ui-widget-content" style="background: none; border: 0;">
+
+ <h1 style="text-align:left;padding-left:18px "> Sign in</h1>
+
+ <% form_tag do %>
+
+ <fieldset id="user-email">
+
+ <p>
+ <label for="name">Name:</label>
+ <span>
+ <%= text_field_tag :name, params[:name] %>
+ </span>
+ </p>
+ </fieldset>
+
+
+
+ <fieldset id="user-email">
+ <p>
+ <label for="password">Password:</label>
+ <span>
+ <%= password_field_tag :password, params[:password] %>
+ </span>
+ </p>
+ </fieldset>
+
+ <%= submit_tag "Login" , {:class => "button"}%>
+
+
+
+ <% end %>
+
+
+
+
+ </div>
+</div>
+
-<h1 style="text-align:left;padding-left:18px "> Sign in</h1>
-<% form_tag do %>
-<fieldset id="user-email">
- <p>
- <label for="name">Name:</label>
- <span>
- <%= text_field_tag :name, params[:name] %>
- </span>
- </p>
-</fieldset>
-<fieldset id="user-email">
- <p>
- <label for="password">Password:</label>
- <span>
- <%= password_field_tag :password, params[:password] %>
- </span>
- </p>
-</fieldset>
-<p>
-
- <%#= submit_tag "Login" , :type => "image", :src=>"/images/btn_sign-in.gif"%>
- <%= submit_tag "Login" , {:class => "input_submit_button"} %>
-</p>
-<% end %>
View
8 app/views/graphs/_bar_graph.html.erb → app/views/projects/_bar_graph.html.erb
@@ -18,7 +18,7 @@
%>
-<div id="<%= placeholder %>" style="width:450px;height:250px;"></div>
+<div id="<%= placeholder %>" style="width:400px;height:250px;"></div>
<script id="source" language="javascript" type="text/javascript">
$(function () {
@@ -31,7 +31,9 @@ $(function () {
xaxis : { minTickSize : 1, ticks: <%= labels %> },
- grid: { backgroundColor: "#eeeeee"}
+ grid: { backgroundColor: "#ffffff",
+ borderWidth: 0,
+ tickColor: "#eeeeee"},
}
line = {
@@ -43,7 +45,7 @@ $(function () {
fill : true,
align: "center"
},
- color : "#99aaee"
+ color :"#8888ff"
}
View
8 app/views/graphs/_line_plot.html.erb → app/views/projects/_line_plot.html.erb
@@ -22,7 +22,7 @@ end
%>
-<div id="<%= placeholder %>" style="width:450px;height:250px; "></div>
+<div id="<%= placeholder %>" style="width:450px;height:100px; "></div>
<script id="source" language="javascript" type="text/javascript">
$(function () {
@@ -32,7 +32,9 @@ $(function () {
lines : {show : true },
points : {show : true},
xaxis : {mode : '<%= xaxis_mode %>'},
- grid: { backgroundColor: "#eeeeee"},
+ grid: { backgroundColor: "#ffffff",
+ borderWidth: 0,
+ tickColor: "#eeeeee"},
}
var line = {
@@ -42,7 +44,7 @@ $(function () {
show : true,
fill : true,
},
- color : "#99aaee"
+ color : "#8888ff"
}
View
11 app/views/projects/_portlet.html.erb
@@ -0,0 +1,11 @@
+<div class="portlet">
+ <div class="portlet-header"> <%= title %></div>
+ <div class="portlet-content">
+ <%= render :partial => graph_type,
+ :locals => {:data =>data,
+ :placeholder => placeholder ,
+ :legend => legend}%>
+
+
+ </div>
+</div>
View
36 app/views/projects/_portlet_table.html.erb
@@ -0,0 +1,36 @@
+
+
+<div class="portlet">
+ <div class="portlet-header"><%=title%></div>
+ <div class="portlet-content">
+ <%= render :partial => "table_panel" ,
+ :locals => {:data => data,
+ :placeholder => placeholder
+ }
+ %>
+
+ <!-- <div id="<%=placeholder%>_pager" class="pager" style="float:bottom">
+ <form>
+ <img src="/images/icons/first.png" class="first"/>
+ <img src="/images/icons/prev.png" class="prev"/>
+ <input type="text" class="pagedisplay"/>
+ <img src="/images/icons/next.png" class="next"/>
+ <img src="/images/icons/last.png" class="last"/>
+ <select class="pagesize">
+ <option selected="selected" value="10">10</option>
+ <option value="20">20</option>
+ <option value="30">30</option>
+ <option value="40">40</option>
+ </select>
+ </form>
+ </div> -->
+ </div>
+</div>
+
+<script>
+ $(document).ready(function() {
+ $("#<%=placeholder%>")
+ .tablesorter({ widthFixed: true, widgets: ['zebra']})
+ //.tablesorterPager({container: $("#<%=placeholder%>_pager")});
+ });
+</script>
View
23 app/views/projects/_table_panel.html.erb
@@ -0,0 +1,23 @@
+
+
+<table id="<%= placeholder %>" class="tablesorter">
+ <thead>
+ <tr>
+ <th> Query String </th>
+ <th> Visits </th>
+ <th> Page/Visits </th>
+ <th> Avg. Time </th>
+
+ </tr>
+ </thead>
+ <tbody>
+ <%for ds in data%>
+ <tr>
+ <%for i in ds %>
+ <td> <%=h truncate(i.to_s, :length => 30)%></td>
+ <%end%>
+ </tr>
+ <% end %>
+
+ </tbody>
+</table>
View
22 app/views/projects/_table_panel2.html.erb
@@ -0,0 +1,22 @@
+
+<table id="<%= placeholder %>" class="tablesorter">
+ <thead>
+ <tr>
+ <th> Query String </th>
+ <th> Visits </th>
+ <th> Page/Visits </th>
+ <th> Avg. Time </th>
+
+ </tr>
+ </thead>
+ <tbody>
+ <%for ds in data%>
+ <tr>
+ <%for i in ds %>
+ <td> <%=h truncate(i.to_s, :length => 30)%></td>
+ <%end%>
+ </tr>
+ <% end %>
+
+ </tbody>
+</table>
View
46 app/views/projects/_timeline_plot.html.erb
@@ -0,0 +1,46 @@
+<%
+# Format the data in order to be used by the flot library
+
+formatted_data = []
+
+ for d in data
+ formatted_data << "[#{Time.parse(d.first).to_i*1000}, #{d.second}]"
+ end
+
+ formatted_data = "[#{formatted_data.join(",")}]"
+
+%>
+
+
+<div id="<%= placeholder %>" style="width:850px;height:200px; "></div>
+
+<script id="source" language="javascript" type="text/javascript">
+$(function () {
+ var total = <%= formatted_data %>;
+
+ var graph_options = {
+ lines : {show : true },
+ points : {show : true},
+ xaxis : {mode : 'time'},
+ grid: { backgroundColor: "#ffffff",
+ borderWidth: 0,
+ tickColor: "#eeeeee"},
+ }
+
+ var line = {
+ label: "<%= legend %>",
+ data: total ,
+ lines : {
+ show : true,
+ fill : true,
+ },
+ color : "#8888ff"
+
+ }
+
+
+ $.plot($("#<%= placeholder %>"), [line], graph_options);
+
+});
+</script>
+
View
73 app/views/projects/index.html.erb
@@ -0,0 +1,73 @@
+
+
+<% if @project == nil %>
+ Empty project <%= button_to "Create Project", :action => "create" %>
+
+<% else %>
+
+<script type="text/javascript">
+$(function() {
+ $(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
+ .find(".portlet-header")
+ .addClass("ui-widget-header ui-corner-all")
+ .prepend('<span class="ui-icon ui-icon-plusthick"></span>')
+ .end()
+ .find(".portlet-content");
+
+ $(".portlet-header .ui-icon").click(function() {
+ $(this).toggleClass("ui-icon-minusthick");
+ $(this).parents(".portlet:first").find(".portlet-content").toggle();
+ });
+
+});
+</script>
+
+<script type="text/javascript">
+$(function() {
+ $(".column_large").sortable({
+ connectWith: '.column_large'
+ });
+});
+</script>
+
+<div class="column_large">
+
+
+ <%= render :partial =>"portlet",
+ :locals =>{ :data =>@total_clicks,
+ :placeholder =>"placeholder1",
+ :legend =>"Total visits",
+ :title => "Total visits",
+ :graph_type => "timeline_plot"
+ }
+ %>
+
+ <div class="portlet">
+ <div class="portlet-header"> Overview </div>
+ <div class="portlet-content">
+ <div style="font-size:16px">
+ <div style="width:450px; float:left; padding-left:30px">
+ <strong> <%= @nvisits %> </strong> Total visitors <br> <br>
+ <strong> <%= @page_views %> </strong> Page views <br> <br>
+ <strong> <%= @avg_pageviews%> </strong> Average page views <br> <br>
+ </div>
+ <div style="float:left; margin-right:auto">
+ <strong> <%= @time_on_site%> </strong> Time on site <br> <br>
+ <strong> <%= @bounce_rate%>% </strong> Bounce rate <br> <br>
+ <strong> <%= @new_visits%>% </strong> New Visits <br> <br>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <%= render :partial => "portlet_table" ,
+ :locals => {:data => @data_website,
+ :placeholder => "tabella2",
+ :title =>"Top referers"
+ }
+ %>
+
+</div>
+
+<% end %>
+
View
76 app/views/projects/overview.html.erb
@@ -1,16 +1,72 @@
-<!-- <ul id="subnavigation">
- <li class="active"><%= link_to "Overview", project_overview_url(:id => @project ) %> </li>
- <li class="tab"><%= link_to "Graphs", project_graph1_url(@project) %> </li>
- <li class="tab"><%= link_to "Referers", referers_queries_url(@project) %> </li>
- <li class="tab"><%= link_to "Logout", :controller => 'login', :action => 'logout' %> </li>
-</ul> -->
-
-<div id="panel">
+
+
<% if @project == nil %>
Empty project <%= button_to "Create Project", :action => "create" %>
<% else %>
- Project id = <%= @project.id%>
+
+
+ <script type="text/javascript">
+ $(function() {
+ $(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
+ .find(".portlet-header")
+ .addClass("ui-widget-header ui-corner-all")
+ .prepend('<span class="ui-icon ui-icon-plusthick"></span>')
+ .end()
+ .find(".portlet-content");
+
+ $(".portlet-header .ui-icon").click(function() {
+ $(this).toggleClass("ui-icon-minusthick");
+ $(this).parents(".portlet:first").find(".portlet-content").toggle();
+ });
+
+ });
+ </script>
+
+
+
+
+
+ <div style="width:880px">
+ <%= render :partial =>"portlet",
+ :locals =>{ :data =>@total_clicks,
+ :placeholder =>"placeholder1",
+ :legend =>"Total visits",
+ :title => "Total visits",
+ :graph_type => "timeline_plot"
+ }
+ %>
+ </div>
+ <div style="width:880px">
+
+ <div class="portlet">
+ <div class="portlet-header"> Overview </div>
+ <div class="portlet-content">
+ <div style="font-size:16px">
+ <div style="width:450px; float:left; padding-left:30px">
+ <strong> <%= @nvisits %> </strong> Total visitors <br> <br>
+ <strong> <%= @page_views %> </strong> Page views <br> <br>
+ <strong> <%= @avg_pageviews%> </strong> Average page views <br> <br>
+ </div>
+ <div style="float:left; margin-right:auto">
+ <strong> <%= @time_on_site%> </strong> Time on site <br> <br>
+ <strong> <%= @bounce_rate%>% </strong> Bounce rate <br> <br>
+ <strong> <%= @new_visits%>% </strong> New Visits <br> <br>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <%= render :partial => "portlet_table" ,
+ :locals => {:data => @data_website,
+ :placeholder => "tabella2",
+ :title =>"Top referers"
+ }
+ %>
+
+
+
+
<% end %>
-</div>
View
139 app/views/projects/prova.html.erb
@@ -0,0 +1,139 @@
+ <script type="text/javascript">
+ $(function() {
+ $(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
+ .find(".portlet-header")
+ .addClass("ui-widget-header ui-corner-all")
+ .prepend('<span class="ui-icon ui-icon-plusthick"></span>')
+ .end()
+ .find(".portlet-content");
+
+ $(".portlet-header .ui-icon").click(function() {
+ $(this).toggleClass("ui-icon-minusthick");
+ $(this).parents(".portlet:first").find(".portlet-content").toggle();
+ });
+
+ });
+ </script>
+
+
+
+
+
+<div style="width:880px">
+<%= render :partial =>"portlet",
+ :locals =>{ :data =>@total_clicks,
+ :placeholder =>"placeholder1",
+ :legend =>"Total visits",
+ :title => "Total visits",
+ :graph_type => "timeline_plot"
+ }
+%>
+</div>
+<div style="width:880px">
+
+<div class="portlet">
+ <div class="portlet-header"> Overview </div>
+ <div class="portlet-content">
+ <div style="font-size:16px">
+ <div style="width:450px; float:left; padding-left:30px">
+ <strong> <%= @nvisits %> </strong> Total visitors <br> <br>
+ <strong> <%= @page_views %> </strong> Page views <br> <br>
+ <strong> <%= @avg_pageviews%> </strong> Average page views <br> <br>
+ </div>
+ <div style="float:left; margin-right:auto">
+ <strong> <%= @time_on_site%> </strong> Time on site <br> <br>
+ <strong> <%= @bounce_rate%>% </strong> Bounce rate <br> <br>
+ <strong> <%= @new_visits%>% </strong> New Visits <br> <br>
+ </div>
+ </div>
+ </div>
+</div>
+</div>
+
+
+<%= render :partial =>"portlet",
+ :locals =>{
+ :data =>@traffic_sources,
+ :placeholder => "placeholder_traffic_sources",
+ :legend => "Traffic sources",
+ :title => "Traffic sources",
+ :graph_type => "bar_graph"
+ }
+%>
+
+<%= render :partial =>"portlet",
+ :locals =>{
+ :data =>@config_os,
+ :placeholder => "placeholder33",
+ :legend => "Operating Systems",
+ :title => "Operating Systems",
+ :graph_type => "bar_graph"
+ }
+%>
+
+ <%= render :partial =>"portlet",
+ :locals =>{ :data =>@browsers,
+ :placeholder =>"placeholder2",
+ :legend =>"Browsers",
+ :title => "Browsers",
+ :graph_type => "bar_graph"
+ }
+%>
+
+
+<%= render :partial =>"portlet",
+ :locals =>{ :data =>@actions,
+ :placeholder =>"placeholder8",
+ :legend =>"No. of visitors per page",
+ :title => "No. of visitors per page",
+ :graph_type => "bar_graph"
+ }
+%>
+
+<%= render :partial =>"portlet",
+ :locals =>{ :data =>@search_engines,
+ :placeholder =>"placeholder5",
+ :legend =>"Search Engines",
+ :title => "Search Engines",
+ :graph_type => "bar_graph"
+ }
+%>
+
+
+
+<%= render :partial =>"portlet",
+ :locals =>{ :data =>@time_spent,
+ :placeholder =>"placeholder6",
+ :legend =>"Time spent on site",
+ :title => "Time spent on site",
+ :graph_type => "bar_graph"
+ }
+%>
+
+
+<%= render :partial =>"portlet",
+ :locals =>{ :data =>@hours_by_servertime,
+ :placeholder =>"placeholder4",
+ :legend =>"Hours by server time",
+ :title => "Hours by server time",
+ :graph_type => "bar_graph"
+ }
+%>
+
+
+<%= render :partial => "portlet_table" ,
+ :locals => {:data => @data,
+ :placeholder => "tabella1",
+ :title => "Searched Keywords"
+ }
+%>
+<%= render :partial => "portlet_table" ,
+ :locals => {:data => @data_website,
+ :placeholder => "tabella2",
+ :title =>"Top referers"
+ }
+%>
+
+
+
+
View
43 app/views/projects/referrers.html.erb
@@ -0,0 +1,43 @@
+<script type="text/javascript">
+$(function() {
+ $(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
+ .find(".portlet-header")
+ .addClass("ui-widget-header ui-corner-all")
+ .prepend('<span class="ui-icon ui-icon-plusthick"></span>')
+ .end()
+ .find(".portlet-content");
+
+ $(".portlet-header .ui-icon").click(function() {
+ $(this).toggleClass("ui-icon-minusthick");
+ $(this).parents(".portlet:first").find(".portlet-content").toggle();
+ });
+
+});
+</script>
+
+<script type="text/javascript">
+$(function() {
+ $(".column_large").sortable({
+ connectWith: '.column_large'
+ });
+});
+</script>
+
+<div class="column_large">
+
+<%= render :partial => "portlet_table" ,
+ :locals => {:data => @searched_keywords,
+ :placeholder => "tabella1",