diff --git a/ccm-cms/web/assets/xinha/plugins/OpenCCM/OpenCCM.js b/ccm-cms/web/assets/xinha/plugins/OpenCCM/OpenCCM.js
index 7a828f206..5100dbf6f 100644
--- a/ccm-cms/web/assets/xinha/plugins/OpenCCM/OpenCCM.js
+++ b/ccm-cms/web/assets/xinha/plugins/OpenCCM/OpenCCM.js
@@ -64,6 +64,12 @@ function OpenCCM(editor)
cfg.addToolbarElement(["separator"], "insertimage", 1);
}
+ if(typeof editor._insertImage == 'undefined')
+ {
+ editor._insertImage = function() { self.showImageDialog(); };
+ // editor.config.btnList.insertimage[3] = function() { self.show(); }
+ }
+
// Register double click action
cfg.dblclickList["a"][0] = function(e, target) { self.showLinkDialog(self._getSelectedAnchor()); };
}
diff --git a/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.html b/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.html
index 49114e70e..4db09ce7e 100644
--- a/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.html
+++ b/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.html
@@ -1,83 +1,165 @@
-
Insert Image
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js b/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js
index 0e5b53caa..c88d14699 100644
--- a/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js
+++ b/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js
@@ -1,61 +1,62 @@
OpenCCM.prototype.showImageDialog = function(image)
{
- if (!this.dialogs["images"]) this.prepareImageDialog();
+ if (!this.dialogs["images"])
+ {
+ this.prepareImageDialog();
+ }
var editor = this.editor;
- if ( typeof image == "undefined" )
+ this.image = image;
+
+ var data =
{
+ src : "",
+ name : "",
+ alt : "",
+ title : "",
+ width : "",
+ height : "",
+ caption : "",
+ zoom : "",
+ gallery : "",
+ aspect : ""
+ };
+
+ if (typeof image == "undefined" )
+ {
+ alert ("was?");
image = editor.getParentElement();
if ( image && image.tagName.toLowerCase() != 'img' )
{
image = null;
+ alert("WAS?");
}
}
- if ( image )
+ if(image && image.tagName.toLowerCase == "img")
{
- function getSpecifiedAttribute(element,attribute)
- {
- var a = element.attributes;
- for (var i=0;i 0) ? newHeightForPreview : 0) + "px"; // no-go beyond 0
-
- this.getElementById("ipreview").style.width = this.width - 2 + 'px'; // and the width
-
- }
-*/
+ // Connect the Select button
+ dialog.getElementById('browse').onclick = function() { self.imageBrowse(window); };
this.imageDialogReady = true;
};
-// and finally ... take some action
+//
OpenCCM.prototype.imageApply = function()
{
- var param = this.dialogs["images"].hide();
- if (!param.f_url)
- {
- return;
- }
+
+ var values = this.dialogs["images"].hide();
+ var image = this.image;
var editor = this.editor;
- var img = this.image;
+
+ var imgAttr =
+ {
+ src : "",
+ alt : "",
+ title : "",
+ width : "",
+ height : ""
+ };
+
+ var spanAttr =
+ {
+ class : "caption",
+ style : "",
+ }
+
+ var linkAttr =
+ {
+ href : "",
+ rel : "",
+ class : ""
+
+ };
+
+ var divAttr =
+ {
+ class : "image"
+ };
+
+ // If not all mandatory informations are set
+ if (!values.src)
+ {
+ // don't do anything at all
+ return false;
+ }
+
+ // Read form values for image
+ imgAttr.src = values.src;
+ imgAttr.alt = values.alt;
+ imgAttr.title = values.title;
+ imgAttr.width = values.width;
+ imgAttr.height = values.height;
+
+ // Read form values for caption
+ if(values.caption)
+ {
+ spanAttr.style = "width:" + imgAttr.width + "px";
+ }
+
+ // Read form values for link
+ if(values.zoom || values.gallery)
+ {
+ linkAttr.href = values.src;
+
+ if(values.zoom)
+ {
+ linkAttr.rel = "";
+ linkAttr.class = "imageZoom";
+ }
+
+ else if(values.gallery)
+ {
+ linkAttr.rel = "imageGalleryName";
+ linkAttr.class = "imageGallery";
+ }
+ }
+
+ // Read form values for div
+/*
+ if(values.alignment != "")
+ {
+ var alignment = values.alignment;
+ divAttr.class += " " + alignment;
+ }
+*/
+
+ // Modify Image
+ if(image && image.tagName.toLowerCase() == "img")
+ {
+ alert("Modifying image aka removing currently selected image");
+ }
+
+ // Add Image
+ alert("Adding image");
+
+
+ var div = document.createElement("div");
+ for(var attr in divAttr)
+ {
+ div.setAttribute(attr, divAttr[attr]);
+ }
+
+ if(values.zoom || values.gallery)
+ {
+ link = document.createElement("a");
+ for(var attr in linkAttr)
+ {
+ link.setAttribute(attr, linkAttr[attr]);
+ }
+ div.appendChild(link);
+ }
+
+ var img = document.createElement("img");
+ for(var attr in imgAttr)
+ {
+ img.setAttribute(attr, imgAttr[attr]);
+ }
+ if(values.zoom || values.gallery)
+ {
+ link.appendChild(img);
+ }
+ else
+ {
+ div.appendChild(img);
+ }
+
+ if(values.caption)
+ {
+ var span = document.createElement("span");
+ for(var attr in spanAttr)
+ {
+ span.setAttribute(attr, spanAttr[attr]);
+ }
+
+ div.appendChild(span);
+ }
+
+ editor.insertNodeAtSelection(div);
+
+/*
if ( !img )
{
if ( Xinha.is_ie )
@@ -143,54 +245,13 @@ OpenCCM.prototype.imageApply = function()
img.src = param.f_url;
}
- for ( var field in param )
- {
- var value = param[field];
- switch (field)
- {
- case "f_alt":
- if (value)
- img.alt = value;
- else
- img.removeAttribute("alt");
- break;
- case "f_border":
- if (value)
- img.border = parseInt(value || "0");
- else
- img.removeAttribute("border");
- break;
- case "f_align":
- if (value.value)
- img.align = value.value;
- else
- img.removeAttribute("align");
- break;
- case "f_vert":
- if (value != "")
- img.vspace = parseInt(value || "0");
- else
- img.removeAttribute("vspace");
- break;
- case "f_horiz":
- if (value != "")
- img.hspace = parseInt(value || "0");
- else
- img.removeAttribute("hspace");
- break;
- case "f_width":
- if (value)
- img.width = parseInt(value || "0");
- else
- img.removeAttribute("width");
- break;
- case "f_height":
- if (value)
- img.height = parseInt(value || "0");
- else
- img.removeAttribute("height");
- break;
- }
- }
-
+*/
+};
+
+OpenCCM.prototype.imageBrowse = function(window)
+{
+ this.dialogs["images"].getElementById(this.dialogs["images"].id["src"]).value = "/theme/mandalay/ccm/cms-service/stream/image/?image_id=9001";
+ this.dialogs["images"].getElementById(this.dialogs["images"].id["width"]).value = "304";
+ this.dialogs["images"].getElementById(this.dialogs["images"].id["height"]).value = "420";
+ this.dialogs["images"].getElementById(this.dialogs["images"].id["name"]).value = "Schild.jpg";
};
diff --git a/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.html b/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.html
index ed98e9ee1..c729b6bac 100644
--- a/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.html
+++ b/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.html
@@ -7,6 +7,7 @@
}
label.key {
+ clear: left;
float: left;
width: 5em;
padding: 0.25em 0.2em;
diff --git a/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.js b/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.js
index 3df8dce22..fae95f59a 100644
--- a/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.js
+++ b/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.js
@@ -5,14 +5,15 @@ OpenCCM.prototype.showLinkDialog = function(link)
this.prepareLinkDialog();
}
- var editor = this.editor;
- this.link = link;
if(!link && this.editor.selectionEmpty(this.editor.getSelection()))
{
alert(this._lc("You need to select some text before creating a link"));
return false;
}
+ var editor = this.editor;
+ this.link = link;
+
var data =
{
title : '',