Skip to content

Commit

Permalink
SAK-23311 - Enable support for sending full page documents from CKEditor
Browse files Browse the repository at this point in the history
git-svn-id: https://source.sakaiproject.org/svn/jsf/trunk@307038 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
jonespm committed Mar 12, 2014
1 parent ffead65 commit 83bd1d5
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
10 changes: 10 additions & 0 deletions jsf/jsf-widgets/src/META-INF/sakai-jsf.tld
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,16 @@
</description>
</attribute>

<attribute>
<name>enableFullPage</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
<description>
If true, this will set CKEditor's fullPage property, which captures the entire HTML document
with html, head and body tags.
</description>
</attribute>

<attribute>
<name>buttonSet</name>
<required>false</required>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ public void encodeBegin(FacesContext context, UIComponent component)
String buttonSet = (String) RendererUtil.getAttribute(context, component, "buttonSet");
// Comma delimited list of toolbar command buttons registered with component.
String buttonList = (String) RendererUtil.getAttribute(context, component, "buttonList");

//If true, send full documents via CKEditor
String enableFullPage = (String) RendererUtil.getAttribute(context, component, "enableFullPage");

/**
* @todo need to do something with extensions.
*/
Expand Down Expand Up @@ -229,9 +233,24 @@ public void encodeBegin(FacesContext context, UIComponent component)
writer.write("</textarea>");

if (!"true".equals(textareaOnly))
{
writer.write("<script type=\"text/javascript\">sakai.editor.launch('" + clientId + "_inputRichText', {"+collectionId+"}, '" + widthPx + "','" + heightPx + "');</script>");
}
{
if (enableFullPage != null && "true".equals(enableFullPage))
{
writer.write("<script type=\"text/javascript\" defer=\"1\">");
writer.write("function config(){}");
writer.write("config.prototype.fullPage=true;");
writer.write("config.prototype.width=" + widthPx + ";");
writer.write("config.prototype.height=" + heightPx + ";");
if (collectionBase != null) writer.write("config.prototype.collectionId='" + collectionBase.replaceAll("\"", "\\\"") + "';");
writer.write("sakai.editor.launch('" + clientId + "_inputRichText', new config(), " + widthPx + ", " + heightPx + ");</script>");

}
else
{
writer.write("<script type=\"text/javascript\">sakai.editor.launch('" + clientId + "_inputRichText', {" + collectionId + "}, '"
+ widthPx + "','" + heightPx + "');</script>");
}
}

writer.write("</td></tr></table>\n");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class InputRichTextTag
private String width;
private String height;
private String textareaOnly;
private String enableFullPage;
private String buttonSet;
private String buttonList;
private String javascriptLibraryURL;
Expand Down Expand Up @@ -133,6 +134,7 @@ protected void setProperties(UIComponent component)
TagUtil.setInteger(component, "width", width);
TagUtil.setInteger(component, "height", height);
TagUtil.setString(component, "textareaOnly", textareaOnly);
TagUtil.setString(component, "enableFullPage", enableFullPage);
TagUtil.setString(component, "buttonSet", buttonSet);
TagUtil.setString(component, "buttonList", buttonList);
TagUtil.setString(component, "javascriptLibraryURL", javascriptLibraryURL);
Expand Down Expand Up @@ -170,6 +172,7 @@ public void release()
width = null;
height = null;
textareaOnly = null;
enableFullPage = null;
buttonSet = null;
buttonList = null;
javascriptLibraryURL = null;
Expand Down Expand Up @@ -234,6 +237,17 @@ public void setTextareaOnly(String textareaOnly)
{
this.textareaOnly = textareaOnly;
}

public String getEnableFullPage()
{
return enableFullPage;
}

public void setEnableFullPage(String enableFullPage)
{
this.enableFullPage = enableFullPage;
}


public String getButtonSet()
{
Expand Down

0 comments on commit 83bd1d5

Please sign in to comment.