Fixed some isses with the integration with TinyMCE and also Created the plugin pmSimpleUploader for TinyMCE
This commit is contained in:
69
gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/editor_plugin_src.js
vendored
Normal file
69
gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/editor_plugin_src.js
vendored
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/**
|
||||||
|
* Name: editor_plugin_src.js (for pmSimpleUploader tinyMCE plugin)
|
||||||
|
**/
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
var strPluginURL;
|
||||||
|
tinymce.create('tinymce.plugins.pmSimpleUploaderPlugin', {
|
||||||
|
init: function(ed, url)
|
||||||
|
{
|
||||||
|
strPluginURL = url; // store the URL for future use..
|
||||||
|
ed.addCommand('mcepmSimpleUploader', function() {
|
||||||
|
pmSimpleUploader();
|
||||||
|
});
|
||||||
|
ed.addButton('pmSimpleUploader', {
|
||||||
|
title: 'pmSimpleUploader',
|
||||||
|
label : 'Upload File',
|
||||||
|
cmd: 'mcepmSimpleUploader',
|
||||||
|
image: url + '/img/pmSimpleUploader.png'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
createControl: function(n, cm) {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
getPluginURL: function() {
|
||||||
|
return strPluginURL;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tinymce.PluginManager.add('pmSimpleUploader', tinymce.plugins.pmSimpleUploaderPlugin);
|
||||||
|
})();
|
||||||
|
|
||||||
|
// this function can get called from the plugin inint (above) or from the callback on advlink/advimg plugins..
|
||||||
|
// in the latter case, win and type will be set.. In the rist case, we will just update the main editor window
|
||||||
|
// with the path of the uploaded file
|
||||||
|
function pmSimpleUploader(field_name, url, type, win) {
|
||||||
|
var strPluginPath = tinyMCE.activeEditor.plugins.pmSimpleUploader.getPluginURL(); // get the path to the uploader plugin
|
||||||
|
var strUploaderURL = strPluginPath + "/uploader.php"; // generate the path to the uploader script
|
||||||
|
var strUploadPath = tinyMCE.activeEditor.getParam('plugin_pmSimpleUploader_upload_path'); // get the relative upload path
|
||||||
|
var strSubstitutePath = tinyMCE.activeEditor.getParam('plugin_pmSimpleUploader_upload_substitute_path'); // get the path we'll substitute for the for the upload path (i.e. fully qualified)
|
||||||
|
|
||||||
|
if (strUploaderURL.indexOf("?") < 0){ // if we were called without any GET params
|
||||||
|
strUploaderURL = strUploaderURL + "?type=" + type + "&d=" + strUploadPath + "&subs=" + strSubstitutePath; // add our own params
|
||||||
|
} else {
|
||||||
|
strUploaderURL = strUploaderURL + "&type=" + type + "&d=" + strUploadPath + "&subs=" + strSubstitutePath;
|
||||||
|
}
|
||||||
|
tinyMCE.activeEditor.windowManager.open({ // open the plugin popup
|
||||||
|
file : strUploaderURL,
|
||||||
|
title : 'Upload from file',
|
||||||
|
width : 500,
|
||||||
|
height : 100,
|
||||||
|
resizable : "yes",
|
||||||
|
inline : 1, // This parameter only has an effect if you use the inlinepopups plugin!
|
||||||
|
close_previous : "no"
|
||||||
|
}, {
|
||||||
|
window : win,
|
||||||
|
input : field_name
|
||||||
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// This function will get called when the uploader is done uploading the file and ready to update
|
||||||
|
// calling dialog and close the upload popup
|
||||||
|
// strReturnURL should be the string with the path to the uploaded file
|
||||||
|
function closePluginPopup(){
|
||||||
|
tinyMCEPopup.close(); // close popup window
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateEditorContent(serializedHTML){
|
||||||
|
tinyMCE.activeEditor.execCommand('mceSetContent', false, serializedHTML);
|
||||||
|
}
|
||||||
BIN
gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/img/pmSimpleUploader.png
vendored
Normal file
BIN
gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/img/pmSimpleUploader.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 671 B |
3
gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/langs/en.js
vendored
Normal file
3
gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/langs/en.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
tinyMCE.addI18n('en.pmSimpleUploader', {
|
||||||
|
desc:"Upload File to Server"
|
||||||
|
});
|
||||||
3
gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/langs/es.js
vendored
Normal file
3
gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/langs/es.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
tinyMCE.addI18n('es.pmSimpleUploader', {
|
||||||
|
desc:"Subir Archivo al Servidor"
|
||||||
|
});
|
||||||
BIN
gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/progress.gif
vendored
Normal file
BIN
gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/progress.gif
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
62
gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/uploader.php
vendored
Normal file
62
gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/uploader.php
vendored
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<head>
|
||||||
|
<title>Upload an Output Document</title>
|
||||||
|
<script type="text/javascript" src="../../tiny_mce_popup.js" ></script>
|
||||||
|
<script type="text/javascript" src="editor_plugin_src.js" ></script>
|
||||||
|
<base target="_self" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<?php
|
||||||
|
$Action = isset($_GET["q"]) ? $_GET["q"] : "none";
|
||||||
|
if($Action =="none"){
|
||||||
|
displayUploadForm();
|
||||||
|
}else if($Action=="upload"){
|
||||||
|
uploadContentFile();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// displays the upload form
|
||||||
|
function displayUploadForm()
|
||||||
|
{
|
||||||
|
echo '<form action="uploader.php?'.$_SERVER["QUERY_STRING"].'&q=upload" method="post" enctype="multipart/form-data" onsubmit="">'
|
||||||
|
.'File Name: <br/>'
|
||||||
|
.'<input type="file" size="40" name="upload_file" ID="File1"/><br/>'
|
||||||
|
.'<input type="submit" name="Upload File" value="Upload File" style="width: 150px;" onclick="document.getElementById(\'progress_div\').style.visibility=\'visible\';"/>'
|
||||||
|
.' <div id="progress_div" style="visibility: hidden;"><img src="progress.gif" alt="wait..." style="padding-top: 5px;"></div>'
|
||||||
|
.'</form>';
|
||||||
|
}
|
||||||
|
// uploads the file to the destination path, and returns a link with link path substituted for destination path
|
||||||
|
function uploadContentFile()
|
||||||
|
{
|
||||||
|
$StatusMessage = "";
|
||||||
|
$ActualFileName = "";
|
||||||
|
$FileObject = $_FILES["upload_file"]; // find data on the file
|
||||||
|
$DestPath = sys_get_temp_dir();
|
||||||
|
updateEditorContent(trim(file_get_contents($FileObject['tmp_name'])));
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function showPopUp($PopupText)
|
||||||
|
{
|
||||||
|
echo "<script type=\"text/javascript\" language=\"javascript\">alert (\"$PopupText\");</script>";
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateEditorContent($serializedHTML)
|
||||||
|
{
|
||||||
|
echo "<script type=\"text/javascript\" language=\"javascript\">updateEditorContent(\"".$serializedHTML."\");</script>";
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeWindow()
|
||||||
|
{
|
||||||
|
echo '
|
||||||
|
<script language="javascript" type="text/javascript">
|
||||||
|
closePluginPopup();
|
||||||
|
</script>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
@@ -4233,15 +4233,21 @@ tinymce.html.Styles = function(settings, schema) {
|
|||||||
// Remove already removed children
|
// Remove already removed children
|
||||||
fi = nodes.length;
|
fi = nodes.length;
|
||||||
while (fi--) {
|
while (fi--) {
|
||||||
if (!nodes[fi].parent)
|
if(list.name!='toStr'&&list.name!='concat'&&list.name!='get_by_key'&&list.name!='expand'&&list.name!='setParent'&&list.name!='isset_key'){
|
||||||
|
// if (!nodes[fi].parent){
|
||||||
nodes.splice(fi, 1);
|
nodes.splice(fi, 1);
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (fi = 0, fl = list.callbacks.length; fi < fl; fi++)
|
for (fi = 0, fl = list.callbacks.length; fi < fl; fi++){
|
||||||
|
if(list.name!='toStr'&&list.name!='concat'&&list.name!='get_by_key'&&list.name!='expand'&&list.name!='setParent'&&list.name!='isset_key'){
|
||||||
list.callbacks[fi](nodes, list.name, args);
|
list.callbacks[fi](nodes, list.name, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return rootNode;
|
return rootNode;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ class OutputDocument extends BaseOutputDocument
|
|||||||
if (!is_null($oOutputDocument)) {
|
if (!is_null($oOutputDocument)) {
|
||||||
$aFields = $oOutputDocument->toArray(BasePeer::TYPE_FIELDNAME);
|
$aFields = $oOutputDocument->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
$aFields['OUT_DOC_TITLE'] = $oOutputDocument->getOutDocTitle();
|
$aFields['OUT_DOC_TITLE'] = $oOutputDocument->getOutDocTitle();
|
||||||
|
$aFields['PRO_UID'] = $oOutputDocument->getProUid();
|
||||||
$aFields['OUT_DOC_DESCRIPTION'] = $oOutputDocument->getOutDocDescription();
|
$aFields['OUT_DOC_DESCRIPTION'] = $oOutputDocument->getOutDocDescription();
|
||||||
$aFields['OUT_DOC_FILENAME'] = $oOutputDocument->getOutDocFilename();
|
$aFields['OUT_DOC_FILENAME'] = $oOutputDocument->getOutDocFilename();
|
||||||
$aFields['OUT_DOC_TEMPLATE'] = $oOutputDocument->getOutDocTemplate();
|
$aFields['OUT_DOC_TEMPLATE'] = $oOutputDocument->getOutDocTemplate();
|
||||||
|
|||||||
@@ -79,11 +79,26 @@ switch ($action) {
|
|||||||
case 'loadOutputEditor':
|
case 'loadOutputEditor':
|
||||||
global $G_PUBLISH;
|
global $G_PUBLISH;
|
||||||
$G_PUBLISH = new Publisher();
|
$G_PUBLISH = new Publisher();
|
||||||
$aData = "";
|
$fcontent = '';
|
||||||
|
$proUid = '';
|
||||||
|
$filename = '';
|
||||||
|
$title = '';
|
||||||
|
|
||||||
|
require_once 'classes/model/OutputDocument.php';
|
||||||
|
$oOutputDocument = new OutputDocument();
|
||||||
|
if (isset( $_REQUEST['OUT_DOC_UID'] )) {
|
||||||
|
$aFields = $oOutputDocument->load( $_REQUEST['OUT_DOC_UID'] );
|
||||||
|
$fcontent = $aFields['OUT_DOC_TEMPLATE'];
|
||||||
|
$proUid = $aFields['PRO_UID'];
|
||||||
|
$filename = $aFields['OUT_DOC_FILENAME'];
|
||||||
|
$title = $aFields['OUT_DOC_TITLE'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$aData = Array ( 'PRO_UID' => $proUid,'OUT_DOC_TEMPLATE' => $fcontent, 'FILENAME' => $filename, 'OUT_DOC_UID'=> $_REQUEST['OUT_DOC_UID'], 'OUT_DOC_TITLE'=> $title);
|
||||||
|
|
||||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Edit', '', $aData );
|
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Edit', '', $aData );
|
||||||
//$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Edit', '', $aData );
|
|
||||||
G::RenderPage( 'publish', 'raw' );
|
G::RenderPage( 'publish', 'raw' );
|
||||||
//echo '<h3>outputss</h3>';
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ echo '
|
|||||||
';
|
';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<textarea name="form[fcontent]" id="form[fcontent]" class="tmceEditor"><p>news</p></textarea>
|
<textarea name="form[fcontent]" id="form[fcontent]" class="tmceEditor"><p>news<table><tr><td>cell 1</td></tr><tr><td>cell 2</td></tr></table></p></textarea>
|
||||||
<!--<textarea name="new" id="new" class="tmceEditor">another one</textarea>-->
|
<!--<textarea name="new" id="new" class="tmceEditor">another one</textarea>-->
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<dynaForm name="outputdocs/outputdocs_Edit" type="xmlform" width="100%" labelWidth="2px" enableTemplate="1">
|
<dynaForm name="outputdocs/outputdocs_Edit" action="outputdocs/outputdocs_Save" type="xmlform" width="100%" labelWidth="2px" enableTemplate="1">
|
||||||
|
|
||||||
<INSERT_VARIABLE type="button" align="right" style="position:absolute;left:700px;top:420px;border-style:double;" onmouseover="saveSelection();" onclick="showDynaformsFormVars('form[TEXT_TEST]','../controls/varsAjax','@#PRO_UID','@#');">
|
<INSERT_VARIABLE type="button" align="right" style="position:absolute;left:700px;top:420px;border-style:double;" onmouseover="saveSelection();" onclick="showDynaformsFormVars('form[TEXT_TEST]','../controls/varsAjax','@#PRO_UID','@#');">
|
||||||
<en>@#</en>
|
<en>@#</en>
|
||||||
@@ -8,8 +8,9 @@
|
|||||||
<PRO_UID type="hidden"/>
|
<PRO_UID type="hidden"/>
|
||||||
|
|
||||||
<OUT_DOC_UID type="hidden" showInTable="0"/>
|
<OUT_DOC_UID type="hidden" showInTable="0"/>
|
||||||
|
<OUT_DOC_TITLE type="hidden" showInTable="0"/>
|
||||||
|
|
||||||
<OUT_DOC_TEMPLATE type="wysiwyg_editor" editorType="OUTPUT_DOCUMENT" width="100%" height="365px" defaultValue="<br/>"/>
|
<OUT_DOC_TEMPLATE type="wysiwyg_editor" editorType="OUTPUT_DOCUMENT" width="640" height="365" defaultValue="<br/>"/>
|
||||||
|
|
||||||
<ACCEPT type="button" onclick="outputdocsSave(this.form);">
|
<ACCEPT type="button" onclick="outputdocsSave(this.form);">
|
||||||
<en>Save</en>
|
<en>Save</en>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ var outputdocsEditor;
|
|||||||
|
|
||||||
var oRPC = new leimnud.module.rpc.xmlhttp({
|
var oRPC = new leimnud.module.rpc.xmlhttp({
|
||||||
url : '../outputdocs/outputdocs_Ajax',
|
url : '../outputdocs/outputdocs_Ajax',
|
||||||
args: 'action=loadOutputEditor'
|
args: 'action=loadOutputEditor&OUT_DOC_UID='+uid+'&OUT_DOC_TYPE='+typ
|
||||||
});
|
});
|
||||||
|
|
||||||
outputdocsEditor.loader.show();
|
outputdocsEditor.loader.show();
|
||||||
@@ -92,10 +92,9 @@ var outputdocsEditor;
|
|||||||
}
|
}
|
||||||
|
|
||||||
function outputdocsSave( form ) {
|
function outputdocsSave( form ) {
|
||||||
alert(form.action);
|
form.action = '../outputdocs/outputdocs_Save';
|
||||||
ajax_post( form.action, form, 'POST' );
|
ajax_post( form.action, form, 'POST' );
|
||||||
outputdocsEditor.remove();
|
outputdocsEditor.remove();
|
||||||
|
|
||||||
@#PAGED_TABLE_ID.refresh();
|
@#PAGED_TABLE_ID.refresh();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user