Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
insert_dfn.php
1 <?php
26 require_once dirname(__FILE__).'/../../../../core/include/init.inc';
27 require_once SQ_LIB_PATH.'/html_form/html_form.inc';
28 require_once SQ_FUDGE_PATH.'/var_serialise/var_serialise.inc';
29 
30 if (empty($GLOBALS['SQ_SYSTEM']->user) || !($GLOBALS['SQ_SYSTEM']->user->canAccessBackend() || $GLOBALS['SQ_SYSTEM']->user->type() == 'simple_edit_user')){
31  exit;
32 }
33 
34 if (!isset($_GET['title'])) $_GET['title'] = "";
35 //Sanitise
36 $_GET['title'] = preg_replace('/[\'"\(\);\[\]{}<>=]+/', '', $_GET['title']);
37 $_GET['dfn'] = preg_replace('/[\'"\(\);\[\]{}<>=]+/', '', $_GET['dfn']);
38 ?>
39 
40 <html style="width: 400px; height: 250px;">
41  <head>
42  <title>Insert Definition</title>
43 
44  <?php
45  // add required js translation files, as we are using asset finder
46  $include_list = Array(sq_web_path('lib').'/js/translation.js');
47 
48  $locales = $GLOBALS['SQ_SYSTEM']->lm->getCumulativeLocaleParts($GLOBALS['SQ_SYSTEM']->lm->getCurrentLocale());
49 
50  foreach($locales as $locale) {
51  if (file_exists(SQ_DATA_PATH.'/public/system/core/js_strings.'.$locale.'.js')) {
52  $include_list[] = sq_web_path('data').'/system/core/js_strings.'.$locale.'.js';
53  }
54  }
55 
56  foreach($include_list as $link) {
57  ?><script type="text/javascript" src="<?php echo $link; ?>"></script>
58  <?php
59  }
60  ?>
61  <script type="text/javascript" src="../../core/popup.js"></script>
62  <script type="text/javascript" src="<?php echo sq_web_path('fudge').'/var_serialise/var_serialise.js' ?>"></script>
63  <script type="text/javascript" src="<?php echo sq_web_path('lib').'/html_form/html_form.js' ?>"></script>
64  <script type="text/javascript" src="<?php echo sq_web_path('lib').'/js/general.js' ?>"></script>
65 
66  <script type="text/javascript">
67 
68  function getFocus() {
69  setTimeout('self.focus()',100);
70  };
71 
72  function Init() {
73  __dlg_init("matrixInsertDfn");
74  setTimeout('self.focus()',100);
75  };
76 
77  function onOK() {
78  // pass data back to the calling window
79  var fields = ["title"];
80  var param = new Object();
81  var f = document.main_form;
82 
83  param["title"] = form_element_value(f.title);
84  param["dfn"] = form_element_value(f.dfn);
85 
86  __dlg_close("matrixInsertDfn", param);
87  return false;
88  };
89 
90  function onCancel() {
91  __dlg_close("matrixInsertDfn", null);
92  return false;
93  };
94 
95  function buildForm() {
96  document.write('<tr>');
97  document.write('<td class="label"><?php echo translate('definition'); ?>:</td>');
98  document.write('<td colspan="3"><?php text_box('dfn', trim($_GET['dfn']), 40, 0);?></td>');
99  document.write('</tr>');
100  document.write('<tr>');
101  document.write(' <td class="label"><?php echo translate('title'); ?>:</td>');
102  document.write(' <td colspan="3"><?php text_box('title', trim($_GET['title']), 40, 0);?></td>');
103  document.write('</tr>');
104  };
105 
106  </script>
107 
108  <style type="text/css">
109  html, body {
110  background: #FCFCFC;
111  color: #000000;
112  font: 11px Tahoma,Verdana,sans-serif;
113  margin: 0px;
114  padding: 0px;
115  padding: 5px;
116  }
117 
118  table {
119  font: 11px Tahoma,Verdana,sans-serif;
120  }
121 
122  /* main popup title */
123  .title {
124  background: #402F48;
125  color: #FFFFFF;
126  font-weight: bold;
127  font-size: 120%;
128  padding: 3px 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  </style>
175  </head>
176 
177  <body onload="Javascript: Init();">
178  <div class="title"><?php echo translate('insert_definition'); ?></div>
179  <form action="" method="get" name="main_form">
180  <table width="100%" >
181  <tr>
182  <td valign="top" width="100%">
183  <fieldset>
184  <legend><b><?php echo translate('general'); ?></b></legend>
185  <table style="width:100%">
186  <script type="text/javascript">
187  buildForm();
188  </script>
189  </table>
190  </fieldset>
191  </td>
192  </tr>
193  </table>
194 
195  <div style="margin-top: 5px; margin-right: 5px; text-align: right;">
196  <hr />
197  <script type="text/javascript" language="javascript">
198  document.write('<button type="button" name="ok" onclick="return onOK();"><?php echo translate('ok'); ?></button>');
199  </script>
200  <button type="button" name="cancel" onclick="return onCancel();"><?php echo translate('cancel'); ?></button>
201  </div>
202  </form>
203  </body>
204 </html>