Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/sakaiproject/sakai
Browse files Browse the repository at this point in the history
  • Loading branch information
axxter99 committed Jul 1, 2015
2 parents f94feff + be3fb48 commit d3b7991
Show file tree
Hide file tree
Showing 95 changed files with 1,658 additions and 859 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -869,10 +869,15 @@ public void removeAssignmentContent(AssignmentContentEdit content) throws Assign
*/
public boolean getAllowGroupAssignmentsInGradebook();

/**
* Whether a specific user can submit
*/
public boolean canSubmit(String context, Assignment a, String userId);
/**
* Whether the current user can submit
*/
public boolean canSubmit(String context, Assignment a);


public Collection<Group> getSubmitterGroupList(String searchFilterOnly, String allOrOneGroup, String searchString, String aRef, String contextString);
/**
Expand Down
6 changes: 4 additions & 2 deletions assignment/assignment-bundles/resources/assignment.properties
Original file line number Diff line number Diff line change
Expand Up @@ -903,8 +903,10 @@ content_review.accepted.types.delimiter=,
content_review.accepted.types.lparen=(
content_review.accepted.types.rparen=)

noti.releaseresubmission.subject.content=Email notification for assignment with resubmissions allowed
noti.releaseresubmission.text=Your submission to assignment "{0}" has been corrected and it allows resubmissions. Please go to {1} to view details.
noti.releaseresubmission.subject.content=Assignment submission has been corrected
noti.releaseresubmission.text=Your submission to assignment "{0}" has been corrected and it allows resubmissions until the due date. Please go to {1} to view details.
noti.releaseresubmission.noresubmit.text=Your submission to assignment "{0}" has been corrected. Please go to {1} to view details.

send.submission.releasereturn.email.options=Released Resubmission Notification Email Options:
send.submission.releasereturn.email.none=Do not send notification email to student when the grade is released and resubmission is available
send.submission.releasereturn.email=Send notification email to student when the grade is released and resubmission is available
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2982,9 +2982,19 @@ private String htmlContentReleaseResubmission(AssignmentSubmission s){
buffer.append(rb.getString("noti.site.title") + " " + siteTitle + newline);
buffer.append(rb.getString("noti.site.url") + " <a href=\""+ siteUrl+ "\">" + siteUrl + "</a>"+ newline);
// notification text
buffer.append(rb.getFormattedMessage("noti.releaseresubmission.text", new String[]{a.getTitle(), siteTitle}));
//Get the actual person that submitted, for a group submission just get the first person from that group (This is why the array is used)
String userId = null;
if (s.getSubmitterIds() != null && s.getSubmitterIds().size() > 0) {
userId = (String) s.getSubmitterIds().get(0);
}
if (canSubmit(context,a,userId)) {
buffer.append(rb.getFormattedMessage("noti.releaseresubmission.text", new String[]{a.getTitle(), siteTitle}));
}
else {
buffer.append(rb.getFormattedMessage("noti.releaseresubmission.noresubmit.text", new String[]{a.getTitle(), siteTitle}));
}

return buffer.toString();
return buffer.toString();
}
/**
* Cancel the changes made to a AssignmentSubmissionEdit object, and release the lock.
Expand Down Expand Up @@ -7043,7 +7053,14 @@ else if (REF_TYPE_SUBMISSION.equals(ref.getSubType()))
/**
* {@inheritDoc}
*/
public boolean canSubmit(String context, Assignment a)
public boolean canSubmit(String context, Assignment a) {
return canSubmit (context,a,null);
}

/**
* {@inheritDoc}
*/
public boolean canSubmit(String context, Assignment a, String userId)
{
// submissions are never allowed to non-electronic assignments
if (a.getContent().getTypeOfSubmission() == Assignment.NON_ELECTRONIC_ASSIGNMENT_SUBMISSION)
Expand All @@ -7054,7 +7071,10 @@ public boolean canSubmit(String context, Assignment a)
// return false if not allowed to submit at all
if (!allowAddSubmissionCheckGroups(context, a) && !allowAddAssignment(context) /*SAK-25555 return true if user is allowed to add assignment*/) return false;

String userId = SessionManager.getCurrentSessionUserId();
//If userId is not defined look it up
if (userId == null) {
userId = SessionManager.getCurrentSessionUserId();
}

// if user can submit to this assignment
List visibleAssignments = assignments(context, userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4221,6 +4221,7 @@ protected String build_instructor_grade_assignment_context(VelocityPortlet portl
context.put("showAllowResubmission", Boolean.TRUE);
}
// put the re-submission info into context
assignment_resubmission_option_into_state(assignment, null, state);
putTimePropertiesInContext(context, state, "Resubmit", ALLOW_RESUBMIT_CLOSEMONTH, ALLOW_RESUBMIT_CLOSEDAY, ALLOW_RESUBMIT_CLOSEYEAR, ALLOW_RESUBMIT_CLOSEHOUR, ALLOW_RESUBMIT_CLOSEMIN);
assignment_resubmission_option_into_context(context, state);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,17 +506,17 @@ public interface LTIService {
"frameheight:integer:label=bl_frameheight:allowed=true",
"newpage:checkbox:label=bl_newpage",
"debug:checkbox:label=bl_debug",
"custom:textarea:label=bl_custom:rows=5:cols=25:allowed=true:maxlength=1024",
"custom:textarea:label=bl_custom:rows=5:cols=25:allowed=true:maxlength=16384",
"launch:url:label=bl_launch:maxlength=1024:allowed=true",
"consumerkey:text:label=bl_consumerkey:allowed=true:maxlength=1024",
"secret:text:label=bl_secret:allowed=true:maxlength=1024",
"resource_handler:text:label=bl_resource_handler:maxlength=1024:role=admin",
"xmlimport:text:hidden=true:maxlength=16384",
"xmlimport:text:hidden=true:maxlength=1M",
// LTI 2.x settings
"settings:text:hidden=true:maxlength=8096",
"enabled_capability:text:hidden=true:maxlength=16384:role=admin",
"settings:text:hidden=true:maxlength=1M",
"enabled_capability:text:hidden=true:maxlength=1M:role=admin",
// Sakai LTI 1.x extension settings (see SAK-25621)
"settings_ext:text:hidden=true:maxlength=8096",
"settings_ext:text:hidden=true:maxlength=1M",
"placement:text:hidden=true:maxlength=256",
"placementsecret:text:hidden=true:maxlength=512",
"oldplacementsecret:text:hidden=true:maxlength=512",
Expand All @@ -540,7 +540,7 @@ public interface LTIService {
"resource_handler:text:label=bl_resource_handler:maxlength=1024:only=lti2",
"deployment_id:integer:hidden=true",
"lti2_launch:header:fields=launch,consumerkey,secret:only=lti2",
"launch:url:label=bl_launch:maxlength=1024",
"launch:url:label=bl_launch:maxlength=1024:required=true",
"allowlaunch:radio:label=bl_allowlaunch:choices=disallow,allow:only=lti1",
"consumerkey:text:label=bl_consumerkey:maxlength=1024",
"allowconsumerkey:radio:label=bl_allowconsumerkey:choices=disallow,allow:only=lti1",
Expand All @@ -559,15 +559,15 @@ public interface LTIService {
"newpage:radio:label=bl_newpage:choices=off,on,content",
"debug:radio:label=bl_debug:choices=off,on,content",
// LTI 1.x user-entered custom
"custom:textarea:label=bl_custom:rows=5:cols=25:maxlength=1024",
"custom:textarea:label=bl_custom:rows=5:cols=25:maxlength=16384",
// LTI 2.x settings from web services
"settings:text:hidden=true:maxlength=8096",
"settings:text:hidden=true:maxlength=1M",
// LTI 2.x tool-registration time parameters
"parameter:textarea:label=bl_parameter:rows=5:cols=25:maxlength=1024:only=lti2",
"parameter:textarea:label=bl_parameter:rows=5:cols=25:maxlength=16384:only=lti2",
"enabled_capability:textarea:label=bl_enabled_capability:rows=5:cols=25:maxlength=16384:only=lti2",
"allowcustom:checkbox:label=bl_allowcustom",
"xmlimport:text:hidden=true:maxlength=16384",
"splash:textarea:label=bl_splash:rows=5:cols=25:maxlength=4096",
"xmlimport:text:hidden=true:maxlength=1M",
"splash:textarea:label=bl_splash:rows=5:cols=25:maxlength=16384",
"created_at:autodate",
"updated_at:autodate" };

Expand Down Expand Up @@ -599,8 +599,8 @@ public interface LTIService {
"consumerkey:text:label=bl_consumerkey:maxlength=1024:hide=insert",
"secret:text:label=bl_secret:maxlength=1024:hide=insert",
"new_secret:text:label=bl_secret:maxlength=1024:hide=insert",
"reg_profile:textarea:label=bl_reg_profile:maxlength=1000000:hide=insert:role=admin",
"settings:text:hidden=true:maxlength=8096", // This is "custom" in the JSON
"reg_profile:textarea:label=bl_reg_profile:maxlength=1M:hide=insert:role=admin",
"settings:text:hidden=true:maxlength=1M", // This is "custom" in the JSON
"created_at:autodate",
"updated_at:autodate" };

Expand All @@ -609,7 +609,7 @@ public interface LTIService {
"id:key",
"tool_id:integer:hidden=true",
"SITE_ID:text:maxlength=99:role=admin",
"settings:text:hidden=true:maxlength=8096",
"settings:text:hidden=true:maxlength=1M",
"created_at:autodate",
"updated_at:autodate" };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import org.imsglobal.basiclti.BasicLTIUtil;
import org.sakaiproject.authz.api.Member;
import org.sakaiproject.authz.api.Role;
import org.sakaiproject.authz.cover.AuthzGroupService;
import org.sakaiproject.component.cover.ServerConfigurationService;
import org.sakaiproject.event.cover.UsageSessionService;
import org.sakaiproject.id.cover.IdManager;
Expand Down Expand Up @@ -533,7 +534,7 @@ protected void processSetting(HttpServletRequest request, HttpServletResponse re
Map<String,Object> content = null;
String contentStr = pitch.getProperty("contentKey");
Long contentKey = foorm.getLongKey(contentStr);
if ( contentKey > 0 ) content = ltiService.getContentDao(contentKey, siteId);
if ( contentKey >= 0 ) content = ltiService.getContentDao(contentKey, siteId);
if ( content != null ) {
if ( "basic-lti-savesetting".equals(lti_message_type) ) {
setting = request.getParameter("setting");
Expand Down Expand Up @@ -664,14 +665,21 @@ protected void processRoster(HttpServletRequest request, HttpServletResponse res
String ims_user_id = member.getUserId();
mm.put("/user_id",ims_user_id);
String ims_role = "Learner";
if ( maintainRole != null && maintainRole.equals(role.getId())) ims_role = "Instructor";

// If there is a role mapping, it has precedence over site.update
if ( roleMap.containsKey(role.getId()) ) {
ims_role = roleMap.get(role.getId());
}
else if (AuthzGroupService.isAllowed(ims_user_id, SiteService.SECURE_UPDATE_SITE, "/site/"+siteId))
{
ims_role = "Instructor";
}
// This is incorrect according to
// http://developers.imsglobal.org/ext_membership.html. It
// should be roles. If we can determine that nobody is using
// the role tag, we should remove it.

// Using "/role" is inconsistent with to
// http://developers.imsglobal.org/ext_membership.html. It
// should be roles. If we can determine that nobody is using
// the role tag, we should remove it.

mm.put("/role",ims_role);
mm.put("/roles",ims_role);
User user = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1548,6 +1548,7 @@ public static Long getLongNull(Object key) {
if (key instanceof Number)
return new Long(((Number) key).longValue());
if (key instanceof String) {
if ( ((String)key).length() < 1 ) return new Long(-1);
try {
return new Long((String) key);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
"Person.name.full",
"Person.name.given",
"Person.name.family",
"Person.sourcedId",
"CourseOffering.label",
"CourseOffering.title",
"CourseOffering.sourcedId",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/licenses/ECL-2.0
* http://www.opensource.org/licenses/ECL-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -45,6 +45,10 @@ public class Foorm {
public static String NUMBER_TYPE = "java.lang.Number";
public static String STRING_TYPE = "java.lang.String";

// Anything longer than this is treated as "LONG TEXT"
// With multiple megabytes of text possible
// Make this larger than 2^16 (65535)
public static int MAX_TEXT = 70000;

// Parse a form field description
// field:type:key=value:key2=value2
Expand Down Expand Up @@ -99,6 +103,7 @@ public Long getLongNull(Object key) {
if (key instanceof Number)
return new Long(((Number) key).longValue());
if (key instanceof String) {
if ( ((String)key).length() < 1 ) return new Long(-1);
try {
return new Long((String) key);
} catch (Exception e) {
Expand Down Expand Up @@ -1041,11 +1046,13 @@ public String formExtract(Object parms, String[] formDefinition, Object loader,
if ( errors != null ) errors.put(label, error);
}

String maxs = info.getProperty("maxlength", null);
String maxs = adjustMax(info.getProperty("maxlength", null));
if (maxs != null && dataField instanceof String) {
int maxlength = (new Integer(maxs)).intValue();
String truncate = info.getProperty("truncate", "true");
if (sdf.length() > maxlength) {
if ( maxlength >= MAX_TEXT ) {
// We are OK
} else if (sdf.length() > maxlength) {
if ("true".equals(truncate)) {
sdf = sdf.substring(0, maxlength);
dataField = sdf;
Expand Down Expand Up @@ -1354,7 +1361,7 @@ public String formSql(String fieldinfo, String vendor) {
String field = info.getProperty("field", null);
String type = info.getProperty("type", null);
if ( "header".equals(type) ) return null;
String maxs = info.getProperty("maxlength", null);
String maxs = adjustMax(info.getProperty("maxlength", null));
int maxlength = 0;
if (maxs != null)
maxlength = (new Integer(maxs)).intValue();
Expand Down Expand Up @@ -1397,12 +1404,16 @@ public String formSql(String fieldinfo, String vendor) {
schema = "CLOB";
}
} else if ("hsqldb".equals(vendor)) {
schema = "VARCHAR(" + maxlength + ")";
if ( maxlength < 4000 ) {
schema = "VARCHAR(" + maxlength + ")";
} else {
schema = "CLOB";
}
} else {
if (maxlength < 512) {
if (maxlength < 4000) {
schema = "VARCHAR(" + maxlength + ")";
} else {
schema = "TEXT(" + maxlength + ")";
schema = "MEDIUMTEXT";
}
}
} else if ("radio".equals(type) || "checkbox".equals(type) ) {
Expand Down Expand Up @@ -1449,7 +1460,7 @@ public String[] formAdjustTable(String table, String[] formDefinition, String ve
String field = info.getProperty("field", null);
String type = info.getProperty("type", null);
if ( "header".equals(type) ) continue;
String maxs = info.getProperty("maxlength", null);
String maxs = adjustMax(info.getProperty("maxlength", null));
int maxlength = 0;
if (maxs != null) maxlength = (new Integer(maxs)).intValue();
if (maxlength < 1) maxlength = 80;
Expand All @@ -1473,8 +1484,8 @@ public String[] formAdjustTable(String table, String[] formDefinition, String ve
// ignore
}

// System.out.println( field + " (" + maxlength + ") type="+type);
// System.out.println( field + " (" + sqlLength + ") auto=" + autoIncrement+" type="+sqlType+" null="+isNullable);
System.out.println( field + " (" + maxlength + ") type="+type);
System.out.println( field + " (" + sqlLength + ") auto=" + autoIncrement+" type="+sqlType+" null="+isNullable);
// If the field is not there...
if ( sqlType == null ) {
if ( "oracle".equals(vendor) ) {
Expand Down Expand Up @@ -1667,4 +1678,16 @@ public String getPagedSelect(String sqlIn, int startRec, int endRec, String vend
}
}

/**
* Deal with suffixes like "M" and "K"
*/
public String adjustMax(String maxs)
{
if ( maxs == null ) return null;
maxs = maxs.toLowerCase();
if ( maxs.endsWith("m")) maxs = maxs.replace("m","000000");
if ( maxs.endsWith("k")) maxs = maxs.replace("k","000");
return maxs;
}

}
22 changes: 14 additions & 8 deletions calendar/calendar-bundles/resources/calendar.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Java code
java.importcal = Import calendar
java.importcal = Import Events
java.theend = The end date you have specified on the Frequency page is earlier than the start date. Change it please.
java.merge = Merge Internal Calendars
java.merge.title = Display events from sites
Expand All @@ -25,11 +25,11 @@ java.permissions = Permissions
java.set = Set permissions for Schedule in worksite
java.error = The event doesn't exist any more.

ical.title = Calendar Subscription Export
ical.title = Generate a Link to this Calendar for Public Use
ical.schedname = Calendar Name
ical.option = Enable Subscription?
ical.url = Subscription URL:
ical.info = Subscription enables all calendar events within a window plus/minus 6 months to be publicly subscribed and accessed, without authentication.
ical.info = Subscription to this calendar in other applications will display all events within a window of plus and minus 6 months. Authentication is not required and all events will potentially be visible to the general public. If this is not desirable then please publish via a private link instead.
java.alert.aliasreq = An Alias is required to enable iCal exports.

java.alert.youneed = You need to enter the name of the field to be added.
Expand Down Expand Up @@ -329,9 +329,13 @@ cust.save = Save Field Changes
cust.list = Table contains list of additional fields. First column contains the fieldname, second column a checkbox to take remove it.

#Subscriptions Vm
subs.subscriptions = Calendar Subscriptions
subs.subscriptions = Show Events from an External Calendar
subs.institutional = Institutional Calendars
subs.institutional.instruction = Select what Institutional Calendars you want to subscribe.
subs.institutional.instruction = This page allows subscription to an external calendar. Unfortunately this feature has some limitations, it
subs.institutional.instruction.detailed.1 = Does not support all-day events
subs.institutional.instruction.detailed.2 = Only supports events defined with &lt;VEVENT&gt;
subs.institutional.instruction.detailed.3 = Does not support re-occurring events
subs.institutional.instruction.detailed.4 = Does not support events without an end time
subs.institutional.summary = List of Institutional Calendars
subs.calendar.name = Calendar Name
subs.calendar.url = URL
Expand All @@ -342,7 +346,7 @@ subs.user.summary = List of User-specified Calendars
subs.calendar.subscribe = Subscribe

#Merge Vm
merge.merge = Merging calendars...
merge.merge = Show Events from Another Site
merge.select = Select what calendars you want to merge into this site. This site's users will only see those events they had permission to see in the source site.
merge.list.summary = List of calendars from sites you can merge into this one. Column 1: site name. Column 2: checkbox - select for merge.
merge.showsched = Show Schedule
Expand Down Expand Up @@ -476,8 +480,10 @@ date_link_format =yyyy-MM-dd
java.opaque_subscribe = Publish (private)
java.opaque_subscribe.title = Generate link for personal use in other calendar applications
# SAK-21497
ical_opaqueurl_header=Subscribe
ical_opaqueurl_explanation=If you would like to generate a private URL for you to access the calendar in this site, please press the button below:
ical_opaqueurl_header=Generate a Link to this Calendar for Personal Use
ical_opaqueurl_header_existing = Subscribe to this Calendar
ical_opaqueurl_explanation=Please click the 'Generate' button to create a link to this calendar. The link is for private use only and will allow events from this site to be displayed in other calendaring applications.
ical_opaqueurl_explanation_existing = The following links are for private use only. If you have accidentally disclosed the URL to others then please click the 'Regenerate' button to create a new private link.
ical_opaqueurl_myworkspace=Note: If you subscribe to the calendar in your 'My Workspace', it will aggregate the events from the calendars of all the sites of which you are a member.
ical_opaqueurl_generate=Generate
ical_opaqueurl_webcal=If you click on the link below, your browser should present you with a client (e.g. Outlook) that you can use to subscribe to this calendar:
Expand Down
Loading

0 comments on commit d3b7991

Please sign in to comment.