[Jaws-commits] r13291 - in branches/0.8/html/gadgets/Phoo: . templates

afz at jaws-project.com afz at jaws-project.com
Sun Aug 5 21:37:25 UTC 2012


Author: afz
Date: 2012-08-05 21:37:25 +0000 (Sun, 05 Aug 2012)
New Revision: 13291

Modified:
   branches/0.8/html/gadgets/Phoo/AdminHTML.php
   branches/0.8/html/gadgets/Phoo/templates/SelectImage.html
Log:
[Phoo]: Added support ckeditor image browser function

Modified: branches/0.8/html/gadgets/Phoo/AdminHTML.php
===================================================================
--- branches/0.8/html/gadgets/Phoo/AdminHTML.php	2012-08-05 21:37:02 UTC (rev 13290)
+++ branches/0.8/html/gadgets/Phoo/AdminHTML.php	2012-08-05 21:37:25 UTC (rev 13291)
@@ -1533,6 +1533,16 @@
         $album   = $request->get('album', 'get');
         $post    = $request->get(array('date', 'album'), 'post');
         $albums  = $model->GetAlbums('createtime','ASC');
+
+        $extraParams = '';
+        $editor = $GLOBALS['app']->GetEditor();
+        if ($editor === 'CKEditor') {
+            $extraParams = $request->get(array('CKEditor', 'CKEditorFuncNum', 'langCode'), 'get');
+            $extraParams = '&CKEditor='.$extraParam['CKEditor'].
+                           '&CKEditorFuncNum='.$extraParam['CKEditorFuncNum'].
+                           '&langCode='.$extraParam['langCode'];
+        }
+
         if (!Jaws_Error::IsError($albums) && !empty($albums)) {
             $objDate = $GLOBALS['app']->loadDate();
             $t->SetBlock ("phoo_browse/photos");
@@ -1646,7 +1656,9 @@
 
                                 $imgData = Jaws_Image::get_image_details(JAWS_DATA . 'phoo/' . $img['thumb']);
                                 $t->SetBlock ('phoo_browse/photos/albums/item');
-                                $t->SetVariable ('url',"admin.php?gadget=Phoo&action=SelectImage&image={$img["id"]}&album={$albumId}");
+                                $t->SetVariable ('url',
+                                                 "admin.php?gadget=Phoo&action=SelectImage&".
+                                                 "image={$img["id"]}&album={$albumId}". $extraParams);
                                 $t->SetVariable('thumb',  $GLOBALS['app']->getDataURL('phoo/' . $img['thumb']));
                                 $t->SetVariable('name',   $img['name']);
                                 $t->SetVariable('album',  $img['albumid']);
@@ -1721,6 +1733,9 @@
         if ($editor === 'TinyMCE') {
             $t->SetBlock('ImageSelect/script');
             $t->ParseBlock('ImageSelect/script');
+        } elseif ($editor === 'CKEditor') {
+            $ckFuncIndex = $request->get('CKEditorFuncNum', 'get');
+            $t->SetVariable('ckFuncIndex', $ckFuncIndex);
         }
 
         $image = $model->GetImage($iGet['image'], $iGet['album']);

Modified: branches/0.8/html/gadgets/Phoo/templates/SelectImage.html
===================================================================
--- branches/0.8/html/gadgets/Phoo/templates/SelectImage.html	2012-08-05 21:37:02 UTC (rev 13290)
+++ branches/0.8/html/gadgets/Phoo/templates/SelectImage.html	2012-08-05 21:37:25 UTC (rev 13291)
@@ -92,6 +92,11 @@
                 if (win.ImageDialog.showPreviewImage) win.ImageDialog.showPreviewImage(src);
                 tinyMCEPopup.close();
                 break;
+            case 'CKEditor':
+                var ckFuncIndex = '{ckFuncIndex}';
+                window.opener.CKEDITOR.tools.callFunction(ckFuncIndex, src, setImageAlt(title));
+                close();
+                break;
             case 'TextArea':
                 var img = '<img src="' + src + '" title="' + title + '" alt="' + desc + '" />';
                 if (linked === 'true') {
@@ -117,6 +122,14 @@
                     return filename;
             }
         }
+
+        function setImageAlt(title) {
+            var dialog = window.opener.CKEDITOR.dialog.getCurrent();
+            if (dialog.getName() == 'image') {
+                var txtAltField = dialog.getContentElement( 'info', 'txtAlt' );
+                txtAltField.setValue(title);
+            }
+        }
     }
 </script>
 <!-- END ImageSelect -->
\ No newline at end of file



More information about the Jaws-commits mailing list