[ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 3 /** 4 * $Horde: horde/services/editor/htmlarea/plugins/AnselImage/insert_image.php,v 1.5.6.5 2005/10/18 11:34:02 jan Exp $ 5 */ 6 7 // Check for a prior definition of HORDE_BASE (perhaps by an auto_prepend_file 8 // definition for site customization). 9 if (!defined('HORDE_BASE')) { 10 @define('HORDE_BASE', dirname(__FILE__) . '/../../../../..'); 11 } 12 13 // Load the Horde Framework core, and set up inclusion paths. 14 require_once HORDE_BASE . '/lib/core.php'; 15 16 // Registry 17 $registry = &Registry::singleton(); 18 19 /* Determine how we were called; with a URL, or with a gallery id */ 20 $gallerylist = $registry->call('images/listGalleries', array(null)); 21 $gallery_id = Util::getFormData('gallery', key($gallerylist)); 22 $imagelist = $registry->call('images/listImages', array(null, $gallery_id, PERMS_SHOW, 'screen', true)); 23 $first_image = count($imagelist) ? $imagelist[key($imagelist)]['url'] : ''; 24 25 ?> 26 <html> 27 28 <head> 29 <title>Insert Image</title> 30 31 <script type="text/javascript" src="../../popups/popup.js"></script> 32 33 <script type="text/javascript"> 34 35 window.resizeTo(400, 200); 36 37 function Init() { 38 __dlg_init(); 39 var param = window.dialogArguments; 40 if (param) { 41 document.getElementById("f_url").value = param["f_url"]; 42 document.getElementById("f_alt").value = param["f_alt"]; 43 document.getElementById("f_border").value = param["f_border"]; 44 document.getElementById("f_align").value = param["f_align"]; 45 document.getElementById("f_vert").value = param["f_vert"]; 46 document.getElementById("f_horiz").value = param["f_horiz"]; 47 window.ipreview.location.replace(param.f_url); 48 } 49 document.getElementById("f_url").focus(); 50 }; 51 52 function onOK() { 53 var required = { 54 "f_url": "You must enter the URL" 55 }; 56 for (var i in required) { 57 var el = document.getElementById(i); 58 if (!el.value) { 59 alert(required[i]); 60 el.focus(); 61 return false; 62 } 63 } 64 // pass data back to the calling window 65 var fields = ["f_url", "f_alt", "f_align", "f_border", 66 "f_horiz", "f_vert"]; 67 var param = new Object(); 68 for (var i in fields) { 69 var id = fields[i]; 70 var el = document.getElementById(id); 71 param[id] = el.value; 72 } 73 __dlg_close(param); 74 return false; 75 }; 76 77 function onCancel() { 78 __dlg_close(null); 79 return false; 80 }; 81 82 function onPreview() { 83 var f_url = document.getElementById("f_url"); 84 var url = f_url.value; 85 if (!url) { 86 alert("You have to enter an URL first"); 87 f_url.focus(); 88 return false; 89 } 90 window.ipreview.location.replace('showimage.html?' + url); 91 return false; 92 }; 93 94 function changeGallery() { 95 var reload_url = document.location.href; 96 97 reload_url = reload_url.substring(0,reload_url.lastIndexOf('?')); 98 reload_url = reload_url + '?gallery=' + document.forms[0].gallery.value; 99 100 document.location.replace(reload_url); 101 } 102 </script> 103 104 <style type="text/css"> 105 html, body { 106 background: ButtonFace; 107 color: ButtonText; 108 font: 11px Tahoma,Verdana,sans-serif; 109 margin: 0px; 110 padding: 0px; 111 } 112 body { padding: 5px; } 113 table { 114 font: 11px Tahoma,Verdana,sans-serif; 115 } 116 form p { 117 margin-top: 5px; 118 margin-bottom: 5px; 119 } 120 .fl { width: 9em; float: left; padding: 2px 5px; text-align: right; } 121 .fr { width: 6em; float: left; padding: 2px 5px; text-align: right; } 122 fieldset { padding: 0px 10px 5px 5px; } 123 select, input, button { font: 11px Tahoma,Verdana,sans-serif; } 124 button { width: 70px; } 125 .space { padding: 2px; } 126 127 .title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px; 128 border-bottom: 1px solid black; letter-spacing: 2px; 129 } 130 form { padding: 0px; margin: 0px; } 131 </style> 132 133 </head> 134 135 <body onload="Init()"> 136 137 <div class="title">Insert Image</div> 138 <!--- new stuff ---> 139 <form action="" method="get"> 140 <table border="0" width="100%" style="padding: 0px; margin: 0px"> 141 <tbody> 142 <tr> 143 <td style="width: 7em; text-align: right">Gallery:</td> 144 <td><select size="1" name="gallery" id="f_gallery" title="Gallery to take image from" onChange="changeGallery();"> 145 <?php foreach ($gallerylist as $gallery): ?> 146 <option value="<?php echo htmlspecialchars($gallery->getID()) ?>"<?php if ($gallery_id == $gallery->getId()) echo ' selected="selected"' ?>><?php echo str_repeat(' ', 2 * $gallery->getLevel()) . htmlspecialchars($gallery->get('name')) ?></option> 147 <?php endforeach; ?> 148 </select> 149 </td> 150 </tr> 151 <tr> 152 <td style="width: 7em; text-align: right">Image from gallery:</td> 153 <td><select size="1" name="img_gallery" id="f_img_gallery" title="Image from gallery" onChange="document.forms[0].url.value = document.forms[0].img_gallery.value"> 154 <?php foreach ($imagelist as $id => $image): ?> 155 <option value="<?php echo $image['url'] ?>"><?php echo $image['name'] ?></option> 156 <?php endforeach; ?> 157 </select> 158 </td> 159 </tr> 160 161 <tr> 162 <td style="width: 7em; text-align: right">Image URL:</td> 163 <td><input type="text" name="url" id="f_url" style="width:75%" 164 title="Enter the image URL here" value="<?php echo $first_image ?>" /> 165 <button name="preview" onclick="return onPreview();" 166 title="Preview the image in a new window">Preview</button> 167 </td> 168 </tr> 169 <tr> 170 <td style="width: 7em; text-align: right">Alternate text:</td> 171 <td><input type="text" name="alt" id="f_alt" style="width:100%" 172 title="For browsers that don't support images" /></td> 173 </tr> 174 175 </tbody> 176 </table> 177 178 <p /> 179 180 <fieldset style="float: left; margin-left: 5px;"> 181 <legend>Layout</legend> 182 183 <div class="space"></div> 184 185 <div class="fl">Alignment:</div> 186 <select size="1" name="align" id="f_align" 187 title="Positioning of this image"> 188 <option value="" >Not set</option> 189 <option value="left" >Left</option> 190 <option value="right" >Right</option> 191 <option value="texttop" >Texttop</option> 192 <option value="absmiddle" >Absmiddle</option> 193 <option value="baseline" selected="1" >Baseline</option> 194 <option value="absbottom" >Absbottom</option> 195 <option value="bottom" >Bottom</option> 196 <option value="middle" >Middle</option> 197 <option value="top" >Top</option> 198 </select> 199 200 <p /> 201 202 <div class="fl">Border thickness:</div> 203 <input type="text" name="border" id="f_border" size="5" 204 title="Leave empty for no border" /> 205 206 <div class="space"></div> 207 208 </fieldset> 209 210 <fieldset style="float:right; margin-right: 5px;"> 211 <legend>Spacing</legend> 212 213 <div class="space"></div> 214 215 <div class="fr">Horizontal:</div> 216 <input type="text" name="horiz" id="f_horiz" size="5" 217 title="Horizontal padding" /> 218 219 <p /> 220 221 <div class="fr">Vertical:</div> 222 <input type="text" name="vert" id="f_vert" size="5" 223 title="Vertical padding" /> 224 225 <div class="space"></div> 226 227 </fieldset> 228 <br clear="all" /> 229 <table width="100%" style="margin-bottom: 0.2em"> 230 <tr> 231 <td valign="bottom"> 232 Image Preview:<br /> 233 <iframe name="ipreview" id="ipreview" frameborder="0" style="border : 1px solid gray;" height="200" width="300" src=""></iframe> 234 </td> 235 <td valign="bottom" style="text-align: right"> 236 <button type="button" name="ok" onclick="return onOK();">OK</button><br> 237 <button type="button" name="cancel" onclick="return onCancel();">Cancel</button> 238 </td> 239 </tr> 240 </table> 241 </form> 242 </body> 243 </html>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |