Skip to content

Commit

Permalink
LSNBLDR-633: Adding config (sakaiproject#4132)
Browse files Browse the repository at this point in the history
LSNBLDR-633: Adding config for lessonbuilder.show.set.owner

LSNBLDR-633: moving properties
  • Loading branch information
nicholaswilson100 authored and jonespm committed Apr 18, 2017
1 parent c670d1b commit 17af8c0
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4125,6 +4125,53 @@
# DEFAULT: false
# lessonbuilder.cc.import.singlepage=true

# ######################################################
# LSNBLDR-711 Added Twitter Timeline component for lessons
# ######################################################
# This is the Twitter widget id (used in the Lessons tool) which varies for each institution.
# It is used by the Twitter widget in Lessons to access the Twitter API and
# grab the widget HTML. To find out what your widget id is, go to https://twitter.com/settings/widgets,
# edit your widget (or create one if you don't have one), and the id (a long number) is the value of "data-widget-id"
# in the embed code bottom right.
#lessonbuilder.twitter.widget.id=123456789012345678
#
# Set this to false to hide the 'Embed Twitter Timeline' link which
# appears in the list when you click 'Add Content' in Lessons tool
#
# true/false Defaults to false (off)
# ###############################################################
#lessonbuilder.show.twitter.link=true

# ###############################################################
# LSNBLDR-542 New Lessons component: "Add Resources Folder listing"
#
# Set this to false to hide the 'Add Resources Folder' link which
# appears in the list when you click 'Add Content'
#
# true/false Defaults to true (on)
# ###############################################################
#lessonbuilder.show.resource.folder.link=false

# ###############################################################
# LSNBLDR-709 Add calendar component for Lessons page
#
# Set this to false to hide the 'Embed Calendar' link which
# appears in the list when you click 'Add Content' in Lessons tool
#
# true/false Defaults to true (on)
# ###############################################################
#lessonbuilder.show.calendar.link=false

# ###############################################################
# LSNBLDR-633 Restrict editing of Lessons pages and subpages to one person
#
# Set this to false to hide the set owner dropdown (and message above it)
# which appears when you click the 'Settings' cog in the Lessons tool
#
# true/false Defaults to true (on)
# ###############################################################
#lessonbuilder.show.set.owner=false

## END LESSONBUILDER

# If you don't want to use ui.service as the Production name, use:
Expand Down Expand Up @@ -4699,23 +4746,6 @@
#sitemanage.tools.groups.expanded=systoolgroups.lti


# ######################################################
# LSNBLDR-711 Added Twitter Timeline component for lessons
# ######################################################
# This is the Twitter widget id (used in the Lessons tool) which varies for each institution.
# It is used by the Twitter widget in Lessons to access the Twitter API and
# grab the widget HTML. To find out what your widget id is, go to https://twitter.com/settings/widgets,
# edit your widget (or create one if you don't have one), and the id (a long number) is the value of "data-widget-id"
# in the embed code bottom right.
#lessonbuilder.twitter.widget.id=123456789012345678
#
# Set this to false to hide the 'Embed Twitter Timeline' link which
# appears in the list when you click 'Add Content' in Lessons tool
#
# true/false Defaults to false (off)
# ###############################################################
#lessonbuilder.show.twitter.link=true

#SAK-25438 - Zip Download in Resources
#Option is not available unless the next properties are configured with a value (in bytes) greater than 0.
#Max size in bytes for a single file - Default 0 bytes
Expand Down Expand Up @@ -4746,26 +4776,6 @@
# ###############################################################
#portal.bullhorns.poll.interval=5000

# ###############################################################
# LSNBLDR-542 New Lessons component: "Add Resources Folder listing"
#
# Set this to false to hide the 'Add Resources Folder' link which
# appears in the list when you click 'Add Content'
#
# true/false Defaults to true (on)
# ###############################################################
#lessonbuilder.show.resource.folder.link=false

# ###############################################################
# LSNBLDR-709 Add calendar component for Lessons page
#
# Set this to false to hide the 'Embed Calendar' link which
# appears in the list when you click 'Add Content' in Lessons tool
#
# true/false Defaults to true (on)
# ###############################################################
#lessonbuilder.show.calendar.link=false

#TAGS

# If the tag service will be enabled or not. (default is true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4809,48 +4809,50 @@ private void createEditTitleDialog(UIContainer tofill, SimplePage page, SimplePa
UISelect.make(form, "cssDropdown", options, labels, "#{simplePageBean.dropDown}", currentCss);

UIOutput.make(form, "cssDefaultInstructions", messageLocator.getMessage("simplepage.css-default-instructions"));
UIOutput.make(form, "ownerDefaultInstructions", messageLocator.getMessage("simplepage.owner-default-instructions")
.replace("{1}", messageLocator.getMessage("simplepage.permissions")).replace("{2}", messageLocator.getMessage("simplepage.more-tools")));
UIOutput.make(form, "cssUploadLabel", messageLocator.getMessage("simplepage.css-upload-label"));
UIOutput.make(form, "cssUpload");
UIBoundBoolean.make(form, "nodownloads",
"#{simplePageBean.nodownloads}",
(simplePageBean.getCurrentSite().getProperties().getProperty("lessonbuilder-nodownloadlinks") != null));

//Set the changeOwner dropdown in the settings dialog
UIOutput.make(form, "changeOwnerSection");
List<String> roleOptions = new ArrayList<>();
List<String> roleLabels = new ArrayList<>();
List<String> possOwners = new LinkedList<>();
boolean isOwned = page.isOwned();
String owner = page.getOwner();
possOwners.addAll(simplePageBean.getCurrentSite().getUsers());
Set<String> siteUsersCanUpdate = simplePageBean.getCurrentSite().getUsersIsAllowed(SimplePage.PERMISSION_LESSONBUILDER_UPDATE);
possOwners.removeAll(siteUsersCanUpdate);
if (isOwned){
if (possOwners.contains(owner)){
int i = possOwners.indexOf(owner);
Collections.swap(possOwners, i, 0); // put owner top of list
boolean showSetOwner = ServerConfigurationService.getBoolean("lessonbuilder.show.set.owner", true);
if (showSetOwner){
//Set the changeOwner dropdown in the settings dialog
UIOutput.make(form, "ownerDefaultInstructions", messageLocator.getMessage("simplepage.owner-default-instructions")
.replace("{1}", messageLocator.getMessage("simplepage.permissions")).replace("{2}", messageLocator.getMessage("simplepage.more-tools")));
UIOutput.make(form, "changeOwnerSection");
List<String> roleOptions = new ArrayList<>();
List<String> roleLabels = new ArrayList<>();
List<String> possOwners = new LinkedList<>();
boolean isOwned = page.isOwned();
String owner = page.getOwner();
possOwners.addAll(simplePageBean.getCurrentSite().getUsers());
Set<String> siteUsersCanUpdate = simplePageBean.getCurrentSite().getUsersIsAllowed(SimplePage.PERMISSION_LESSONBUILDER_UPDATE);
possOwners.removeAll(siteUsersCanUpdate);
if (isOwned){
if (possOwners.contains(owner)){
int i = possOwners.indexOf(owner);
Collections.swap(possOwners, i, 0); // put owner top of list
}
else {
roleOptions.add(owner);
roleLabels.add(getUserDisplayName(owner));
}
}
else {
roleOptions.add(owner);
roleLabels.add(getUserDisplayName(owner));
roleOptions.add(null);
roleLabels.add(messageLocator.getMessage("simplepage.default-user"));
}
for(String user : possOwners){
roleOptions.add(user);
roleLabels.add(getUserDisplayName(user));
}
if (isOwned){
roleOptions.add(null);
roleLabels.add( messageLocator.getMessage("simplepage.default-user"));
}
UIOutput.make(form, "changeOwnerDropdownLabel", messageLocator.getMessage("simplepage.change-owner-dropdown-label"));
UISelect.make(form, "changeOwnerDropdown", roleOptions.toArray(new String[roleOptions.size()]), roleLabels.toArray(new String[roleLabels.size()]), "#{simplePageBean.newOwner}", null);
}
else {
roleOptions.add(null);
roleLabels.add(messageLocator.getMessage("simplepage.default-user"));
}
for(String user : possOwners){
roleOptions.add(user);
roleLabels.add(getUserDisplayName(user));
}
if (isOwned){
roleOptions.add(null);
roleLabels.add( messageLocator.getMessage("simplepage.default-user"));
}
UIOutput.make(form, "changeOwnerDropdownLabel", messageLocator.getMessage("simplepage.change-owner-dropdown-label"));
UISelect.make(form, "changeOwnerDropdown", roleOptions.toArray(new String[roleOptions.size()]), roleLabels.toArray(new String[roleLabels.size()]), "#{simplePageBean.newOwner}", null);
}
UIInput.make(form, "page-points", "#{simplePageBean.points}", pointString);

Expand Down

0 comments on commit 17af8c0

Please sign in to comment.