XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
xoopsimagemanager.php
Go to the documentation of this file.
1 <?php
16 // load mainfile.php
17 $current_path = dirname(__FILE__);
18 if ( DIRECTORY_SEPARATOR != "/" ) {
19  $current_path = str_replace( DIRECTORY_SEPARATOR, "/", $current_path);
20 }
21 $xoops_root_path = substr($current_path, 0, strpos(strtolower($current_path), "/class/xoopseditor/tinymce/"));
22 include_once $xoops_root_path . "/mainfile.php";
23 if (!defined("XOOPS_ROOT_PATH")) { die("XOOPS root path not defined"); }
24 
25 // include
26 include_once XOOPS_ROOT_PATH."/modules/system/constants.php";
27 
28 // check user/group
29 $admin = false;
30 
32 $groups = is_object( $GLOBALS["xoopsUser"] ) ? $GLOBALS["xoopsUser"]->getGroups() : array( XOOPS_GROUP_ANONYMOUS );
33 $admin = $gperm_handler->checkRight( 'system_admin', XOOPS_SYSTEM_IMAGE, $groups );
34 
35 // check categories readability/writability by group
36 $imgcat_handler =& xoops_gethandler('imagecategory');
37 $catreadlist =& $imgcat_handler->getList($groups, 'imgcat_read', 1); // get readable categories
38 $catwritelist =& $imgcat_handler->getList($groups, 'imgcat_write', 1); // get writable categories
39 
40 $canbrowse = ($admin || !empty($catreadlist) || !empty($catwritelist)) ? true : false;
41 
42 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
43 echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . _LANGCODE . '" lang="' . _LANGCODE . '">';
44 ?>
45 <head>
46  <title>{#xoopsimagemanager_dlg.dialog_title}</title>
47  <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
48  <script type="text/javascript" src="../../utils/mctabs.js"></script>
49  <script type="text/javascript" src="../../utils/form_utils.js"></script>
50  <script type="text/javascript" src="../../utils/validate.js"></script>
51  <script type="text/javascript" src="js/xoopsimagemanager.js"></script>
52  <link href="css/xoopsimagemanager.css" rel="stylesheet" type="text/css" />
53  <base target="_self" />
54 </head>
55 
56 <body id="xoopsimagemanager" style="display: none">
57  <form onsubmit="XoopsimagemanagerDialog.insert();return false;" action="#">
58  <div class="tabs">
59  <ul>
60  <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xoopsimagemanager_dlg.tab_general}</a></span></li>
61  <li id="appearance_tab"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#xoopsimagemanager_dlg.tab_appearance}</a></span></li>
62  <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#xoopsimagemanager_dlg.tab_advanced}</a></span></li>
63  </ul>
64  </div>
65 
66  <div class="panel_wrapper">
67  <div id="general_panel" class="panel current">
68  <fieldset>
69  <legend>{#xoopsimagemanager_dlg.general}</legend>
70  <table class="properties">
71  <tr>
72  <td class="column1">
73  <label id="srclabel" for="src">{#xoopsimagemanager_dlg.src}</label>
74  </td>
75  <td colspan="2">
76  <table border="0" cellspacing="0" cellpadding="0">
77  <tr>
78  <td>
79  <input name="src" type="text" id="src" value="" onchange="XoopsimagemanagerDialog.showPreviewImage(this.value);" />
80  <?php echo imageBrowser("src", $canbrowse); ?>
81  </td>
82  <td id="srcbrowsercontainer">&nbsp;</td>
83  </tr>
84  </table>
85  </td>
86  </tr>
87  <tr>
88  <td><label for="src_list">{#xoopsimagemanager_dlg.image_list}</label></td>
89  <td><select id="src_list" name="src_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;document.getElementById('title').value=this.options[this.selectedIndex].text;XoopsimagemanagerDialog.showPreviewImage(this.options[this.selectedIndex].value);"></select></td>
90  </tr>
91  <tr>
92  <td class="column1"><label id="altlabel" for="alt">{#xoopsimagemanager_dlg.alt}</label></td>
93  <td colspan="2"><input id="alt" name="alt" type="text" value="" /></td>
94  </tr>
95  <tr>
96  <td class="column1"><label id="titlelabel" for="title">{#xoopsimagemanager_dlg.title}</label></td>
97  <td colspan="2"><input id="title" name="title" type="text" value="" /></td>
98  </tr>
99  </table>
100  </fieldset>
101 
102  <fieldset>
103  <legend>{#xoopsimagemanager_dlg.preview}</legend>
104  <div id="prev"></div>
105  </fieldset>
106  </div>
107 
108  <div id="appearance_panel" class="panel">
109  <fieldset>
110  <legend>{#xoopsimagemanager_dlg.tab_appearance}</legend>
111 
112  <table border="0" cellpadding="4" cellspacing="0">
113  <tr>
114  <td class="column1"><label id="alignlabel" for="align">{#xoopsimagemanager_dlg.align}</label></td>
115  <td>
116  <select id="align" name="align" onchange="XoopsimagemanagerDialog.updateStyle('align');XoopsimagemanagerDialog.changeAppearance();">
117  <option value="">{#not_set}</option>
118  <option value="baseline">{#xoopsimagemanager_dlg.align_baseline}</option>
119  <option value="top">{#xoopsimagemanager_dlg.align_top}</option>
120  <option value="middle">{#xoopsimagemanager_dlg.align_middle}</option>
121  <option value="bottom">{#xoopsimagemanager_dlg.align_bottom}</option>
122  <option value="text-top">{#xoopsimagemanager_dlg.align_texttop}</option>
123  <option value="text-bottom">{#xoopsimagemanager_dlg.align_textbottom}</option>
124  <option value="left">{#xoopsimagemanager_dlg.align_left}</option>
125  <option value="right">{#xoopsimagemanager_dlg.align_right}</option>
126  </select>
127  </td>
128  <td rowspan="6" valign="top">
129  <div class="alignPreview">
130  <img id="alignSampleImg" src="img/sample.gif" alt="{#xoopsimagemanager_dlg.example_img}" />
131  Lorem ipsum, Dolor sit amet, consectetuer adipiscing loreum ipsum edipiscing elit, sed diam
132  nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Loreum ipsum
133  edipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam
134  erat volutpat.
135  </div>
136  </td>
137  </tr>
138 
139  <tr>
140  <td class="column1"><label id="widthlabel" for="width">{#xoopsimagemanager_dlg.dimensions}</label></td>
141  <td nowrap="nowrap">
142  <input name="width" type="text" id="width" value="" size="5" maxlength="5" class="size" onchange="XoopsimagemanagerDialog.changeHeight();" /> x
143  <input name="height" type="text" id="height" value="" size="5" maxlength="5" class="size" onchange="XoopsimagemanagerDialog.changeWidth();" /> px
144  </td>
145  </tr>
146 
147  <tr>
148  <td>&nbsp;</td>
149  <td>
150  <table border="0" cellpadding="0" cellspacing="0">
151  <tr>
152  <td><input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>
153  <td><label id="constrainlabel" for="constrain">{#xoopsimagemanager_dlg.constrain_proportions}</label></td>
154  </tr>
155  </table>
156  </td>
157  </tr>
158 
159  <tr>
160  <td class="column1"><label id="vspacelabel" for="vspace">{#xoopsimagemanager_dlg.vspace}</label></td>
161  <td><input name="vspace" type="text" id="vspace" value="" size="3" maxlength="3" class="number" onchange="XoopsimagemanagerDialog.updateStyle('vspace');XoopsimagemanagerDialog.changeAppearance();" onblur="XoopsimagemanagerDialog.updateStyle('vspace');XoopsimagemanagerDialog.changeAppearance();" />
162  </td>
163  </tr>
164 
165  <tr>
166  <td class="column1"><label id="hspacelabel" for="hspace">{#xoopsimagemanager_dlg.hspace}</label></td>
167  <td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3" class="number" onchange="XoopsimagemanagerDialog.updateStyle('hspace');XoopsimagemanagerDialog.changeAppearance();" onblur="XoopsimagemanagerDialog.updateStyle('hspace');XoopsimagemanagerDialog.changeAppearance();" /></td>
168  </tr>
169 
170  <tr>
171  <td class="column1"><label id="borderlabel" for="border">{#xoopsimagemanager_dlg.border}</label></td>
172  <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" class="number" onchange="XoopsimagemanagerDialog.updateStyle('border');XoopsimagemanagerDialog.changeAppearance();" onblur="XoopsimagemanagerDialog.updateStyle('border');XoopsimagemanagerDialog.changeAppearance();" /></td>
173  </tr>
174 
175  <tr>
176  <td><label for="class_list">{#class_name}</label></td>
177  <td><select id="class_list" name="class_list"></select></td>
178  </tr>
179 
180  <tr>
181  <td class="column1"><label id="stylelabel" for="style">{#xoopsimagemanager_dlg.style}</label></td>
182  <td colspan="2"><input id="style" name="style" type="text" value="" onchange="XoopsimagemanagerDialog.changeAppearance();" /></td>
183  </tr>
184 
185  <!-- <tr>
186  <td class="column1"><label id="classeslabel" for="classes">{#xoopsimagemanager_dlg.classes}</label></td>
187  <td colspan="2"><input id="classes" name="classes" type="text" value="" onchange="selectByValue(this.form,'classlist',this.value,true);" /></td>
188  </tr> -->
189  </table>
190  </fieldset>
191  </div>
192 
193  <div id="advanced_panel" class="panel">
194  <fieldset>
195  <legend>{#xoopsimagemanager_dlg.swap_image}</legend>
196 
197  <input type="checkbox" id="onmousemovecheck" name="onmousemovecheck" class="checkbox" onclick="XoopsimagemanagerDialog.setSwapImage(this.checked);" />
198  <label id="onmousemovechecklabel" for="onmousemovecheck">{#xoopsimagemanager_dlg.alt_image}</label>
199 
200  <table border="0" cellpadding="4" cellspacing="0" width="100%">
201  <tr>
202  <td class="column1"><label id="onmouseoversrclabel" for="onmouseoversrc">{#xoopsimagemanager_dlg.mouseover}</label></td>
203  <td>
204  <table border="0" cellspacing="0" cellpadding="0">
205  <tr>
206  <td>
207  <input id="onmouseoversrc" name="onmouseoversrc" type="text" value="" />
208  <?php echo imageBrowser("onmouseoversrc", $canbrowse); ?>
209  </td>
210  <td id="onmouseoversrccontainer">&nbsp;</td>
211  </tr>
212  </table>
213  </td>
214  </tr>
215  <tr>
216  <td><label for="over_list">{#xoopsimagemanager_dlg.image_list}</label></td>
217  <td><select id="over_list" name="over_list" onchange="document.getElementById('onmouseoversrc').value=this.options[this.selectedIndex].value;"></select></td>
218  </tr>
219  <tr>
220  <td class="column1"><label id="onmouseoutsrclabel" for="onmouseoutsrc">{#xoopsimagemanager_dlg.mouseout}</label></td>
221  <td class="column2">
222  <table border="0" cellspacing="0" cellpadding="0">
223  <tr>
224  <td>
225  <input id="onmouseoutsrc" name="onmouseoutsrc" type="text" value="" />
226  <?php echo imageBrowser("onmouseoutsrc", $canbrowse); ?>
227  </td>
228  <td id="onmouseoutsrccontainer">&nbsp;</td>
229  </tr>
230  </table>
231  </td>
232  </tr>
233  <tr>
234  <td><label for="out_list">{#xoopsimagemanager_dlg.image_list}</label></td>
235  <td><select id="out_list" name="out_list" onchange="document.getElementById('onmouseoutsrc').value=this.options[this.selectedIndex].value;"></select></td>
236  </tr>
237  </table>
238  </fieldset>
239 
240  <fieldset>
241  <legend>{#xoopsimagemanager_dlg.misc}</legend>
242 
243  <table border="0" cellpadding="4" cellspacing="0">
244  <tr>
245  <td class="column1"><label id="idlabel" for="id">{#xoopsimagemanager_dlg.id}</label></td>
246  <td><input id="id" name="id" type="text" value="" /></td>
247  </tr>
248 
249  <tr>
250  <td class="column1"><label id="dirlabel" for="dir">{#xoopsimagemanager_dlg.langdir}</label></td>
251  <td>
252  <select id="dir" name="dir" onchange="XoopsimagemanagerDialog.changeAppearance();">
253  <option value="">{#not_set}</option>
254  <option value="ltr">{#xoopsimagemanager_dlg.ltr}</option>
255  <option value="rtl">{#xoopsimagemanager_dlg.rtl}</option>
256  </select>
257  </td>
258  </tr>
259 
260  <tr>
261  <td class="column1"><label id="langlabel" for="lang">{#xoopsimagemanager_dlg.langcode}</label></td>
262  <td>
263  <input id="lang" name="lang" type="text" value="" />
264  </td>
265  </tr>
266 
267  <tr>
268  <td class="column1"><label id="usemaplabel" for="usemap">{#xoopsimagemanager_dlg.map}</label></td>
269  <td>
270  <input id="usemap" name="usemap" type="text" value="" />
271  </td>
272  </tr>
273 
274  <tr>
275  <td class="column1"><label id="longdesclabel" for="longdesc">{#xoopsimagemanager_dlg.long_desc}</label></td>
276  <td>
277  <table border="0" cellspacing="0" cellpadding="0">
278  <tr>
279  <td><input id="longdesc" name="longdesc" type="text" value="" /></td>
280  <td id="longdesccontainer">&nbsp;</td>
281  </tr>
282  </table>
283  </td>
284  </tr>
285  </table>
286  </fieldset>
287  </div>
288  </div>
289 
290  <div class="mceActionPanel">
291  <div style="float: left">
292  <input type="button" id="insert" name="insert" value="{#insert}" onclick="XoopsimagemanagerDialog.insert();" />
293  </div>
294 
295  <div style="float: right">
296  <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
297  </div>
298  </div>
299  </form>
300 </body>
301 </html>
302 
303 <?php
304 function imageBrowser( $inputname = "src", $canbrowse = false ) {
305  $html = "";
306  if ( $canbrowse ) {
307  $html = "<img title=\"{#xoopsimagebrowser.desc}\" class=\"xoopsimagebrowser\" src=\"img/xoopsimagemanager.png\"
308  onclick=\"javascript:XoopsImageBrowser('" . $inputname . "');\" />\n";
309  }
310  return $html;
311 }
312 ?>