blob: 9dcf83d33598d787f7a5886b1aca55df7f3d60e2 [file] [log] [blame]
<% src = url_for("/editor/pinEdit.html?url=/#{url_for(@checkout.version.rel_path_root)}") %>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><%= @checkout.site.title + ' - Edit ' + @checkout.page.presentation_name %></title>
<%= stylesheet_link_tag 'default' %>
</head>
<script>
var editor;
// this function is called if editor is loaded
function editOnEditorLoaded(objEditor)
{
// save editor object for later use (save)
editor = objEditor;
// read the HTML content from hidden text area
//var html = document.getElementById("__editData").value;
// write content to editor
//editor.editWrite(html);
// get document object
//var doc = editor.editGetDocument();
}
// load the HTML content from the editor in the hidden field "html"
function editOnBeforeSave(object, sContent)
{
//alert(sContent);
document.forms[0].html.value = sContent;
document.forms[0].submit();
return true;
}
function transfer()
{
// get the html content from the editor
var html = editor.editGetHtml();
// add the content to the hidden field
document.forms[0].html.value = html;
// submit the formular
document.forms[0].submit();
}
function save()
{
document.forms[0].save.value = 'Y'
transfer();
}
function checkin()
{
if (confirm("Save and check-in the current document?") )
{
transfer();
}
}
function preview()
{
if (confirm("Save changes and preview the page?") )
{ document.forms[0].save.value = 'P'
transfer();
}
}
</script>
<body style="margin-left:0px;margin-bottom:0px;margin-right:0px;overflow:hidden;">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="pageTitle">
<%= "Edit " + @checkout.page.presentation_name %>
</td>
<td align="right">
<strong>
<a href="javascript: preview();">preview</a> |
<a href="javascript: checkin();">checkin</a> |
<%= link_to 'undo check out', {:controller => 'pages', :action => 'undocheckout', :checkout_id => @checkout.id}, :confirm => "Are you sure to want to undo the checkout? Any changes made to this version will be lost." %> |
<a href="javascript: save()">save</a>
</strong>
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td class="pageTitleSeparator">
<img alt="Shim" height="1" src="/images/shim.gif" /></td>
</tr>
</table>
<%= start_form_tag :action => 'saveorcheckin' %>
<input type="hidden" name="html" value="" id="html">
<input type="hidden" name="checkout_id" value="<%= @checkout.id.to_s %>">
<input type="hidden" name="save">
</form>
<!------------------------------------>
<!-- include this code in your page -->
<!-- this hidden field is used to post the content -->
<!-- the content is loaded here -->
<div style="position:absolute;visibility:hidden;top:1;height:1;">
<TEXTAREA style='visibility:hidden' id="__editData" NAME="__editData"></TEXTAREA>
</div>
<!-- include this code in your page -->
<!------------------------------------>
<!---------------------------------------------->
<!-- set the correct path to the pinEdit.html -->
<!---------------------------------------------->
<IFRAME id="editorFrame" style="WIDTH: 100%; HEIGHT: 92%" src=<%= "\""+ src + '&Id=' + session['user'].images_path + '&dd=' + session['user'].documents_path + '&hm=2&hb=1"' %> frameborder=0>
</IFRAME>
</body>
</html>