From b5a3906a11a70840262c3cd43b1212dac9901bf7 Mon Sep 17 00:00:00 2001 From: quasi Date: Fri, 10 Aug 2012 14:48:41 +0000 Subject: [PATCH] =?UTF-8?q?OpenCCM=20PlugIn=20f=C3=BCr=20Xinha?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vorschau funktioniert nun auch. (#1206) git-svn-id: https://svn.libreccm.org/ccm/trunk@1816 8810af33-2d31-482b-a856-94f89814c4df --- .../xinha/plugins/OpenCCM/images/images.html | 4 ++-- .../xinha/plugins/OpenCCM/images/images.js | 24 ++++++++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) 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 8b1a3ad38..79963967d 100644 --- a/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.html +++ b/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.html @@ -111,7 +111,7 @@ --> -
+
Layout @@ -146,7 +146,7 @@
-
+
Dimension 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 b2269c61d..c67abc582 100644 --- a/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js +++ b/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js @@ -87,14 +87,7 @@ OpenCCM.prototype.prepareImageDialog = function() // OnResize this.dialogs["images"].onresize = function () { - var newHeightForPreview = - parseInt(this.height, 10) -// - this.getElementById("h1").offsetHeight -// - this.getElementById("buttons").offsetHeight -// - this.getElementById("inputs").offsetHeight - - parseInt(this.rootElem.style.paddingBottom, 10); - this.getElementById("preview").style.height = ((newHeightForPreview > 0) ? newHeightForPreview : 0) + "px"; - this.getElementById("preview").style.width = "98%"; + self.resizePreview(this); }; this.imageDialogReady = true; @@ -299,19 +292,32 @@ OpenCCM.prototype.imageBrowse = function(window) OpenCCM.prototype.imageSet = function(imageData) { - var dialog = this.dialogs["images"]; + var dialog = this.dialogs["images"] dialog.getElementById(dialog.id["src"]).value = imageData.src; dialog.getElementById(dialog.id["ipreview"]).src = imageData.src; dialog.getElementById(dialog.id["width"]).value = imageData.width; dialog.getElementById(dialog.id["height"]).value = imageData.height; dialog.getElementById(dialog.id["name"]).value = imageData.name; dialog.getElementById(dialog.id["aspect"]).value = dialog.getElementById(dialog.id["width"]).value / dialog.getElementById(dialog.id["height"]).value; + + this.resizePreview(dialog); + if(imageData.src != "") { dialog.getElementById(dialog.id["preview"]).style.display = "block"; + } else { + dialog.getElementById(dialog.id["preview"]).style.display = "none"; } }; +OpenCCM.prototype.resizePreview = function(dialog) { + var aspect = dialog.getElementById(dialog.id["aspect"]).value; + var previewWidth = dialog.width - 22; + + dialog.getElementById(dialog.id["ipreview"]).style.height = Math.round(previewWidth / aspect) + "px"; + dialog.getElementById(dialog.id["ipreview"]).style.width = previewWidth + "px"; +}; + OpenCCM.prototype.calcWidth = function() { var dialog = this.dialogs["images"];