Ignore:
Timestamp:
05/07/05 21:19:31 (14 years ago)
Author:
yermol
Message:

htmlarea.js

. more debugging messages added.
. added HTMLArea.Config.linkReplacementMode which can be either

fullyqualified (the old default behavior) or absolute.


When set to fullyqualified all absolute links (e.g. /somepath) will be changed to fullyqualified URLS (e.g. http://yoursite/somepth).


When set to absolute, all fullyqualified urls back to the current site
will be changed to absolute (e.g. httpyoursite/somepath to /somepath)
making the Xinha generated content portable between sites.


( see HTMLArea.prototype.outwardHtml() )


. bugfix - if plugin .js file has a parse error htmlarea will only try to load

it a configurable number of times before popping up an error message.


backends/backend.php

. initial unified backend created. Requests to this backend are routed

to the corresponding plugin specific backend.php file.


backends/backend_conf.php

. a central server side configuration file has been created for the use

of plugin serverside code.

. all backends hooked into this scheme must include the central config file.

ImageManager?

. modified the config to allow overriding default values.
. default image directory is now xinha/examples/images
. added debugging trace messages which are tagged with the ImageManager? name.
. now uses unified backend.

Linker

. includes central config.
. default directory is now the xinha/examples directory (to avoid scan.php security

problem)

. added debugging trace messages which are tagged with the Linker name.
. links selected from the tree are now displayed in absolute instead of fully qualified

fashion.

. on edit the link that was previously selected is highlighted.
. on edit the selected link is scrolled to if it's outside the viewable area.
. if scan.php returns some kind of error or invalid javascript Linker now pops up

a nice descriptive error message.


. bugfix - same pattern as in loading plugins. If there is some error in loading the directory listing Linker will only attempt it a few times before giving up and

displaying a nice error.


dTree.js

. added clear_s() method to clear the selection
. added getNodeElement() method to return the <a ..> element for a given node.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/unified_backend/plugins/ImageManager/images.php

    r60 r121  
    88 
    99require_once('config.inc.php'); 
    10 require_once('ddt.php'); 
     10require_once(XINHA_INSTALL_ROOT . '/ddt/ddt.php'); 
    1111require_once('Classes/ImageManager.php'); 
    1212 
     
    4242$manager = new ImageManager($IMConfig); 
    4343 
    44  
    4544//get the list of files and directories 
    4645$list = $manager->getFiles($relative); 
    47  
    4846 
    4947/* ================= OUTPUT/DRAW FUNCTIONS ======================= */ 
     
    6260                <td> 
    6361 
    64                 <? _ddt( __FILE__, __LINE__, "drawFiles(): relative is '" . $file['relative'] . "' thumbnail '" . $manager->getThumbnail($file['relative']) . "'" ); ?> 
     62                <?php _ddt( __FILE__, __LINE__, "drawFiles(): relative is '" . $file['relative'] . "' thumbnail '" . $manager->getThumbnail($file['relative']) . "'" ); ?> 
    6563 
    6664                <table width="100" cellpadding="0" cellspacing="0"><tr><td class="block"> 
    6765 
    68                 <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> 
     66                <a href="javascript:;" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo $entry; ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);"title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"><img src="<?php print $manager->getThumbnail($file['relative']); ?>" alt="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"/></a> 
    6967                </td></tr><tr><td class="edit"> 
    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> 
    71                 <? if($file['image']){ echo $file['image'][0].'x'.$file['image'][1]; } else echo $entry;?> 
     68                        <a href="<?php echo $IMConfig['backend_url']; ?>__function=images&dir=<?php echo $relative; ?>&amp;delf=<?php echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash"/></a><a href="javascript:;" title="Edit" onclick="editImage('<?php echo rawurlencode($file['relative']);?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a> 
     69                <?php if($file['image']){ echo $file['image'][0].'x'.$file['image'][1]; } else echo $entry;?> 
    7270                </td></tr></table></td>  
    73           <?  
     71          <?php  
    7472        }//foreach 
    7573}//function drawFiles 
     
    7775 
    7876/** 
    79  * Draw the directory. 
    80  */ 
     77* Draw the directory. 
     78*/ 
     79 
    8180function drawDirs($list, &$manager)  
    8281{ 
     
    8786        { ?> 
    8887                <td><table width="100" cellpadding="0" cellspacing="0"><tr><td class="block"> 
    89                 <a href="images.php?dir=<? echo rawurlencode($path); ?>" onclick="updateDir('<? echo $path; ?>')" title="<? echo $dir['entry']; ?>"><img src="<? print $IMConfig['base_url'];?>img/folder.gif" height="80" width="80" alt="<? echo $dir['entry']; ?>" /></a> 
     88                <a href="<?php print $IMConfig['backend_url']; ?>__function=images&dir=<?php echo rawurlencode($path); ?>" onclick="updateDir('<?php echo $path; ?>')" title="<?php echo $dir['entry']; ?>"><img src="<?php print $IMConfig['base_url'];?>img/folder.gif" height="80" width="80" alt="<?php echo $dir['entry']; ?>" /></a> 
    9089                </td></tr><tr> 
    9190                <td class="edit"> 
    92                         <a href="images.php?dir=<? echo $relative; ?>&amp;deld=<? echo rawurlencode($path); ?>" title="Trash" onclick="return confirmDeleteDir('<? echo $dir['entry']; ?>', <? echo $dir['count']; ?>);"><img src="<? print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash"/></a> 
    93                         <? echo $dir['entry']; ?> 
     91                        <a href="<?php print $IMConfig['backend_url']; ?>__function=editor&dir=<?php echo $relative; ?>&amp;deld=<?php echo rawurlencode($path); ?>" title="Trash" onclick="return confirmDeleteDir('<?php echo $dir['entry']; ?>', <?php echo $dir['count']; ?>);"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash"/></a> 
     92                        <?php echo $dir['entry']; ?> 
    9493                </td> 
    9594                </tr></table></td> 
    96           <?  
     95          <?php  
    9796        } //foreach 
    9897}//function drawDirs 
     
    121120<table width="100%"> 
    122121  <tr> 
    123     <td class="error">Invalid base directory: <? echo $manager->config['images_dir']; ?></td> 
     122    <td class="error">Invalid base directory: <?php echo $manager->config['images_dir']; ?></td> 
    124123  </tr> 
    125124</table> 
     
    134133        <title>Image List</title> 
    135134  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    136         <link href="<? print $IMConfig['base_url'];?>assets/imagelist.css" rel="stylesheet" type="text/css" /> 
     135        <link href="<?php print $IMConfig['base_url'];?>assets/imagelist.css" rel="stylesheet" type="text/css" /> 
    137136<script type="text/javascript"> 
    138 _backend_url = "<? print $IMConfig['backend_url']; ?>"; 
     137_backend_url = "<?php print $IMConfig['backend_url']; ?>"; 
     138 
     139// This page is a frame inside manager.php. 
     140// 
     141// our parent frame (manager.php) has an _imgManager reference that we need to  
     142// import here. _imgManager has an .editor member that allows us to get to the editor 
     143// instance we're working with if we need it. 
     144 
     145_imgManager = top._imgManager; 
     146 
     147_imgManager.ddt._ddt( "images.php", "38", "top of file after _imgManager from top frame." ); 
     148 
    139149</script> 
    140150 
    141 <script type="text/javascript" src="<? print $IMConfig['base_url'];?>assets/dialog.js"></script> 
     151<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/dialog.js"></script> 
    142152<script type="text/javascript"> 
    143153/*<![CDATA[*/ 
     
    147157 
    148158        function hideMessage() 
    149         { 
     159                { 
     160 
     161                _imgManager.ddt._ddt( "images.php", "38", "hideMessage(): top" ); 
     162 
    150163                var topDoc = window.top.document; 
    151164                var messages = topDoc.getElementById('messages'); 
    152165                if(messages) 
    153166                        messages.style.display = "none"; 
    154         } 
     167                } 
    155168 
    156169        init = function() 
    157         { 
     170                { 
     171 
     172                _imgManager.ddt._ddt( "images.php", "38", "init(): top" ); 
     173 
    158174                hideMessage(); 
    159175                var topDoc = window.top.document; 
    160176 
    161 <?  
     177<?php  
    162178        //we need to refesh the drop directory list 
    163179        //save the current dir, delete all select options 
     
    167183                $dirs = $manager->getDirs(); 
    168184?> 
     185 
     186                _imgManager.ddt._ddt( "images.php", "38", "init(): refreshDir section" ); 
     187 
    169188                var selection = topDoc.getElementById('dirPath'); 
    170189                var currentDir = selection.options[selection.selectedIndex].text; 
    171190 
    172191                while(selection.length > 0) 
    173                 {       selection.remove(0); } 
     192                        {        
     193                        selection.remove(0);  
     194                        } 
    174195                 
    175                 selection.options[selection.length] = new Option("/","<? echo rawurlencode('/'); ?>");   
    176                 <? foreach($dirs as $relative=>$fullpath) { ?> 
    177                 selection.options[selection.length] = new Option("<? echo $relative; ?>","<? echo rawurlencode($relative); ?>");                 
    178                 <? } ?> 
     196                selection.options[selection.length] = new Option("/","<?php echo rawurlencode('/'); ?>");        
     197 
     198                <?php foreach($dirs as $relative=>$fullpath) { ?> 
     199                        selection.options[selection.length] = new Option("<?php echo $relative; ?>","<?php echo rawurlencode($relative); ?>");           
     200                <?php } ?> 
    179201                 
    180202                for(var i = 0; i < selection.length; i++) 
     
    187209                        } 
    188210                }                
    189 <? } ?> 
     211<?php } ?> 
    190212        }        
    191213 
    192214        function editImage(image)  
    193         { 
    194                 var url = "<? print $IMConfig['backend_url']; ?>__function=editor&img="+image; 
    195                 Dialog(url, function(param)  
    196                 { 
    197                         if (!param) // user must have pressed Cancel 
    198                                 return false; 
    199                         else 
    200                         { 
    201                                 return true; 
    202                         } 
    203                 }, null);                
    204         } 
     215                { 
     216 
     217                _imgManager.ddt._ddt( "images.php", "38", "editImage(): top with image '" + image + "'" ); 
     218 
     219                var url = "<?php echo $IMConfig['backend_url']; ?>__function=editor&img="+image; 
     220 
     221                // we have to propagate the editor object through. 
     222 
     223                Dialog(url,  
     224                        function(param)  
     225                                { 
     226                                if (!param) // user must have pressed Cancel 
     227                                        return false; 
     228                                else 
     229                                        { 
     230                                        return true; 
     231                                        } 
     232                                }, null, _imgManager.editor);            
     233 
     234                } // end of editImage() 
    205235 
    206236/*]]>*/ 
    207237</script> 
    208 <script type="text/javascript" src="<? print $IMConfig['base_url'];?>assets/images.js"></script> 
     238<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/images.js"></script> 
    209239</head> 
    210240 
    211241<body> 
    212 <? if ($manager->isValidBase() == false) { drawErrorBase($manager); }  
     242<?php if ($manager->isValidBase() == false) { drawErrorBase($manager); }  
    213243        elseif(count($list[0]) > 0 || count($list[1]) > 0) { ?> 
    214244<table> 
    215245        <tr> 
    216         <? drawDirs($list[0], $manager); ?> 
    217         <? drawFiles($list[1], $manager); ?> 
     246        <?php drawDirs($list[0], $manager); ?> 
     247        <?php drawFiles($list[1], $manager); ?> 
    218248        </tr> 
    219249</table> 
    220 <? } else { drawNoResults(); } ?> 
     250<?php } else { drawNoResults(); } ?> 
    221251</body> 
    222252</html> 
Note: See TracChangeset for help on using the changeset viewer.