Skip to content

Commit

Permalink
SAK-25399 add property to enable/disable public polls. Off by default…
Browse files Browse the repository at this point in the history
…. Patch from Erik L

git-svn-id: https://source.sakaiproject.org/svn/polls/trunk@134302 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
ottenhoff committed Feb 10, 2014
1 parent 6ca2cc9 commit 47f6873
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ public interface ExternalLogic {
*/
public boolean isResultsChartEnabled();

/**
* Are the public access options available to the Instructor?
* poll.allow.public.access=true|false, default false
* @return
*/
public boolean isShowPublicAccess();

/**
* Is the current user using a mobile browser?
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,9 @@ public boolean isResultsChartEnabled() {
return serverConfigurationService.getBoolean("poll.results.chart.enabled", false);
}

public boolean isShowPublicAccess() {
return serverConfigurationService.getBoolean("poll.allow.public.access", false);
}

public boolean isMobileBrowser() {
Session session = sessionManager.getCurrentSession();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ public boolean isResultsChartEnabled() {
return false;
}

public boolean isShowPublicAccess() {
// TODO Auto-generated method stub
return false;
}

public boolean isMobileBrowser() {
// TODO Auto-generated method stub
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,17 @@ public void fillComponents(UIContainer tofill, ViewParameters viewparams,
/*
* access options
*/
UIMessage.make(newPoll,"poll_access_label","new_poll_access_label");
UIBoundBoolean.make(newPoll, "access-public", "poll.isPublic", poll.getIsPublic());
UIMessage pollAccessLabel = UIMessage.make(newPoll,"poll_access_label","new_poll_access_label");
UIBoundBoolean accessPublic = UIBoundBoolean.make(newPoll, "access-public", "poll.isPublic", poll.getIsPublic());
UIMessage newPollAccessPublicLabel = UIMessage.make(newPoll, "new_poll_access_public_label", "new_poll_access_public");

// SAK-25399: Do not display the public access by default
if(!externalLogic.isShowPublicAccess()) {
newPoll.remove(pollAccessLabel);
newPoll.remove(accessPublic);
newPoll.remove(newPollAccessPublicLabel);
}


String[] minVotes = new String[]{"0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"};
String[] maxVotes = new String[]{"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"};
UISelect min = UISelect.make(newPoll,"min-votes",minVotes,"#{poll.minOptions}",Integer.toString(poll.getMinOptions()));
Expand Down
2 changes: 1 addition & 1 deletion polls/tool/src/webapp/templates/voteAdd.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ <h3 rsf:id="new_poll_title">Add/Edit a poll</h3>
<p><strong rsf:id="poll_access_label">Access:</strong></p>
<div>
<input type="checkbox" rsf:id="access-public" id="access-public" />
<label rsf:id="msg=new_poll_access_public" for="access-public">This poll is publically viewable</label>
<label rsf:id="new_poll_access_public_label" for="access-public">This poll is publically viewable</label>
</div>

<p><strong rsf:id="add_results_label">Release results: </strong><br />
Expand Down

0 comments on commit 47f6873

Please sign in to comment.