sufia 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +12 -1
  3. data/History.md +10 -0
  4. data/README.md +1 -6
  5. data/app/assets/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  6. data/app/assets/javascripts/sufia.js +3 -4
  7. data/app/assets/javascripts/sufia/batch_select_all.js +2 -2
  8. data/app/controllers/concerns/sufia/users_controller_behavior.rb +133 -0
  9. data/app/controllers/users_controller.rb +1 -115
  10. data/app/helpers/trophy_helper.rb +2 -3
  11. data/app/models/datastreams/properties_datastream.rb +5 -3
  12. data/app/views/batch/edit.html.erb +7 -3
  13. data/app/views/batch_edits/edit.html.erb +47 -77
  14. data/app/views/dashboard/_index_partials/_list_files.html.erb +25 -12
  15. data/app/views/dashboard/index.html.erb +29 -44
  16. data/app/views/generic_files/_descriptions.html.erb +17 -17
  17. data/app/views/generic_files/_permission.html.erb +7 -124
  18. data/app/views/generic_files/_permission_form.html.erb +123 -0
  19. data/app/views/generic_files/_versioning.html.erb +1 -1
  20. data/app/views/generic_files/edit.html.erb +9 -21
  21. data/app/views/users/_notify_number.html.erb +1 -1
  22. data/app/views/users/edit.html.erb +1 -1
  23. data/config/routes.rb +3 -1
  24. data/lib/sufia.rb +5 -1
  25. data/lib/sufia/files_controller_behavior.rb +8 -8
  26. data/lib/sufia/user.rb +4 -8
  27. data/lib/sufia/version.rb +1 -1
  28. data/spec/controllers/generic_files_controller_spec.rb +8 -0
  29. data/spec/controllers/users_controller_spec.rb +22 -0
  30. data/spec/models/properties_datastream_spec.rb +21 -0
  31. data/spec/routing/route_spec.rb +1 -0
  32. data/sufia.gemspec +0 -1
  33. data/vendor/assets/javascripts/ZeroClipboard.min.js +8 -0
  34. data/vendor/assets/javascripts/ZeroClipboard.swf +0 -0
  35. metadata +8 -19
  36. data/app/assets/javascripts/sufia/tabs.js +0 -58
  37. data/app/views/catalog/_uva_tabs.html.erb +0 -10
  38. data/vendor/assets/javascripts/jquery.zclip.min.js +0 -12
@@ -20,11 +20,11 @@ on element ids -->
20
20
  <% noid = document.noid %>
21
21
  <tr id="document_<%= noid.gsub(":", "_") %>" class="<%= cycle("","zebra") %>">
22
22
  <% gf = GenericFile.find(document.id) %>
23
- <td width="6%"><%= batch_edit_select(document) %>&nbsp;</td>
23
+ <td width="6%"><%= batch_edit_select(document) %>&nbsp;</td>
24
24
  <td width="1%">
25
25
  <% if gf.processing? %>
26
26
  <i class="icon-magic icon-large <%= 'ss-'+gf.batch.noid%>"/>
27
- <% elsif gf.depositor != @user.user_key %>
27
+ <% elsif gf.depositor != @user.user_key %>
28
28
  <i class="icon-gift icon-large"/>
29
29
  <% end %>
30
30
  </td>
@@ -36,22 +36,35 @@ on element ids -->
36
36
  <td width="17%"><%= document.date_uploaded %> </td>
37
37
  <td width="5%" align="center">
38
38
  <% if document.registered? %>
39
- <a href="<%= sufia.generic_file_path(noid) %>/edit/?tab=permissions" id="permission_<%= noid %>"><span class="label label-info" title="<%=t('sufia.institution_name') %>"><%=t('sufia.institution_name') %></span></a>
39
+ <a href="<%= sufia.generic_file_path(noid) %>/edit/?tab=permissions" id="permission_<%= noid %>"><span class="label label-info" title="<%=t('sufia.institution_name') %>"><%=t('sufia.institution_name') %></span></a>
40
40
  <% elsif document.public? %>
41
41
  <a href="<%= sufia.generic_file_path(noid) %>/edit/?tab=permissions" id="permission_<%= noid %>"><span class="label label-success" title="Open Access">Open Access</span></a>
42
42
  <% else %>
43
43
  <a href="<%= sufia.generic_file_path(noid) %>/edit/?tab=permissions" id="permission_<%= noid %>"><span class="label label-important" title="Private">Private</span></a>
44
44
  <% end %>
45
45
  </td>
46
- <td width="23%" class="center">
47
- <span style="position: relative; display: inline-block">
48
- <%= link_to raw('<!--i class="icon-unlock under"></i--><i class="icon-link icon-large over"></i>'), '#', :class => 'copypaste itemicon itemcode', :title => 'Single Use Link to File', :id => "copy_link_#{noid}" %>
49
- </span>&nbsp;&nbsp;&nbsp;
50
- <%= link_to raw('<i class="icon-pencil icon-large"></i>'), sufia.edit_generic_file_path(noid), :class=> 'itemicon itemedit', :title => 'Edit File' %>&nbsp;&nbsp;&nbsp;
51
- <%= link_to raw('<i class="icon-download-alt icon-large"></i>'), sufia.download_path(noid), :class=> 'itemicon itemdownload', :title => 'Download File', :target => '_new' %>&nbsp;&nbsp;&nbsp;
52
- <%= link_to raw('<i class="icon-trash icon-large"></i>'), sufia.generic_file_path(noid), :class=> 'itemicon itemtrash', :title => 'Delete File', :method => :delete, :data => { :confirm => "Deleting a file from #{t('sufia.product_name')} is permanent. Click OK to delete this file from #{t('sufia.product_name')}, or Cancel to cancel this operation"} %>&nbsp;&nbsp;&nbsp;
53
-
54
- <%= display_trophy_link(@user, noid) %>&nbsp;&nbsp;&nbsp;
46
+ <td width="23%">
47
+ <div class="btn-group">
48
+ <button class="btn btn-small" href="#"><i class="icon-wrench"></i> Select an action</button>
49
+ <button class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#"><span class="icon-caret-down"></span></button>
50
+ <ul class="dropdown-menu">
51
+ <li>
52
+ <%= link_to raw('<i class="icon-link over"></i> Single-Use Link to File'), '#', :class => "copypaste itemicon itemcode", :title => "Single-Use Link to File", :id => "copy_link_#{noid}" %>
53
+ </li>
54
+ <li>
55
+ <%= link_to raw('<i class="icon-pencil"></i> Edit File'), sufia.edit_generic_file_path(noid), :class=> 'itemicon itemedit', :title => 'Edit File' %>
56
+ </li>
57
+ <li>
58
+ <%= link_to raw('<i class="icon-download-alt"></i> Download File'), sufia.download_path(noid), :class=> 'itemicon itemdownload', :title => 'Download File', :target => '_new' %>
59
+ </li>
60
+ <li>
61
+ <%= link_to raw('<i class="icon-trash"></i> Delete File'), sufia.generic_file_path(noid), :class=> 'itemicon itemtrash', :title => 'Delete File', :method => :delete, :data => { :confirm => "Deleting a file from #{t('sufia.product_name')} is permanent. Click OK to delete this file from #{t('sufia.product_name')}, or Cancel to cancel this operation"} %>
62
+ </li>
63
+ <li>
64
+ <%= display_trophy_link(@user, noid) %>
65
+ </li>
66
+ </ul>
67
+ </div>
55
68
  </td>
56
69
  </tr>
57
70
  <tr class="hide" id="detail_<%= noid.gsub(":", "_") %>"> <!-- document detail"> -->
@@ -17,63 +17,48 @@ limitations under the License.
17
17
  <% content_for :local_js do %>
18
18
 
19
19
  initialize_audio();
20
-
21
- function getSingleUse( id){
20
+
21
+ function getSingleUse(id) {
22
22
  <% rurl = root_url %>
23
- <% rurl = rurl.slice(0,rurl.length-1) if rurl[rurl.length-1] == '/' %>
23
+ <% rurl = rurl.slice(0, rurl.length-1) if rurl[rurl.length-1] == "/" %>
24
24
  var resp = $.ajax({
25
- headers: {Accept : "application/javascript"},
25
+ headers: { Accept: "application/javascript" },
26
26
  type: 'get',
27
- url: '<%=rurl %>/single_use_link/generate_show/'+id.slice(10),
27
+ url: "<%= rurl %>/single_use_link/generate_show/" + id.slice(10),
28
28
  async: false,
29
29
  });
30
- $('#'+id).attr('singleUse',resp.responseText);
31
- return resp;
32
- }
33
-
34
-
35
- // Load clipboard swif
36
- $(document).ready(function(){
37
- var singleUse;
38
- <% rurl = root_url %>
39
- <% rurl = rurl.slice(0,rurl.length-1) if rurl[rurl.length-1] == '/' %>
40
- if (typeof swfobject !== 'undefined' && swfobject.getFlashPlayerVersion().major !== 0){
41
- copy_links = $('a.copypaste');
42
- for(var i=0; i < copy_links.length; i++)
43
- {
44
- setTimeout(getSingleUse(copy_links[i].id),1);
45
- $('#'+ copy_links[i].id).zclip({
46
- path: '/assets/ZeroClipboard.swf',
47
- copy: function() {
48
- var singleUse = $('#'+this.id).attr('singleUse');
49
- return '<%=rurl%>' + singleUse;
50
- },
51
- afterCopy: function(f) {
52
- alert("A single use link to "+$('#src_copy_link'+this.id.slice(10))[0].text+" was copied to your clip board.");
53
- setTimeout(getSingleUse(this.id),5);
54
- }
55
-
56
- });
57
- }
58
- } else {
59
- $('a.copypaste').click(function(){
60
- var singleUse = getSingleUse(this.id);
61
- var url = '<%=rurl%>' + singleUse.responseText;
62
- alert('Your Single Use Link: '+url);
63
- return false;
64
- });
65
- }
30
+ return "<%= rurl %>/" + resp.responseText;
31
+ }
32
+
33
+ // Load clipboard swf
34
+ $(document).ready(function() {
35
+ ZeroClipboard.setDefaults({ moviePath: "/assets/ZeroClipboard.swf" });
36
+ $.each($(".copypaste"), function() {
37
+ var clip = new ZeroClipboard();
38
+ clip.on("dataRequested", function(client, args) {
39
+ clip.setText(getSingleUse(this.id));
40
+ })
41
+ clip.on("complete", function(client, args) {
42
+ alert("A single use link to " + args.text + " was copied to your clipboard.")
43
+ })
44
+ clip.on("noflash", function(client, args) {
45
+ alert("Your single-use link: " + getSingleUse(this.id))
46
+ })
47
+ clip.on("wrongflash", function(client, args) {
48
+ alert("Your single-use link: " + getSingleUse(this.id))
49
+ })
50
+ clip.glue($("#" + this.id))
51
+ })
66
52
  });
67
53
 
68
-
69
54
  // hide or show the batch update buttons on page startup
70
55
  window.batch_part_on_other_page = <%= @batch_part_on_other_page%>;
71
56
  window.batch_size_on_other_page = <%= @batch_size_on_other_page%>;
72
57
  window.result_set_size = <%= @result_set_size%>;
73
58
  window.document_list_count = <%= @document_list.count %>;
74
59
  toggleButtons(<%= !@empty_batch %>);
75
-
76
- // initialize hydra batch edit and set up select all button toggle after checkboxes have been created
60
+
61
+ // initialize hydra batch edit and set up select all button toggle after checkboxes have been created
77
62
  $('#documents').batchEdit({afterCheckboxUpdate: setup_buttontoggle});
78
63
 
79
64
 
@@ -14,22 +14,22 @@ See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  %>
16
16
 
17
- <%= form_for @generic_file, :url => sufia.generic_file_path, :html => {:multipart => true, :class => 'form-horizontal'} do |f| %>
18
- <%= hidden_field_tag('redirect_tab', 'descriptions') %>
19
- <div id="descriptions_display">
20
- <h2 class="non lower">Descriptions <small class="pull-right"><span class="error">*</span> indicates required fields</small> </h2>
21
- <div class="well">
17
+ <div id="descriptions_display" class="tab-pane active">
18
+ <%= form_for @generic_file, :url => sufia.generic_file_path, :html => {:multipart => true, :class => 'form-horizontal'} do |f| %>
19
+ <%= hidden_field_tag('redirect_tab', 'descriptions') %>
20
+ <h2 class="non lower">Descriptions <small class="pull-right"><span class="error">*</span> indicates required fields</small> </h2>
21
+ <div class="well">
22
22
 
23
- <%= render :partial=>'generic_files/edit_fields/type', :locals => {f:f} %>
24
- <% (@generic_file.terms_for_editing - [:resource_type]).each do |term| %>
25
- <%= render :partial => "generic_files/field_form", :locals => { :generic_file => @generic_file, :f =>f, :render_req => true, :key => term } %>
26
- <% end %>
27
-
28
- </div><!-- /well -->
29
- <div class="row">
30
- <div class="form-actions">
31
- <%= f.button '<i class="icon-save"></i> Save Descriptions'.html_safe, :type => 'submit', :class => 'btn-primary', :onclick => "confirmation_needed = false;", :id => "upload_submit", :name => "update_descriptions" %>
23
+ <%= render :partial=>'generic_files/edit_fields/type', :locals => {f:f} %>
24
+ <% (@generic_file.terms_for_editing - [:resource_type]).each do |term| %>
25
+ <%= render :partial => "generic_files/field_form", :locals => { :generic_file => @generic_file, :f =>f, :render_req => true, :key => term } %>
26
+ <% end %>
27
+
28
+ </div><!-- /well -->
29
+ <div class="row">
30
+ <div class="form-actions">
31
+ <%= f.button '<i class="icon-save"></i> Save Descriptions'.html_safe, :type => 'submit', :class => 'btn-primary', :onclick => "confirmation_needed = false;", :id => "upload_submit", :name => "update_descriptions" %>
32
+ </div>
32
33
  </div>
33
- </div>
34
- </div><!-- /row /span6 -->
35
- <% end %>
34
+ <% end %>
35
+ </div>
@@ -14,130 +14,13 @@ See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  %>
16
16
 
17
- <% depositor = gf.depositor || batch.generic_files.first.depositor %>
18
- <% public_perm = gf.permissions.map { |perm| perm[:access] if perm[:name] == "public"}.compact.first %>
19
- <% public_perm = true if params[:controller] == 'batch' %>
20
- <% psu_perm = gf.permissions.map { |perm| perm[:access] if perm[:name] == "registered"}.compact.first %>
21
-
22
-
23
- <div id="permissions_display">
24
- <input type="hidden" name="generic_file[permissions][group][public]" value="1" />
25
- <input type="hidden" name="generic_file[permissions][group][registered]" value="2" />
26
- <h2><% if params[:controller] == 'batch' %>Bulk <% end %>Permissions <% if params[:controller] == 'batch' %><small>(applied to all files just uploaded)</small><% end %></h2>
27
- <div class="alert hide" id="save_perm_note">Permissions are <strong>not</strong> saved until the &quot;Save&quot; button is pressed at the bottom of the page.</div>
28
- <div class="alert alert-error hide" id="permissions_error"><a class="close" data-dismiss="alert" href="#">×</a><span id="permissions_error_text"></span></div>
29
- <div class="well">
30
- <div class="row">
31
- <p class="pull-right">
32
- <!-- Button to trigger modal -->
33
- <a href="#myModal" role="button" class="btn btn-warning" data-toggle="modal">What's this <i class="icon-question-sign icon-large"></i></a>
34
- <!-- Modal -->
35
- <div class="modal hide" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
36
- <div class="modal-header">
37
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
38
- <h2 id="myModalLabel"><%=t('sufia.product_name') %> Permissions</h2>
39
- </div>
40
- <div class="modal-body">
41
- <h3>Visibility</h3>
42
- <p>This setting will determine who can view your file, and the associated metadata. Setting
43
- the visibility to <span class="label label-success">Open Access</span> will allow your content to be discovered in Google and viewed by anyone.
44
- The visibility setting <span class="label label-info"><%=t('sufia.institution_name') %></span> will only allow users who are logged into <%=t('sufia.product_name') %>
45
- (via WebAccess) to view the content. Files that are marked <span class="label label-important">Private</span> are only able to be viewed
46
- by users and/or groups that have been given specific access in the &quot;Share With&quot; section.
47
- </p>
48
-
49
- <p>
50
- Permissions in <%=t('sufia.product_name') %> are hierarchical. This means that you cannot set the visibility of a file to <span class="label label-success">Open Access</span> or
51
- <span class="label label-info"><%=t('sufia.institution_name') %></span> and simultaneously try to restrict the access of a single user. However, you may mark the visibility of
52
- a file as <span class="label label-important">Private</span> and then grant access to particular users and/or groups for that file in the &quot;Share With&quot;
53
- section.
54
- </p>
55
-
56
- <h3>Share With</h3>
57
- <p>You may grant &quot;View/Download&quot; or &quot;Edit&quot; access for specific users and/or groups to files. Enter
58
- a valid <%=t('sufia.account_name') %>, one at a time, select the access level for that user and click
59
- <button class="btn btn-mini btn-inverse" onclick="return false;"><i class="icon-plus-sign" ></i>Add</button>.
60
- </p>
61
-
62
- <%= render partial: 'generic_files/groups_description' %>
63
-
64
- <h3>Permission Definitions</h3>
65
- <p>
66
- <strong>View/Download:</strong> this file (both contents and metadata) is accessible from within <%=t('sufia.product_name') %>.<br />
67
- <strong>Edit:</strong> this file (both contents and metadata) can be edited. You may only grant this permission to <%=t('sufia.institution_name') %> users and/or groups.
68
- </p>
69
- </div>
70
- <div class="modal-footer">
71
- <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>
72
- </div>
73
- </div>
74
- </p>
75
- </div>
76
- <div class="control-group">
77
- <h3>Visibility - <small>who should have the ability to read and download</small></h3>
78
- <div class="controls">
79
- <label class="radio">
80
- <input type="radio" id="visibility_open" name="visibility" value="open" <% if !public_perm.blank? %> checked="true"<% end %>/> <span class="label label-success">Open Access</span> Visible to the world.
81
- </label>
82
- <label class="radio">
83
- <input type="radio" id="visibility_psu" name="visibility" value="psu" <% if !psu_perm.blank? %> checked="true"<% end %> /><span class="label label-info"><%=t('sufia.institution_name') %></span> Visible to all <%=t('sufia.institution_name') %> users.
84
- </label>
85
- <label class="radio">
86
- <input type="radio" id="visibility_restricted" name="visibility" value="restricted"<% if psu_perm.blank? and public_perm.blank?%> checked="true"<% end %> /> <span class="label label-important">Private</span> Visible to users/groups specified below, if any.
87
- </label>
88
- </div><!-- /.controls -->
89
- </div><!-- /.control-group -->
90
- <div class="row">
91
- <h3>Share With <small>(optional)</small></h3>
92
- </div>
93
- <div class="row control-group">
94
- <div id="new-user">
95
- <div class="input-append">
96
- <p class="help-block">Enter <%=t('sufia.account_label') %> (one at a time)</p>
97
- <%= text_field_tag 'new_user_name_skel', nil, :class => "span29" %><span class="add-on"><%=t('sufia.directory.suffix') %></span>
98
- <%= select_tag 'new_user_permission_skel', options_for_select(Sufia::Engine.config.permission_levels), :class=> 'span17' %>
99
- <button class="btn btn-mini btn-inverse" id="add_new_user_skel"><i class="icon-plus-sign"></i> Add</button>
100
- <br /> <span id="directory_user_result"></span>
101
- </div>
102
- </div>
103
- </div>
104
- <div class="row control-group">
105
- <div id="new-group" >
106
- <div class="input-append">
107
- <%= select_tag 'new_group_name_skel', options_for_select(["Select a group"] + groups), :class => 'span38' %>
108
- <%= select_tag 'new_group_permission_skel', options_for_select(Sufia::Engine.config.permission_levels), :class => 'span17' %>
109
- <button class="btn btn-mini btn-inverse" id="add_new_group_skel" ><i class="icon-plus-sign"></i> Add</button>
110
- <br /><span id="directory_group_result"></span>
17
+ <div id="permissions_display" class="tab-pane">
18
+ <%= form_for @generic_file, :url => sufia.generic_file_path, :html => {:multipart => true, :class => 'form-horizontal', :id => 'permission'} do |f| %>
19
+ <%= hidden_field_tag('redirect_tab', 'permissions') %>
20
+ <%= render :partial => "generic_files/permission_form", :locals => { :gf => @generic_file, :f=> f } %>
21
+ <div class="row form-actions" id="permissions_submit">
22
+ <%= button_tag '<i class="icon-save"></i> Save'.html_safe, :type => 'submit', :class => 'btn-primary btn-large', :onclick => "confirmation_needed = false;", :id => "upload_submit", :name => "update_permission" %>
111
23
  </div>
112
- </div>
113
- </div>
114
- </div><!-- /.well -->
115
- <table class="table table-bordered">
116
- <tr>
117
- <th width="60%">Person/Group</th>
118
- <th width="40%">Access Level</th>
119
- </tr>
120
- <tr id="file_permissions">
121
- <td><%= label_tag :owner_access, "Depositor (<span id=\"file_owner\">#{link_to_profile depositor}</span>)".html_safe, :class=>"control-label" %></td>
122
- <td>
123
- <%= Sufia::Engine.config.owner_permission_levels.keys[0] %>
124
- </td>
125
- </tr>
126
- <% gf.permissions.each do |permission| %>
127
- <%-# skip the public, penn state (aka registered), and depositor perms as they are displayed first at the top -%>
128
- <% next if permission[:name].downcase == 'public' %>
129
- <% next if permission[:name].downcase == 'registered' %>
130
- <% next if permission[:name].downcase == depositor %>
131
- <tr>
132
- <td><%= label_tag "generic_file[permissions][#{permission[:type]}][#{permission[:name]}]", permission[:name], :class=>"control-label" %></td>
133
- <td>
134
- <%= select_tag "generic_file[permissions][#{permission[:type]}][#{permission[:name]}]", options_for_select(Sufia::Engine.config.permission_levels, permission[:access]), :class=>'span20 select_perm' %>
135
- <button class="btn close remove_perm">X</button>
136
- </td>
137
- </tr>
138
24
  <% end %>
139
- </table>
140
25
  </div><!-- /#permissions_display -->
141
- <div class="row form-actions" id="permissions_submit">
142
- <%= button_tag '<i class="icon-save"></i> Save'.html_safe, :type => 'submit', :class => 'btn-primary btn-large', :onclick => "confirmation_needed = false;", :id => "upload_submit", :name => "update_permission" %>
143
- </div>
26
+
@@ -0,0 +1,123 @@
1
+ <% depositor = gf.depositor || batch.generic_files.first.depositor %>
2
+ <% public_perm = gf.permissions.map { |perm| perm[:access] if perm[:name] == "public"}.compact.first %>
3
+ <% public_perm = true if params[:controller] == 'batch' %>
4
+ <% registered_perm = gf.permissions.map { |perm| perm[:access] if perm[:name] == "registered"}.compact.first %>
5
+
6
+
7
+ <input type="hidden" name="generic_file[permissions][group][public]" value="1" />
8
+ <input type="hidden" name="generic_file[permissions][group][registered]" value="2" />
9
+ <h2><% if params[:controller] == 'batch' %>Bulk <% end %>Permissions <% if params[:controller] == 'batch' %><small>(applied to all files just uploaded)</small><% end %></h2>
10
+ <div class="alert hide" id="save_perm_note">Permissions are <strong>not</strong> saved until the &quot;Save&quot; button is pressed at the bottom of the page.</div>
11
+ <div class="alert alert-error hide" id="permissions_error"><a class="close" data-dismiss="alert" href="#">×</a><span id="permissions_error_text"></span></div>
12
+ <div class="well">
13
+ <div class="row">
14
+ <p class="pull-right">
15
+ <!-- Button to trigger modal -->
16
+ <a href="#myModal" role="button" class="btn btn-warning" data-toggle="modal">What's this <i class="icon-question-sign icon-large"></i></a>
17
+ <!-- Modal -->
18
+ <div class="modal hide" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
19
+ <div class="modal-header">
20
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
21
+ <h2 id="myModalLabel"><%=t('sufia.product_name') %> Permissions</h2>
22
+ </div>
23
+ <div class="modal-body">
24
+ <h3>Visibility</h3>
25
+ <p>This setting will determine who can view your file, and the associated metadata. Setting
26
+ the visibility to <span class="label label-success">Open Access</span> will allow your content to be discovered in Google and viewed by anyone.
27
+ The visibility setting <span class="label label-info"><%=t('sufia.institution_name') %></span> will only allow users who are logged into <%=t('sufia.product_name') %>
28
+ (via WebAccess) to view the content. Files that are marked <span class="label label-important">Private</span> are only able to be viewed
29
+ by users and/or groups that have been given specific access in the &quot;Share With&quot; section.
30
+ </p>
31
+
32
+ <p>
33
+ Permissions in <%=t('sufia.product_name') %> are hierarchical. This means that you cannot set the visibility of a file to <span class="label label-success">Open Access</span> or
34
+ <span class="label label-info"><%=t('sufia.institution_name') %></span> and simultaneously try to restrict the access of a single user. However, you may mark the visibility of
35
+ a file as <span class="label label-important">Private</span> and then grant access to particular users and/or groups for that file in the &quot;Share With&quot;
36
+ section.
37
+ </p>
38
+
39
+ <h3>Share With</h3>
40
+ <p>You may grant &quot;View/Download&quot; or &quot;Edit&quot; access for specific users and/or groups to files. Enter
41
+ a valid <%=t('sufia.account_name') %>, one at a time, select the access level for that user and click
42
+ <button class="btn btn-mini btn-inverse" onclick="return false;"><i class="icon-plus-sign" ></i>Add</button>.
43
+ </p>
44
+
45
+ <%= render partial: 'generic_files/groups_description' %>
46
+
47
+ <h3>Permission Definitions</h3>
48
+ <p>
49
+ <strong>View/Download:</strong> this file (both contents and metadata) is accessible from within <%=t('sufia.product_name') %>.<br />
50
+ <strong>Edit:</strong> this file (both contents and metadata) can be edited. You may only grant this permission to <%=t('sufia.institution_name') %> users and/or groups.
51
+ </p>
52
+ </div>
53
+ <div class="modal-footer">
54
+ <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>
55
+ </div>
56
+ </div>
57
+ </p>
58
+ </div>
59
+ <div class="control-group">
60
+ <h3>Visibility - <small>who should have the ability to read and download</small></h3>
61
+ <div class="controls">
62
+ <label class="radio">
63
+ <input type="radio" id="visibility_open" name="visibility" value="open" <% if !public_perm.blank? %> checked="true"<% end %>/> <span class="label label-success">Open Access</span> Visible to the world.
64
+ </label>
65
+ <label class="radio">
66
+ <input type="radio" id="visibility_psu" name="visibility" value="psu" <% if !registered_perm.blank? %> checked="true"<% end %> /><span class="label label-info"><%=t('sufia.institution_name') %></span> Visible to all <%=t('sufia.institution_name') %> users.
67
+ </label>
68
+ <label class="radio">
69
+ <input type="radio" id="visibility_restricted" name="visibility" value="restricted"<% if registered_perm.blank? and public_perm.blank?%> checked="true"<% end %> /> <span class="label label-important">Private</span> Visible to users/groups specified below, if any.
70
+ </label>
71
+ </div><!-- /.controls -->
72
+ </div><!-- /.control-group -->
73
+ <div class="row">
74
+ <h3>Share With <small>(optional)</small></h3>
75
+ </div>
76
+ <div class="row control-group">
77
+ <div id="new-user">
78
+ <div class="input-append">
79
+ <p class="help-block">Enter <%=t('sufia.account_label') %> (one at a time)</p>
80
+ <%= text_field_tag 'new_user_name_skel', nil, :class => "span29" %><span class="add-on"><%=t('sufia.directory.suffix') %></span>
81
+ <%= select_tag 'new_user_permission_skel', options_for_select(Sufia::Engine.config.permission_levels), :class=> 'span17' %>
82
+ <button class="btn btn-mini btn-inverse" id="add_new_user_skel"><i class="icon-plus-sign"></i> Add</button>
83
+ <br /> <span id="directory_user_result"></span>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ <div class="row control-group">
88
+ <div id="new-group" >
89
+ <div class="input-append">
90
+ <%= select_tag 'new_group_name_skel', options_for_select(["Select a group"] + groups), :class => 'span38' %>
91
+ <%= select_tag 'new_group_permission_skel', options_for_select(Sufia::Engine.config.permission_levels), :class => 'span17' %>
92
+ <button class="btn btn-mini btn-inverse" id="add_new_group_skel" ><i class="icon-plus-sign"></i> Add</button>
93
+ <br /><span id="directory_group_result"></span>
94
+ </div>
95
+ </div>
96
+ </div>
97
+ </div><!-- /.well -->
98
+ <table class="table table-bordered">
99
+ <tr>
100
+ <th width="60%">Person/Group</th>
101
+ <th width="40%">Access Level</th>
102
+ </tr>
103
+ <tr id="file_permissions">
104
+ <td><%= label_tag :owner_access, "Depositor (<span id=\"file_owner\">#{link_to_profile depositor}</span>)".html_safe, :class=>"control-label" %></td>
105
+ <td>
106
+ <%= Sufia::Engine.config.owner_permission_levels.keys[0] %>
107
+ </td>
108
+ </tr>
109
+ <% gf.permissions.each do |permission| %>
110
+ <%-# skip the public, penn state (aka registered), and depositor perms as they are displayed first at the top -%>
111
+ <% next if permission[:name].downcase == 'public' %>
112
+ <% next if permission[:name].downcase == 'registered' %>
113
+ <% next if permission[:name].downcase == depositor %>
114
+ <tr>
115
+ <td><%= label_tag "generic_file[permissions][#{permission[:type]}][#{permission[:name]}]", permission[:name], :class=>"control-label" %></td>
116
+ <td>
117
+ <%= select_tag "generic_file[permissions][#{permission[:type]}][#{permission[:name]}]", options_for_select(Sufia::Engine.config.permission_levels, permission[:access]), :class=>'span20 select_perm' %>
118
+ <button class="btn close remove_perm">X</button>
119
+ </td>
120
+ </tr>
121
+ <% end %>
122
+ </table>
123
+