More churn,closer - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
DIR Log
DIR Files
DIR Refs
DIR README
---
DIR commit ed59b0769838af75c9fcde776c5092b329bc8b2b
DIR parent 9974997874fab6f83540def599d2031acacbf5f1
HTML Author: HD Moore <hd_moore@rapid7.com>
Date: Wed, 2 Jan 2013 03:13:00 -0600
More churn,closer
Diffstat:
M app/controllers/analyze_controller… | 51 +++----------------------------
M app/controllers/jobs_controller.rb | 2 +-
M app/models/job.rb | 4 ++--
M app/views/analyze/view.html.erb | 2 +-
M app/views/analyze/view_matches.htm… | 55 ++++++++++---------------------
M app/views/shared/_lightbox_freq.ht… | 7 ++-----
M app/views/shared/_lightbox_sig.htm… | 7 ++-----
M config/routes.rb | 2 +-
8 files changed, 31 insertions(+), 99 deletions(-)
---
DIR diff --git a/app/controllers/analyze_controller.rb b/app/controllers/analyze_controller.rb
@@ -10,7 +10,7 @@ class AnalyzeController < ApplicationController
def view
@job_id = params[:id]
- @job = Job.find(@job_id)
+ @job = Job.find(@job_id)
@shown = params[:show]
ltypes = Call.find( :all, :select => 'DISTINCT line_type', :conditions => ["job_id = ?", @job_id] ).map{|r| r.line_type}
@@ -49,49 +49,13 @@ class AnalyzeController < ApplicationController
end
- def show
- @job_id = params[:id]
- @job = Job.find(@job_id)
- @shown = params[:show]
-
- ltypes = Call.find( :all, :select => 'DISTINCT line_type', :conditions => ["job_id = ?", @job_id] ).map{|r| r.line_type}
- res_types = {}
-
- ltypes.each do |k|
- next if not k
- res_types[k.capitalize.to_sym] = Call.count(
- :conditions => ['job_id = ? and line_type = ?', @job_id, k]
- )
- end
-
- @lines_by_type = res_types
-
- if(@shown and @shown != 'all')
- @results = Job.where(:id => @job_id).paginate(
- :page => params[:page],
- :order => 'number ASC',
- :per_page => 20,
- :conditions => [ 'completed = ? and processed = ? and busy = ? and line_type = ?', true, true, false, @shown ]
- )
- else
- @results = Job.where(:id => @job_id).paginate(
- :page => params[:page],
- :order => 'number ASC',
- :per_page => 20,
- :conditions => [ 'completed = ? and processed = ? and busy = ?', true, true, false ]
- )
- end
-
- @filters = []
- @filters << { :scope => "all", :label => "All" }
- res_types.keys.each do |t|
- @filters << { :scope => t.to_s.downcase, :label => t.to_s }
- end
+ def view_matches
+ @result = Call.find(params[:call_id])
+ @job_id = @result.job_id
+ @results = @result.matches.select{|x| x.matchscore.to_f > 10.0 }
end
-
- # GET /calls/1/resource?id=XXX&type=YYY
def resource
ctype = 'text/html'
cpath = nil
@@ -132,9 +96,4 @@ class AnalyzeController < ApplicationController
end
- def view_matches
- @result = Call.find(params[:call_id])
- @job_id = @result.job_id
- @results = @result.matches.select{|x| x.matchscore.to_f > 10.0 }
- end
end
DIR diff --git a/app/controllers/jobs_controller.rb b/app/controllers/jobs_controller.rb
@@ -17,7 +17,7 @@ class JobsController < ApplicationController
def results
- @jobs = @project.jobs.where('task = ? AND completed_at IS NOT NULL', 'dialer').paginate(
+ @jobs = @project.jobs.where('(task = ? OR task = ?) AND completed_at IS NOT NULL', 'dialer', 'import').paginate(
:page => params[:page],
:order => 'id DESC',
:per_page => 30
DIR diff --git a/app/models/job.rb b/app/models/job.rb
@@ -26,10 +26,10 @@ class Job < ActiveRecord::Base
unless ['job', 'project', 'global'].include?(record.scope)
record.errors[:scope] << "Scope must be job, project, or global"
end
- if record.scope == "job" and Job.where(:id => record.target_id.to_i, :task => 'dialer').count == 0
+ if record.scope == "job" and Job.where(:id => record.target_id.to_i, :task => ['import', 'dialer']).count == 0
record.errors[:job_id] << "The job_id is not valid"
end
- if record.scope == "project" and Job.where(:id => record.target_id.to_i, :task => 'dialer').count == 0
+ if record.scope == "project" and Project.where(:id => record.target_id.to_i).count == 0
record.errors[:project_id] << "The project_id is not valid"
end
when 'import'
DIR diff --git a/app/views/analyze/view.html.erb b/app/views/analyze/view.html.erb
@@ -47,7 +47,7 @@
<%= render :partial => 'shared/lightbox_sig', :locals => { :call => call } %>
<%= render :partial => 'shared/lightbox_freq', :locals => { :call => call } %>
<% if call.fprint and call.fprint.length > 0 %>
- <a href="<%=view_matches_path(@project, call.id)%>">View Matches</a>
+ <a href="<%=view_matches_path(@project, call.job_id, call.id)%>">View Matches</a>
<% end %>
</td>
</tr>
DIR diff --git a/app/views/analyze/view_matches.html.erb b/app/views/analyze/view_matches.html.erb
@@ -1,6 +1,6 @@
<% call = @result %>
-<h1 class='title'><%= @result.number %> (<a href="<%=view_analyze_path(call.job_id)%>">Back to Job</a>)</h1>
+<h1 class='title'><%= @result.number %> (<a href="<%=view_analyze_path(@project.id, call.job_id)%>">Back to Job Analysis</a>)</h1>
<table class='table table-striped table-bordered' width='90%'>
<tr>
<th>Number</th>
@@ -12,33 +12,26 @@
<object
type="application/x-shockwave-flash"
- data="/assets/musicplayer.swf?song_url=<%=resource_analyze_path(@job_id, call.id, "mp3")%>"
+ data="/assets/musicplayer.swf?song_url=<%=resource_analyze_path(call.id, "mp3")%>"
width="20"
height="17"
style="margin-bottom: -5px;"
>
- <param name="movie" value="/assets/musicplayer.swf?song_url=<%=resource_analyze_path(@job_id, call.id, "mp3")%>"></param>
+ <param name="movie" value="/assets/musicplayer.swf?song_url=<%=resource_analyze_path(call.id, "mp3")%>"></param>
<param name="wmode" value="transparent"></param>
</object>
<b><%= call.number %></b>
<hr width='100%' size='1'/>
- CallerID: <%= call.cid%><br/>
- Provider: <%=h call.provider.name %><br/>
- Audio: <%=h call.seconds %> Seconds<br/>
- Ringer: <%=h call.ringtime %> Seconds<br/>
+ CallerID: <%= call.caller_id%><br/>
+ Provider: <%= call.provider.name %><br/>
+ Audio: <%= call.audio_length %> Seconds<br/>
+ Ringer: <%= call.ring_length %> Seconds<br/>
</td>
<td align='center'>
<b><%=h call.line_type.upcase %></b><br/>
- <a href="<%=resource_analyze_path(@job_id, call.id, "big_sig_dots")%>" rel="lightbox"><img src="<%=resource_analyze_path(@job_id, call.id, "small_sig")%>" /></a>
- <a href="<%=resource_analyze_path(@job_id, call.id, "big_freq")%>" rel="lightbox"><img src="<%=resource_analyze_path(@job_id, call.id, "small_freq")%>" /></a><br/>
- <% (call.signatures||"").split("\n").each do |s|
- sid,mat,name = s.split(':', 3)
- str = [mat.to_i * 6.4, 255].min
- col = ("%.2x" % (255 - str)) * 3
- %>
- <div style="color: #<%= col%>;"><%=h name%> (<%=h sid %>@<%=h mat %>)</div>
- <% end %>
+ <%= render :partial => 'shared/lightbox_sig', :locals => { :call => call } %>
+ <%= render :partial => 'shared/lightbox_freq', :locals => { :call => call } %>
</td>
</tr>
@@ -63,45 +56,31 @@
<object
type="application/x-shockwave-flash"
- data="/assets/musicplayer.swf?song_url=<%=resource_analyze_path(@job_id, call.id, "mp3")%>"
+ data="/assets/musicplayer.swf?song_url=<%=resource_analyze_path(call.id, "mp3")%>"
width="20"
height="17"
style="margin-bottom: -5px;"
>
- <param name="movie" value="/assets/musicplayer.swf?song_url=<%=resource_analyze_path(@job_id, call.id, "mp3")%>"></param>
+ <param name="movie" value="/assets/musicplayer.swf?song_url=<%=resource_analyze_path(call.id, "mp3")%>"></param>
<param name="wmode" value="transparent"></param>
</object>
<b><%= call.number %></b>
<hr width='100%' size='1'/>
- CallerID: <%= call.cid%><br/>
+ CallerID: <%= call.caller_id%><br/>
Provider: <%=h call.provider.name %><br/>
- Audio: <%=h call.seconds %> Seconds<br/>
- Ringer: <%=h call.ringtime %> Seconds<br/>
+ Audio: <%=h call.audio_length %> Seconds<br/>
+ Ringer: <%=h call.ring_length %> Seconds<br/>
</td>
<td align='center'>
<b><%=h call.line_type.upcase %></b><br/>
- <a href="<%=resource_analyze_path(@job_id, call.id, "big_sig_dots")%>" class="lightbox"><img src="<%=resource_analyze_path(@job_id, call.id, "small_sig")%>" /></a>
- <a href="<%=resource_analyze_path(@job_id, call.id, "big_freq")%>" class="lightbox"><img src="<%=resource_analyze_path(@job_id, call.id, "small_freq")%>" /></a><br/>
- <% (call.signatures||"").split("\n").each do |s|
- sid,mat,name = s.split(':', 3)
- str = [mat.to_i * 6.4, 255].min
- col = ("%.2x" % (255 - str)) * 3
- %>
- <div style="color: #<%= col%>;"><%=h name%> (<%=h sid %>@<%=h mat %>)</div>
- <% end %>
+ <%= render :partial => 'shared/lightbox_sig', :locals => { :call => call } %>
+ <%= render :partial => 'shared/lightbox_freq', :locals => { :call => call } %>
<% if call.fprint %>
- <a href="<%=view_matches_path(call.id)%>">View Matches</a>
+ <a href="<%=view_matches_path(call.project_id, call.job_id, call.id)%>">View Matches</a>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
-
-<script type="text/javascript">
-$(function() {
- // Use this example, or...
- $('a.lightbox').lightBox();
-});
-</script>
DIR diff --git a/app/views/shared/_lightbox_freq.html.erb b/app/views/shared/_lightbox_freq.html.erb
@@ -2,12 +2,9 @@
lid = "call_#{call.id}_freq"
%>
<div id="<%= lid %>" class="lightbox hide fade" tabindex="-1" role="dialog" aria-hidden="true">
- <div class='lightbox-header'>
- <button type="button" class="close" data-dismiss="lightbox" aria-hidden="true">×</button>
- </div>
<div class='lightbox-content'>
- <img src="<%=resource_analyze_path(call.id, "big_freq")%>">
+ <a href="#" data-dismiss="lightbox"><img src="<%=resource_analyze_path(call.id, "big_freq")%>"/></a>
</div>
</div>
-<a data-toggle="lightbox" href="#<%= lid %>"><img src="<%=resource_analyze_path(call.id, "small_freq")%>" alt="<%= call.number %> frequency graph"/></a>
+<a data-toggle="lightbox" href="#<%= lid %>"><img src="<%=resource_analyze_path(call.id, "small_freq")%>"/></a>
DIR diff --git a/app/views/shared/_lightbox_sig.html.erb b/app/views/shared/_lightbox_sig.html.erb
@@ -2,12 +2,9 @@
lid = "call_#{call.id}_sig"
%>
<div id="<%= lid %>" class="lightbox hide fade" tabindex="-1" role="dialog" aria-hidden="true">
- <div class='lightbox-header'>
- <button type="button" class="close" data-dismiss="lightbox" aria-hidden="true">×</button>
- </div>
<div class='lightbox-content'>
- <img src="<%=resource_analyze_path(call.id, "big_sig_dots")%>">
+ <a href="#" data-dismiss="lightbox"><img src="<%=resource_analyze_path(call.id, "big_sig_dots")%>"/></a>
</div>
</div>
-<a data-toggle="lightbox" href="#<%= lid %>"><img src="<%=resource_analyze_path(call.id, "small_sig")%>" alt="<%= call.number %> signal graph" /></a>
+<a data-toggle="lightbox" href="#<%= lid %>"><img src="<%=resource_analyze_path(call.id, "small_sig")%>"/></a>
DIR diff --git a/config/routes.rb b/config/routes.rb
@@ -30,7 +30,7 @@ Web::Application.routes.draw do
match '/calls/:result_id/:type' => 'analyze#resource', :as => :resource_analyze
match '/projects/:project_id/analyze/:id/view' => 'analyze#view', :as => :view_analyze
- match '/projects/:project_id/analyze/:call_id/matches' => 'analyze#view_matches', :as => :view_matches
+ match '/projects/:project_id/analyze/:job_id/:call_id/matches' => 'analyze#view_matches', :as => :view_matches
resources :settings
resources :providers