- <%= check_box_tag "article[dspace_collection_id]", true %> |
- <%= _('DSpace Collection') %> |
+
+
+ |
+ <%= _('Collection name') %> |
+
+ <% 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| %>
+
- <%= check_box_tag "article[dspace_collection_id][]", collection[1] %> |
+ <% if dspace_collections_ids.include? collection[1] %>
+ <%= check_box_tag "article[dspace_collections_ids][]", collection[1], true, :disabled => 'disabled', :onclick => "selectCollection(this,'#{collection[0]}')" %> |
+ <% else %>
+ <%= check_box_tag "article[dspace_collections_ids][]", collection[1], false, :onclick => "selectCollection(this,'#{collection[0]}')" %> |
+ <% end %>
- <%= hidden_field_tag "article[dspace_collection_name][]", collection[0].to_slug %>
<%= collection[0] %>
|
+
<% end %>
+
-<%#= labelled_form_field(_('Collections:'),
- select(:article,
- :dspace_collection_id,
- options_for_select_with_title(collections))) %>
+<%= javascript_include_tag 'plugins/dspace/javascripts/dspace_plugin' %>
diff --git a/plugins/dspace/views/cms/dspace_plugin/_communityy.html.erb b/plugins/dspace/views/cms/dspace_plugin/_communityy.html.erb
index de3ef1a..ef3ecd8 100644
--- a/plugins/dspace/views/cms/dspace_plugin/_communityy.html.erb
+++ b/plugins/dspace/views/cms/dspace_plugin/_communityy.html.erb
@@ -1,18 +1,34 @@
-<%= _('DSpace Community') %>
-
-<%= required_fields_message %>
-
-<%= required f.text_field('name', :size => '64', :maxlength => 150) %>
+<%= _('DSpace Communities') %>
<%= hidden_field_tag 'article[parent_id]', @article.parent_id %>
<% dspace_server_url = @article.parent.dspace_server_url %>
-<% dspace_client = Dspace::Client.new(dspace_server_url) %>
+<% communities = Dspace::Community.get_all_communities_from(dspace_server_url).map { |community| item = [_(community.name), community.id] } %>
+
+
+
+ |
+ <%= _('Community name') %> |
+
+
+ <% dspace_communities_ids = DspacePlugin::Communityy.find(:all, :conditions => { :parent_id => @article.parent_id }).map { |community| ids = community.dspace_community_id.to_i } %>
+
+ <% communities.each do |community| %>
+
+
+ <% if dspace_communities_ids.include? community[1] %>
+ <%= check_box_tag "article[dspace_communities_ids][]", community[1], true, :disabled => 'disabled', :onclick => "selectCommunity(this,'#{community[0]}')" %> |
+ <% else %>
+ <%= check_box_tag "article[dspace_communities_ids][]", community[1], false, :onclick => "selectCommunity(this,'#{community[0]}')" %> |
+ <% end %>
+
+ <%= community[0] %>
+ |
+
+
+ <% end %>
-<% communities = dspace_client.get_communities.map { |community| item = [_(community.name), community.id] } %>
+
-<%= labelled_form_field(_('Communities:'),
- select(:article,
- :dspace_community_id,
- options_for_select_with_title(communities))) %>
+<%= javascript_include_tag 'plugins/dspace/javascripts/dspace_plugin' %>
diff --git a/plugins/dspace/views/content_viewer/community.html.erb b/plugins/dspace/views/content_viewer/community.html.erb
index e85faa5..4049eb4 100644
--- a/plugins/dspace/views/content_viewer/community.html.erb
+++ b/plugins/dspace/views/content_viewer/community.html.erb
@@ -6,7 +6,7 @@
<% if dspace_community.allow_create?(user) %>
- <%= content_tag('a', :href => url_for({:controller => 'dspace_plugin_myprofile', :action => 'new', :type => "DspacePlugin::Collection", :parent_id => dspace_community.id}), :class => 'button with-text icon-add') do %>
+ <%= content_tag('a', :href => url_for({:controller => 'cms', :action => 'new', :type => "DspacePlugin::Collection", :parent_id => dspace_community.id}), :class => 'button with-text icon-add') do %>
<%= _("Add a %s") % DspacePlugin::Collection.short_description %>
<% end %>
diff --git a/plugins/dspace/views/content_viewer/library.html.erb b/plugins/dspace/views/content_viewer/library.html.erb
index 3305f88..0800839 100644
--- a/plugins/dspace/views/content_viewer/library.html.erb
+++ b/plugins/dspace/views/content_viewer/library.html.erb
@@ -3,7 +3,7 @@
<% if dspace_library.allow_create?(user) %>
- <%= content_tag('a', :href => url_for({:controller => 'dspace_plugin_myprofile', :action => 'new', :type => "DspacePlugin::Communityy", :parent_id => dspace_library.id}), :class => 'button with-text icon-add') do %>
+ <%= content_tag('a', :href => url_for({:controller => 'cms', :action => 'new', :type => "DspacePlugin::Communityy", :parent_id => dspace_library.id}), :class => 'button with-text icon-add') do %>
<%= _("Add a %s") % DspacePlugin::Communityy.short_description %>
<% end %>
--
libgit2 0.21.2