source: branches/unified_backend/plugins/ImageManager/backend.php @ 121

Last change on this file since 121 was 121, checked in by yermol, 14 years ago

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 size: 3.4 KB
Line 
1<?php
2
3/**
4* Unified backend for ImageManager
5*
6* Image Manager was originally developed by:
7*   Xiang Wei Zhuo, email: xiangweizhuo(at)hotmail.com Wei Shou.
8*
9* Unified backend sponsored by DTLink Software, http://www.dtlink.com
10* Implementation by Yermo Lamers, http://www.formvista.com/contact.html
11*
12* (c) DTLink, LLC 2005.
13* Distributed under the same terms as HTMLArea itself.
14* This notice MUST stay intact for use (see license.txt).
15*
16* DESCRIPTION:
17*
18* Instead of using separate URL's for each function, ImageManager now
19* routes all requests to the server through this single, replaceable,
20* entry point. backend.php expects at least two URL variable parameters:
21*
22* __plugin=ImageManager   for future expansion; identify the plugin being requested.
23* __function=thumbs|images|editorFrame|editor|manager  function being called.
24*
25* Having a single entry point that strictly adheres to a defined interface will
26* make the backend code much easier to maintain and expand. It will make it easier
27* on integrators, not to mention it'll make it easier to have separate
28* implementations of the backend in different languages (Perl, Python, ASP, etc.)
29*
30* @see config.inc.php
31*/
32
33/**
34* ImageManager configuration
35*/
36
37require_once('config.inc.php');
38
39/**
40* debug message library
41*/
42
43include_once( "../ddt/ddt.php" );
44
45// uncomment to turn on debugging
46// _ddtOn();
47
48// ---------------------------------------------------------------
49
50/**
51* ImageManager backend callback
52*
53* After including this file, the unified backend.php script
54* will call this function
55*/
56
57function imagemanager_callback( $formVars )
58{
59
60global $IMConfig;
61
62_ddt( __FILE__, __LINE__, "backend.php: top with query '" . $_SERVER["PHP_SELF"] . "' string '" . $_SERVER["QUERY_STRING"] . "'" );
63
64// make sure the request is for us (this gives us the ability to eventually organize
65// a backend event handler system) For an include file the return doesn't make alot of
66// sense but eventually we'll want to turn all of this into at least functions
67// separating out all the presentation HTML from the logic. (Right now all the HTML
68// used by ImageManager is in the same files as the PHP code ...)
69
70if ( @$formVars[ "__plugin" ] != "ImageManager" )
71        {
72        // not for us.
73
74        _ddt( __FILE__, __LINE__, "request was not for us" );
75
76        return true;
77        }
78
79// so we don't have to re-engineer the entire thing right now, since it's probably
80// going to get rewritten anyway, we just include the correct file based on the
81// function request.
82
83_ddt( __FILE__, __LINE__, "backend.php(): handling function '" . $formVars[ "__function" ] . "' base_dir is '" . $IMConfig["base_dir"] . "'" );
84
85switch ( @$formVars[ "__function" ] )
86        {
87
88        case "editor":
89
90                include_once( $IMConfig['base_dir'] . "/editor.php" );
91                exit();
92               
93                break;
94
95        case "editorFrame":
96
97                include_once( $IMConfig['base_dir'] . "/editorFrame.php" );
98                exit();
99
100                break;
101
102        case "manager":
103
104                _ddt( __FILE__, __LINE__, "including '" . $IMConfig['base_dir'] . "/manager.php" );
105
106                include_once( $IMConfig['base_dir'] . "/manager.php" );
107                exit();
108
109                break;
110
111        case "images":
112
113                include_once( $IMConfig['base_dir'] . "/images.php" );
114                exit();
115
116                break;
117
118        case "thumbs":
119
120                include_once( $IMConfig['base_dir'] . "/thumbs.php" );
121                exit();
122
123                break;
124
125        default:
126
127                _ddt( __FILE__, __LINE__, "function request not supported" );
128                _error( __FILE__, __LINE__, "function request not supported" );
129
130                break;
131
132        }       // end of switch.
133
134return false ;
135
136}       // end of ImageManager_plugin
137
138// END
139
140?>
Note: See TracBrowser for help on using the repository browser.