Changeset 567 for trunk/plugins


Ignore:
Timestamp:
09/13/06 19:24:04 (13 years ago)
Author:
koto
Message:

ExtendedFileManager? update:

  • EFM now supports new way of passing configuration variables to backend introduced in changeset:565
  • updated Readme.txt to encourage the new way
  • added German translation (by sven schomacker)
  • added support for editing 'title' attributes for inserted images (new config options 'images_enable_alt' and 'images_enable_title')
Location:
trunk/plugins/ExtendedFileManager
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/ExtendedFileManager/Readme.txt

    r521 r567  
    3636* Can be used to insert link to non-image files like pdf or zip. 
    3737* You can specify image margin / padding / background and border colors 
     38** You may edit Alt/title tags for inserted images 
    3839 
    3940Installation : 
     
    5253// only snippets of code from initializing file shown below 
    5354 
    54 <?php 
    55  
    56     // define backend configuration for both plugins 
    57      
    58     $IMConfig = array(); 
    59     $IMConfig['images_dir'] = '<images dir>'; 
    60     $IMConfig['images_url'] = '<images url>'; 
    61     $IMConfig['thumbnail_prefix'] = 't_'; 
    62     $IMConfig['thumbnail_dir'] = 't'; 
    63     $IMConfig['resized_prefix'] = 'resized_'; 
    64     $IMConfig['resized_dir'] = ''; 
    65     $IMConfig['tmp_prefix'] = '_tmp'; 
    66     $IMConfig['max_filesize_kb_image'] = 2000; 
    67     // maximum size for uploading files in 'insert image' mode (2000 kB here) 
    68  
    69     $IMConfig['max_filesize_kb_link'] = 5000; 
    70     // maximum size for uploading files in 'insert link' mode (2000 kB here) 
    71  
    72     // Maximum upload folder size in Megabytes. 
    73     // Use 0 to disable limit 
    74  
    75     $IMConfig['max_foldersize_mb'] = 0; 
    76     $IMConfig['allowed_image_extensions'] = array("jpg","gif","png"); 
    77     $IMConfig['allowed_link_extensions'] = array("jpg","gif","pdf","ip","txt", 
    78                                                  "psd","png","html","swf", 
    79                                                  "xml","xls"); 
    80  
    81     $IMConfig = serialize($IMConfig); 
    82     if(!isset($_SESSION['Xinha:ImageManager'])) 
    83     { 
    84       $_SESSION['Xinha:ImageManager'] = uniqid('secret_code'); 
    85     } 
    86  
    87 ?> 
    8855 
    8956  xinha_plugins = xinha_plugins ? xinha_plugins : 
     
    10168 
    10269// pass the configuration to plugins 
    103 if (xinha_config.ImageManager) { 
    104     xinha_config.ImageManager.backend_config = '<?php echo jsaddslashes($IMConfig)?>'; 
    105     xinha_config.ImageManager.backend_config_hash = '<?php echo sha1($IMConfig . $_SESSION['Xinha:ImageManager'])?>'; 
     70if (xinha_config.ExtendedFileManager) { 
     71            with (xinha_config.ExtendedFileManager) 
     72        { 
     73            <?php 
     74 
     75            // define backend configuration for the plugin 
     76            $IMConfig = array(); 
     77            $IMConfig['images_dir'] = '<images dir>'; 
     78            $IMConfig['images_url'] = '<images url>'; 
     79            $IMConfig['thumbnail_prefix'] = 't_'; 
     80            $IMConfig['thumbnail_dir'] = 't'; 
     81            $IMConfig['resized_prefix'] = 'resized_'; 
     82            $IMConfig['resized_dir'] = ''; 
     83            $IMConfig['tmp_prefix'] = '_tmp'; 
     84            $IMConfig['max_filesize_kb_image'] = 2000; 
     85            // maximum size for uploading files in 'insert image' mode (2000 kB here) 
     86 
     87            $IMConfig['max_filesize_kb_link'] = 5000; 
     88            // maximum size for uploading files in 'insert link' mode (2000 kB here) 
     89 
     90            // Maximum upload folder size in Megabytes. 
     91            // Use 0 to disable limit 
     92            $IMConfig['max_foldersize_mb'] = 0; 
     93             
     94            $IMConfig['allowed_image_extensions'] = array("jpg","gif","png"); 
     95            $IMConfig['allowed_link_extensions'] = array("jpg","gif","pdf","ip","txt", 
     96                                                         "psd","png","html","swf", 
     97                                                         "xml","xls"); 
     98 
     99            require_once '/path/to/xinha/contrib/php-xinha.php'; 
     100            xinha_pass_to_php_backend($IMConfig); 
     101             
     102            ?> 
     103        } 
    106104} 
    107  
    108 if (xinha_config.ExtendedFileManager) { 
    109     xinha_config.ExtendedFileManager.backend_config = '<?php echo jsaddslashes($IMConfig)?>'; 
    110     xinha_config.ExtendedFileManager.backend_config_hash = '<?php echo sha1($IMConfig . $_SESSION['Xinha:ImageManager'])?>'; 
    111 } 
    112  
    113105 
    114106===== 
  • trunk/plugins/ExtendedFileManager/assets/images.js

    r524 r567  
    7373    topDoc.getElementById('f_url').value = ''; 
    7474    topDoc.getElementById('f_alt').value = ''; 
     75    topDoc.getElementById('f_title').value = ''; 
    7576    topDoc.getElementById('f_width').value = ''; 
    7677    topDoc.getElementById('f_margin').value = ''; 
     
    113114    { 
    114115        var obj = topDoc.getElementById('f_url');  obj.value = filename; 
    115         var obj = topDoc.getElementById('f_alt'); obj.value = alt; 
     116        obj = topDoc.getElementById('f_alt'); obj.value = alt; 
     117        obj = topDoc.getElementById('f_title'); obj.value = alt; 
    116118 
    117119        if(width==0 && height==0) toggleImageProperties(true); 
  • trunk/plugins/ExtendedFileManager/assets/manager.js

    r521 r567  
    102102        document.getElementById("f_url").value = param["f_url"]; 
    103103        document.getElementById("f_alt").value = param["f_alt"]; 
     104        document.getElementById("f_title").value = param["f_title"]; 
    104105        document.getElementById("f_border").value = param["f_border"]; 
    105106        document.getElementById("f_width").value = param["f_width"]; 
     
    217218    { 
    218219        // pass data back to the calling window 
    219         var fields = ["f_url", "f_alt", "f_align", "f_border", "f_margin", "f_padding", "f_height", "f_width", "f_borderColor", "f_backgroundColor"]; 
     220        var fields = ["f_url", "f_alt", "f_title", "f_align", "f_border", "f_margin", "f_padding", "f_height", "f_width", "f_borderColor", "f_backgroundColor"]; 
    220221        var param = new Object(); 
    221222        for (var i in fields) 
  • trunk/plugins/ExtendedFileManager/config.inc.php

    r524 r567  
    203203$IMConfig['use_color_pickers'] = true; 
    204204 
     205$IMConfig['images_enable_alt'] = false; 
     206$IMConfig['images_enable_title'] = true; 
     207 
    205208/* 
    206209  Possible values: true, false 
     
    254257 
    255258 
    256 // If config specified from front end, merge it 
    257 if(isset($_REQUEST['backend_config'])) 
     259// Standard PHP Backend Data Passing 
     260//  if data was passed using xinha_pass_to_php_backend() we merge the items 
     261//  provided into the Config 
     262require_once(realpath(dirname(__FILE__) . '/../../contrib/php-xinha.php')); 
     263if($passed_data = xinha_read_passed_data()) 
     264{ 
     265  $IMConfig = array_merge($IMConfig, $passed_data); 
     266  $IMConfig['backend_url'] .= xinha_passed_data_querystring() . '&'; 
     267} 
     268// Deprecated config passing, don't use this way any more! 
     269elseif(isset($_REQUEST['backend_config'])) 
    258270{ 
    259271  if(get_magic_quotes_gpc()) { 
  • trunk/plugins/ExtendedFileManager/extended-file-manager.js

    r521 r567  
    6363{ 
    6464  'backend'    : _editor_url + 'plugins/ExtendedFileManager/backend.php?__plugin=ExtendedFileManager&', 
     65  'backend_data' : null, 
     66  // deprecated keys, use passing data through e.g. xinha_pass_to_php_backend() 
    6567  'backend_config'     : null, 
    6668  'backend_config_hash': null, 
     
    8486            f_url    : HTMLArea.is_ie ? image.src : image.getAttribute("src"), 
    8587            f_alt    : image.alt, 
     88            f_title  : image.title, 
    8689            f_border : image.style.borderWidth ? image.style.borderWidth : image.border, 
    8790            f_align  : image.align, 
     
    115118      manager += '&backend_config_secret_key_location=' 
    116119        + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_secret_key_location); 
     120    } 
     121 
     122    if(editor.config.ExtendedFileManager.backend_data != null) 
     123    { 
     124        for ( var i in editor.config.ExtendedFileManager.backend_data ) 
     125        { 
     126            manager += '&' + i + '=' + encodeURIComponent(editor.config.ExtendedFileManager.backend_data[i]); 
     127        } 
    117128    } 
    118129 
     
    151162            { 
    152163                case "f_alt"    : img.alt    = value; break; 
     164                case "f_title"  : img.title = value; break; 
    153165                case "f_border" : 
    154166                    img.style.borderWidth = /[^0-9]/.test(value) ? value : (parseInt(value || "0") + 'px'); 
  • trunk/plugins/ExtendedFileManager/manager.php

    r525 r567  
    9494</table> 
    9595</fieldset> 
    96 <!-- temp --> 
    97 <!-- /temp --> 
    9896<!-- image properties --> 
    9997        <table class="inputTable"> 
     
    10199                        <td align="right" nowrap><label for="f_url"><?php if($insertMode=='image') echo 'File Name'; else echo 'URL';?></label></td> 
    102100                        <td colspan="5"><input type="text" id="<?php if($insertMode=='image') echo 'f_url'; else echo 'f_href';?>" class="largelWidth" value="" /></td> 
    103             <td rowspan="5" colspan="2" valign="top"><?php if($insertMode=='image') { ?> 
     101<?php // calculate number of table rows to span for the preview cell 
     102$num_rows = 3; // filename & upload & disk info message 
     103if ($insertMode == 'image' && $IMConfig['images_enable_alt']) 
     104    $num_rows++; 
     105if ($insertMode == 'link' || $IMConfig['images_enable_title']) 
     106    $num_rows++; 
     107?> 
     108            <td rowspan="<?php echo $num_rows ?>" colspan="2" valign="top"><?php if($insertMode=='image') { ?> 
    104109            <div style="padding:4px;background-color:#CCC;border:1px inset;width: 100px; height: 100px;"> 
    105110            <img src="" id="f_preview" /> 
     
    114119<input type="text" name="f_other_target" id="f_other_target" style="visibility:hidden; width:120px;" /> 
    115120            <?php } ?></td> 
    116                 </tr> 
    117                 <tr> 
    118                         <td align="right"><label for="f_alt"><?php if($insertMode=='image') echo 'Alt'; else echo 'Title (tooltip)';?></label></td> 
    119                         <td colspan="5"><input type="text" id="<?php if($insertMode=='image') echo 'f_alt'; else echo 'f_title';?>" class="largelWidth" value="" /></td> 
    120                 </tr> 
     121            </tr> 
     122<?php if($insertMode == 'image' && $IMConfig['images_enable_alt']) { ?> 
     123                <tr> 
     124                        <td align="right"><label for="f_alt">Alt</label></td> 
     125                        <td colspan="5"><input type="text" id="f_alt" class="largelWidth" value="" /></td> 
     126        </tr> 
     127<?php } else { 
     128        $hidden_fields[] = 'f_alt'; 
     129      } 
     130      if ($insertMode == 'link' || $IMConfig['images_enable_title']) { ?> 
     131      <tr> 
     132                        <td align="right"><label for="f_title">Title (tooltip)</label></td> 
     133                        <td colspan="5"><input type="text" id="f_title" class="largelWidth" value="" /></td> 
     134      </tr> 
     135<?php } else {  
     136        $hidden_fields[] = 'f_title'; 
     137      } ?> 
    121138                <tr> 
    122139<?php 
     
    141158                </tr> 
    142159                <tr> 
    143                  <td></td> 
    144                  <td colspan="5"> <span id="diskmesg"></span></td> 
     160                 <td>tu<?php if (!empty($hidden_fields)) foreach ($hidden_fields as $hf) echo "<input type=\"hidden\" id=\"{$hf}\" name=\"{$hf}\" value=\"\" />"; ?></td> 
     161                 <td colspan="5"><span id="diskmesg"></span></td> 
    145162      </tr> 
    146163<tr> 
    147164                        <td align="right"><?php if($insertMode=='image') { ?> <label for="f_width">Width</label><?php }?></td> 
    148165 
    149                         <td><?php if($insertMode=='image') { ?> <input type="text" id="f_width" class="smallWidth" value="" onchange="javascript:checkConstrains('width');"/><?php } else echo "&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp";?></td> 
     166                        <td><?php if($insertMode=='image') { ?> <input type="text" id="f_width" class="smallWidth" value="" onchange="javascript:checkConstrains('width');"/><?php } else echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";?></td> 
    150167 
    151168                        <td rowspan="2"><?php if($insertMode=='image') { ?><img src="<?php print $IMConfig['base_url'];?>img/locked.gif" id="imgLock" width="25" height="32" alt="Constrained Proportions" /> 
Note: See TracChangeset for help on using the changeset viewer.