Skip to content

Commit

Permalink
SAK-44376 Changed the messaging and the default size of Samigo's File…
Browse files Browse the repository at this point in the history
… Upload question type (sakaiproject#8714)
  • Loading branch information
fostersdesign authored Oct 29, 2020
1 parent d820f9e commit 9e6ea87
Show file tree
Hide file tree
Showing 17 changed files with 15 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3398,7 +3398,9 @@
# DEFAULT: 1024
# samigo.sizeThreshold=512

# DEFAULT: 40960
# Samigo File Upload question max size (in kb) to upload per file.
# Must be less than or equal to content.upload.max above
# DEFAULT: 20480
# samigo.sizeMax=20480

# DEFAULT: true
Expand Down
2 changes: 1 addition & 1 deletion samigo/samigo-app/src/java/com/corejsf/UploadRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void decode(FacesContext context, UIComponent component){
log.debug("wrappedUpload = {}", item);

ServerConfigurationService serverConfigurationService = ComponentManager.get(ServerConfigurationService.class);
Long maxSize = Long.valueOf(serverConfigurationService.getString("samigo.sizeMax", "40960"));
Long maxSize = Long.valueOf(serverConfigurationService.getString("samigo.sizeMax", "20480"));

// Check if file > maxSize allowed
if (item != null && item.getSize()/1000 > maxSize.intValue()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ random_draw_msg_no_date=The questions for this part are generated randomly from
random_update_questions=Update Questions

# for upload questions in editAssessment.jsp
upload_instruction=Click \"Browse\" to locate your file and then click \"Upload\" to upload your file.
upload_instruction=Choose a file to upload.

update_pool_error_size_too_large=The question draw size value exceeds the number of questions in the pool. Please edit the section draw size value.
update_pool_error_unknown=An error has occurred while updating the random drawn questions from the question pool.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,6 @@ random_draw_msg_published=The questions for this part were generated from the qu
random_draw_msg_no_date=The questions for this part are generated randomly from a question pool. Click Preview Assessment to see a sample random draw.
random_update_questions=Update Questions

# for upload questions in editAssessment.jsp
upload_instruction=Click "Browse" to locate your file and then click "Upload" to upload your file.

update_pool_error_size_too_large=The question draw size value exceeds the number of questions in the pool. Please edit the section draw size value.
update_pool_error_unknown=An error has occurred while updating the random drawn questions from the question pool.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,6 @@ random_draw_msg_published=The questions for this part were generated from the qu
random_draw_msg_no_date=The questions for this part are generated randomly from a question pool. Click Preview Assessment to see a sample random draw.
random_update_questions=Mettre \u00e0 jour les questions

# for upload questions in editAssessment.jsp
upload_instruction=Click "Browse" to locate your file and then click "Upload" to upload your file.

update_pool_error_size_too_large=The question draw size value exceeds the number of questions in the pool. Please edit the section draw size value.
update_pool_error_unknown=An error has occurred while updating the random drawn questions from the question pool.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ unlimited=Unlimited
unlimited_=Unlimited
upload_assessment=Upload Assessment
upload_file=Upload a file
upload_instruction=Click \"Browse\" to locate your file and then click \"Upload\" to upload your file.
upload_instruction=Choose a file to upload.
file_limit=MB/file limit
user_must_click_sav=User must click "Save" button to save input.
username=Username
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ unlimited=Unlimited
unlimited_=Unlimited
upload_assessment=Upload Assessment
upload_file=Upload a file
upload_instruction=Click "Browse" to locate your file and then click "Upload" to upload your file.
file_limit=MB/file limit
user_must_click_sav=User must click "Save" button to save input.
username=\u0625\u0633\u0645 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ unlimited=Illimit\u00e9
unlimited_=Illimit\u00e9
upload_assessment=D\u00e9poser \u00e9valuation
upload_file=D\u00e9poser un fichier
upload_instruction=Click "Browse" to locate your file and then click "Upload" to upload your file.
file_limit=Limite Mo/fichier
user_must_click_sav=User must click "Save" button to save input.
username=Identifiant de l'utilisateur
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ number_of_tries=Number of Tries Allowed
file=File
browse=Browse
upload=Upload
upload_instruction=Click \"Browse\" to locate your file and then click \"Upload\" to upload your file.
upload_instruction=Choose a file to upload.
attachments=Attachments

# General icons
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ number_of_tries=Number of Tries Allowed
file=\u0645\u0644\u0641
browse=Browse
upload=Upload
upload_instruction=Click "Browse" to locate your file and then click "Upload" to upload your file.
attachments=\u0645\u0631\u0641\u0642\u0627\u062a

# General icons

img_back=/images/print/icons/arrow_turn_left.png

Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ number_of_tries=Nombre d'essais permis
file=Fichie
browse=Parcourir
upload=D\u00e9poser
upload_instruction=Click "Browse" to locate your file and then click "Upload" to upload your file.
attachments=Fichiers joints

# General icons

img_back=/images/print/icons/arrow_turn_left.png

Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,7 @@ public boolean mediaIsValid()
FacesContext context = FacesContext.getCurrentInstance();
ExternalContext external = context.getExternalContext();
Long fileSize = (Long)((ServletContext)external.getContext()).getAttribute("TEMP_FILEUPLOAD_SIZE");
Long maxSize = Long.valueOf(ServerConfigurationService.getString("samigo.sizeMax", "40960"));
Long maxSize = Long.valueOf(ServerConfigurationService.getString("samigo.sizeMax", "20480"));

((ServletContext)external.getContext()).removeAttribute("TEMP_FILEUPLOAD_SIZE");
if (fileSize!=null){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ public boolean mediaIsValid() {
FacesContext context = FacesContext.getCurrentInstance();
ExternalContext external = context.getExternalContext();
Long fileSize = (Long)((ServletContext)external.getContext()).getAttribute("TEMP_FILEUPLOAD_SIZE");
Long maxSize = Long.valueOf(ServerConfigurationService.getInt("samigo.sizeMax", 40960));
Long maxSize = Long.valueOf(ServerConfigurationService.getInt("samigo.sizeMax", 20480));

((ServletContext)external.getContext()).removeAttribute("TEMP_FILEUPLOAD_SIZE");
if (fileSize!=null){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void importAssessment(ValueChangeEvent e)
String uploadFile = (String) e.getNewValue();

if (uploadFile!= null && uploadFile.startsWith("SizeTooBig:")) {
Long sizeMax = Long.valueOf(ServerConfigurationService.getString("samigo.sizeMax", "40960"));
Long sizeMax = Long.valueOf(ServerConfigurationService.getString("samigo.sizeMax", "20480"));
String sizeTooBigMessage = MessageFormat.format(rb.getString("import_size_too_big"), uploadFile.substring(11), Math.round(sizeMax.floatValue()/1024));
FacesMessage message = new FacesMessage(sizeTooBigMessage);
FacesContext.getCurrentInstance().addMessage(null, message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void processAction(ActionEvent ae) throws
delivery.setProtocol(ContextUtil.getProtocol());

ServerConfigurationService serverConfigurationService = ComponentManager.get(ServerConfigurationService.class);
Long sizeMax = Long.valueOf(serverConfigurationService.getInt("samigo.sizeMax", 40960));
Long sizeMax = Long.valueOf(serverConfigurationService.getInt("samigo.sizeMax", 20480));
delivery.setFileUploadSizeMax(Math.round(sizeMax.floatValue()/1024));
delivery.setPublishedAssessment(pub);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ include file for delivering file upload questions
should be included in file importing DeliveryMessages
--%>
<script src="/webcomponents/rubrics/sakai-rubrics-utils.js<h:outputText value="#{studentScores.CDNQuery}" />"></script>
<h:outputText value="#{question.text} <br/>" escape="false"/>

<h:outputText value="#{question.text} <br/>" escape="false"/>
<!-- ATTACHMENTS -->
<%@ include file="/jsf/delivery/item/attachment.jsp" %>

Expand All @@ -43,7 +43,7 @@ should be included in file importing DeliveryMessages
<corejsf:upload
target="jsf/upload_tmp/assessment#{delivery.assessmentId}/question#{question.itemData.itemId}/#{person.eid}"
valueChangeListener="#{delivery.addMediaToItemGrading}" />
<f:verbatim>&nbsp;&nbsp;</f:verbatim>

<h:commandButton id="upl" value="#{deliveryMessages.upload}" action="#{delivery.getOutcome}" onclick="showNotif('submitnotif',this.name,'takeAssessmentForm');disableShowTimeWarning();"/>
</h:panelGroup>
<h:outputText escape="false" value="<span id=\"submitnotif\" style=\"visibility:hidden\"> #{deliveryMessages.processing}</span>"/>
Expand All @@ -61,8 +61,6 @@ should be included in file importing DeliveryMessages
<h:commandButton value="#{deliveryMessages.upload}" type="button"/>
</h:panelGroup>

<f:verbatim><br /></f:verbatim>

<%-- media list, note that question is ItemContentBean --%>
<h:panelGroup rendered="#{question!=null and question.mediaArray!=null}">
<h:dataTable value="#{question.mediaArray}" var="media">
Expand Down
6 changes: 2 additions & 4 deletions samigo/samigo-app/src/webapp/jsf/shared/removeMedia.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@
<h:inputHidden id="showTimer" value="#{delivery.showTimer}"/>
<h:inputHidden id="mediaId" value="#{mediaBean.mediaId}"/>
<h3> <h:outputText value="#{deliveryMessages.remove_media_conf}" /></h3>
<div class="validation tier1">
<div class="sak-banner-warn">
<h:outputText value="#{deliveryMessages.cert_rem_media}" />
</div>
<p>
<f:verbatim>&nbsp;&nbsp;&nbsp;&nbsp;</f:verbatim>
<h:outputLink title="#{deliveryMessages.t_media}" value="#" onclick="window.open('#{mediaBean.mediaUrl}','new_window');" onkeypress="window.open('#{mediaBean.mediaUrl}','new_window');">
<p><h:outputLink title="#{deliveryMessages.t_media}" value="#" onclick="window.open('#{mediaBean.mediaUrl}','new_window');" onkeypress="window.open('#{mediaBean.mediaUrl}','new_window');">
<h:outputText value="#{mediaBean.filename}" />
</h:outputLink>
</p>
Expand Down

0 comments on commit 9e6ea87

Please sign in to comment.