Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
insert_image.php
1 <?php
26 require_once dirname(__FILE__).'/../../../../core/include/init.inc';
27 require_once SQ_LIB_PATH.'/html_form/html_form.inc';
28 
29 if (empty($GLOBALS['SQ_SYSTEM']->user) || !($GLOBALS['SQ_SYSTEM']->user->canAccessBackend() || $GLOBALS['SQ_SYSTEM']->user->type() == 'simple_edit_user')){
30  exit;
31 }
32 
33 $url_protocol_options = Array(
34  '' => '',
35  'http://' => 'http://',
36  'https://' => 'https://',
37  );
38 
39 if (!isset($_GET['f_imageid'])) $_GET['f_imageid'] = 0;
40 ?>
41 
42 <html style="width: 800px; height: 600px;">
43  <head>
44  <title>Insert Image</title>
45 
46  <?php
47  //add required js translation files, as we are using asset finder
48  $include_list = Array(sq_web_path('lib').'/js/translation.js');
49 
50  $locales = $GLOBALS['SQ_SYSTEM']->lm->getCumulativeLocaleParts($GLOBALS['SQ_SYSTEM']->lm->getCurrentLocale());
51 
52  foreach ($locales as $locale) {
53  if (file_exists(SQ_DATA_PATH.'/public/system/core/js_strings.'.$locale.'.js')) {
54  $include_list[] = sq_web_path('data').'/system/core/js_strings.'.$locale.'.js';
55  }
56  }
57 
58  foreach ($include_list as $link) {
59  ?><script type="text/javascript" src="<?php echo $link; ?>"></script>
60  <?php
61  }
62  ?>
63  <script type="text/javascript" src="../../core/popup.js"></script>
64  <script type="text/javascript" src="<?php echo sq_web_path('lib').'/asset_map/javaExternalCall.js' ?>"></script>
65  <script type="text/javascript" src="<?php echo sq_web_path('fudge').'/var_serialise/var_serialise.js' ?>"></script>
66  <script type="text/javascript" src="<?php echo sq_web_path('lib').'/html_form/html_form.js' ?>"></script>
67  <script type="text/javascript" src="<?php echo sq_web_path('lib').'/js/JsHttpConnector.js' ?>"></script>
68  <script type="text/javascript" src="<?php echo sq_web_path('lib').'/js/general.js' ?>"></script>
69  <script type="text/javascript" src="<?php echo sq_web_path('lib').'/js/tooltip.js' ?>"></script>
70 
71  <script type="text/javascript">
72 
73  function getFocus() {
74  setTimeout('self.focus()',100);
75  };
76 
77  function Init() {
78  __dlg_init("matrixInsertImage");
79  if (document.getElementById("f_imageid[assetid]").value != 0) {
80  newImg(document.getElementById('image_container'), '<?php echo sq_web_path('root_url'); ?>' + '/?a=' + document.getElementById("f_imageid[assetid]").value, document.getElementById('f_width').value, document.getElementById('f_height').value);
81  }
82  };
83 
84  function onOK() {
85  document.getElementById('main-form').action = "";
86  document.getElementById('main-form').method = "get";
87  if (navigator.appName == "Microsoft Internet Explorer") {
88  // Hack for IE, Files don't get uploaded unless this is set a very special way
89  // ie. don't set it here !?!
90  } else {
91  document.getElementById('main-form').enctype = "";
92  }
93  document.getElementById('main-form').target = "";
94  var required = {
95  "f_alt": "Please enter the alternate text"
96  };
97  for (var i in required) {
98  var el = document.getElementById(i);
99  if (!el.value) {
100  alert(required[i]);
101  el.focus();
102  return false;
103  }
104  }
105  // pass data back to the calling window
106  var fields = ["f_alt", "f_title", "f_align", "f_border", "f_image_class", "f_image_id",
107  "f_horiz", "f_vert", "f_width", "f_height"];
108  var param = new Object();
109  for (var i in fields) {
110  var id = fields[i];
111  var el = document.getElementById(id);
112  param[id] = el.value;
113  }
114 
115  // Because the id of the f_image field has array references in it,
116  // we can't get use getElementById, so do this...
117  param["f_imageid"] = document.main_form.elements["f_imageid[assetid]"].value;
118 
119  // Optional Long Description
120  if (document.main_form.elements["f_longdesc[assetid]"].value != "" && document.main_form.elements["f_longdesc[assetid]"].value != "0") {
121  param["f_longdesc"] = document.main_form.elements["f_longdesc[assetid]"].value;
122  } else {
123  param["f_longdesc"] = document.main_form.elements["f_longdesc_protocol"].value + document.main_form.elements["f_longdesc_link"].value;
124  }
125 
126  __dlg_close("matrixInsertImage", param);
127  return false;
128  };
129 
130  function onCancel() {
131  __dlg_close("matrixInsertImage", null);
132  return false;
133  };
134 
135  function populateImageInfo(responseText) {
136  var imageInfo = var_unserialise(responseText);
137 
138  // generate the alt text from the file name if they have not set it
139  // for the image asset
140  if (imageInfo['alt'] == '') {
141  var path = imageInfo['name'];
142  ext = "";
143  i = path.length;
144  while (ext.charAt(0) != "." && i > 0) ext = path.substring(i--);
145  imageInfo['alt'] = path.substring(0, ++i);
146  }
147  document.getElementById("f_alt").value = imageInfo['alt'];
148  document.getElementById("f_width").value = imageInfo['width'];
149  document.getElementById("f_height").value = imageInfo['height'];
150  newImg(document.getElementById('image_container'), '<?php echo sq_web_path('root_url'); ?>' + '/?a=' + document.getElementById("f_imageid[assetid]").value, imageInfo['width'], imageInfo['height']);
151  };
152 
153  function setImageInfo() {
154  // put a random no in the url to overcome any caching
155  var assetid = document.getElementById("f_imageid[assetid]").value;
156 
157  var url = '<?php echo sq_web_path('root_url').'/'.SQ_CONF_LIMBO_SUFFIX; ?>/?SQ_BACKEND_PAGE=main&backend_section=am&am_section=edit_asset&assetid=' + escape(assetid) + '&asset_ei_screen=image_info&ignore_frames=1&t=' + Math.random() * 1000;
158 
159  JsHttpConnector.submitRequest(url, populateImageInfo);
160  };
161 
162  function doStatus(img) {
163  //on Image Load
164  }
165 
166  function newImg(div, url, width, height) {
167  var limit = 160.0;
168  var scalar = 1.0;
169  // convert width and height into a float format
170  width = parseFloat(width);
171  height = parseFloat(height);
172  var img = document.getElementById('preview_image');
173  img.height = 0;
174  img.width = 0;
175  img.src = url;
176 
177  img.onload = function() { doStatus()};
178 
179  if( width > limit || height > limit) {
180  if (width > height) {
181  scalar = limit / width;
182  } else {
183  scalar = limit / height;
184  }
185  }
186 
187  img.width = parseInt(Math.ceil(width * scalar));
188  img.height = parseInt(Math.ceil(height * scalar));
189 
190  div.appendChild(img);
191 
192  }
193 
194 
195  function setImagePreview() {
196  if (document.getElementById("f_imageid[assetid]").value == "" || document.getElementById("f_imageid[assetid]").value == 0) {
197  return;
198  }
199  newImg(document.getElementById('image_container'), '<?php echo sq_web_path('root_url'); ?>' + '/?a=' + document.getElementById("f_imageid[assetid]").value);
200  }
201 
202  function toggleCreateImage() {
203  changeButton = document.getElementById('show_create_button');
204  changeDivElements = ["show_create_image_label1", "show_create_image1", "show_create_image_label2", "show_create_image2", "show_create_image_submit"];
205  //document.getElementById('show_create_image');
206  errorDiv = document.getElementById('show_upload_error');
207  if (changeButton.style.display == "block") {
208  for (i in changeDivElements) {
209  var changeDiv = document.getElementById(changeDivElements[i]);
210  changeDiv.style.visibility = "visible";
211  changeDiv.style.display = "block";
212  }
213  changeButton.style.visibility = "hidden";
214  changeButton.style.display = "none";
215  } else {
216  for (i in changeDivElements) {
217  var changeDiv = document.getElementById(changeDivElements[i]);
218  changeDiv.style.visibility = "hidden";
219  changeDiv.style.display = "none";
220  }
221  errorDiv.style.visibility = "hidden";
222  errorDiv.style.display = "none";
223  changeButton.style.visibility = "visible";
224  changeButton.style.display = "block";
225  }
226  }
227 
228  function submitCreateImage() {
229  document.getElementById('main-form').action = "upload_image.php";
230  document.getElementById('main-form').method = "post";
231  if (navigator.appName == "Microsoft Internet Explorer") {
232  // Hack for IE, Files don't get uploaded unless this is set a very special way
233  var encType = document.getElementById('main-form').getAttributeNode("enctype");
234  encType.value = "multipart/form-data";
235  } else {
236  document.getElementById('main-form').enctype = "multipart/form-data";
237  }
238  document.getElementById('main-form').target = "create_image_frame";
239  }
240 
241  </script>
242 
243  <style type="text/css">
244  html, body {
245  background: #FCFCFC;
246  color: #000000;
247  font: 11px Tahoma,Verdana,sans-serif;
248  margin: 0px;
249  padding: 0px;
250  }
251 
252  table {
253  font: 11px Tahoma,Verdana,sans-serif;
254  }
255 
256  form#main-form {
257  padding: 5px;
258  clear: right;
259  }
260 
261  #quick-search {
262  font: 11px Tahoma,Verdana,sans-serif;
263  letter-spacing: 0;
264  float: right;
265  padding-right: 12px;
266  }
267 
268  #quick-search #quick-search-for {
269  font: 11px Arial,Verdana,sans-serif;
270  border: 1px solid black;
271  padding: 1px 3px;
272  }
273 
274  #quick-search #quick-search-for-label {
275  font: 11px Arial,Verdana,sans-serif;
276  color: #999;
277  }
278 
279 
280  /* main popup title */
281  .title {
282  background: #402F48;
283  color: #FFFFFF;
284  font-weight: bold;
285  font-size: 120%;
286  padding: 6px 10px;
287  margin-bottom: 10px;
288  border-bottom: 1px solid black;
289  letter-spacing: 4px;
290  }
291 
292  /* fieldset styles */
293  fieldset {
294  padding: 0px 10px 5px 5px;
295  border-color: #725B7D;
296  }
297 
298  .prev {
299  padding: 0px 10px 5px 5px;
300  border-color: #725B7D;
301  margin-right: 3px;
302  height: 200px;
303  }
304 
305  .fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
306  .fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }
307 
308  /* form and form fields */
309  form { padding: 0px; margin: 0px; }
310 
311  select, input, button {
312  font: 11px Tahoma,Verdana,sans-serif;
313  }
314 
315  button {
316  width: 70px;
317  }
318 
319  /* colour picker button styles */
320  .buttonColor, .buttonColor-hilite {
321  cursor: default;
322  border: 1px solid;
323  border-color: #9E86AA #725B7D #725B7D #9E86AA;
324  }
325 
326  .buttonColor-hilite {
327  border-color: #402F48;
328  }
329 
330  .buttonColor-chooser, .buttonColor-nocolor, .buttonColor-nocolor-hilite {
331  height: 0.6em;
332  border: 1px solid;
333  padding: 0px 1em;
334  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
335  }
336 
337  .preview {
338  height: 120px;
339  width: 160px;
340  }
341 
342  .buttonColor-nocolor, .buttonColor-nocolor-hilite { padding: 0px; }
343  .buttonColor-nocolor-hilite { background: #402F48; color: #FFFFFF; }
344 
345  /* Popup styles (for backend search feature) */
346 
347  #new-message-popup, #search-wait-popup {
348  position: absolute;
349  right: 10px;
350  top: 0;
351  width: 300px;
352  background-color: white;
353  border: 2px solid black;
354  font: normal 10px Arial,Verdana,sans-serif;
355  display: none;
356  }
357 
358  #new-message-popup-titlebar, #search-wait-popup-titlebar {
359  font-weight: bold;
360  padding: 5px;
361  }
362 
363  #new-message-popup-close, #search-wait-popup-close {
364  float: right;
365  }
366 
367  #new-message-popup-close a, #search-wait-popup-close a {
368  color: black;
369  text-decoration: none;
370  }
371 
372  #new-message-popup-details, #search-wait-popup-details {
373  padding: 5px;
374  }
375 
376  div.search-result {
377  padding: 0;
378  margin: 5px;
379  }
380 
381  div.search-result-blurb {
382  padding: 0;
383  margin: 5px;
384  font-weight: bold;
385  }
386 
387  div.search-result-pager {
388  padding: 0;
389  margin: 5px;
390  text-align: center;
391  }
392 
393  div.search-result-detail {
394  padding: 0;
395  padding-left: 15px;
396  margin: 5px;
397  display: none;
398  }
399 
400  a.search-result-expand-link {
401  text-decoration: none;
402  top: 0px;
403  left: 0px;
404  height: 10px;
405  font-size: 14px;
406  margin-top: 0px;
407  font-weight: bold;
408  text-decoration: none;
409  color: #33B9E6;
410  }
411 
412  .search-result-expand-div {
413  float: left;
414  width: 22px;
415  font-weight: bold;
416  background-color: white;
417  white-space: nowrap;
418  }
419 
420  .search-result-entry {
421  margin-top: 5px;
422  text-indent: -38px;
423  padding-left: 50px;
424  }
425 
426  .sq-backend-search-failed-table {
427  border: 2px solid #594165;
428  border-collapse: collapse;
429  background-color: #ECECEC;
430  }
431 
432  .sq-backend-search-failed-heading, .sq-backend-search-failed-body {
433  color: #342939;
434  background-color: #ececec;
435  font-family: Arial, Verdana, Helvetica, sans-serif;
436  font-size: 10px;
437  vertical-align: top;
438  padding: 5px;
439  text-decoration: none;
440  font-weight: bold;
441  }
442 
443  .sq-backend-search-failed-body {
444  color: #342939;
445  font-weight: normal;
446  }
447 
448  .sq-backend-search-results-table {
449  border: 2px solid #594165;
450  border-collapse: collapse;
451  background-color: #ECECEC;
452  }
453 
454  .sq-backend-search-results-heading, .sq-backend-search-results-body {
455  color: #342939;
456  background-color: #FFFFFF;
457  font-family: Arial, Verdana, Helvetica, sans-serif;
458  font-size: 10px;
459  vertical-align: top;
460  padding: 5px;
461  text-decoration: none;
462  font-weight: bold;
463  }
464 
465  .sq-backend-search-results-heading {
466  background-color: #F0F0E6;
467  }
468 
469  .sq-backend-search-results-highlight {
470  background-color: yellow;
471  }
472 
473  .sq-backend-search-results-body {
474  color: #342939;
475  font-weight: normal;
476  }
477  </style>
478  </head>
479 
480  <body onload="Init();" onUnload="asset_finder_onunload();">
481 
482  <form action="" method="get" name="main_form" id="main-form">
483  <?php
484  // insert nonce secuirty token.
485  if( $GLOBALS['SQ_SYSTEM']->user && !($GLOBALS['SQ_SYSTEM']->user instanceof Public_User))
486  hidden_field('token', get_unique_token());
487  ?>
488  <table width="100%">
489  <tr>
490  <td valign="top">
491  <?php
492  include_once(SQ_LIB_PATH.'/asset_map/asset_map.inc');
493  $asset_map = new Asset_Map();
494  $asset_map->embedAssetMap('simple', 200, 350);
495  ?>
496  </td>
497  <td valign="top">
498  <table cellspacing="0" cellpadding="0">
499  <tr>
500  <td valign="top" width="100%" colspan=2>
501  <fieldset>
502  <legend><b><?php echo translate('general'); ?></b></legend>
503  <table style="width:100%">
504  <tr>
505  <td class="label" nowrap="nowrap"><?php echo translate('image_url'); ?>:</td>
506  <td>
507  <?php asset_finder('f_imageid', (assert_valid_assetid($_GET['f_imageid'], '', TRUE, FALSE) ? $_GET['f_imageid'] : 0), Array('image' => 'D', 'image_variety' => 'D'), '', false, 'setImageInfo'); ?>
508  </td>
509  </tr>
510  <tr>
511  <td class="label" nowrap="nowrap"><?php echo translate('alternate_text'); ?>:</td>
512  <td>
513  <input type="text" name="alt" id="f_alt" style="width:100%" title="For browsers that don't support images" value="<?php echo htmlspecialchars($_REQUEST['f_alt']) ?>" />
514  </td>
515  </tr>
516  <tr>
517  <td class="label" nowrap="nowrap"><?php echo translate('title_text'); ?>:</td>
518  <td>
519  <input type="text" name="title" id="f_title" style="width:100%" title="Your Image Title" value="<?php echo htmlspecialchars($_REQUEST['f_title']) ?>" />
520  </td>
521  </tr>
522  <tr>
523  <td colspan="2">
524  <div align="center" id="show_create_button" style="display: block; visibility: visible;">
525  <input type="button" name="show" value="Create Image" onclick="toggleCreateImage();" />
526  </div>
527  </td>
528  </tr>
529  <tr>
530  <td colspan="2">
531  <div id="show_upload_error" style="background:#cc0000;color:#ffffff;display:none; visibility:hidden;padding:0.1cm;">
532  </div>
533  </td>
534  </tr>
535  <tr>
536  <td><div id="show_create_image_label1" style="display: none; visibility: hidden;">Create an image:</div></td>
537  <td><div id="show_create_image1" style="display: none; visibility: hidden;"><input name="create_image_upload" id="create_image_upload" type="file" /></div></td>
538  </tr>
539  <tr>
540  <td><div id="show_create_image_label2" style="display: none; visibility: hidden;">Create under:</div></td>
541  <td><div id="show_create_image2" style="display: none; visibility: hidden;"><?php asset_finder('f_create_root_node', '0', Array(), ''); ?></div></td>
542  </tr>
543  <tr>
544  <td align="center" colspan="2"><div id="show_create_image_submit" style="display: none; visibility: hidden;"><input type="submit" name="create_image_submit" value="Create &amp; Use Image" onclick="submitCreateImage();" /><input type="button" name="cancel_create_image" value="Cancel" onclick="toggleCreateImage();" /></div></td>
545  </tr>
546  </div>
547  <tr>
548  <td colspan="2">
549  <div id="create_image_frame_div" style="display:none;visibility:hidden;">
550  <iframe id="create_image_frame" name="create_image_frame" src=""></iframe>
551  </div>
552  </td>
553  </tr>
554  </table>
555  </fieldset>
556  </td>
557  </tr>
558  <tr>
559  <td valign="top" width="100%" colspan=2>
560  <fieldset>
561  <legend><b><?php echo translate('optional_attributes'); ?></b></legend>
562  <table style="width:100%">
563  <tr>
564  <td valign="top" class="label" nowrap="nowrap"><?php echo translate('longdesc_text'); ?>:</td>
565  <td>
566  <?php
567  if (!empty($_GET['f_longdesc'])) {
568  if (preg_match("/^\d+$/", $_GET['f_longdesc']) && $_GET['f_longdesc'] != "0") {?>
569  Enter URL manually<br />
570  <?php echo translate('protocol'); ?>&nbsp;<?php combo_box('f_longdesc_protocol', $url_protocol_options, '', 'style="font-family: courier new; font-size: 11px;"'); ?>
571  <?php echo translate('link'); ?>&nbsp;<?php text_box('f_longdesc_link', '', 40, 0)?>
572  <br /><br />or choose a Standard Page asset<br />
573  <?php asset_finder('f_longdesc', $_GET['f_longdesc'], Array('page_standard' => 'D'), ''); ?>
574  <br /><br />If you enter URL manually, current asset in the asset finder must be cleared .<br />
575  <?php
576  } else {
577  $matches = Array();
578  if (preg_match_all('/^(http:\/\/|https:\/\/){1}(.*)$/', $_GET['f_longdesc'], $matches) === FALSE ||
579  empty($matches[0])) {?>
580  Enter URL manually<br />
581  <?php echo translate('protocol'); ?>&nbsp;<?php combo_box('f_longdesc_protocol', $url_protocol_options, FALSE, '', 'style="font-family: courier new; font-size: 11px;"'); ?>
582  <?php echo translate('link'); ?>&nbsp;<?php text_box('f_longdesc_link', $_GET['f_longdesc'], 40, 0)?>
583  <br /><br />or choose a Standard Page asset<br />
584  <?php asset_finder('f_longdesc', '0', Array('page_standard' => 'D'), ''); ?>
585  <?php
586  } else {?>
587  Enter URL manually<br />
588  <?php echo translate('protocol'); ?>&nbsp;<?php combo_box('f_longdesc_protocol', $url_protocol_options, FALSE, $matches[1][0], 'style="font-family: courier new; font-size: 11px;"'); ?>
589  <?php echo translate('link'); ?>&nbsp;<?php text_box('f_longdesc_link', $matches[2][0], 40, 0)?>
590  <br /><br />or choose a Standard Page asset<br />
591  <?php asset_finder('f_longdesc', '0', Array('page_standard' => 'D'), ''); ?>
592  <?php
593  }
594 
595  }
596  } else {?>
597  Enter URL manually<br />
598  <?php echo translate('protocol'); ?>&nbsp;<?php combo_box('f_longdesc_protocol', $url_protocol_options, '', 'style="font-family: courier new; font-size: 11px;"'); ?>
599  <?php echo translate('link'); ?>&nbsp;<?php text_box('f_longdesc_link', '', 40, 0)?>
600  <br /><br />or choose a Standard Page asset<br />
601  <?php asset_finder('f_longdesc', '0', Array('page_standard' => 'D'), ''); ?>
602  <?php
603  }?>
604  <br /><br />If you enter URL manually, current asset in the asset finder must be cleared .<br />
605  </td>
606  </tr>
607  </table>
608  </fieldset>
609  </tr>
610  <tr>
611  <td valign="center" align="center" rowspan=2 width="50%">
612  <fieldset class="prev">
613  <legend><b><?php echo translate('preview'); ?></b></legend>
614  <table class="preview" >
615  <tr>
616  <td id="image_container" align="center" valign="center" height="160px" width="340px">
617  <img id="preview_image" src="<?php echo sq_web_path('fudge') ?>/wysiwyg/images/blank.gif" width="0" height="0">
618  </td>
619  </tr>
620  </table>
621  </fieldset>
622  </td>
623  <td valign="top" width="50%">
624  <fieldset>
625  <legend><b><?php echo translate('layout'); ?></b></legend>
626  <table>
627  <tr>
628  <td class="label" width="30%"><?php echo translate('alignment'); ?>:</td>
629  <td>
630  <select size="1" name="align" id="f_align" title="<?php echo translate('positioning_of_this_image'); ?>">
631  <?php
632  if (!isset($_REQUEST['f_align'])) {
633  $_REQUEST['f_align'] = 'baseline';
634  }
635  $options_array = Array(
636  '' => 'Not set',
637  'left' => translate('left'),
638  'right' => translate('right'),
639  'texttop' => translate('texttop'),
640  'absmiddle' => translate('absmiddle'),
641  'baseline' => translate('baseline'),
642  'absbottom' => translate('absbottom'),
643  'bottom' => translate('bottom'),
644  'middle' => translate('middle'),
645  'top' => translate('top'),
646  );
647  foreach ($options_array as $value => $text) {
648  ?><option value="<?php echo $value?>" <?php echo ($_REQUEST['f_align'] == $value) ? 'selected="1"' : ''?>><?php echo $text?></option><?php
649  }
650  ?>
651  </select>
652  </td>
653  </tr>
654  <tr>
655  <td class="label"><?php echo translate('border_thickness'); ?>:</td>
656  <td>
657  <input type="text" name="border" id="f_border" size="5" title="Leave empty for no border" value="<?php echo htmlspecialchars($_REQUEST['f_border']) ?>" />
658  </td>
659  </tr>
660  <tr>
661  <td class="label"><?php echo translate('horizontal'); ?>:</td>
662  <td>
663  <input type="text" name="horiz" id="f_horiz" size="5" title="Horizontal padding" value="<?php echo htmlspecialchars($_REQUEST['f_horiz']) ?>" />
664  </td>
665  </tr>
666  <tr>
667  <td class="label"><?php echo translate('vertical'); ?>:</td>
668  <td>
669  <input type="text" name="vert" id="f_vert" size="5" title="Vertical padding" value="<?php echo htmlspecialchars($_REQUEST['f_vert']) ?>" />
670  </td>
671  </tr>
672  <tr>
673  <td class="label"><?php echo translate('name'); ?>:</td>
674  <td>
675  <input type="text" name="image_id" id="f_image_id" size="20" title="Name" value="<?php echo htmlspecialchars($_REQUEST['f_image_id']) ?>" />
676  </td>
677  </tr>
678  <tr>
679  <td class="label"><?php echo translate('class'); ?>:</td>
680  <td>
681  <input type="text" name="image_class" id="f_image_class" size="20" title="Class" value="<?php echo htmlspecialchars($_REQUEST['f_image_class']) ?>" />
682  </td>
683  </tr>
684  </table>
685  </fieldset>
686  </td>
687  </tr>
688  <tr>
689  <td valign="top" width="50%">
690  <fieldset>
691  <legend><b><?php echo translate('size'); ?></b></legend>
692  <table style="width:100%">
693  <tr>
694  <?php
695  $disable_resize = $GLOBALS['SQ_SYSTEM']->getUserPrefs('content_type_wysiwyg', 'SQ_WYSIWYG_DISABLE_IMAGE_RESIZE');
696  ?>
697  <td class="label" width="30%"><?php echo translate('width'); ?>:</td>
698  <td>
699  <?php
700  switch ($disable_resize) {
701  case 'yes':
702  echo htmlspecialchars($_REQUEST['f_width']).'&nbsp;px';
703  ?>
704  <input type="hidden" name="width" id="f_width" size="5" title="Width" value="<?php echo htmlspecialchars($_REQUEST['f_width']) ?>" />
705  <?php
706  break;
707  case 'no':
708  ?>
709  <input type="text" name="width" id="f_width" size="5" title="Width" value="<?php echo htmlspecialchars($_REQUEST['f_width']) ?>" />&nbsp;px
710  <?php
711  break;
712  }
713  ?>
714  </td>
715  </tr>
716  <tr>
717  <td class="label"><?php echo translate('height'); ?>:</td>
718  <td>
719  <?php
720  switch ($disable_resize) {
721  case 'yes':
722  echo htmlspecialchars($_REQUEST['f_height']).'&nbsp;px';
723  ?>
724  <input type="hidden" name="height" id="f_height" size="5" title="Height" value="<?php echo htmlspecialchars($_REQUEST['f_height']) ?>" />
725  <?php
726  break;
727  case 'no':
728  ?>
729  <input type="text" name="height" id="f_height" size="5" title="Height" value="<?php echo htmlspecialchars($_REQUEST['f_height']) ?>" />&nbsp;px
730  <?php
731  break;
732  }
733  ?>
734  </td>
735  </tr>
736  </table>
737  </fieldset>
738  </td>
739  </tr>
740  <tr>
741  <td colspan=2>
742  <div style="margin-top: 5px; text-align: right;">
743  <hr />
744  <button type="button" name="ok" onclick="return onOK();"><?php echo translate('ok'); ?></button>
745  <button type="button" name="cancel" onclick="return onCancel();"><?php echo translate('cancel'); ?></button>
746  </div>
747  </td>
748  </tr>
749  </table>
750  </td>
751  </tr>
752  </table>
753  </form>
754 
755  <!-- Search results -->
756  <div id="new-message-popup"><div id="new-message-popup-titlebar"><div id="new-message-popup-close">[ <a href="#" onclick="document.getElementById('new-message-popup').style.display = 'none'; return false;">x</a> ]</div><span id="new-message-popup-title">Searched for ''</span></div>
757  <div id="new-message-popup-details"></div>
758  </div>
759  <div id="search-wait-popup"><div id="search-wait-popup-titlebar"><div id="search-wait-popup-close">[ <a href="#" onclick="document.getElementById('search-wait-popup').style.display = 'none'; return false;">x</a> ]</div><span id="search-wait-popup-title">Search in Progress</span></div>
760  <div id="search-wait-popup-details">Your search is being processed, please wait...</div>
761  </div>
762 
763  <script type="text/javascript"><!--
764  var current = 1;
765  var results_per_page = <?php echo $GLOBALS['SQ_SYSTEM']->getUserPrefs('search_manager', 'SQ_SEARCH_BACKEND_PAGE_SIZE') !== FALSE ? $GLOBALS['SQ_SYSTEM']->getUserPrefs('search_manager', 'SQ_SEARCH_BACKEND_PAGE_SIZE') : 5; ?>;
766  var total_results = 0;
767 
768  function jump_to_search_results(page) {
769  // Show the correct page
770  document.getElementById("search-result-page-" + current).style.display = 'none';
771  document.getElementById("search-result-page-" + page).style.display = 'block';
772 
773  // Update page start and end markers
774  document.getElementById("sq-search-results-page-start").innerHTML = (results_per_page * (page - 1)) + 1;
775  document.getElementById("sq-search-results-page-end").innerHTML = Math.min(total_results, results_per_page * page);
776 
777  for (i = ((page - 1) * results_per_page) + 1; i <= Math.min(total_results, page * results_per_page); i++) {
778  // collapse the new page when page is switched, so they're
779  // back to just the tag lines
780  document.getElementById("search-result-" + i + "-expand-link").innerHTML = '+';
781  document.getElementById("search-result-" + i + "-detail").style.display = 'none';
782  }
783 
784  current = page;
785  }
786 
787  function set_asset_finder_from_search(assetid, label, url, linkid, filename, alt, width, height) {
788  document.cookie = 'lastSelectedAssetId=' + escape(assetid);
789 
790  ASSET_FINDER_OBJ.set_hidden_field('f_imageid[assetid]', assetid);
791  ASSET_FINDER_OBJ.set_hidden_field('f_imageid[url]', url);
792  ASSET_FINDER_OBJ.set_hidden_field('f_imageid[linkid]', linkid);
793  ASSET_FINDER_OBJ.set_text_field('sq_asset_finder_f_imageid_label', (assetid == 0) ? '' : label + ' (Id : #' + assetid + ')');
794 
795  document.getElementById("new-message-popup").style.display = 'none';
796  document.getElementById("f_alt").value = alt;
797 
798  image_info = new Array();
799  image_info['name'] = filename;
800  image_info['alt'] = alt;
801  image_info['width'] = width;
802  image_info['height'] = height;
803 
804  image_info_ser = var_serialise(image_info);
805  populateImageInfo(image_info_ser);
806  //setUrl('', './?a=' + assetid);
807  }
808 
809  // --></script>
810  </body>
811 </html>