_collection.html.erb
1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<h1><%= _('DSpace Collections') %></h1>
<%= hidden_field_tag 'article[parent_id]', @article.parent_id %>
<%= hidden_field_tag 'article[dspace_community_id]', @article.parent.dspace_community_id %>
<% dspace_server_url = @article.parent.parent.dspace_server_url %>
<% community_id = @article.parent.dspace_community_id %>
<% collections = Dspace::Community.get_all_collections_from( dspace_server_url, community_id ).map { |collection| item = [_(collection.name), collection.id] } %>
<table border="0" style="border-bottom: 1px solid #c0c0c0;">
<tr style="background-color: #f0f0f0; border-bottom: 1px solid #c0c0c0;">
<th style="border-bottom: none;"> </th>
<th style="border-bottom: none;" align="left"><%= _('Collection name') %></th>
</tr>
<% dspace_collections_ids = DspacePlugin::Collection.find(:all, :conditions => { :parent_id => @article.parent_id}).map { |collection| ids = collection.dspace_collection_id.to_i } %>
<% collections.each do |collection| %>
<tr>
<% if dspace_collections_ids.include? collection[1] %>
<td align="center"><%= check_box_tag "article[dspace_collections_ids][]", collection[1], true, :disabled => 'disabled', :onclick => "selectCollection(this,'#{collection[0]}')" %> </td>
<% else %>
<td align="center"><%= check_box_tag "article[dspace_collections_ids][]", collection[1], false, :onclick => "selectCollection(this,'#{collection[0]}')" %> </td>
<% end %>
<td>
<%= collection[0] %>
</td>
</tr>
<% end %>
</table>
<%= javascript_include_tag 'plugins/dspace/javascripts/dspace_plugin' %>