Skip to content

Commit

Permalink
Merge pull request sakaiproject#329 from ramonchu2k/SAM-2358
Browse files Browse the repository at this point in the history
SAM-2358:Add the link <<Show/Hide All Rich-Text Editors>> in Multiple Ch...
  • Loading branch information
ottenhoff committed Mar 24, 2015
2 parents 2cbb402 + 70d4d7f commit fe36bef
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,15 @@ private void encodeCK(ResponseWriter writer, String value, String identity, Stri
if (shouldToggle) {
writer.write("<input type=\"hidden\" name=\"" + clientId + "_textinput_current_status\" id=\"" + clientId + "_textinput_current_status\" value=\"firsttime\">");
}
else if(hasToggle.equals("plain") && !valueHasRichText){
writer.write("<input type=\"hidden\" name=\"" + clientId + "_textinput_current_status\" id=\"" + clientId + "_textinput_current_status\" value=\"fckonly\" data-first=\"" + clientId + "\" data-second=\"" + samigoFrameId + "\">");
}
else {
writer.write("<input type=\"hidden\" name=\"" + clientId + "_textinput_current_status\" id=\"" + clientId + "_textinput_current_status\" value=\"fckonly\">");
}
//if toggling is off or the content is already rich, make the editor show up immediately
if(!shouldToggle){
writer.write("<script type=\"text/javascript\" defer=\"1\">chef_setupformattedtextarea('" + clientId + "', false, '" + samigoFrameId +"');</script>");
//if toggling is off or the content is already rich, make the editor show up immediately if hasToggle is not plain
if(!shouldToggle && (!hasToggle.equals("plain") || valueHasRichText)){
writer.write("<script type=\"text/javascript\" defer=\"1\">chef_setupformattedtextarea('" + clientId + "', false, '" + samigoFrameId +"');</script>");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ cert_rem_attachment=Are you sure you would like to remove this attachment?
t_attachment = Display Attachment on different window

show_editor=Show Rich-Text Editor
show_editors=Show All Rich-Text Editors

file=File:
upload=Upload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ cert_rem_attachment=\u00bfEst\u00e1 seguro de querer borrar este fichero adjunto
t_attachment=Muestra el fichero adjunto en una ventana diferente

show_editor=Mostrar el Editor de Texto Enriquecido
show_editors=Mostrar todos los editores con formato

file=Fichero\:
upload=Subir
Expand Down
4 changes: 4 additions & 0 deletions samigo/samigo-app/src/webapp/css/tool_sam.css
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,10 @@ div.collapse {
background: url('/library/image/sakai/expand.gif') no-repeat left !important;
}

div.multiple_editor {
float:right;
clear:left;
}
td.releaseTo div.alertMessage {
width: auto;
}
Expand Down
10 changes: 9 additions & 1 deletion samigo/samigo-app/src/webapp/js/authoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,4 +595,12 @@ function lockdownGradebook(value) {
}
}


function show_multiple_text(show_multiple_link){
$('.simple_text_area').each(function(){
var $currentStatus=$(this).siblings('[type="hidden"]');
if(typeof $currentStatus.data("first") != 'undefined' && typeof $currentStatus.data("second") != 'undefined'){
show_editor($currentStatus.data("first"),$currentStatus.data("second"));
}
});
$(show_multiple_link).hide();
}
5 changes: 4 additions & 1 deletion samigo/samigo-app/src/webapp/js/samigo-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ function show_editor(client_id, frame_id) {
setBlockDivs();
retainHideUnhideStatus('none');
}
document.getElementById(client_id + "_toggle").style.display = "none";
var toggle=document.getElementById(client_id + "_toggle");
if(toggle!==null){
toggle.style.display = "none";
}
}

function encodeHTML(text) {
Expand Down
16 changes: 10 additions & 6 deletions samigo/samigo-app/src/webapp/jsf/author/item/multipleChoice.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,17 @@


<!-- 2 TEXT -->

<div class="multiple_editor">
<a id="multiple_show_editor" onclick="javascript:show_multiple_text(this);" href="#">
<h:outputText id="text" value="#{authorMessages.show_editors}"/>
</a>
</div>
<div class="longtext"><h:outputLabel value="#{authorMessages.q_text}" />
</div>
<!-- WYSIWYG -->

<h:panelGrid>
<samigo:wysiwyg rows="140" value="#{itemauthor.currentItem.itemText}" hasToggle="yes" mode="author">
<samigo:wysiwyg rows="140" value="#{itemauthor.currentItem.itemText}" hasToggle="plain" mode="author">
<f:validateLength minimum="1" maximum="60000"/>
</samigo:wysiwyg>

Expand Down Expand Up @@ -245,7 +249,7 @@
<!-- WYSIWYG -->
<h:panelGrid>

<samigo:wysiwyg rows="140" value="#{answer.text}" hasToggle="yes" mode="author">
<samigo:wysiwyg rows="140" value="#{answer.text}" hasToggle="plain" mode="author">
<f:validateLength maximum="60000"/>
</samigo:wysiwyg>
</h:panelGrid>
Expand All @@ -254,7 +258,7 @@

<!-- WYSIWYG -->
<h:panelGrid rendered="#{itemauthor.target == 'questionpool' || (itemauthor.target != 'questionpool' && (author.isEditPendingAssessmentFlow && assessmentSettings.feedbackAuthoring ne '1') || (!author.isEditPendingAssessmentFlow && publishedSettings.feedbackAuthoring ne '1'))}">
<samigo:wysiwyg rows="140" value="#{answer.feedback}" hasToggle="yes" mode="author">
<samigo:wysiwyg rows="140" value="#{answer.feedback}" hasToggle="plain" mode="author">
<f:validateLength maximum="4000"/>
</samigo:wysiwyg>
</h:panelGrid>
Expand Down Expand Up @@ -363,7 +367,7 @@
<br/>
<!-- WYSIWYG -->
<h:panelGrid>
<samigo:wysiwyg rows="140" value="#{itemauthor.currentItem.corrFeedback}" hasToggle="yes" mode="author">
<samigo:wysiwyg rows="140" value="#{itemauthor.currentItem.corrFeedback}" hasToggle="plain" mode="author">
<f:validateLength maximum="4000"/>
</samigo:wysiwyg>
</h:panelGrid>
Expand All @@ -372,7 +376,7 @@

<!-- WYSIWYG -->
<h:panelGrid>
<samigo:wysiwyg rows="140" value="#{itemauthor.currentItem.incorrFeedback}" hasToggle="yes" mode="author">
<samigo:wysiwyg rows="140" value="#{itemauthor.currentItem.incorrFeedback}" hasToggle="plain" mode="author">
<f:validateLength maximum="4000"/>
</samigo:wysiwyg>
</h:panelGrid>
Expand Down

0 comments on commit fe36bef

Please sign in to comment.