Skip to content

Commit

Permalink
Merge pull request sakaiproject#1275 from ern/SAK-30077
Browse files Browse the repository at this point in the history
SAK-30077 FilePicker option to hide "Show Other Sites"
  • Loading branch information
ern committed Nov 17, 2015
2 parents 4dd6ecc + a015243 commit 96b0835
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2549,6 +2549,11 @@
# DEFAULT: false
# resources.show_all_collections.helper=true

# Indicates whether users should see "Show Other Sites" twiggle in file picker
# If this is not set explicity it will look to the resources helper twiggle setting as it is very similar
# DEFAULT: resources.show_all_collections.helper
# filepicker.show_all_collections=true

# The default number of members for a collection at which the resourcse tool should refuse to expand the collection.
# DEFAULT: 256
# resources.expanded_folder_size_limit=256
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public class FilePickerAction extends PagedResourceHelperAction
protected static final String STATE_SESSION_INITIALIZED = PREFIX + "session_initialized";
protected static final String STATE_SHOW_ALL_SITES = PREFIX + "show_all_sites";
protected static final String STATE_SHOW_OTHER_SITES = PREFIX + "show_other_sites";
public static final String SAK_PROP_SHOW_ALL_SITES = PREFIX + "show_all_collections";

/** The sort by */
private static final String STATE_SORT_BY = PREFIX + "sort_by";
Expand Down Expand Up @@ -1047,8 +1048,9 @@ protected String initHelperAction(SessionState state, ToolSession toolSession)
state.setAttribute(STATE_MODE, MODE_HELPER);
toolSession.setAttribute(STATE_FILEPICKER_MODE, MODE_ATTACHMENT_SELECT);

// TODO: Should check sakai.properties
toolSession.setAttribute(STATE_SHOW_ALL_SITES, Boolean.TRUE.toString());
boolean show_all_sites = ServerConfigurationService.getBoolean(SAK_PROP_SHOW_ALL_SITES,
ServerConfigurationService.getBoolean(ResourcesAction.SAK_PROP_SHOW_ALL_SITES_IN_HELPER, Boolean.TRUE));
toolSession.setAttribute(STATE_SHOW_ALL_SITES, Boolean.toString(show_all_sites));

// state attribute ResourcesAction.STATE_ATTACH_TOOL_NAME should be set with a string to indicate name of tool
String toolName = ToolManager.getCurrentPlacement().getTitle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,10 @@ public void setParent(String parent)
/** The default value for whether to show all sites in resources tool (used if global value can't be read from server config service) */
private static final boolean SHOW_ALL_SITES_IN_RESOURCES = false;
/** The collection id being browsed. */
public static final String SAK_PROP_SHOW_ALL_SITES_IN_TOOL = PREFIX + "show_all_collections.tool";
public static final String SAK_PROP_SHOW_ALL_SITES_IN_DROPBOX = PREFIX + "show_all_collections.dropbox";
public static final String SAK_PROP_SHOW_ALL_SITES_IN_HELPER = PREFIX + "show_all_collections.helper";

private static final String STATE_COLLECTION_ID = PREFIX + REQUEST + "collection_id";


Expand Down Expand Up @@ -8491,15 +8495,15 @@ else if(uploadMax == null)
boolean show_other_sites = false;
if(RESOURCES_MODE_HELPER.equals(resources_mode))
{
show_other_sites = ServerConfigurationService.getBoolean("resources.show_all_collections.helper", SHOW_ALL_SITES_IN_FILE_PICKER);
show_other_sites = ServerConfigurationService.getBoolean(SAK_PROP_SHOW_ALL_SITES_IN_HELPER, SHOW_ALL_SITES_IN_FILE_PICKER);
}
else if(RESOURCES_MODE_DROPBOX.equals(resources_mode))
{
show_other_sites = ServerConfigurationService.getBoolean("resources.show_all_collections.dropbox", SHOW_ALL_SITES_IN_DROPBOX);
show_other_sites = ServerConfigurationService.getBoolean(SAK_PROP_SHOW_ALL_SITES_IN_DROPBOX, SHOW_ALL_SITES_IN_DROPBOX);
}
else
{
show_other_sites = ServerConfigurationService.getBoolean("resources.show_all_collections.tool", SHOW_ALL_SITES_IN_RESOURCES);
show_other_sites = ServerConfigurationService.getBoolean(SAK_PROP_SHOW_ALL_SITES_IN_TOOL, SHOW_ALL_SITES_IN_RESOURCES);
}

/** set attribute for the maximum size at which the resources tool will expand a collection. */
Expand Down

0 comments on commit 96b0835

Please sign in to comment.