[Jaws-commits] r13289 - in branches/0.8/html/gadgets/FileBrowser: . templates

afz at jaws-project.com afz at jaws-project.com
Sun Aug 5 21:24:59 UTC 2012


Author: afz
Date: 2012-08-05 21:24:59 +0000 (Sun, 05 Aug 2012)
New Revision: 13289

Modified:
   branches/0.8/html/gadgets/FileBrowser/AdminHTML.php
   branches/0.8/html/gadgets/FileBrowser/templates/BrowseFile.html
Log:
[FileBrowser]: Added support ckeditor filebrowser function

Modified: branches/0.8/html/gadgets/FileBrowser/AdminHTML.php
===================================================================
--- branches/0.8/html/gadgets/FileBrowser/AdminHTML.php	2012-08-05 21:24:12 UTC (rev 13288)
+++ branches/0.8/html/gadgets/FileBrowser/AdminHTML.php	2012-08-05 21:24:59 UTC (rev 13289)
@@ -381,10 +381,17 @@
         $dir = _t('GLOBAL_LANG_DIRECTION');
         $tpl->SetVariable('.dir', ($dir == 'rtl')? '.' . $dir : '');
 
+        $extraParam = '';
         $editor = $GLOBALS['app']->GetEditor();
         if ($editor === 'TinyMCE') {
             $tpl->SetBlock('browse/script');
             $tpl->ParseBlock('browse/script');
+        } elseif ($editor === 'CKEditor') {
+            $extraParam = $request->get(array('CKEditor', 'CKEditorFuncNum', 'langCode'), 'get');
+            $extraParam = '&CKEditor='.$extraParam['CKEditor'].
+                          '&CKEditorFuncNum='.$extraParam['CKEditorFuncNum'].
+                          '&langCode='.$extraParam['langCode'];
+            $tpl->SetVariable('ckFuncIndex', $request->get('CKEditorFuncNum', 'get'));
         }
 
         $model = $GLOBALS['app']->LoadGadget('FileBrowser', 'AdminModel');
@@ -429,7 +436,7 @@
 
                 // Directory / File
                 if ($file['is_dir']) {
-                    $url = BASE_SCRIPT . '?gadget=FileBrowser&action=BrowseFile&path=' . $file['relative'];
+                    $url = BASE_SCRIPT. '?gadget=FileBrowser&action=BrowseFile&path='. $file['relative']. $extraParam;
                     $link =& Piwi::CreateWidget('Link', $file['filename'], $url);
                     $link->SetID('');
                     $link->SetTitle($file['title']);
@@ -441,18 +448,19 @@
                         $fid = empty($file['fast_url'])? $file['id'] : $xss->filter($file['fast_url']);
                         $furl = $this->GetURLFor('Download', array('id' => $fid), false);
                     }
-                    $link =& Piwi::CreateWidget('Link', $file['filename'], "javascript:selectFile('$furl', '{$file['title']}', '$editor')");
+                    $link =& Piwi::CreateWidget('Link',
+                                                $file['filename'],
+                                                "javascript:selectFile('$furl', '{$file['title']}', '$editor')");
                     $tpl->SetVariable('file_name', $link->Get());
                 }
 
                 // File Size
                 $tpl->SetVariable('file_size', $file['size']);
-
                 $tpl->ParseBlock('browse/file');
             }
         }
+
         $tpl->ParseBlock('browse');
-
         return $tpl->Get();
     }
 

Modified: branches/0.8/html/gadgets/FileBrowser/templates/BrowseFile.html
===================================================================
--- branches/0.8/html/gadgets/FileBrowser/templates/BrowseFile.html	2012-08-05 21:24:12 UTC (rev 13288)
+++ branches/0.8/html/gadgets/FileBrowser/templates/BrowseFile.html	2012-08-05 21:24:59 UTC (rev 13289)
@@ -40,12 +40,25 @@
             }
             tinyMCEPopup.close();
             break;
+        case 'CKEditor':
+            var ckFuncIndex = '{ckFuncIndex}';
+            window.opener.CKEDITOR.tools.callFunction(ckFuncIndex, url, setLinkTitle(title));
+            close();
+            break;
         case 'TextArea':
             var a = '<a href="' + url + '">' + title + '</a>';
             opener.insertTags(opener.the_textarea, a, '', '');
             close();
             break;
     }
+
+    function setLinkTitle(title) {
+        var dialog = window.opener.CKEDITOR.dialog.getCurrent();
+        if (dialog.getName() == 'link') {
+            var txtAltField = dialog.getContentElement('advanced', 'advTitle');
+            txtAltField.setValue(title);
+        }
+    }
 }
 </script>
 <!-- END browse -->



More information about the Jaws-commits mailing list