Diff
Modified: branches/authorization_new/app/controllers/api_controller.rb (2073 => 2074)
--- branches/authorization_new/app/controllers/api_controller.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/controllers/api_controller.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -13,6 +13,19 @@
def process_request
+ auth = request.env["HTTP_AUTHORIZATION"]
+
+ if auth and auth.starts_with?("Basic ")
+ credentials = Base64.decode64(auth.sub(/^Basic /, '')).split(':')
+ current_user = User.authenticate(credentials[0], credentials[1])
+
+ if current_user.nil?
+ render :xml => rest_error_response(401, 'Not authorized').to_s
+ return
+ end
+
+ end
+
query = CGIMethods.parse_query_parameters(request.query_string)
method = request.method.to_s.upcase
uri = params[:uri]
@@ -46,9 +59,9 @@
end
case rules['Type']
- when 'index'; doc = rest_index_request(rules, query)
- when 'crud'; doc = rest_crud_request(rules)
- when 'call'; doc = rest_call_request(rules, query)
+ when 'index'; doc = rest_index_request(rules, current_user, query)
+ when 'crud'; doc = rest_crud_request(rules, current_user)
+ when 'call'; doc = rest_call_request(rules, current_user, query)
else; bad_rest_request
end
Modified: branches/authorization_new/app/controllers/citations_controller.rb (2073 => 2074)
--- branches/authorization_new/app/controllers/citations_controller.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/controllers/citations_controller.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -48,7 +48,7 @@
respond_to do |format|
if @citation.save
flash[:notice] = 'Citation was successfully created.'
- format.html { redirect_to citation_url(@workflow, @citation) }
+ format.html { redirect_to workflow_citation_url(@workflow, @citation) }
else
format.html { render :action ="" "new" }
end
@@ -73,7 +73,7 @@
respond_to do |format|
flash[:notice] = 'Citation was successfully deleted.'
- format.html { redirect_to citations_url(@workflow) }
+ format.html { redirect_to workflow_citations_url(@workflow) }
end
end
Modified: branches/authorization_new/app/controllers/friendships_controller.rb (2073 => 2074)
--- branches/authorization_new/app/controllers/friendships_controller.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/controllers/friendships_controller.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -111,7 +111,7 @@
end
flash[:notice] = 'Friendship was successfully requested.'
- format.html { redirect_to friendship_url(current_user.id, @friendship) }
+ format.html { redirect_to user_friendship_url(current_user.id, @friendship) }
else
format.html { render :action ="" "new" }
end
@@ -176,7 +176,7 @@
respond_to do |format|
flash[:notice] = "Friendship was successfully deleted"
- format.html { redirect_to (params[:return_to] ? params[:return_to] : friendships_url(friend_id)) }
+ format.html { redirect_to(params[:return_to] ? params[:return_to] : user_friendships_url(friend_id)) }
end
end
Modified: branches/authorization_new/app/controllers/memberships_controller.rb (2073 => 2074)
--- branches/authorization_new/app/controllers/memberships_controller.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/controllers/memberships_controller.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -133,7 +133,7 @@
flash[:notice] = 'Membership was successfully requested.'
end
- format.html { redirect_to membership_url(current_user.id, @membership) }
+ format.html { redirect_to user_membership_url(current_user.id, @membership) }
else
format.html { render :action ="" "new" }
end
@@ -219,7 +219,7 @@
respond_to do |format|
flash[:notice] = "Membership successfully deleted"
- format.html { redirect_to (params[:return_to] ? params[:return_to] : group_path(network_id)) }
+ format.html { redirect_to(params[:return_to] ? params[:return_to] : group_path(network_id)) }
end
end
@@ -230,7 +230,7 @@
def check_user_present
if params[:user_id].blank?
flash.now[:error] = "Invalid URL"
- redirect_to memberships_url(current_user.id)
+ redirect_to user_memberships_url(current_user.id)
return false
end
end
Modified: branches/authorization_new/app/controllers/pictures_controller.rb (2073 => 2074)
--- branches/authorization_new/app/controllers/pictures_controller.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/controllers/pictures_controller.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -118,7 +118,7 @@
@picture.destroy
respond_to do |format|
- format.html { redirect_to pictures_url(user_id) }
+ format.html { redirect_to user_pictures_url(user_id) }
end
end
Modified: branches/authorization_new/app/controllers/reviews_controller.rb (2073 => 2074)
--- branches/authorization_new/app/controllers/reviews_controller.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/controllers/reviews_controller.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -51,7 +51,7 @@
if @review.save
update_rating(@review, params[:rating])
flash[:notice] = 'Thank you for your review!'
- format.html { redirect_to review_url(@reviewable, @review) }
+ format.html { redirect_to workflow_review_url(@reviewable, @review) }
else
format.html { render :action ="" "new" }
end
@@ -69,7 +69,7 @@
if @review.update_attributes(params[:review])
update_rating(@review, params[:rating])
flash[:notice] = 'Review was successfully updated.'
- format.html { redirect_to review_url(@reviewable, @review) }
+ format.html { redirect_to workflow_review_url(@reviewable, @review) }
else
format.html { render :action ="" "edit" }
end
@@ -81,7 +81,7 @@
respond_to do |format|
flash[:notice] = 'Review was successfully deleted.'
- format.html { redirect_to reviews_url(@reviewable) }
+ format.html { redirect_to workflow_reviews_url(@reviewable) }
end
end
Modified: branches/authorization_new/app/controllers/workflows_controller.rb (2073 => 2074)
--- branches/authorization_new/app/controllers/workflows_controller.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/controllers/workflows_controller.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -313,7 +313,7 @@
if policy_err_msg.blank?
flash[:notice] = 'Workflow was successfully created.'
- format.html { redirect_to workflow_url(@workflow) }
+ format.html { redirect_to tag_suggestions_workflow_url(@workflow) }
else
flash[:notice] = "Workflow was successfully created. However some problems occurred, please see these below.</br></br><span style='color: red;'>" + policy_err_msg + "</span>"
format.html { redirect_to :controller => 'workflows', :id => @workflow, :action ="" "edit" }
@@ -564,6 +564,15 @@
@suggestions = @workflow.get_tag_suggestions
end
+ def process_tag_suggestions
+
+ params[:tag_list].split(',').each do |tag|
+ @workflow.add_tag(tag, current_user)
+ end
+
+ redirect_to(workflow_url(@workflow))
+ end
+
protected
def find_workflows
Modified: branches/authorization_new/app/helpers/application_helper.rb (2073 => 2074)
--- branches/authorization_new/app/helpers/application_helper.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/helpers/application_helper.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -212,7 +212,7 @@
text = "<b>" + text + " (#{length})</b>"
end
- mships = icon('membership', memberships_path(user), nil, nil, text)
+ mships = icon('membership', user_memberships_path(user), nil, nil, text)
return mships
Modified: branches/authorization_new/app/helpers/mashup_helper.rb (2073 => 2074)
--- branches/authorization_new/app/helpers/mashup_helper.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/helpers/mashup_helper.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -66,13 +66,13 @@
return "" if ob.nil?
- doc = rest_get_request(ob, rest_name, rest_resource_uri(ob), rest_name, query)
+ doc = rest_get_request(ob, rest_name, nil, rest_resource_uri(ob), rest_name, query)
trim_and_wrap(doc)
end
def rest_index_example(thing)
- doc = rest_index_request(TABLES['REST'][:data][thing]['GET'], {} )
+ doc = rest_index_request(TABLES['REST'][:data][thing]['GET'], nil, {} )
trim_and_wrap(doc)
end
Modified: branches/authorization_new/app/models/policy.rb (2073 => 2074)
--- branches/authorization_new/app/models/policy.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/models/policy.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -329,7 +329,8 @@
"edit_item",
"update_item",
"quick_add",
- "resolve_link"],
+ "resolve_link",
+ "process_tag_suggestions"],
"view" => ["index",
"show",
"statistics",
Modified: branches/authorization_new/app/views/blobs/new.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/blobs/new.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/blobs/new.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -7,7 +7,7 @@
<%= error_messages_for :blob %>
-<% form_tag ({:action ="" :create}, :multipart => true) do %>
+<% form_tag({:action ="" :create}, :multipart => true) do %>
<p style="text-align: center;">
<strong>File to upload: </strong>
Modified: branches/authorization_new/app/views/blobs/show.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/blobs/show.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/blobs/show.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -63,7 +63,7 @@
<br/>
<h3>
- <%= info_icon_with_tooltip("This section shows the overall description for this version of the Workflow") %>
+ <%= info_icon_with_tooltip("This section shows the overall description for this File") %>
Description
</h3>
Modified: branches/authorization_new/app/views/citations/_breadcrumbs.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/citations/_breadcrumbs.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/citations/_breadcrumbs.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -6,7 +6,7 @@
<li><b>»</b></li>
-<li><%= link_to 'Citations', citations_path(@workflow) -%></li>
+<li><%= link_to 'Citations', workflow_citations_path(@workflow) -%></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
<li><b>»</b></li>
@@ -16,7 +16,7 @@
<% when "new" %>
<li>New Citation</li>
<% when "edit" %>
- <li><%= link_to "#{h(@citation.title)}", citation_path(@workflow, @citation) %></li>
+ <li><%= link_to "#{h(@citation.title)}", workflow_citation_path(@workflow, @citation) %></li>
<li><b>»</b></li>
<li>Edit</li>
<% else %>
Modified: branches/authorization_new/app/views/citations/edit.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/citations/edit.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/citations/edit.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -2,10 +2,10 @@
<%= error_messages_for :citation %>
-<% form_for(:citation, :url ="" citation_path(@workflow, @citation), :html => { :method => :put }) do |f| %>
+<% form_for(:citation, :url ="" workflow_citation_path(@workflow, @citation), :html => { :method => :put }) do |f| %>
<%= render :partial => "citations/form", :object => f %>
<p>
<%= submit_tag "Update", :disable_with => "Updating..." %>
</p>
-<% end %>
\ No newline at end of file
+<% end %>
Modified: branches/authorization_new/app/views/citations/new.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/citations/new.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/citations/new.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -2,10 +2,10 @@
<%= error_messages_for :citation %>
-<% form_for(:citation, :url ="" citations_path(@workflow)) do |f| %>
+<% form_for(:citation, :url ="" workflow_citations_path(@workflow)) do |f| %>
<%= render :partial => "citations/form", :object => f %>
<p>
<%= submit_tag "Create", :disable_with => 'Creating...' %>
</p>
-<% end %>
\ No newline at end of file
+<% end %>
Modified: branches/authorization_new/app/views/contributions/_contributor_form.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/contributions/_contributor_form.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/contributions/_contributor_form.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -11,13 +11,13 @@
<p>
<p>
- <%= f.radio_button(:class_id, "User-#{user.id}", { :checked => (current.type.to_s == "User" and current.id.to_i == user.id) }) %> - <%= link_to 'Me', user_path(user) %>
+ <%= f.radio_button(:class_id, "User-#{user.id}", { :checked => (current.class.to_s == "User" and current.id.to_i == user.id) }) %> - <%= link_to 'Me', user_path(user) %>
</p>
<% unless user.networks_owned.empty? %>
<p>
<b>Administrator of...</b><br/>
<% for n in user.networks_owned %>
- <%= f.radio_button(:class_id, "Network-#{n.id}", { :checked => (current.type.to_s == "Network" and current.id.to_i == n.id) }) %> - <%= link_to h(n.title), group_path(n) %><br/>
+ <%= f.radio_button(:class_id, "Network-#{n.id}", { :checked => (current.class.to_s == "Network" and current.id.to_i == n.id) }) %> - <%= link_to h(n.title), group_path(n) %><br/>
<% end %>
</p>
<% end %>
@@ -25,7 +25,7 @@
<p>
<b>Member of..</b><br/>
<% for n in user.networks %>
- <%= f.radio_button(:class_id, "Network-#{n.id}", { :checked => (current.type.to_s == "Network" and current.id.to_i == n.id) }) %> - <%= link_to h(n.title), group_path(n) %><br/>
+ <%= f.radio_button(:class_id, "Network-#{n.id}", { :checked => (current.class.to_s == "Network" and current.id.to_i == n.id) }) %> - <%= link_to h(n.title), group_path(n) %><br/>
<% end %>
</p>
<% end %>
Modified: branches/authorization_new/app/views/downloads/_breadcrumbs.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/downloads/_breadcrumbs.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/downloads/_breadcrumbs.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -6,7 +6,7 @@
<li><b>»</b></li>
-<li><%= link_to 'Downloads', downloads_path(@contribution) %>
+<li><%= link_to 'Downloads', contribution_downloads_path(@contribution) %>
<% if ["show"].include? controller.action_name.to_s %>
<li><b>»</b></li>
Modified: branches/authorization_new/app/views/friendships/_breadcrumbs.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/friendships/_breadcrumbs.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/friendships/_breadcrumbs.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -7,7 +7,7 @@
<li><b>»</b></li>
- <li><%= link_to 'Friendships', friendships_path(@user) %></li>
+ <li><%= link_to 'Friendships', user_friendships_path(@user) %></li>
<% else %>
<li><%= link_to 'Friendships', url_for(:controller => :friendships) %>
<% end %>
@@ -15,5 +15,5 @@
<% if ["show"].include? controller.action_name.to_s %>
<li><b>»</b></li>
- <li><%= link_to "View: #{h(@friendship.user.name)}", friendship_path(@friendship.friend, @friendship) %></li>
+ <li><%= link_to "View: #{h(@friendship.user.name)}", user_friendship_path(@friendship.friend, @friendship) %></li>
<% end %>
Modified: branches/authorization_new/app/views/friendships/_table.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/friendships/_table.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/friendships/_table.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -21,13 +21,13 @@
<td><%= "<b>" unless friendship.accepted? %><%=datetime(friendship.accepted_at, false) || "Pending" %><%= "</b>" unless friendship.accepted? %></td>
<td class="actions">
<% if mine? friendship %>
- <%= icon "show", friendship_path(friendship.friend_id, friendship), nil, nil, "View" %>
+ <%= icon "show", user_friendship_path(friendship.friend_id, friendship), nil, nil, "View" %>
<% unless friendship.accepted? %> <%= icon "confirm", accept_friendship_path(friendship.friend_id, friendship), nil, :method => :post %><% end %>
- <%= icon (friendship.accepted? ? "destroy" : "reject"), friendship_path(friendship.friend_id, friendship), nil, :confirm => "Are you sure?", :method => :delete %>
+ <%= icon (friendship.accepted? ? "destroy" : "reject"), user_friendship_path(friendship.friend_id, friendship), nil, :confirm => "Are you sure?", :method => :delete %>
<% end %>
</td>
</tr>
<% end %>
</table>
-<% end %>
\ No newline at end of file
+<% end %>
Modified: branches/authorization_new/app/views/friendships/edit.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/friendships/edit.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/friendships/edit.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -2,8 +2,8 @@
<%= error_messages_for :friendship %>
-<% form_for(:friendship, :url ="" friendship_path(@friendship.friend_id, @friendship), :html => { :method => :put }) do |f| %>
+<% form_for(:friendship, :url ="" user_friendship_path(@friendship.friend_id, @friendship), :html => { :method => :put }) do |f| %>
<p>
<%= submit_tag "Save Changes" %>
</p>
-<% end %>
\ No newline at end of file
+<% end %>
Modified: branches/authorization_new/app/views/friendships/new.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/friendships/new.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/friendships/new.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -2,7 +2,7 @@
<%= error_messages_for :friendship %>
-<% form_for(:friendship, :url ="" friendships_path) do |f| %>
+<% form_for(:friendship, :url ="" user_friendships_path) do |f| %>
<%= f.hidden_field :user_id, :value => current_user.id %>
<%= f.hidden_field :friend_id, :value => params[:user_id] %>
<% friend = User.find(params[:user_id]) %>
@@ -59,4 +59,4 @@
</div>
<% end %>
-<% end %>
\ No newline at end of file
+<% end %>
Modified: branches/authorization_new/app/views/friendships/show.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/friendships/show.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/friendships/show.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -1,6 +1,6 @@
<h1>Friendship</h1>
-<% display_user = !my_page? (@friendship.user_id) %>
+<% display_user = !my_page?(@friendship.user_id) %>
<% display_user_instance = display_user ? @friendship.user : @friendship.friend %>
@@ -80,7 +80,7 @@
<%= hidden_field_tag "accept_msg", "" %>
<% end %>
- <% form_tag (friendship_path(@friendship.friend_id, @friendship) + "?return_to=" + currentusers_things_url('friends'), :method => :delete) do %>
+ <% form_tag(user_friendship_path(@friendship.friend_id, @friendship) + "?return_to=" + currentusers_things_url('friends'), :method => :delete) do %>
<%= hidden_field_tag "reject_msg", "" %>
<% end %>
@@ -102,4 +102,4 @@
<div id="user_box" style="display: none; margin-top: 3em;">
<%= render :partial => "users/table", :locals => { :collection => [ display_user_instance ] } %>
-</div>
\ No newline at end of file
+</div>
Modified: branches/authorization_new/app/views/gadgets/_user_monitor.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/gadgets/_user_monitor.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/gadgets/_user_monitor.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -14,12 +14,12 @@
<li>
<%= icon "profile", user_url(current_user), nil, nil, " My Profile" %>
<span style="color: #666666; margin-left: 0.5em;">
- <small>[ <%= link_to "edit", edit_profile_path(current_user) -%> ]</small>
+ <small>[ <%= link_to "edit", edit_user_profile_path(current_user) -%> ]</small>
</span>
</li>
<li><%= messages_link(current_user, "My Messages") %></li>
<li><%= memberships_link(current_user, "My Memberships") %></li>
- <li><%= icon "history", userhistory_url(current_user), nil, nil, "My History" %></li>
+ <li><%= icon "history", user_userhistory_url(current_user), nil, nil, "My History" %></li>
<li><%= icon "news", home_url, nil, nil, "My News" %></li>
</ul>
@@ -59,8 +59,8 @@
<ul class="gadget_list">
<% current_user.friendships_pending.each do |friendship| %>
<li>
- <%= icon "user", friendship_path(current_user, friendship), nil, nil, "" %>
- <b><%= link_to truncate(h(friendship.user.name), trunc_length), friendship_path(current_user, friendship), :title => tooltip_title_attrib(h(friendship.user.name)) -%></b>
+ <%= icon "user", user_friendship_path(current_user, friendship), nil, nil, "" %>
+ <b><%= link_to truncate(h(friendship.user.name), trunc_length), user_friendship_path(current_user, friendship), :title => tooltip_title_attrib(h(friendship.user.name)) -%></b>
</li>
<% end %>
</ul>
Modified: branches/authorization_new/app/views/layouts/_footer.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/layouts/_footer.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/layouts/_footer.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -18,7 +18,7 @@
<p><%= link_to "Publications", "http://www.semanticgrid.org/myexperiment/", :target => '_blank' %></p>
</td>
<td class="middle">
- <p><%= link_to "Taverna Workflow Workbench", "http://taverna.sourceforge.net/", :target => '_blank' %></p>
+ <p><%= link_to "Taverna Workflow Workbench", "http://www.taverna.org.uk/", :target => '_blank' %></p>
<p><%= link_to "Google Coop Search", "/google", :target => '_blank' %></p>
<br/>
<p><%= link_to "Invite people to myExperiment", invite_users_path %></p>
Modified: branches/authorization_new/app/views/layouts/_paginate.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/layouts/_paginate.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/layouts/_paginate.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -6,7 +6,7 @@
<%= link_to '« previous', { :page => collection.previous_page } %>
</li>
<% else -%>
- <li class="disablepage">« previous</li>
+ <li class="disabledpage">« previous</li>
<% end -%>
<% last_page = 0 -%>
@@ -26,7 +26,7 @@
<%= link_to 'next »', { :page => collection.next_page } %>
</li>
<% else -%>
- <li class="disablepage">next »</li>
+ <li class="disabledpage">next »</li>
<% end -%>
</ul>
</div>
Modified: branches/authorization_new/app/views/memberships/_breadcrumbs.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/memberships/_breadcrumbs.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/memberships/_breadcrumbs.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -7,7 +7,7 @@
<li><b>»</b></li>
- <li><%= link_to 'Memberships', memberships_path(@user) %></li>
+ <li><%= link_to 'Memberships', user_memberships_path(@user) %></li>
<% else %>
<li><%= link_to 'Memberships', url_for(:controller => :memberships) %>
<% end %>
@@ -15,5 +15,5 @@
<% if ["show"].include? controller.action_name.to_s %>
<li><b>»</b></li>
- <li><%= link_to "View: #{h(@membership.network.title)}", membership_path(@membership.user, @membership) %></li>
+ <li><%= link_to "View: #{h(@membership.network.title)}", user_membership_path(@membership.user, @membership) %></li>
<% end %>
Modified: branches/authorization_new/app/views/memberships/new.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/memberships/new.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/memberships/new.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -2,7 +2,7 @@
<%= error_messages_for :membership %>
-<% form_for(:membership, :url ="" memberships_path(params[:user_id]), :html => {:id => 'memb_request_form'}) do |f| %>
+<% form_for(:membership, :url ="" user_memberships_path(params[:user_id]), :html => {:id => 'memb_request_form'}) do |f| %>
<%= f.hidden_field :user_id, :value => current_user.id %>
<center>
@@ -57,4 +57,4 @@
</div>
<% end %>
-<% end %>
\ No newline at end of file
+<% end %>
Modified: branches/authorization_new/app/views/memberships/show.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/memberships/show.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/memberships/show.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -38,7 +38,7 @@
is a member of:
<% end %>
<% else %>
- <%= membership_invite_request_action_message(allow_approval, @membership.is_invite?, link_to_function (h(@membership.user.name) + expand_image, visual_effect(:toggle_blind, "user_box", :duration => 0.3)) ) -%>
+ <%= membership_invite_request_action_message(allow_approval, @membership.is_invite?, link_to_function(h(@membership.user.name) + expand_image, visual_effect(:toggle_blind, "user_box", :duration => 0.3)) ) -%>
<% end %>
</b>
<br/>
@@ -104,11 +104,11 @@
<!-- These forms serve as 'data senders' for Accept/Reject buttons -->
- <% form_tag (accept_membership_path(current_user.id, @membership)) do %>
+ <% form_tag(accept_membership_path(current_user.id, @membership)) do %>
<%= hidden_field_tag "accept_msg", "" %>
<% end %>
- <% form_tag (membership_path(@membership.user_id, @membership) + "?return_to=" + currentusers_things_url('groups'), :method => :delete) do %>
+ <% form_tag(user_membership_path(@membership.user_id, @membership) + "?return_to=" + currentusers_things_url('groups'), :method => :delete) do %>
<%= hidden_field_tag "reject_msg", "" %>
<% end %>
@@ -137,4 +137,4 @@
<div id="user_box" style="display: none; margin-top: 3em;">
<%= render :partial => "users/table", :locals => { :collection => [ @membership.user ] } %>
<a name="user_box"></a>
-</div>
\ No newline at end of file
+</div>
Modified: branches/authorization_new/app/views/networks/_table.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/networks/_table.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/networks/_table.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -68,7 +68,7 @@
<% if mine? network -%>
<%= icon "manage", edit_group_path(network) %>
<% elsif logged_in? %> <!-- admins can't leave the group or request membership! -->
- <% if network.member? (current_user.id) %>
+ <% if network.member?(current_user.id) %>
<!-- user is not an admin, but a member already -->
<% cur_membership = Membership.find(:first, :conditions => ["network_id = ? AND user_id = ?", network.id, current_user.id] ) %>
<% if cur_membership %>
Modified: branches/authorization_new/app/views/notifier/friendship_request.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/notifier/friendship_request.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/notifier/friendship_request.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -2,11 +2,11 @@
<%= @friend_name %> wants to be your friend.
-Please go to <%= "http://" + @base_url + friendship_path(@user, @friendship) %> to confirm/reject this request.
+Please go to <%= "http://" + @base_url + user_friendship_path(@user, @friendship) %> to confirm/reject this request.
Your username is: <%= @user.username %>
Thanks,
- The myExperiment Team
-<%= BASE_URI -%>
\ No newline at end of file
+<%= BASE_URI -%>
Modified: branches/authorization_new/app/views/notifier/membership_request.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/notifier/membership_request.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/notifier/membership_request.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -5,11 +5,11 @@
Name: <%= @network.title %>
Administrator: <%= @network.owner.name %>
-Please go to <%= "http://" + @base_url + membership_path(@requestor, @membership) %> to confirm/reject this request.
+Please go to <%= "http://" + @base_url + user_membership_path(@requestor, @membership) %> to confirm/reject this request.
Your username is: <%= @user.username %>
Thanks,
- The myExperiment Team
-<%= BASE_URI -%>
\ No newline at end of file
+<%= BASE_URI -%>
Modified: branches/authorization_new/app/views/permissions/_breadcrumbs.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/permissions/_breadcrumbs.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/permissions/_breadcrumbs.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -7,24 +7,24 @@
<li><b>»</b></li>
- <li><%= link_to 'Permissions', permissions_path(@policy) %></li>
+ <li><%= link_to 'Permissions', policy_permissions_path(@policy) %></li>
<% else %>
<li><%= link_to h(@permission.policy.name), policy_path(@permission.policy) %></li>
<li><b>»</b></li>
- <li><%= link_to 'Permissions', permissions_path(@permission.policy) %></li>
+ <li><%= link_to 'Permissions', policy_permissions_path(@permission.policy) %></li>
<% end %>
<% if ["show", "new", "edit"].include? controller.action_name.to_s %>
<li><b>»</b></li>
<% case controller.action_name.to_s; when "show" %>
- <li><%= link_to "View: #{contributor_name(@permission.contributor_id, @permission.contributor_type)}", permission_path(@policy, @permission) %></li>
+ <li><%= link_to "View: #{contributor_name(@permission.contributor_id, @permission.contributor_type)}", policy_permission_path(@policy, @permission) %></li>
<% when "new" %>
- <li><%= link_to "New Permission", new_permission_path(@permission.policy) %></li>
+ <li><%= link_to "New Permission", new_policy_permission_path(@permission.policy) %></li>
<% when "edit" %>
- <li><%= link_to "Edit: #{contributor_name(@permission.contributor_id, @permission.contributor_type)}", edit_permission_path(@policy, @permission) %></li>
+ <li><%= link_to "Edit: #{contributor_name(@permission.contributor_id, @permission.contributor_type)}", edit_policy_permission_path(@policy, @permission) %></li>
<% else %>
<!-- no breadcrumb -->
<% end %>
Modified: branches/authorization_new/app/views/permissions/_subnav.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/permissions/_subnav.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/permissions/_subnav.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -1,6 +1,6 @@
<% if @permission.policy %>
<ul class="sectionIcons">
- <li><%= icon('new', new_permission_path(@permission.policy), nil, nil, 'New permission') %></li>
+ <li><%= icon('new', new_policy_permission_path(@permission.policy), nil, nil, 'New permission') %></li>
</ul>
<% end %>
Modified: branches/authorization_new/app/views/permissions/edit.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/permissions/edit.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/permissions/edit.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -2,7 +2,7 @@
<%= error_messages_for :permission %>
-<% form_for(:permission, :url ="" permission_path(@permission.policy, @permission), :html => { :method => :put }) do |f| %>
+<% form_for(:permission, :url ="" policy_permission_path(@permission.policy, @permission), :html => { :method => :put }) do |f| %>
<p>
<b>Contributor</b><br />
<%= f.text_field :contributor_id %>
@@ -31,4 +31,4 @@
<p>
<%= submit_tag "Update" %>
</p>
-<% end %>
\ No newline at end of file
+<% end %>
Modified: branches/authorization_new/app/views/permissions/new.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/permissions/new.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/permissions/new.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -2,7 +2,7 @@
<%= error_messages_for :permission %>
-<% form_for(:permission, :url ="" permissions_path(params[:policy_id])) do |f| %>
+<% form_for(:permission, :url ="" policy_permissions_path(params[:policy_id])) do |f| %>
<% if params[:policy_id] %>
<p>
<b>Policy</b><br/>
@@ -71,4 +71,4 @@
<p>
<%= submit_tag "Create" %>
</p>
-<% end %>
\ No newline at end of file
+<% end %>
Modified: branches/authorization_new/app/views/pictures/_breadcrumbs.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/pictures/_breadcrumbs.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/pictures/_breadcrumbs.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -8,7 +8,7 @@
<li><b>»</b></li>
<% end %>
-<li><%= link_to 'Pictures', pictures_path -%></li>
+<li><%= link_to 'Pictures', user_pictures_path -%></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
<li><b>»</b></li>
Modified: branches/authorization_new/app/views/pictures/new.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/pictures/new.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/pictures/new.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -2,7 +2,7 @@
<%= error_messages_for :picture %>
-<% form_tag ({:action ="" :create}, :multipart => true) do %>
+<% form_tag({:action ="" :create}, :multipart => true) do %>
<%= hidden_field_tag(:redirect_to, params[:return_to] ? params[:return_to] : user_pictures_path(current_user.id) ) -%>
<br/>
@@ -21,4 +21,4 @@
or <%= link_to "Cancel", params[:return_to] ? params[:return_to] : user_pictures_path(current_user.id) -%>
</center>
</p>
-<% end %>
\ No newline at end of file
+<% end %>
Modified: branches/authorization_new/app/views/profiles/_form.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/profiles/_form.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/profiles/_form.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -6,8 +6,8 @@
<h2>Your profile pictures</h2>
<ul class="sectionIcons">
- <li><%= icon("pictures", pictures_path(@user), nil, nil, "Manage Profile Pictures") %></li>
- <li><%= icon('avatar', new_picture_path(@user) + "?return_to=" + edit_profile_path(current_user.id), nil, nil, 'Upload New Profile Pic')%></li>
+ <li><%= icon("pictures", user_pictures_path(@user), nil, nil, "Manage Profile Pictures") %></li>
+ <li><%= icon('avatar', new_user_picture_path(@user) + "?return_to=" + edit_user_profile_path(current_user.id), nil, nil, 'Upload New Profile Pic')%></li>
</ul>
<p class="box_standout" style="text-align: center; padding: 0.3em 0.5em; margin: 0.3em 0;">
@@ -23,7 +23,7 @@
<% pictures.each do |p| %>
<li>
<center>
- <%= image_tag url_for :controller => 'pictures', :action ="" 'show', :id => p.id, :size => '60x60' %>
+ <%= image_tag(url_for(:controller => 'pictures', :action ="" 'show', :id => p.id, :size => '60x60')) %>
<br/>
<%= form.radio_button :picture_id, p.id %>
</center>
@@ -110,4 +110,4 @@
<%= fckeditor_textarea(:profile, :body, :toolbarSet => 'Simple', :width => '700px', :height => '300px') %>
<br/>
-<br/>
\ No newline at end of file
+<br/>
Modified: branches/authorization_new/app/views/profiles/edit.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/profiles/edit.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/profiles/edit.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -2,7 +2,7 @@
<%= error_messages_for :profile %>
-<% form_for(:profile, :url ="" profile_path(@profile.user_id), :html => { :method => :put }) do |f| %>
+<% form_for(:profile, :url ="" user_profile_path(@profile.user_id), :html => { :method => :put }) do |f| %>
<% if mine? @user %>
<%= render :partial => "form", :object => f, :locals => { :pictures => @user.pictures } %>
Modified: branches/authorization_new/app/views/reviews/_breadcrumbs.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/reviews/_breadcrumbs.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/reviews/_breadcrumbs.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -4,7 +4,7 @@
<li><%= link_to "#{h(@reviewable.title)}", workflow_path(@reviewable) -%></li>
<li><b>»</b></li>
-<li><%= link_to 'Reviews', reviews_path(@reviewable) -%></li>
+<li><%= link_to 'Reviews', workflow_reviews_path(@reviewable) -%></li>
<% if ["show", "new", "edit"].include? controller.action_name.to_s -%>
<li><b>»</b></li>
@@ -14,7 +14,7 @@
<% when "new" -%>
<li>New Review</li>
<% when "edit" -%>
- <li><%= link_to "#{h(@review.title)}", review_path(@reviewable, @review) -%></li>
+ <li><%= link_to "#{h(@review.title)}", workflow_review_path(@reviewable, @review) -%></li>
<li><b>»</b></li>
<li>Edit</li>
<% else -%>
Modified: branches/authorization_new/app/views/users/_table.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/users/_table.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/users/_table.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -77,14 +77,14 @@
<%= icon "edit", edit_user_path(user), nil, nil, "Edit" %>
<% else %>
<!-- check if the profile that we are viewing now is a friend of current user -> stored for better performance -->
- <% this_user_is_friend_of_current_user = user.friend? current_user.id %>
+ <% this_user_is_friend_of_current_user = user.friend?(current_user.id) %>
<% unless !logged_in? || this_user_is_friend_of_current_user || current_user.friendship_pending?(user.id) %>
- <%= icon "friendship", new_friendship_url(:user_id => user.id), nil, nil, "Request Friendship" %>
+ <%= icon "friendship", new_user_friendship_url(:user_id => user.id), nil, nil, "Request Friendship" %>
<% end %>
<%= icon "message", new_message_path(:user_id => user.id), nil, nil, "Send Message" %>
<% if logged_in? && this_user_is_friend_of_current_user %>
<% master_id, friendship_obj = current_user.friendship_from_self_id_and_friends_id(user.id) %>
- <%= icon "friend_delete", friendship_path(master_id, friendship_obj) + "?return_to=" + currentusers_things_url('friends'), nil, {:confirm => "Are you sure you want to remove this user from your friend list?", :method => :delete}, "Cancel Friendship" %>
+ <%= icon "friend_delete", user_friendship_path(master_id, friendship_obj) + "?return_to=" + currentusers_things_url('friends'), nil, {:confirm => "Are you sure you want to remove this user from your friend list?", :method => :delete}, "Cancel Friendship" %>
<% end %>
<% end %>
</td>
Modified: branches/authorization_new/app/views/users/show.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/users/show.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/users/show.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -6,7 +6,7 @@
<% if friend_id == @user.id %>
You have already sent a friendship request to this person. Awaiting their confirmation.
<% else %>
- This person has sent you a friendship request. Awaiting your <%= link_to "confirmation", friendship_path(current_user, friendship_obj) -%>.
+ This person has sent you a friendship request. Awaiting your <%= link_to "confirmation", user_friendship_path(current_user, friendship_obj) -%>.
<% end %>
</b></div>
<% end %>
@@ -47,7 +47,7 @@
<li><%= icon("message", new_message_path(:user_id => @user.id), nil, nil, "Send Message") %></li>
<% if this_user_is_friend_of_current_user %>
<% master_id, friendship_obj = current_user.friendship_from_self_id_and_friends_id(@user.id) %>
- <li><%= icon "friend_delete", friendship_path(master_id, friendship_obj) + "?return_to=" + user_path(@user), nil, {:confirm => "Are you sure you want to remove this user from your friend list?", :method => :delete}, "Cancel Friendship" %></li>
+ <li><%= icon "friend_delete", user_friendship_path(master_id, friendship_obj) + "?return_to=" + user_path(@user), nil, {:confirm => "Are you sure you want to remove this user from your friend list?", :method => :delete}, "Cancel Friendship" %></li>
<% end %>
<% end %>
@@ -378,7 +378,7 @@
<% end %>
<% if mine? @user %>
- <p style="color: #666666;">[ <%= link_to 'View all Memberships in detail', memberships_path(@user) %> ]</p>
+ <p style="color: #666666;">[ <%= link_to 'View all Memberships in detail', user_memberships_path(@user) %> ]</p>
<% end %>
<% when "Workflows" %>
Modified: branches/authorization_new/app/views/viewings/_breadcrumbs.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/viewings/_breadcrumbs.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/viewings/_breadcrumbs.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -6,13 +6,13 @@
<li><b>»</b></li>
-<li><%= link_to 'Viewings', viewings_path(@contribution) %>
+<li><%= link_to 'Viewings', contribution_viewings_path(@contribution) %>
<% if ["show"].include? controller.action_name.to_s %>
<li><b>»</b></li>
<% case controller.action_name.to_s; when "show" %>
- <li><%= link_to datetime(@viewing.created_at, false), viewing_path(@contribution, @viewing) %></li>
+ <li><%= link_to datetime(@viewing.created_at, false), contribution_viewing_path(@contribution, @viewing) %></li>
<% else %>
<!-- no breadcrumb -->
<% end %>
Modified: branches/authorization_new/app/views/workflows/_main_metadata_form.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/workflows/_main_metadata_form.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/workflows/_main_metadata_form.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -20,7 +20,7 @@
<% if show_infer_option %>
<p>
<label for=""
- <%= radio_button_tag ("metadata_choice",
+ <%= radio_button_tag("metadata_choice",
"infer",
main_metadata_infer_selected,
: "$('metadata_choice_custom').checked=false;$('div_main_metadata_custom').hide();return true;") -%>
@@ -32,7 +32,7 @@
<p style="margin-top: 0.1em;">
<label for=""
- <%= radio_button_tag ("metadata_choice",
+ <%= radio_button_tag("metadata_choice",
"custom",
!main_metadata_infer_selected,
: "$('metadata_choice_infer').checked=false;$('div_main_metadata_custom').show();return true;") -%>
@@ -76,4 +76,4 @@
</div>
</div>
-</center>
\ No newline at end of file
+</center>
Modified: branches/authorization_new/app/views/workflows/index.rhtml (2073 => 2074)
--- branches/authorization_new/app/views/workflows/index.rhtml 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/app/views/workflows/index.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -1,3 +1,10 @@
+<div class="box_standout" style="text-align: center; margin-bottom: 1em; font-weight: bold; line-height: 1.5em;">
+ <% Workflow.count(:all, :group => 'content_type').sort{|x,y| y[1] <=> x[1]}.each do |arr| %>
+ | <%= pluralize(arr[1], (h(WorkflowTypesHandler.type_display_name_for_content_type(arr[0]) + " workflow"))) %>
+ <% end %>
+ |
+</div>
+
<ul class="sectionIcons">
<li><%= icon "workflow", new_workflow_path, nil, nil, "Upload New Workflow" %></li>
<li><%= icon "view-all", all_workflows_path, nil, nil, "View All Workflows" %></li>
Copied: branches/authorization_new/app/views/workflows/tag_suggestions.rhtml (from rev 2073, trunk/app/views/workflows/tag_suggestions.rhtml) (0 => 2074)
--- branches/authorization_new/app/views/workflows/tag_suggestions.rhtml (rev 0)
+++ branches/authorization_new/app/views/workflows/tag_suggestions.rhtml 2009-01-27 15:51:03 UTC (rev 2074)
@@ -0,0 +1,49 @@
+<%= _javascript__include_tag "tag_suggestions.js" %>
+
+<h1>Tag suggestions</h1>
+
+<p>Based on the content of your workflow, here are some tags which you may wish to add:</p>
+
+<h2>Selected tags to add</h2>
+
+<% if false %>
+
+ <form action="" "/workflows/address@hidden/tag" %>" method="post" Ajax.Request(<%= "'/workflows/address@hidden/tag'" %>, { asynchronous:true, evalScripts:true, onComplete:function(request){addTag(<%= "'#{suggestion}'" %>)}, onLoading:function(request){addingTag(<%= "'#{suggestion}'" %>)}, onSuccess:function(request){tagSuccess(<%= "'#{suggestion}'" %>)}, parameters:Form.serialize(this)}); return false;">
+
+ <span><%= suggestion %></span>
+ <input id="tag_list" name="tag_list" type="hidden" value="<%= suggestion %>"/>
+ <input name="commit" type="submit" value="Add" />
+
+ </form>
+ <% end %>
+
+<p>Click on tags below to add them. Once you have chosen all the tags you want, press submit.</p>
+
+<div class="box_simple" style="font-size: 93%; text-align: left; margin-top: 1em;">
+ <div id="to-add"></div>
+</div>
+
+<h2>Tag suggestions</h2>
+
+<p>These are the tags that have been suggested for your upload, based on the content. The tags
+shown here are already used by other content.</p>
+
+<div class="box_simple" style="font-size: 93%; text-align: left; margin-top: 1em;">
+ <div id="suggestions"></div>
+</div>
+
+<script type="text/ecmascript">
+ <% @suggestions.each do |suggestion| %>
+ defineTag("<%= suggestion %>");
+ <% end %>
+
+ updateTagViews();
+</script>
+
+<form action="" "/workflows/address@hidden/process_tag_suggestions" %>" method="post">
+ <p style="text-align: center">
+ <input type="submit" value="Continue" />
+ <input type="hidden" name="tag_list" id="tag_list" />
+ </p>
+</form>
+
Modified: branches/authorization_new/config/routes.rb (2073 => 2074)
--- branches/authorization_new/config/routes.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/config/routes.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -82,6 +82,7 @@
:update_version => :put,
:comments_timeline => :get,
:comments => :get,
+ :process_tag_suggestions => :post,
:tag_suggestions => :get } do |workflow|
# workflows have nested citations
workflow.resources :citations
Modified: branches/authorization_new/lib/rest.rb (2073 => 2074)
--- branches/authorization_new/lib/rest.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/lib/rest.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -51,7 +51,7 @@
"#{request.protocol}#{request.host_with_port}#{path}"
end
-def rest_get_request(ob, req_uri, uri, entity_name, query)
+def rest_get_request(ob, req_uri, user, uri, entity_name, query)
if query['version']
return rest_error_response(400, 'Resource not versioned') unless ob.respond_to?('versions')
@@ -96,7 +96,7 @@
limited_ob = eval("ob.#{limited_to_user}")
end
- next if limited_ob != current_user
+ next if limited_ob != user
end
unless query['all_elements'] == 'yes'
@@ -141,7 +141,7 @@
# filter out things that the user cannot see
collection = collection.select do |c|
- not c.respond_to?('contribution') || Authorized.is_authorized?("view", nil, c, current_user)
+ not c.respond_to?('contribution') || Authorized.is_authorized?("view", nil, c, user)
end
collection.each do |item|
@@ -207,7 +207,7 @@
doc
end
-def rest_crud_request(rules)
+def rest_crud_request(rules, user)
query = CGIMethods.parse_query_parameters(request.query_string)
@@ -224,15 +224,15 @@
case rules['Permission']
when 'public'; # do nothing
- when 'view'; return rest_error_response(403, 'Not authorized') if !Authorization.is_authorized?("show", nil, perm_ob, current_user)
- when 'owner'; return rest_error_response(403, 'Not authorized') if logged_in?.nil? or object_owner(perm_ob) != current_user
+ when 'view'; return rest_error_response(403, 'Not authorized') if !Authorization.is_authorized?("show", nil, perm_ob, user)
+ when 'owner'; return rest_error_response(403, 'Not authorized') if logged_in?.nil? or object_owner(perm_ob) != user
end
response.content_type = "application/xml"
- rest_get_request(ob, params[:uri], eval("rest_resource_uri(ob)"), rest_name, query)
+ rest_get_request(ob, params[:uri], user, eval("rest_resource_uri(ob)"), rest_name, query)
end
-def rest_index_request(rules, query)
+def rest_index_request(rules, user, query)
rest_name = rules['REST Entity']
model_name = rules['Model Entity']
@@ -284,7 +284,7 @@
end
# filter out ones they are not allowed to get
- obs = (obs.select do |c| c.respond_to?('contribution') == false || Authorized.is_authorized?("index", nil, c, current_user) end)
+ obs = (obs.select do |c| c.respond_to?('contribution') == false || Authorized.is_authorized?("index", nil, c, user) end)
produce_rest_list(rules, query, obs, rest_name.pluralize)
end
@@ -435,11 +435,11 @@
end
-def get_rest_uri(rules, query)
+def get_rest_uri(rules, user, query)
return bad_rest_request if query['resource'].nil?
- obs = (obs.select do |c| c.respond_to?('contribution') == false || Authorization.is_authorized?("index", nil, c, current_user) end)
+ obs = (obs.select do |c| c.respond_to?('contribution') == false || Authorization.is_authorized?("index", nil, c, user) end)
doc = REXML::Document.new("<?xml version=\"1.0\" encoding=\"UTF-8\"?><rest-uri/>")
"bing"
end
@@ -452,9 +452,9 @@
:contributor => user)
end
-def post_workflow(rules, query)
+def post_workflow(rules, user, query)
- return rest_error_response(400, 'Bad Request') if current_user.nil?
+ return rest_error_response(400, 'Bad Request') if user.nil?
title = params["workflow"]["title"]
description = params["workflow"]["description"]
@@ -472,7 +472,7 @@
contribution = Contribution.new(
:contributor_type => 'User',
- :contributor_id => current_user.id)
+ :contributor_id => user.id)
workflow = Workflow.new(
:title => title,
@@ -481,27 +481,46 @@
:content_type => content_type,
:content_blob => ContentBlob.new(:data ="" content),
:contributor_type => 'User',
- :contributor_id => current_user.id,
+ :contributor_id => user.id,
:contribution => contribution)
-# scufl_model = Scufl::Parser.new.parse(content)
+ # Handle the preview and svg images. If there's a preview supplied, use it.
+ # Otherwise auto-generate one if we can.
-# workflow.create_workflow_diagrams(scufl_model, "1")
+ if params["workflow"]["preview"]
+ image = Tempfile.new('image')
+ image.write(Base64.decode64(params["workflow"]["preview"]))
+ image.rewind
+
+ image.extend FileUpload
+ image.original_filename = 'preview'
+
+ workflow.image = image
+
+ image.close
+
+ elsif workflow.processor_class.can_generate_preview?
+
+ processor = workflow.processor_class.new(content)
+ workflow.image, workflow.svg = processor.get_preview_images
+
+ end
+
workflow.set_unique_name
if not workflow.save
return rest_error_response(400, 'Bad Request')
end
- workflow.contribution.policy = create_default_policy(current_user)
+ workflow.contribution.policy = create_default_policy(user)
workflow.contribution.save
- rest_get_request(workflow, "workflow",
+ rest_get_request(workflow, "workflow", user,
rest_resource_uri(workflow), "workflow", { "id" => workflow.id.to_s })
end
-# def post_job(rules, query)
+# def post_job(rules, user, query)
#
# title = params["job"]["title"]
# description = params["job"]["description"]
@@ -521,15 +540,14 @@
# runner = TavernaEnactor.find_by_id(runner_bits[1].to_i)
# runnable = Workflow.find_by_id(runnable_bits[1].to_i)
#
-# NB! if this method get's worked on later, .authorized? for experiments / runners / runnables is a better choice than Authorized.is_authorized?() call
-# return rest_error_response(400, 'Bad Request') if experiment.nil? or not experiment.authorized?("edit", current_user)
-# return rest_error_response(400, 'Bad Request') if runner.nil? or not runner.authorized?("download", current_user)
-# return rest_error_response(400, 'Bad Request') if runnable.nil? or not runnable.authorized?("view", current_user)
+# return rest_error_response(400, 'Bad Request') if experiment.nil? or not experiment.authorized?("edit", user)
+# return rest_error_response(400, 'Bad Request') if runner.nil? or not runner.authorized?("download", user)
+# return rest_error_response(400, 'Bad Request') if runnable.nil? or not runnable.authorized?("view", user)
#
# puts "#{params[:job]}"
#
# job = Job.new(:title => title, :description => description, :runnable => runnable,
-# :experiment => experiment, :runner => runner, :user => current_user,
+# :experiment => experiment, :runner => runner, :user => user,
# :runnable_version => runnable.versions.last.version)
#
# inputs = { "Tags" => "aa,bb,aa,cc,aa" }
@@ -544,7 +562,7 @@
#
# end
-def search(rules, query)
+def search(rules, user, query)
search_query = query['query']
@@ -568,6 +586,9 @@
root['query'] = search_query
root['type' ] = query['type'] if query['type']
+ # filter out ones they are not allowed to get
+ results = results.select do |r| r.respond_to?('contribution') == false or r.authorized?('index', user) end
+
results.each do |result|
root << rest_reference(result, query)
end
@@ -577,8 +598,9 @@
doc
end
-def user_count(rules, query)
+def user_count(rules, user, query)
+ puts "user = #{user}"
users = User.find(:all).select do |user| user.activated? end
root = XML::Node.new('user-count')
@@ -590,7 +612,7 @@
doc
end
-def group_count(rules, query)
+def group_count(rules, user, query)
groups = Network.find(:all)
@@ -602,7 +624,7 @@
doc
end
-def get_tagged(rules, query)
+def get_tagged(rules, user, query)
return rest_error_response(400, 'Bad Request') if query['tag'].nil?
@@ -611,12 +633,12 @@
obs = tag ? tag.tagged : []
# filter out ones they are not allowed to get
- obs = (obs.select do |c| c.respond_to?('contribution') == false || Authorized.is_authorized?("index", nil, c, current_user) end)
+ obs = (obs.select do |c| c.respond_to?('contribution') == false || Authorized.is_authorized?("index", nil, c, user) end)
produce_rest_list(rules, query, obs, 'tagged')
end
-def tag_cloud(rules, query)
+def tag_cloud(rules, user, query)
num = 25
type = nil
@@ -654,7 +676,7 @@
doc
end
-def post_comment(rules, query)
+def post_comment(rules, user, query)
title = params[:comment][:title]
text = params[:comment][:comment]
@@ -664,7 +686,7 @@
resource_bits = parse_resource_uri(params["comment"]["resource"])
- return rest_error_response(400, 'Bad Request') if current_user == 0
+ return rest_error_response(400, 'Bad Request') if user.nil?
return rest_error_response(400, 'Bad Request') if text.nil? or text.length.zero?
return rest_error_response(400, 'Bad Request') if resource_bits.nil?
@@ -672,16 +694,16 @@
resource = eval(resource_bits[0]).find_by_id(resource_bits[1].to_i)
- comment = Comment.create(:user => current_user, :comment => text)
+ comment = Comment.create(:user => user, :comment => text)
resource.comments << comment
- rest_get_request(comment, "comment", rest_resource_uri(comment), "comment", { "id" => comment.id.to_s })
+ rest_get_request(comment, "comment", user, rest_resource_uri(comment), "comment", { "id" => comment.id.to_s })
end
-# def put_comment(rules, query)
+# def put_comment(rules, user, query)
# end
#
-# def delete_comment(rules, query)
+# def delete_comment(rules, user, query)
#
# return rest_error_response(400, 'Bad Request') if query['id'].nil?
#
@@ -691,12 +713,12 @@
#
# # this will have to be replaced with Authorization.is_authorized?() if it comes into use at some point
# if resource.respond_to?('authorized?')
-# return rest_error_response(403, 'Not Authorized') if not resource.authorized?('edit', current_user)
+# return rest_error_response(403, 'Not Authorized') if not resource.authorized?('edit', user)
# end
#
# end
-def rest_call_request(rules, query)
- eval("#{rules['Function']}(rules, query)")
+def rest_call_request(rules, user, query)
+ eval("#{rules['Function']}(rules, user, query)")
end
Modified: branches/authorization_new/public/index.html (2073 => 2074)
--- branches/authorization_new/public/index.html 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/public/index.html 2009-01-27 15:51:03 UTC (rev 2074)
@@ -119,7 +119,7 @@
<p><a href="" us Feedback</a></p>
<p><a href="" target="_blank">For Developers</a></p>
<p><a href="" target="_blank">The myGrid Project</a></p>
- <p><a href="" target="_blank">Taverna Workflow Workbench</a></p>
+ <p><a href="" target="_blank">Taverna Workflow Workbench</a></p>
<p><a href="" target="_blank">The BioCatalogue Project</a></p>
<p><a href="" target="_blank">myExperiment Publications</a></p>
</div>
@@ -248,7 +248,7 @@
</p>
<p>
myExperiment is part of the <a href="" target="_blank">myGrid</a> consortium,
- which develops the <a href="" target="_blank">Taverna Workflow Workbench</a>
+ which develops the <a href="" target="_blank">Taverna Workflow Workbench</a>
for creating and executing scientific workflows,
and also builds on <a href="" target="_blank">CombeChem</a> - two of the original UK e-Science Pilot Projects.
The related WHIP (<a href="" target="_blank">Triana</a> enactment)
Modified: branches/authorization_new/public/_javascript_s/tag_suggestions.js (2073 => 2074)
--- branches/authorization_new/public/_javascript_s/tag_suggestions.js 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/public/_javascript_s/tag_suggestions.js 2009-01-27 15:51:03 UTC (rev 2074)
@@ -71,6 +71,7 @@
// selected tags
markup = "";
+ form_value = "";
if (tagsToAdd.length == 0) {
@@ -85,9 +86,16 @@
if (i != (tagsToAdd.length - 1))
markup += separator;
+
+ if (i > 0)
+ form_value = form_value + ",";
+
+ form_value = form_value + tagsToAdd[i];
}
}
document.getElementById("to-add").innerHTML = markup;
+
+ document.getElementById("tag_list").value = form_value;
}
Modified: branches/authorization_new/resolr.sh (2073 => 2074)
--- branches/authorization_new/resolr.sh 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/resolr.sh 2009-01-27 15:51:03 UTC (rev 2074)
@@ -2,9 +2,9 @@
export RAILS_ENV=production
-echo 'Workflow.find_all.map do |w| w.solr_save end' | ruby script/console
-echo 'Blob.find_all.map do |b| b.solr_save end' | ruby script/console
-echo 'User.find_all.map do |u| u.solr_save end' | ruby script/console
-echo 'Network.find_all.map do |n| n.solr_save end' | ruby script/console
-echo 'Pack.find_all.map do |p| p.solr_save end' | ruby script/console
+echo 'Workflow.rebuild_solr_index' | ruby script/console
+echo 'Blob.rebuild_solr_index' | ruby script/console
+echo 'User.rebuild_solr_index' | ruby script/console
+echo 'Network.rebuild_solr_index' | ruby script/console
+echo 'Pack.rebuild_solr_index' | ruby script/console
Modified: branches/authorization_new/test/functional/friendships_controller_test.rb (2073 => 2074)
--- branches/authorization_new/test/functional/friendships_controller_test.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/test/functional/friendships_controller_test.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -39,7 +39,7 @@
post :create, :user_id => users(:admin).id, :friendship => { :user_id => users(:john).id, :friend_id => users(:admin).id }
assert_equal old_count+1, Friendship.count
- assert_redirected_to friendship_path(users(:john).id, assigns(:friendship))
+ assert_redirected_to user_friendship_path(users(:john).id, assigns(:friendship))
end
def test_should_show_friendship
Modified: branches/authorization_new/test/functional/memberships_controller_test.rb (2073 => 2074)
--- branches/authorization_new/test/functional/memberships_controller_test.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/test/functional/memberships_controller_test.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -41,7 +41,7 @@
:membership => { :user_id => users(:john).id, :network_id => networks(:spare_network).id } #, :message => "Can I Join Please?" }
assert_equal old_count+1, Membership.count
- assert_redirected_to membership_path(users(:john).id, assigns(:membership))
+ assert_redirected_to user_membership_path(users(:john).id, assigns(:membership))
end
# not convinced that this test is working
Modified: branches/authorization_new/test/functional/packs_controller_test.rb (2073 => 2074)
--- branches/authorization_new/test/functional/packs_controller_test.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/test/functional/packs_controller_test.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -49,7 +49,7 @@
post :create, :pack => { :title => 'my new pack', :description => 'a new pack lalalala' }
assert_response :redirect
- assert_redirected_to pack_url assigns(:pack)
+ assert_redirected_to(pack_url(assigns(:pack)))
assert_equal num_packs + 1, Pack.count
end
Modified: branches/authorization_new/test/functional/workflows_controller_test.rb (2073 => 2074)
--- branches/authorization_new/test/functional/workflows_controller_test.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/test/functional/workflows_controller_test.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -43,7 +43,7 @@
:attributions_workflows => '',
:attributions_files => ''
- assert_redirected_to workflow_path(assigns(:workflow))
+ assert_redirected_to tag_suggestions_workflow_path(assigns(:workflow))
assert_equal old_count+1, Workflow.count
end
Modified: branches/authorization_new/vendor/plugins/white_list/lib/white_list_helper.rb (2073 => 2074)
--- branches/authorization_new/vendor/plugins/white_list/lib/white_list_helper.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/vendor/plugins/white_list/lib/white_list_helper.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -68,7 +68,7 @@
if !attrs.include?(attr_name) || (protocol_attributes.include?(attr_name) && contains_bad_protocols?(value))
node.attributes.delete(attr_name)
else
- node.attributes[attr_name] = CGI::escapeHTML(value)
+ node.attributes[attr_name] = value
end
end if node.attributes
if tags.include?(node.name)
@@ -94,4 +94,4 @@
WhiteListHelper.bad_tags = %w(script div span fieldset legend style)
WhiteListHelper.tags = %w(strong em b i u p code pre tt output samp kbd var sub sup dfn cite big small address hr br h1 h2 h3 h4 h5 h6 ul ol li dt dd abbr acronym a img blockquote del ins)
WhiteListHelper.attributes = %w(href src width height alt cite datetime title class style)
-WhiteListHelper.protocols = %w(ed2k ftp http https irc mailto news gopher nntp telnet webcal xmpp callto feed)
\ No newline at end of file
+WhiteListHelper.protocols = %w(ed2k ftp http https irc mailto news gopher nntp telnet webcal xmpp callto feed)
Modified: branches/authorization_new/vendor/plugins/white_list_formatted_content/init.rb (2073 => 2074)
--- branches/authorization_new/vendor/plugins/white_list_formatted_content/init.rb 2009-01-21 14:36:02 UTC (rev 2073)
+++ branches/authorization_new/vendor/plugins/white_list_formatted_content/init.rb 2009-01-27 15:51:03 UTC (rev 2074)
@@ -20,6 +20,6 @@
def body_html_with_formatting
body_html = auto_link body { |text| truncate(text, 50) }
- white_list(RedCloth.new(body_html).to_html)
+ white_list(body_html)
end
-end
\ No newline at end of file
+end