Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
embed_youtube.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 YouTube</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("matrixEmbedYouTube");
68  };
69 
70  function onOK() {
71  // pass data back to the calling window
72  var fields = ["f_width", "f_height", "f_colour1", "f_colour2"];
73  var chk_fields = ["f_auto_start", "f_loop", "f_full_screen", "f_egm", "f_rel", "f_show_border", "f_enable_js"];
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  param["f_vid"] = document.getElementById('video_id').value;
82  param["f_video_url"] = document.getElementById('video_url').value;
83  for (var i in chk_fields) {
84  var id = chk_fields[i];
85  var el = document.getElementById(id);
86  if (el.checked) {
87  param[id] = "1";
88  } else {
89  param[id] = "0";
90  }
91  }
92  __dlg_close("matrixEmbedYouTube", param);
93 
94  return false;
95  };
96 
97  function onCancel() {
98  __dlg_close("matrixEmbedYouTube", null);
99 
100  return false;
101  };
102  </script>
103 
104  <style type="text/css">
105  html, body {
106  background: #FCFCFC;
107  color: #000000;
108  font: 11px Tahoma,Verdana,sans-serif;
109  margin: 0px;
110  padding: 0px;
111  }
112 
113  table {
114  font: 11px Tahoma,Verdana,sans-serif;
115  }
116 
117  form#main-form {
118  padding: 5px;
119  clear: right;
120  }
121 
122  /* main popup title */
123  .title {
124  background: #402F48;
125  color: #FFFFFF;
126  font-weight: bold;
127  font-size: 120%;
128  padding: 6px 10px;
129  margin-bottom: 10px;
130  border-bottom: 1px solid black;
131  letter-spacing: 4px;
132  }
133 
134  /* fieldset styles */
135  fieldset {
136  padding: 0px 10px 5px 5px;
137  border-color: #725B7D;
138  }
139 
140  .fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
141  .fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }
142 
143  /* form and form fields */
144  form { padding: 0px; margin: 0px; }
145 
146  select, input, button {
147  font: 11px Tahoma,Verdana,sans-serif;
148  }
149 
150  button {
151  width: 70px;
152  }
153 
154  /* colour picker button styles */
155  .buttonColor, .buttonColor-hilite {
156  cursor: default;
157  border: 1px solid;
158  border-color: #9E86AA #725B7D #725B7D #9E86AA;
159  }
160 
161  .buttonColor-hilite {
162  border-color: #402F48;
163  }
164 
165  .buttonColor-chooser, .buttonColor-nocolor, .buttonColor-nocolor-hilite {
166  height: 0.6em;
167  border: 1px solid;
168  padding: 0px 1em;
169  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
170  }
171 
172  .buttonColor-nocolor, .buttonColor-nocolor-hilite { padding: 0px; }
173  .buttonColor-nocolor-hilite { background: #402F48; color: #FFFFFF; }
174 
175  /* Popup styles (for backend search feature) */
176 
177  #new-message-popup, #search-wait-popup {
178  position: absolute;
179  right: 10px;
180  top: 0;
181  width: 300px;
182  background-color: white;
183  border: 2px solid black;
184  font: normal 10px Arial,Verdana,sans-serif;
185  display: none;
186  }
187 
188  #new-message-popup-titlebar, #search-wait-popup-titlebar {
189  font-weight: bold;
190  padding: 5px;
191  }
192 
193  #new-message-popup-close, #search-wait-popup-close {
194  float: right;
195  }
196 
197  #new-message-popup-close a, #search-wait-popup-close a {
198  color: black;
199  text-decoration: none;
200  }
201 
202  #new-message-popup-details, #search-wait-popup-details {
203  padding: 5px;
204  }
205  </style>
206  </head>
207 
208  <body onload="Javascript: Init();">
209  <form action="" method="get" name="main_form" id="main-form">
210  <table width="100%">
211  <tr>
212  <td valign="top">
213  <table width="100%" cellspacing="0" cellpadding="0">
214  <tr>
215  <td valign="top" colspan="2">
216  <fieldset>
217  <legend><b><?php echo translate('general'); ?></b></legend>
218  <table width="100%" cellspacing="0" cellpadding="0">
219  <tr>
220  <td valign="top" width="100%">
221  <table style="width:100%">
222  <tr>
223  <td class="label">Video ID:</td>
224  <td><?php text_box('video_id', (!empty($_REQUEST['f_vid']))?$_REQUEST['f_vid']:'', 20, 0)?></td>
225  <td> or </td>
226  <td class="label"><?php echo translate('url'); ?>:</td>
227  <td><?php text_box('video_url', (!empty($_REQUEST['f_video_url']))?$_REQUEST['f_video_url']:'', 80, 0)?></td>
228  </tr>
229  </table>
230  </td>
231  </tr>
232  </table>
233 
234  </fieldset>
235  </td>
236  </tr>
237  <tr>
238  <td valign="top" width="50%" rowspan="2">
239  <fieldset>
240  <legend><?php echo translate('controls'); ?></legend>
241  <table style="width:100%">
242  <tr>
243  <!-- autoplay -->
244  <td class="label"><?php echo translate('auto_start'); ?>:</td>
245  <td width="50%">
246  <input type="checkbox" name="auto_start" id="f_auto_start" value="1" <?php echo ($_REQUEST['f_auto_start'] == '1') ? 'checked' : ''?> />
247  </td>
248  </tr>
249  <tr>
250  <!-- loop -->
251  <td class="label"><?php echo translate('loop'); ?>:</td>
252  <td>
253  <input type="checkbox" name="loop" id="f_loop" value="1" <?php echo ($_REQUEST['f_loop'] == '1') ? 'checked' : ''?> />
254  </td>
255  </tr>
256  <tr>
257  <!-- full screen -->
258  <td class="label">Full Screen:</td>
259  <td>
260  <input type="checkbox" name="full_screen" id="f_full_screen" value="1" <?php echo ($_REQUEST['f_full_screen'] == '1') ? 'checked' : ''?> />
261  </td>
262  </tr>
263  <tr>
264  <!-- related -->
265  <td class="label">Show Related Videos:</td>
266  <td>
267  <input type="checkbox" name="rel" id="f_rel" value="1" <?php echo ($_REQUEST['f_rel'] == '1') ? 'checked' : ''?> />
268  </td>
269  </tr>
270  <tr>
271  <!-- genius bar -->
272  <td class="label">Enable Genius Bar:</td>
273  <td>
274  <input type="checkbox" name="egm" id="f_egm" value="1" <?php echo ($_REQUEST['f_egm'] == '1') ? 'checked' : ''?> />
275  </td>
276  </tr>
277  <tr>
278  <!-- enable js api -->
279  <td class="label">Enable Javascript API:</td>
280  <td>
281  <input type="checkbox" name="enable_js" id="f_enable_js" value="1" <?php echo ($_REQUEST['f_enable_js'] == '1') ? 'checked' : ''?> />
282  </td>
283  </tr>
284  </table>
285  </fieldset>
286  </td>
287  <td valign="top" width="50%">
288  <fieldset>
289  <legend><?php echo translate('size'); ?></legend>
290  <table style="width:100%">
291  <tr>
292  <td class="label" width="50%"><?php echo translate('width'); ?>:</td>
293  <td>
294  <input type="text" name="width" id="f_width" size="5" title="Width" value="<?php echo empty($_REQUEST['f_width']) ? '480' : htmlspecialchars($_REQUEST['f_width']) ?>" />
295  </td>
296  </tr>
297  <tr>
298  <td class="label"><?php echo translate('height'); ?>:</td>
299  <td>
300  <input type="text" name="height" id="f_height" size="5" title="Height" value="<?php echo empty($_REQUEST['f_height']) ? '385' : htmlspecialchars($_REQUEST['f_height']) ?>" />
301  </td>
302  </tr>
303  </table>
304  </fieldset>
305  </td>
306  </tr>
307  <tr>
308  <td valign="top" width="50%">
309  <fieldset>
310  <legend><?php echo translate('style'); ?></legend>
311  <table style="width:100%">
312  <tr>
313  <td class="label" width="50%"><?php echo translate('border'); ?>:</td>
314  <td>
315  <input type="checkbox" name="show_border" id="f_show_border" size="5" title="Border" value="1" <?php echo ($_REQUEST['f_show_border'] == '1') ? 'checked' : ''?> />
316  </td>
317  </tr>
318  <tr>
319  <td class="label">Primary Border <?php echo translate('colour'); ?>:</td>
320  <td>
321  <input type="text" name="colour1" id="f_colour1" size="8" title="Colour 1" value="<?php echo empty($_REQUEST['f_colour1']) ? '' : htmlspecialchars($_REQUEST['f_colour1']) ?>" />
322  </td>
323  </tr>
324  <tr>
325  <td class="label">Secondary Border <?php echo translate('colour'); ?>:</td>
326  <td>
327  <input type="text" name="colour2" id="f_colour2" size="8" title="Colour 2" value="<?php echo empty($_REQUEST['f_colour2']) ? '' : htmlspecialchars($_REQUEST['f_colour2']) ?>" />
328  </td>
329  </tr>
330  </table>
331  </fieldset>
332  </td>
333  </tr>
334  </table>
335  </td>
336  </tr>
337  </table>
338 
339  <div style="margin-top: 5px; text-align: right;">
340  <hr />
341  <button type="button" name="ok" onclick="return onOK();"><?php echo translate('ok'); ?></button>
342  <button type="button" name="cancel" onclick="return onCancel();"><?php echo translate('cancel'); ?></button>
343  </div>
344  </form>
345 
346  </body>
347 </html>