Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
embed_movie.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 if (!isset($_GET['f_fileid'])) $_GET['f_fileid'] = 0;
34 ?>
35 
36 <html style="width: 740px; height: 500px;">
37  <head>
38  <title>Embed Movie</title>
39 
40  <?php
41  //add required js translation files, as we are using asset finder
42  $include_list = Array(sq_web_path('lib').'/js/translation.js');
43 
44  $locales = $GLOBALS['SQ_SYSTEM']->lm->getCumulativeLocaleParts($GLOBALS['SQ_SYSTEM']->lm->getCurrentLocale());
45 
46  foreach ($locales as $locale) {
47  if (file_exists(SQ_DATA_PATH.'/public/system/core/js_strings.'.$locale.'.js')) {
48  $include_list[] = sq_web_path('data').'/system/core/js_strings.'.$locale.'.js';
49  }
50  }
51 
52  foreach ($include_list as $link) {
53  ?><script type="text/javascript" src="<?php echo $link; ?>"></script>
54  <?php
55  }
56  ?>
57  <script type="text/javascript" src="../../core/popup.js"></script>
58  <script type="text/javascript" src="<?php echo sq_web_path('lib').'/asset_map/javaExternalCall.js' ?>"></script>
59  <script type="text/javascript" src="<?php echo sq_web_path('fudge').'/var_serialise/var_serialise.js' ?>"></script>
60  <script type="text/javascript" src="<?php echo sq_web_path('lib').'/html_form/html_form.js' ?>"></script>
61  <script type="text/javascript" src="<?php echo sq_web_path('lib').'/js/general.js' ?>"></script>
62  <script type="text/javascript" src="<?php echo sq_web_path('lib').'/js/tooltip.js' ?>"></script>
63 
64  <script type="text/javascript">
65 
66  function Init() {
67  __dlg_init("matrixEmbedMovie");
68  };
69 
70  function onOK() {
71  // pass data back to the calling window
72  var fields = ["f_width", "f_height"];
73  var chk_fields = ["f_show_controls", "f_auto_start", "f_embed_loop"];
74  var param = new Object();
75 
76  for (var i in fields) {
77  var id = fields[i];
78  var el = document.getElementById(id);
79  param[id] = el.value;
80  }
81  if (document.getElementById('url_link').value && document.getElementById('url_link').value.substring(0, 5) != './?a=') {
82  if (!document.getElementById('url_protocol').value) {
83  alert("Please specify the protocol for external url");
84  return false;
85  }
86  param['use_external'] = true;
87  param["external_url"] = document.getElementById('url_protocol').value + document.getElementById('url_link').value;
88  } else {
89  param['use_external'] = false;
90  param["f_fileid"] = document.getElementById('assetid[assetid]').value;
91  }
92  for (var i in chk_fields) {
93  var id = chk_fields[i];
94  var el = document.getElementById(id);
95  if (el.checked) {
96  param[id] = "1";
97  } else {
98  param[id] = "0";
99  }
100  }
101  __dlg_close("matrixEmbedMovie", param);
102 
103  return false;
104  };
105 
106  function onCancel() {
107  __dlg_close("matrixEmbedMovie", null);
108 
109  return false;
110  };
111  </script>
112 
113  <style type="text/css">
114  html, body {
115  background: #FCFCFC;
116  color: #000000;
117  font: 11px Tahoma,Verdana,sans-serif;
118  margin: 0px;
119  padding: 0px;
120  }
121 
122  table {
123  font: 11px Tahoma,Verdana,sans-serif;
124  }
125 
126  form#main-form {
127  padding: 5px;
128  clear: right;
129  }
130 
131  #quick-search {
132  font: 11px Tahoma,Verdana,sans-serif;
133  letter-spacing: 0;
134  float: right;
135  padding-right: 12px;
136  }
137 
138  #quick-search #quick-search-for {
139  font: 11px Arial,Verdana,sans-serif;
140  border: 1px solid black;
141  padding: 1px 3px;
142  }
143 
144  #quick-search #quick-search-for-label {
145  font: 11px Arial,Verdana,sans-serif;
146  color: #999;
147  }
148 
149 
150  /* main popup title */
151  .title {
152  background: #402F48;
153  color: #FFFFFF;
154  font-weight: bold;
155  font-size: 120%;
156  padding: 6px 10px;
157  margin-bottom: 10px;
158  border-bottom: 1px solid black;
159  letter-spacing: 4px;
160  }
161 
162  /* fieldset styles */
163  fieldset {
164  padding: 0px 10px 5px 5px;
165  border-color: #725B7D;
166  }
167 
168  .fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
169  .fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }
170 
171  /* form and form fields */
172  form { padding: 0px; margin: 0px; }
173 
174  select, input, button {
175  font: 11px Tahoma,Verdana,sans-serif;
176  }
177 
178  button {
179  width: 70px;
180  }
181 
182  /* colour picker button styles */
183  .buttonColor, .buttonColor-hilite {
184  cursor: default;
185  border: 1px solid;
186  border-color: #9E86AA #725B7D #725B7D #9E86AA;
187  }
188 
189  .buttonColor-hilite {
190  border-color: #402F48;
191  }
192 
193  .buttonColor-chooser, .buttonColor-nocolor, .buttonColor-nocolor-hilite {
194  height: 0.6em;
195  border: 1px solid;
196  padding: 0px 1em;
197  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
198  }
199 
200  .buttonColor-nocolor, .buttonColor-nocolor-hilite { padding: 0px; }
201  .buttonColor-nocolor-hilite { background: #402F48; color: #FFFFFF; }
202 
203  /* Popup styles (for backend search feature) */
204 
205  #new-message-popup, #search-wait-popup {
206  position: absolute;
207  right: 10px;
208  top: 0;
209  width: 300px;
210  background-color: white;
211  border: 2px solid black;
212  font: normal 10px Arial,Verdana,sans-serif;
213  display: none;
214  }
215 
216  #new-message-popup-titlebar, #search-wait-popup-titlebar {
217  font-weight: bold;
218  padding: 5px;
219  }
220 
221  #new-message-popup-close, #search-wait-popup-close {
222  float: right;
223  }
224 
225  #new-message-popup-close a, #search-wait-popup-close a {
226  color: black;
227  text-decoration: none;
228  }
229 
230  #new-message-popup-details, #search-wait-popup-details {
231  padding: 5px;
232  }
233 
234  div.search-result {
235  padding: 0;
236  margin: 5px;
237  }
238 
239  div.search-result-blurb {
240  padding: 0;
241  margin: 5px;
242  font-weight: bold;
243  }
244 
245  div.search-result-pager {
246  padding: 0;
247  margin: 5px;
248  text-align: center;
249  }
250 
251  div.search-result-detail {
252  padding: 0;
253  padding-left: 15px;
254  margin: 5px;
255  display: none;
256  }
257 
258  a.search-result-expand-link {
259  text-decoration: none;
260  top: 0px;
261  left: 0px;
262  height: 10px;
263  font-size: 14px;
264  margin-top: 0px;
265  font-weight: bold;
266  text-decoration: none;
267  color: #33B9E6;
268  }
269 
270  .search-result-expand-div {
271  float: left;
272  width: 22px;
273  font-weight: bold;
274  background-color: white;
275  white-space: nowrap;
276  }
277 
278  .search-result-entry {
279  margin-top: 5px;
280  text-indent: -38px;
281  padding-left: 50px;
282  }
283 
284  .sq-backend-search-failed-table {
285  border: 2px solid #594165;
286  border-collapse: collapse;
287  background-color: #ECECEC;
288  }
289 
290  .sq-backend-search-failed-heading, .sq-backend-search-failed-body {
291  color: #342939;
292  background-color: #ececec;
293  font-family: Arial, Verdana, Helvetica, sans-serif;
294  font-size: 10px;
295  vertical-align: top;
296  padding: 5px;
297  text-decoration: none;
298  font-weight: bold;
299  }
300 
301  .sq-backend-search-failed-body {
302  color: #342939;
303  font-weight: normal;
304  }
305 
306  .sq-backend-search-results-table {
307  border: 2px solid #594165;
308  border-collapse: collapse;
309  background-color: #ECECEC;
310  }
311 
312  .sq-backend-search-results-heading, .sq-backend-search-results-body {
313  color: #342939;
314  background-color: #FFFFFF;
315  font-family: Arial, Verdana, Helvetica, sans-serif;
316  font-size: 10px;
317  vertical-align: top;
318  padding: 5px;
319  text-decoration: none;
320  font-weight: bold;
321  }
322 
323  .sq-backend-search-results-heading {
324  background-color: #F0F0E6;
325  }
326 
327  .sq-backend-search-results-highlight {
328  background-color: yellow;
329  }
330 
331  .sq-backend-search-results-body {
332  color: #342939;
333  font-weight: normal;
334  }
335  </style>
336  </head>
337 
338  <body onload="Javascript: Init();" onUnload="Javascript: asset_finder_onunload();">
339  <form action="" method="get" name="main_form" id="main-form">
340  <table width="100%">
341  <tr>
342  <td valign="top">
343  <?php
344  include_once(SQ_LIB_PATH.'/asset_map/asset_map.inc');
345  $asset_map = new Asset_Map();
346  $asset_map->embedAssetMap('simple', 200, 350);
347 
348  $url_protocol_options = Array(
349  '' => '',
350  'http://' => 'http://',
351  'https://' => 'https://',
352  'ftp://' => 'ftp://',
353  'rtsp://' => 'rtsp://',
354  );
355  ?>
356  </td>
357  <td valign="top">
358  <table width="100%" cellspacing="0" cellpadding="0">
359  <tr>
360  <td valign="top" colspan="2">
361  <script type="text/javascript">
362  function setUrl(protocol, link) {
363  var f = document.main_form;
364 
365  if (protocol != null) highlight_combo_value(f.url_protocol, protocol);
366  if (link != null) {
367  f.url_link.value = link;
368  } else {
369  var assetid = f.elements["assetid[assetid]"].value;
370 
371  if (assetid != '') {
372  // shadow asset
373  if (assetid.search(/:/) != -1) {
374  f.url_link.value = './?a=' + assetid + '$';
375  } else {
376  f.url_link.value = './?a=' + assetid;
377  }
378  highlight_combo_value(f.url_protocol, '');
379  }
380  }
381  setTimeout('self.focus()',100);
382  };
383  </script>
384  <fieldset>
385  <legend><b><?php echo translate('general'); ?></b></legend>
386  <table width="100%" cellspacing="0" cellpadding="0">
387  <tr>
388  <td valign="top" width="100%">
389  <table style="width:100%">
390  <tr>
391  <td class="label"><?php echo translate('protocol'); ?>:</td>
392  <td><?php combo_box('url_protocol',$url_protocol_options , false,$_REQUEST['f_fileprotocol'],0, 'style="font-family: courier new; font-size: 11px;"'); ?></td>
393  <td class="label"><?php echo translate('link'); ?>:</td>
394  <td><?php text_box('url_link', $_REQUEST['f_fileurl'], 40, 0)?></td>
395  </tr>
396  <tr>
397  <td class="label"><?php echo translate('select_asset'); ?>:</td>
398  <td colspan="3"><?php asset_finder('assetid', '', Array('file' => 'D'), '', false, 'setUrl'); ?></td>
399  </tr>
400  </table>
401  </td>
402  </tr>
403  </table>
404 
405  </fieldset>
406  </td>
407  </tr>
408  <tr>
409  <td valign="top" width="50%">
410  <fieldset>
411  <legend><?php echo translate('controls'); ?></legend>
412  <table style="width:100%">
413  <tr>
414  <td class="label" colspan="2"><b><?php echo translate('wmv-asf-asx_only'); ?></b></td>
415  </tr>
416  <tr>
417  <td class="label"><?php echo translate('auto_start'); ?>:</td>
418  <td width="50%">
419  <input type="checkbox" name="auto_start" id="f_auto_start" value="1" <?php echo ($_REQUEST['f_auto_start'] == '1') ? 'checked' : ''?> />
420  </td>
421  </tr>
422  <tr>
423  <td class="label"><?php echo translate('loop'); ?>:</td>
424  <td>
425  <input type="checkbox" name="embed_loop" id="f_embed_loop" value="1" <?php echo ($_REQUEST['f_embed_loop'] == '1') ? 'checked' : ''?> />
426  </td>
427  </tr>
428  <tr>
429  <td class="label" colspan="2"><b><?php echo translate('mov-wmv-asf-asx_only'); ?></b></td>
430  </tr>
431  <tr>
432  <td class="label"><?php echo translate('show_controls'); ?>:</td>
433  <td>
434  <input type="checkbox" name="show_controls" id="f_show_controls" value="1" <?php echo ($_REQUEST['f_show_controls'] == '1') ? 'checked' : ''?> />
435  </td>
436  </tr>
437  </table>
438  </fieldset>
439  </td>
440  <td valign="top" width="50%">
441  <fieldset>
442  <legend><?php echo translate('size'); ?></legend>
443  <table style="width:100%">
444  <tr>
445  <td class="label" width="50%"><?php echo translate('width'); ?>:</td>
446  <td>
447  <input type="text" name="width" id="f_width" size="5" title="Width" value="<?php echo empty($_REQUEST['f_width']) ? '100' : htmlspecialchars($_REQUEST['f_width']) ?>" />
448  </td>
449  </tr>
450  <tr>
451  <td class="label"><?php echo translate('height'); ?>:</td>
452  <td>
453  <input type="text" name="height" id="f_height" size="5" title="Height" value="<?php echo empty($_REQUEST['f_height']) ? '100' : htmlspecialchars($_REQUEST['f_height']) ?>" />
454  </td>
455  </tr>
456  </table>
457  </fieldset>
458  </td>
459  </tr>
460  </table>
461  </td>
462  </tr>
463  </table>
464 
465  <div style="margin-top: 5px; text-align: right;">
466  <hr />
467  <button type="button" name="ok" onclick="return onOK();"><?php echo translate('ok'); ?></button>
468  <button type="button" name="cancel" onclick="return onCancel();"><?php echo translate('cancel'); ?></button>
469  </div>
470  </form>
471 
472  <!-- Search results -->
473  <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>
474  <div id="new-message-popup-details"></div>
475  </div>
476  <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>
477  <div id="search-wait-popup-details">Your search is being processed, please wait...</div>
478  </div>
479 
480  <script type="text/javascript"><!--
481  var current = 1;
482  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; ?>;
483  var total_results = 0;
484 
485  function jump_to_search_results(page) {
486  // Show the correct page
487  document.getElementById("search-result-page-" + current).style.display = 'none';
488  document.getElementById("search-result-page-" + page).style.display = 'block';
489 
490  // Update page start and end markers
491  document.getElementById("sq-search-results-page-start").innerHTML = (results_per_page * (page - 1)) + 1;
492  document.getElementById("sq-search-results-page-end").innerHTML = Math.min(total_results, results_per_page * page);
493 
494  for (i = ((page - 1) * results_per_page) + 1; i <= Math.min(total_results, page * results_per_page); i++) {
495  // collapse the new page when page is switched, so they're
496  // back to just the tag lines
497  document.getElementById("search-result-" + i + "-expand-link").innerHTML = '+';
498  document.getElementById("search-result-" + i + "-detail").style.display = 'none';
499  }
500 
501  current = page;
502  }
503 
504  function set_asset_finder_from_search(assetid, label, url, linkid) {
505  document.cookie = 'lastSelectedAssetId=' + escape(assetid);
506 
507  ASSET_FINDER_OBJ.set_hidden_field('assetid[assetid]', assetid);
508  ASSET_FINDER_OBJ.set_hidden_field('assetid[url]', url);
509  ASSET_FINDER_OBJ.set_hidden_field('assetid[linkid]', linkid);
510  ASSET_FINDER_OBJ.set_text_field('sq_asset_finder_assetid_label', (assetid == 0) ? '' : label + ' (Id : #' + assetid + ')');
511 
512  document.getElementById("new-message-popup").style.display = 'none';
513  setUrl('', './?a=' + assetid);
514  }
515 
516  // --></script>
517  </body>
518 </html>