source: branches/unified_backend/plugins/ImageManager/manager.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: 7.2 KB
Line 
1<?
2/**
3* The main GUI for the ImageManager.
4* @author $Author: Wei Zhuo $
5* @version $Id: manager.php 26 2004-03-31 02:35:21Z Wei Zhuo $
6* @package ImageManager
7*/
8
9require_once('config.inc.php');
10require_once(XINHA_INSTALL_ROOT . '/ddt/ddt.php');
11require_once('Classes/ImageManager.php');
12       
13$manager = new ImageManager($IMConfig);
14$dirs = $manager->getDirs();
15
16?>
17<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
18
19<html>
20<head>
21        <title>Insert Image</title>
22<script type="text/javascript">
23
24<?php // temporary. An ImageManager rewrite will take care of this kludge. ?>
25
26_backend_url = "<?php print $IMConfig['backend_url']; ?>";
27
28// This page is opened by a call to Dialog() in xinha/dialog.js. Subsequent
29// dialogs are opened using the version in ImageManager/assets/dialog.js.
30//
31// The Dialog() call accepts an optional fourth parameter, the editor instance
32// that is raising this dialog. From there we can pull out the ImageManager instance and
33// get access to the ddt instance. This has an added benefit allowing us to
34// put all the previously free standing manager functions into the image manager class.
35
36_imgManager = window.opener.Dialog._editor.plugins[ "ImageManager" ].instance;
37
38_imgManager.ddt._ddt( "manager.php", "38", "top of file after getting imgManager reference." );
39
40</script>
41
42<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
43<link href="<?php print $IMConfig['base_url'];?>assets/manager.css" rel="stylesheet" type="text/css" /> 
44<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/popup.js"></script>
45<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/dialog.js"></script>
46<script type="text/javascript">
47/*<![CDATA[*/
48        window.resizeTo(600, 460);
49
50        if (window.opener)
51                HTMLArea = window.opener.HTMLArea;
52
53        var thumbdir = "<?php echo $IMConfig['thumbnail_dir']; ?>";
54        var base_url = "<?php echo $manager->getImagesURL(); ?>";
55
56        _imgManager.ddt._ddt( "manager.php", "38", "thumbdir is '" + thumbdir + "' base_url is '" + base_url + "'" );
57
58        // manager.js relies on the existence of _imgManager in this scope.
59/*]]>*/
60</script>
61
62<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/manager.js"></script>
63</head>
64<body>
65<div class="title">Insert Image</div>
66<form action="<?php print $IMConfig['backend_url'] ?>" id="uploadForm" method="post" enctype="multipart/form-data">
67
68<?php // we have to propagate our values through forms ?>
69
70<input type="hidden" name="__plugin" value="ImageManager">
71<input type="hidden" name="__function" value="images">
72
73<fieldset><legend>Image Manager</legend>
74<div class="dirs">
75        <label for="dirPath">Directory</label>
76        <select name="dir" class="dirWidth" id="dirPath" onchange="updateDir(this)">
77        <option value="/">/</option>
78<?php foreach($dirs as $relative=>$fullpath) { ?>
79                <option value="<?php echo rawurlencode($relative); ?>"><?php echo $relative; ?></option>
80<?php } ?>
81        </select>
82        <a href="#" onclick="javascript: goUpDir();" title="Directory Up"><img src="<?php print $IMConfig['base_url']; ?>img/btnFolderUp.gif" height="15" width="15" alt="Directory Up" /></a>
83<?php if($IMConfig['safe_mode'] == false && $IMConfig['allow_new_dir']) { ?>
84        <a href="#" onclick="newFolder();" title="New Folder"><img src="<?php print $IMConfig['base_url']; ?>img/btnFolderNew.gif" height="15" width="15" alt="New Folder" /></a>
85<?php } ?>
86        <div id="messages" style="display: none;"><span id="message"></span><img SRC="<?php print $IMConfig['base_url']; ?>img/dots.gif" width="22" height="12" alt="..." /></div>
87        <iframe src="<?php print $IMConfig['backend_url']; ?>__function=images" name="imgManager" id="imgManager" class="imageFrame" scrolling="auto" title="Image Selection" frameborder="0"></iframe>
88</div>
89</fieldset>
90<!-- image properties -->
91        <table class="inputTable">
92                <tr>
93                        <td align="right"><label for="f_url">Image File</label></td>
94                        <td><input type="text" id="f_url" class="largelWidth" value="" /></td>
95                        <td rowspan="3" align="right">&nbsp;</td>
96                        <td align="right"><label for="f_width">Width</label></td>
97                        <td><input type="text" id="f_width" class="smallWidth" value="" onchange="javascript:checkConstrains('width');"/></td>
98                        <td rowspan="2" align="right"><img src="<?php print $IMConfig['base_url']; ?>img/locked.gif" id="imgLock" width="25" height="32" alt="Constrained Proportions" /></td>
99                        <td rowspan="3" align="right">&nbsp;</td>
100                        <td align="right"><label for="f_vert">V Space</label></td>
101                        <td><input type="text" id="f_vert" class="smallWidth" value="" /></td>
102                </tr>           
103                <tr>
104                        <td align="right"><label for="f_alt">Alt</label></td>
105                        <td><input type="text" id="f_alt" class="largelWidth" value="" /></td>
106                        <td align="right"><label for="f_height">Height</label></td>
107                        <td><input type="text" id="f_height" class="smallWidth" value="" onchange="javascript:checkConstrains('height');"/></td>
108                        <td align="right"><label for="f_horiz">H Space</label></td>
109                        <td><input type="text" id="f_horiz" class="smallWidth" value="" /></td>
110                </tr>
111                <tr>
112<?php if($IMConfig['allow_upload'] == true) { ?>
113                        <td align="right"><label for="upload">Upload</label></td>
114                        <td>
115                                <table cellpadding="0" cellspacing="0" border="0">
116                  <tr>
117                    <td><input type="file" name="upload" id="upload"/></td>
118                    <td>&nbsp;<button type="submit" name="submit" onclick="doUpload();"/>Upload</button></td>
119                  </tr>
120                </table>
121                        </td>
122<?php } else { ?>
123                        <td colspan="2"></td>
124<?php } ?>
125                        <td align="right"><label for="f_align">Align</label></td>
126                        <td colspan="2">
127                                <select size="1" id="f_align"  title="Positioning of this image">
128                                  <option value=""                             >Not Set</option>
129                                  <option value="left"                         >Left</option>
130                                  <option value="right"                        >Right</option>
131                                  <option value="texttop"                      >Texttop</option>
132                                  <option value="absmiddle"                    >Absmiddle</option>
133                                  <option value="baseline" selected="selected" >Baseline</option>
134                                  <option value="absbottom"                    >Absbottom</option>
135                                  <option value="bottom"                       >Bottom</option>
136                                  <option value="middle"                       >Middle</option>
137                                  <option value="top"                          >Top</option>
138                                </select>
139                        </td>
140                        <td align="right"><label for="f_border">Border</label></td>
141                        <td><input type="text" id="f_border" class="smallWidth" value="" /></td>
142                </tr>
143                <tr>
144         <td colspan="4" align="right">
145                                <input type="hidden" id="orginal_width" />
146                                <input type="hidden" id="orginal_height" />
147            <input type="checkbox" id="constrain_prop" checked="checked" onclick="javascript:toggleConstrains(this);" />
148          </td>
149          <td colspan="5"><label for="constrain_prop">Constrain Proportions</label></td>
150      </tr>
151        </table>
152<!--// image properties -->     
153        <div style="text-align: right;">
154          <hr />
155                  <button type="button" class="buttons" onclick="return refresh();">Refresh</button>
156          <button type="button" class="buttons" onclick="return onOK();">OK</button>
157          <button type="button" class="buttons" onclick="return onCancel();">Cancel</button>
158    </div>
159</form>
160</body>
161</html>
Note: See TracBrowser for help on using the repository browser.