Author: raintang
Date: 2009-12-01 09:02:20 +0100 (Tue, 01 Dec 2009)
New Revision: 40052

Added:
   
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/
   
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/EmbedCode.js
   
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/img/
   
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/img/embed-code.gif
   
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/img/placeholder.gif
   
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/popups/
   
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/popups/embed_code.html
Log:
CMSC-1556 Insert possibilities for embedding YouTube-code easily in rich text 
article

Added: 
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/EmbedCode.js
===================================================================
--- 
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/EmbedCode.js
                            (rev 0)
+++ 
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/EmbedCode.js
    2009-12-01 08:02:20 UTC (rev 40052)
@@ -0,0 +1,63 @@
+function EmbedCode(editor) {
+  this.editor = editor;
+  var cfg = editor.config;
+  var self = this;
+ 
+  this.placeholderImg = '<img class="EC_placeholder" 
src="'+Xinha.getPluginDir("EmbedCode")+'/img/placeholder.gif" />';
+ 
+  // register the toolbar buttons provided by this plugin
+  cfg.registerButton({
+  id       : "embed-code",
+  tooltip  : this._lc("Embed Code"),
+  image    : editor.imgURL("embed-code.gif", "EmbedCode"),
+  textMode : false,
+  action   : function(editor)
+                {
+                       self.buttonPress(editor);
+                }
+  });
+  cfg.URIs['embed_code'] =  _editor_url + 'popups/embed_code.html';
+  cfg.addToolbarElement("embed-code", "createlink", 1);
+}
+
+EmbedCode._pluginInfo = {
+               name          : "EmbedCode",
+               version       : "1.0",
+               developer     : "Rain Tang",
+               developer_url : "",
+               sponsor       : "",
+               sponsor_url   : "",
+               c_owner       : "Rain Tang",
+               license       : "none"
+       };
+
+EmbedCode.prototype._lc = function(string) {
+    return Xinha._lc(string, 'EmbedCode');
+};
+
+EmbedCode.prototype.onGenerate = function() {
+  this.editor.addEditorStylesheet(Xinha.getPluginDir("EmbedCode") + 
'/embed-code.css');
+ 
+};
+//inwardHtml & outwardHtml are used for change video to image while swiitching 
modes
+//EmbedCode.prototype.inwardHtml = function(html)
+//{
+//        return html;
+//}
+//EmbedCode.prototype.outwardHtml = function(html)
+//{
+//        return html;
+//}
+
+EmbedCode.prototype.buttonPress = function(editor){
+    editor._popupDialog(_editor_url + 
"/plugins/EmbedCode/popups/embed_code.html", function(param){
+        if (param['embededCode']) {
+            var code = param['embededCode'];
+                       var re = /<embed([\s\S]*?)<\/embed>/g;
+                       code = code.match(re);
+            var v = document.createElement("p");
+            v.innerHTML = code;
+            editor.insertNodeAtSelection(v);
+        }
+    }, null);
+}

Added: 
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/img/embed-code.gif
===================================================================
(Binary files differ)


Property changes on: 
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/img/embed-code.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: 
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/img/placeholder.gif
===================================================================
(Binary files differ)


Property changes on: 
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/img/placeholder.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: 
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/popups/embed_code.html
===================================================================
--- 
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/popups/embed_code.html
                          (rev 0)
+++ 
CMSContainer/trunk/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/plugins/EmbedCode/popups/embed_code.html
  2009-12-01 08:02:20 UTC (rev 40052)
@@ -0,0 +1,92 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
+<html>
+<head>
+  <title>Insert/Modify Embeded Code</title>
+<script type="text/javascript" src="../../../popups/popup.js"></script>
+<link rel="stylesheet" type="text/css" href="../../../popups/popup.css" />
+   
+  <script type="text/javascript">
+    window.resizeTo(520, 530);
+    Xinha = window.opener.Xinha;
+
+    function i18n(str) {
+      return (Xinha._lc(str, 'cmscrichtext'));
+    }
+
+    function onTargetChanged() {
+      var f = document.getElementById("f_other_target");
+      if (this.value == "_other") {
+        f.style.visibility = "visible";
+        f.select();
+        f.focus();
+      } else f.style.visibility = "hidden";
+    }
+
+function Init() {
+      __dlg_translate('cmscrichtext');
+      __dlg_init();
+      document.getElementById("embededCode").focus();
+}
+
+function onOK() {
+      // pass data back to the calling window
+      var fields = ["embededCode"];
+      var param = new Object();
+      for (var i in fields) {
+            var id = fields[i];
+            var el = document.getElementById(id);
+            param[id] = el.value;
+      }
+
+      __dlg_close(param);
+      return false;
+}
+
+function onPreview() {
+    var code = document.getElementById('embededCode').value;
+       var re = /<embed([\s\S]*?)<\/embed>/g;
+    code = code.match(re);
+    var iframe = document.getElementById("previewFrame");
+    var doc = iframe.contentWindow.document ;
+    if(iframe.contentDocument){
+        doc = iframe.contentDocument;
+    }
+    if(code){
+       doc.open();
+       doc.write(code);
+       doc.close();
+    }
+};
+
+</script>
+
+</head>
+
+<body class="dialog" onLoad="Init()">
+<div class="title">Insert/Modify Embeded Code</div>
+<form name="embededCodeForm" action="#">
+<div style="padding:10px">
+    <div>
+        <p>
+            Embeded Code:
+        </p>
+        <div style="float:left;width:70%">
+            <textarea name="embededCode" id="embededCode" 
style="width:100%;height:100%" onblur="return onPreview();" ></textarea>
+        </div>
+        <div style="float:right;width:20%;padding: 5px">
+          <button type="button" name="preview" onClick="return 
onPreview();">Preview</button><br/>
+          <button type="button" name="ok" onClick="return onOK();">OK</button>
+        </div>
+    </div>
+    <div style="clear:both;padding-top:10px;">
+        <p>
+            Preview:
+        </p>
+        <div>
+            <iframe id="previewFrame" style="width:100%;height:380px"></iframe>
+        </div>
+    </div>
+</div>
+</form>
+</body>
+</html>
\ No newline at end of file

_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to