From b8d4033e6b93bd7ea5283ff5ff4c1db2386c184b Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Thu, 6 Jul 2006 20:10:16 +0000
Subject: [PATCH] Only edit fields that should be editable, and more.

Added VOICE_SPOOL configuration.  Adjust to moria settings.  Only edit
fields that should be editable.  Make the list prettier.  Sort the
list output.
---
 README                                   | 20 ++++++++++++++++++++
 app/controllers/recordings_controller.rb |  9 +++++----
 app/views/recordings/_form.rhtml         | 10 ++--------
 app/views/recordings/_list.rhtml         |  6 +++---
 app/views/recordings/list.rhtml          |  2 --
 app/views/recordings/list_owned.rhtml    |  2 --
 config/environment.rb                    |  6 ++++--
 7 files changed, 34 insertions(+), 21 deletions(-)

diff --git a/README b/README
index b8e3569..b90150e 100644
--- a/README
+++ b/README
@@ -1,3 +1,23 @@
+== Welcome to ansaphonehandler
+
+To install:
+
+ - create config/database.yml from config/database.yml.template
+
+ - install ruby-mp3info (http://rubyforge.org/projects/ruby-mp3info/)
+
+ - edit config/environment.rb, especially the application
+   configuration paths near the end of the file.
+
+ - run "rake migrate".  Edit RAILS_GEM_VERSION in
+   config/environment.rb if rake tells you to do so.
+
+ - run "script/server".
+
+ - point a browser at the URL that script/server prints.  That's all!
+
+Below is the default Rails README file.
+
 == Welcome to Rails
 
 Rails is a web-application and persistence framework that includes everything
diff --git a/app/controllers/recordings_controller.rb b/app/controllers/recordings_controller.rb
index 4c9879a..86f0e9b 100644
--- a/app/controllers/recordings_controller.rb
+++ b/app/controllers/recordings_controller.rb
@@ -11,7 +11,8 @@ class RecordingsController < ApplicationController
          :redirect_to => { :action => :list }
 
   def list
-    @recording_pages, @recordings = paginate :recordings, :per_page => 10
+    @recording_pages, @recordings = paginate :recordings, :per_page => 10,
+	:order => "`when` desc"
   end
 
   def list_owned
@@ -80,7 +81,7 @@ class RecordingsController < ApplicationController
 
   def import
     @recordings = []
-    dir = "/home/ceder/incoming-samples"
+    dir = VOICE_SPOOL
     Dir.entries(dir + "/incoming").each do |filename|
       if filename =~ /^v-([0-9]+)-([0-9]+)-([A-Z0-9]+)\.rmd$/
 	pid = $1
@@ -107,8 +108,8 @@ class RecordingsController < ApplicationController
 		      		  :archived => 0)
 	recording.save!
 	@recordings << recording
-	# File.rename(dir + "/incoming/" + filename,
-	# 	    dir + "/archived/" + filename)
+	File.rename(dir + "/incoming/" + filename,
+		    dir + "/archived/" + filename)
       end
     end
     @recordings.sort!
diff --git a/app/views/recordings/_form.rhtml b/app/views/recordings/_form.rhtml
index 91d7548..4823d6a 100644
--- a/app/views/recordings/_form.rhtml
+++ b/app/views/recordings/_form.rhtml
@@ -1,17 +1,11 @@
 <%= error_messages_for 'recording' %>
 
 <!--[form:recording]-->
-<p><label for="recording_cid">Cid</label><br/>
-<%= text_field 'recording', 'cid'  %></p>
-
 <p><label for="recording_from">From</label><br/>
 <%= text_field 'recording', 'from'  %></p>
 
-<p><label for="recording_when">When</label><br/>
-<%= datetime_select 'recording', 'when'  %></p>
-
-<p><label for="recording_file">File</label><br/>
-<%= text_field 'recording', 'file'  %></p>
+<p><label for="recording_from">Comment</label><br/>
+<%= text_field 'recording', 'comment'  %></p>
 
 <p><label for="recording_seen">Seen</label><br/>
 <%= text_field 'recording', 'seen'  %></p>
diff --git a/app/views/recordings/_list.rhtml b/app/views/recordings/_list.rhtml
index 0d496df..4c9a7fa 100644
--- a/app/views/recordings/_list.rhtml
+++ b/app/views/recordings/_list.rhtml
@@ -9,15 +9,17 @@
 
 <table border="1">
   <tr>
-    <th>&nbsp;</th>
+    <th colspan="2">&nbsp;</th>
     <% for column_name in sorted_columns %>
       <th><%= Recording.columns_hash[column_name].human_name %></th>
     <%end%>
+    <th>&nbsp;</th>
   </tr>
   
 <% for recording in @recordings %>
   <tr>
     <td><%= link_to 'Play', :action => 'play', :id => recording %></td>
+    <td><%= link_to 'Edit', :action => 'edit', :id => recording %></td>
     <% for column_name in sorted_columns %>
       <td>
         <% case column_name
@@ -31,8 +33,6 @@
       </td>
     <% end %>
     <td><%= link_to 'Show', :action => 'show', :id => recording %></td>
-    <td><%= link_to 'Edit', :action => 'edit', :id => recording %></td>
-    <td><%= link_to 'Destroy', { :action => 'destroy', :id => recording }, :confirm => 'Are you sure?', :post => true %></td>
   </tr>
 <% end %>
 </table>
diff --git a/app/views/recordings/list.rhtml b/app/views/recordings/list.rhtml
index f8a7148..d15ad35 100644
--- a/app/views/recordings/list.rhtml
+++ b/app/views/recordings/list.rhtml
@@ -6,5 +6,3 @@
 <%= link_to 'Next page', { :page => @recording_pages.current.next } if @recording_pages.current.next %> 
 
 <br />
-
-<%= link_to 'New recording', :action => 'new' %>
diff --git a/app/views/recordings/list_owned.rhtml b/app/views/recordings/list_owned.rhtml
index 39e06b6..83c55c6 100644
--- a/app/views/recordings/list_owned.rhtml
+++ b/app/views/recordings/list_owned.rhtml
@@ -10,5 +10,3 @@
 	:user_id => @owner.id } if @recording_pages.current.next %>
 
 <br />
-
-<%= link_to 'New recording', :action => 'new' %>
diff --git a/config/environment.rb b/config/environment.rb
index 667638f..bf7ee9d 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -5,7 +5,7 @@
 # ENV['RAILS_ENV'] ||= 'production'
 
 # Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '1.1.2'
+RAILS_GEM_VERSION = '1.1.4'
 
 # Bootstrap the Rails environment, frameworks, and default configuration
 require File.join(File.dirname(__FILE__), 'boot')
@@ -50,4 +50,6 @@ end
 #   inflect.uncountable %w( fish sheep )
 # end
 
-# Include your application configuration below
\ No newline at end of file
+# Include your application configuration below
+
+VOICE_SPOOL = "/var/spool/voice"
-- 
GitLab