Index: content-bundles/resources/types.properties =================================================================== --- content-bundles/resources/types.properties (revision 114937) +++ content-bundles/resources/types.properties (working copy) @@ -76,6 +76,7 @@ avail.hide10 = Hide this item #avail.hide2 = Hide this folder from non-administrators avail.hide20 = Hide this folder and its contents +avail.hide30 = Hide this folder and enable public access to its contents avail.show = Show avail.show1 = Show this item avail.show2 = Show this folder Index: content-bundles/resources/types_es.properties =================================================================== --- content-bundles/resources/types_es.properties (revision 114937) +++ content-bundles/resources/types_es.properties (working copy) @@ -62,6 +62,7 @@ action.reorder=Reordenar edit.access4=Mostrar a los grupos seleccionados avail.hide20=Ocultar este elemento y sus contenidos +avail.hide30=Ocultar esta carpeta dejando disponible el acceso a su contenido create.text=Nuevo documento de texto simple action.select=- Seleccione una acci\u00F3n - access.public.fldr=Esta carpeta y sus contenidos son p\u00FAblicos. Index: content-tool/tool/src/java/org/sakaiproject/content/tool/ListItem.java =================================================================== --- content-tool/tool/src/java/org/sakaiproject/content/tool/ListItem.java (revision 114937) +++ content-tool/tool/src/java/org/sakaiproject/content/tool/ListItem.java (working copy) @@ -87,6 +87,7 @@ import org.sakaiproject.thread_local.cover.ThreadLocalManager; import org.sakaiproject.time.api.Time; import org.sakaiproject.time.cover.TimeService; +import org.sakaiproject.tool.api.SessionManager; import org.sakaiproject.tool.cover.ToolManager; import org.sakaiproject.user.api.User; import org.sakaiproject.user.cover.UserDirectoryService; @@ -300,6 +301,36 @@ { continue; } + if(isAvailabilityEnabled){ + boolean entityHiddenWithAccessibleContent = false; + try{ + entityHiddenWithAccessibleContent = childEntity.getProperties().getBooleanProperty(ResourceProperties.PROP_HIDDEN_WITH_ACCESSIBLE_CONTENT); + }catch(Exception e){ + entityHiddenWithAccessibleContent = false; + } + + if(entityHiddenWithAccessibleContent){ + //do not show childEntity if the user is a student with read only permissions on the entity + String creator = childEntity.getProperties().getProperty(ResourceProperties.PROP_CREATOR); + String userId = ((SessionManager) ComponentManager.get(SessionManager.class)).getCurrentSessionUserId(); + + // available if user is creator + boolean available = ( creator != null && userId != null && creator.equals(userId) ) + || ( creator == null && userId == null ); + + if(! available) + { + // available if user has permission to view hidden entities + available = SecurityService.unlock(ContentHostingService.AUTH_RESOURCE_HIDDEN, childEntity.getReference()); + } + + if(! available) + { + continue; + } + } + + } ListItem child = getListItem(childEntity, item, registry, expandAll, expandedFoldersSync, items_to_be_moved, items_to_be_copied, depth + 1, userSelectedSort, preventPublicDisplay, addFilter); if(items_to_be_copied != null && items_to_be_copied.contains(child.id)) @@ -412,6 +443,7 @@ protected boolean isPubview = false; protected boolean hidden; + protected boolean hiddenWithAccessibleContent; protected boolean isAvailable; protected boolean useReleaseDate; protected Time releaseDate; @@ -863,6 +895,12 @@ this.retractDate = retractDate; } this.isAvailable = entity.isAvailable(); + + try{ + this.hiddenWithAccessibleContent = props.getBooleanProperty(ResourceProperties.PROP_HIDDEN_WITH_ACCESSIBLE_CONTENT); + }catch(Exception e){ + this.hiddenWithAccessibleContent = false; + } this.htmlFilter = entity.getProperties().getProperty(ResourceProperties.PROP_ADD_HTML); if (this.htmlFilter == null) { @@ -1411,7 +1449,20 @@ protected void captureAvailability(ParameterParser params, String index) { // availability - this.hidden = params.getBoolean("hidden" + index); + String hiddenParam = params.getString("hidden" + index); + if("false".equals(hiddenParam)){ + this.hidden = false; + this.hiddenWithAccessibleContent = false; + } + if("true".equals(hiddenParam)){ + this.hidden = true; + this.hiddenWithAccessibleContent = false; + } + + if("hidden_with_accessible_content".equals(hiddenParam)){ + this.hidden = false; + this.hiddenWithAccessibleContent = true; + } boolean use_start_date = params.getBoolean("use_start_date" + index); boolean use_end_date = params.getBoolean("use_end_date" + index); @@ -2718,6 +2769,14 @@ { this.hidden = hidden; } + + /** + * @return the hiddenWithAccessibleContent + */ + public boolean isHiddenWithAccessibleContent() + { + return this.hiddenWithAccessibleContent; + } /** * @param hover @@ -3040,7 +3099,7 @@ //setCopyrightOnEntity(props); setConditionalReleaseOnEntity(props); setAccessOnEntity(edit); - setAvailabilityOnEntity(edit); + setAvailabilityOnEntity(props, edit); setQuotaOnEntity(props); setHtmlInlineOnEntity(props, edit); @@ -3170,8 +3229,24 @@ } - protected void setAvailabilityOnEntity(GroupAwareEdit edit) + protected void setAvailabilityOnEntity(ResourcePropertiesEdit props, GroupAwareEdit edit) { + if( this.hiddenWithAccessibleContent == true ){ + props.addProperty(ResourceProperties.PROP_HIDDEN_WITH_ACCESSIBLE_CONTENT, "true"); + hidden = false; + useReleaseDate = false; + useRetractDate = false; + } else { + props.removeProperty(ResourceProperties.PROP_HIDDEN_WITH_ACCESSIBLE_CONTENT); + } + + if(useReleaseDate == false){ + releaseDate = null; + } + if(useRetractDate == false){ + retractDate = null; + } + edit.setAvailability(hidden, releaseDate, retractDate); } @@ -3274,7 +3349,7 @@ setCopyrightOnEntity(props); setHtmlFilterOnEntity(props); setAccessOnEntity(edit); - setAvailabilityOnEntity(edit); + setAvailabilityOnEntity(props, edit); setHtmlInlineOnEntity(props, edit); if(! isUrl() && ! isCollection() && this.mimetype != null) Index: content-tool/tool/src/webapp/vm/content/sakai_resources_list.vm =================================================================== --- content-tool/tool/src/webapp/vm/content/sakai_resources_list.vm (revision 114937) +++ content-tool/tool/src/webapp/vm/content/sakai_resources_list.vm (working copy) @@ -320,9 +320,9 @@ ############################### Show top level folder ################# #set ($num=$num + 1) @@ -572,9 +572,9 @@ ############################### Show top level folder ################# #set ($num=$num + 1) Index: content-tool/tool/src/webapp/vm/resources/sakai_properties.vm =================================================================== --- content-tool/tool/src/webapp/vm/resources/sakai_properties.vm (revision 114937) +++ content-tool/tool/src/webapp/vm/resources/sakai_properties.vm (working copy) @@ -364,7 +364,7 @@ + + #if($model.isCollection()) + + + + + #end +
- +
+ + + +
#end Index: content-tool/tool/src/webapp/vm/resources/sakai_properties_scripts.vm =================================================================== --- content-tool/tool/src/webapp/vm/resources/sakai_properties_scripts.vm (revision 114937) +++ content-tool/tool/src/webapp/vm/resources/sakai_properties_scripts.vm (working copy) @@ -125,6 +125,10 @@ { tag.onclick = handleSetToHidden; } + else if(tag.id && tag.id.match(/^hidden_with_accessible_content_true${DOT}\d+$/)) + { + tag.onclick = handleSetToHidden; + } #if($model.isGroupPossible()) else if(tag.id && tag.id.match(/^access_mode_inherited${DOT}\d+$/)) {