Changeset 48 for trunk/plugins


Ignore:
Timestamp:
03/21/05 17:46:51 (15 years ago)
Author:
yermol
Message:

now uses PHP_SELF to figure out installation directory URL.
changed plugin to plugin and f to function everywhere.
updated README.

Location:
trunk/plugins/ImageManager
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/ImageManager/Classes/ImageManager.php

    r43 r48  
    554554                //well, no thumbnail was found, so ask the thumbs.php 
    555555                //to generate the thumbnail on the fly. 
    556                 Return $IMConfig['backend_url'] . 'f=thumbs&img='.rawurlencode($relative); 
     556                Return $IMConfig['backend_url'] . '__function=thumbs&img='.rawurlencode($relative); 
    557557        } 
    558558 
  • trunk/plugins/ImageManager/README.txt

    r47 r48  
    2323 
    2424------------------------------------------------------------------------------ 
    25 To get this working check see config.inc.php for configuration values. 
     25If you have GD installed and configured in PHP this should work out of the  
     26box.  
    2627 
    27 Most likely you will need to adjust images_dir and images_url if you have 
    28 not unpacked Xinha in your DOCUMENT_ROOT. 
     28For production use see config.inc.php for configuration values. You will  
     29want to adjust images_dir and images_url for your application. 
    2930 
    3031For demo purposes ImageManager is set up to view images in the 
     
    3940 
    4041-------------------------------------------------------------------------------- 
    41  
    42  
    43  
    44 I've  packaged  this  up to be distributed with Xinha. In order 
    45 for  this  to  work  as  is, you either have to unpack Xinha in 
    46 DOCUMENT_ROOT  or you will need to edit config.inc.php to match 
    47 your install. 
    4842 
    4943By  default this ImageManager is set up to browse some graphics 
     
    6862Request URLs are of the form: 
    6963 
    70  <config backend URL>(?|&)plugin=ImageManager&f=<function>&arg=value&arg=value 
     64 <config backend URL>(?|&)__plugin=ImageManager&__function=<function>&arg=value&arg=value 
    7165 
    7266The default URL is plugins/xinha/backend.php. 
  • trunk/plugins/ImageManager/assets/editorFrame.js

    r43 r48  
    3434                  // a trailing & 
    3535 
    36         var url = _backend_url + "f=editorFrame&img="+currentImageFile+"&action=crop&params="+parseInt(t_cx.value)+','+parseInt(t_cy.value)+','+ parseInt(t_cw.value)+','+parseInt(t_ch.value); 
     36        var url = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=crop&params="+parseInt(t_cx.value)+','+parseInt(t_cy.value)+','+ parseInt(t_cw.value)+','+parseInt(t_ch.value); 
    3737 
    3838        //alert(url); 
     
    4343    else if (action == 'scale') 
    4444    { 
    45         var url = _backend_url + "f=editorFrame&img="+currentImageFile+"&action=scale&params="+parseInt(s_sw.value)+','+parseInt(s_sh.value); 
     45        var url = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=scale&params="+parseInt(s_sw.value)+','+parseInt(s_sh.value); 
    4646        //alert(url); 
    4747        location.href = url; 
     
    5353 
    5454        if(flip.value == 'hoz' || flip.value == 'ver')  
    55             location.href = _backend_url + "f=editorFrame&img="+currentImageFile+"&action=flip&params="+flip.value; 
     55            location.href = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=flip&params="+flip.value; 
    5656        else if (isNaN(parseFloat(r_ra.value))==false) 
    57             location.href = _backend_url + "f=editorFrame&img="+currentImageFile+"&action=rotate&params="+parseFloat(r_ra.value); 
     57            location.href = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=rotate&params="+parseFloat(r_ra.value); 
    5858    } 
    5959    else if(action == 'save') { 
     
    7171            var filename = encodeURI(s_file.value); 
    7272            var quality = parseInt(s_quality.value); 
    73             var url = _backend_url + "f=editorFrame&img="+currentImageFile+"&action=save&params="+format[0]+","+quality+"&file="+filename; 
     73            var url = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=save&params="+format[0]+","+quality+"&file="+filename; 
    7474            //alert(url); 
    7575            location.href = url; 
  • trunk/plugins/ImageManager/assets/images.js

    r43 r48  
    2020                // assume it has a trailing & 
    2121 
    22                 location.href = _backend_url + "f=images&dir="+newDir; 
     22                location.href = _backend_url + "__function=images&dir="+newDir; 
    2323        } 
    2424 
     
    2626        function newFolder(dir, newDir)  
    2727        { 
    28                 location.href = _backend_url + "f=images&dir="+dir+"&newDir="+newDir; 
     28                location.href = _backend_url + "__function=images&dir="+dir+"&newDir="+newDir; 
    2929        } 
    3030 
  • trunk/plugins/ImageManager/backend.php

    r43 r48  
    2020* entry point. backend.php expects at least two URL variable parameters:  
    2121* 
    22 * plugin=ImageManager   for future expansion; identify the plugin being requested. 
    23 * f=thumbs|images|editorFrame|editor|manager  function being called. 
     22* __plugin=ImageManager   for future expansion; identify the plugin being requested. 
     23* __function=thumbs|images|editorFrame|editor|manager  function being called. 
    2424* 
    2525* Having a single entry point that strictly adheres to a defined interface will  
     
    5656// used by ImageManager is in the same files as the PHP code ...) 
    5757 
    58 if ( @$formVars[ "plugin" ] != "ImageManager" ) 
     58if ( @$formVars[ "__plugin" ] != "ImageManager" ) 
    5959        { 
    6060        // not for us. 
     
    6969// function request. 
    7070 
    71 _ddt( __FILE__, __LINE__, "backend.php(): handling function '" . $formVars[ "f" ] . "' base_dir is '" . $IMConfig["base_dir"] . "'" ); 
     71_ddt( __FILE__, __LINE__, "backend.php(): handling function '" . $formVars[ "__function" ] . "' base_dir is '" . $IMConfig["base_dir"] . "'" ); 
    7272 
    73 switch ( @$formVars[ "f" ] ) 
     73switch ( @$formVars[ "__function" ] ) 
    7474        { 
    7575 
  • trunk/plugins/ImageManager/config.inc.php

    r47 r48  
    2222* URL to use for unified backend. 
    2323* 
    24 * The ?plugin=ImageManager& is required.  
    25 */ 
    26  
    27 $IMConfig['backend_url'] = "backend.php?plugin=ImageManager&"; 
     24* The ?__plugin=ImageManager& is required.  
     25*/ 
     26 
     27$IMConfig['backend_url'] = "backend.php?__plugin=ImageManager&"; 
    2828 
    2929/** 
     
    7777// $IMConfig['images_url'] = "/url/to/above"; 
    7878 
    79 // try to figure out the URL of the images directory. We're assuming it's not 
    80 // symlinked. 
    81  
    82 $IMConfig['images_url'] = "/xinha/plugins/ImageManager/demo_images"; 
     79// try to figure out the URL of the sample images directory. For your installation 
     80// you will probably want to keep images in another directory. 
     81 
     82$IMConfig['images_url'] = str_replace( "backend.php", "", $_SERVER["PHP_SELF"] ) . "demo_images"; 
    8383 
    8484// ------------------------------------------------------------------------- 
     
    250250 
    251251// uncomment to send debug messages to a local file 
    252 // _setDebugLog( "/tmp/debug_log.txt" ); 
     252_setDebugLog( "/tmp/debug_log.txt" ); 
    253253 
    254254// turn debugging on everywhere. 
    255 // _ddtOn(); 
     255_ddtOn(); 
    256256 
    257257// END 
  • trunk/plugins/ImageManager/editor.php

    r43 r48  
    141141</div> 
    142142<div id="contents"> 
    143 <iframe src="<? print $IMConfig['backend_url']; ?>f=editorFrame&img=<? if(isset($_GET['img'])) echo rawurlencode($_GET['img']); ?>" name="editor" id="editor"  scrolling="auto" title="Image Editor" frameborder="0"></iframe> 
     143<iframe src="<? print $IMConfig['backend_url']; ?>__function=editorFrame&img=<? if(isset($_GET['img'])) echo rawurlencode($_GET['img']); ?>" name="editor" id="editor"  scrolling="auto" title="Image Editor" frameborder="0"></iframe> 
    144144</div> 
    145145<div id="bottom"></div> 
  • trunk/plugins/ImageManager/image-manager.js

    r47 r48  
    4444HTMLArea.Config.prototype.ImageManager = 
    4545{ 
    46   'backend' : _editor_url + 'plugins/ImageManager/backend.php?plugin=ImageManager&', 
     46  'backend' : _editor_url + 'plugins/ImageManager/backend.php?__plugin=ImageManager&', 
    4747  'images_url' : _editor_url + 'plugins/ImageManager/demo_images' 
    4848} 
     
    6262 
    6363        // the selection will have the absolute url to the image.  
    64         // We need to coerce it to be relative to the images directory. 
     64        // coerce it to be relative to the images directory. 
    6565        // 
    6666        // FIXME: we have the correct URL, but how to get it to select? 
     67        // FIXME: need to do the same for MSIE. 
    6768 
    6869        if ( image ) 
     
    7879                        var image_src = image.getAttribute("src"); 
    7980 
    80                         // alert( "images_url is '" + editor.config.ImageManager.images_url + "'" ); 
     81                        // strip off any http://blah prefix 
    8182 
    82                         var image_regex = new RegExp( editor.config.ImageManager.images_url ); 
     83                        var images_url = editor.config.ImageManager.images_url.replace( /https?:\/\/[^\/]*/, "" ); 
     84 
     85                        // alert( "images_url is '" + images_url + "'" ); 
     86 
     87                        var image_regex = new RegExp( images_url ); 
    8388 
    8489                        // alert(" regex is '" + image_regex.source + "'" ); 
     
    110115        // alert( "backend is '" + editor.config.ImageManager.backend + "'" ); 
    111116 
    112         var manager = editor.config.ImageManager.backend + 'f=manager'; 
     117        var manager = editor.config.ImageManager.backend + '__function=manager'; 
    113118 
    114119        Dialog(manager, function(param) { 
  • trunk/plugins/ImageManager/images.php

    r46 r48  
    6868                <a href="javascript:;" onclick="selectImage('<? echo $file['relative'];?>', '<? echo $entry; ?>', <? echo $file['image'][0];?>, <? echo $file['image'][1]; ?>);"title="<? echo $entry; ?> - <? echo Files::formatSize($file['stat']['size']); ?>"><img src="<? print $manager->getThumbnail($file['relative']); ?>" alt="<? echo $entry; ?> - <? echo Files::formatSize($file['stat']['size']); ?>"/></a> 
    6969                </td></tr><tr><td class="edit"> 
    70                         <a href="<? print $IMConfig['backend_url']; ?>f=images&dir=<? echo $relative; ?>&amp;delf=<? echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile('<? echo $entry; ?>');"><img src="<? print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash"/></a><a href="javascript:;" title="Edit" onclick="editImage('<? echo rawurlencode($file['relative']);?>');"><img src="<? print $IMConfig['base_url'];?>img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a> 
     70                        <a href="<? print $IMConfig['backend_url']; ?>__function=images&dir=<? echo $relative; ?>&amp;delf=<? echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile('<? echo $entry; ?>');"><img src="<? print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash"/></a><a href="javascript:;" title="Edit" onclick="editImage('<? echo rawurlencode($file['relative']);?>');"><img src="<? print $IMConfig['base_url'];?>img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a> 
    7171                <? if($file['image']){ echo $file['image'][0].'x'.$file['image'][1]; } else echo $entry;?> 
    7272                </td></tr></table></td>  
     
    192192        function editImage(image)  
    193193        { 
    194                 var url = "<? print $IMConfig['backend_url']; ?>f=editor&img="+image; 
     194                var url = "<? print $IMConfig['backend_url']; ?>__function=editor&img="+image; 
    195195                Dialog(url, function(param)  
    196196                { 
  • trunk/plugins/ImageManager/manager.php

    r43 r48  
    4949<? // we have to propagate our values through forms ?> 
    5050 
    51 <input type="hidden" name="plugin" value="ImageManager"> 
    52 <input type="hidden" name="f" value="images"> 
     51<input type="hidden" name="__plugin" value="ImageManager"> 
     52<input type="hidden" name="__function" value="images"> 
    5353 
    5454<fieldset><legend>Image Manager</legend> 
     
    6666<? } ?> 
    6767        <div id="messages" style="display: none;"><span id="message"></span><img SRC="<? print $IMConfig['base_url']; ?>img/dots.gif" width="22" height="12" alt="..." /></div> 
    68         <iframe src="<? print $IMConfig['backend_url']; ?>f=images" name="imgManager" id="imgManager" class="imageFrame" scrolling="auto" title="Image Selection" frameborder="0"></iframe> 
     68        <iframe src="<? print $IMConfig['backend_url']; ?>__function=images" name="imgManager" id="imgManager" class="imageFrame" scrolling="auto" title="Image Selection" frameborder="0"></iframe> 
    6969</div> 
    7070</fieldset> 
Note: See TracChangeset for help on using the changeset viewer.