Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
insert_abbr.php
1 <?php
25 require_once dirname(__FILE__).'/../../../../core/include/init.inc';
26 require_once SQ_LIB_PATH.'/html_form/html_form.inc';
27 require_once SQ_FUDGE_PATH.'/var_serialise/var_serialise.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['title'])) $_GET['title'] = "";
34 
35 ?>
36 
37 <html style="width: 400px; height: 200px;">
38  <head>
39  <title>Insert Abbreviation</title>
40 
41  <?php
42  //add required js translation files, as we are using asset finder
43  $include_list = Array(sq_web_path('lib').'/js/translation.js');
44 
45  $locales = $GLOBALS['SQ_SYSTEM']->lm->getCumulativeLocaleParts($GLOBALS['SQ_SYSTEM']->lm->getCurrentLocale());
46 
47  foreach($locales as $locale) {
48  if (file_exists(SQ_DATA_PATH.'/public/system/core/js_strings.'.$locale.'.js')) {
49  $include_list[] = sq_web_path('data').'/system/core/js_strings.'.$locale.'.js';
50  }
51  }
52 
53  foreach($include_list as $link) {
54  ?><script type="text/javascript" src="<?php echo $link; ?>"></script>
55  <?php
56  }
57  ?>
58  <script type="text/javascript" src="../../core/popup.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 
63  <script type="text/javascript">
64  function getFocus() {
65  setTimeout('self.focus()',100);
66  };
67 
68  function Init() {
69  __dlg_init("matrixInsertAbbr");
70  setTimeout('self.focus()',100);
71  };
72 
73  function onOK() {
74  // pass data back to the calling window
75  var fields = ["title"];
76  var param = new Object();
77  var f = document.main_form;
78 
79  param["title"] = form_element_value(f.title);
80  param["abbr"] = form_element_value(f.abbr);
81 
82  __dlg_close("matrixInsertAbbr", param);
83  return false;
84  };
85 
86  function onCancel() {
87  __dlg_close("matrixInsertAbbr", null);
88  return false;
89  };
90 
91  function buildForm() {
92  document.write('<tr>');
93  document.write('<td class="label"><?php echo translate('abbreviation'); ?>:</td>');
94  document.write('<td colspan="3"><?php text_box('abbr', preg_replace('/[\']+/', '' , trim($_GET['abbr'])), 40, 0);?></td>');
95  document.write('</tr>');
96  document.write('<tr>');
97  document.write(' <td class="label"><?php echo translate('definition'); ?>:</td>');
98  document.write(' <td colspan="3"><?php text_box('title', preg_replace('/[\']+/', '' , trim($_GET['title'])), 40, 0);?></td>');
99  document.write('</tr>');
100  };
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  padding: 5px;
112  }
113 
114  table {
115  font: 11px Tahoma,Verdana,sans-serif;
116  }
117 
118  /* main popup title */
119  .title {
120  background: #402F48;
121  color: #FFFFFF;
122  font-weight: bold;
123  font-size: 120%;
124  padding: 3px 10px;
125  margin-bottom: 10px;
126  border-bottom: 1px solid black;
127  letter-spacing: 4px;
128  }
129 
130  /* fieldset styles */
131  fieldset {
132  padding: 0px 10px 5px 5px;
133  border-color: #725B7D;
134  }
135 
136  .fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
137  .fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }
138 
139  /* form and form fields */
140  form { padding: 0px; margin: 0px; }
141 
142  select, input, button {
143  font: 11px Tahoma,Verdana,sans-serif;
144  }
145 
146  button {
147  width: 70px;
148  }
149 
150  /* colour picker button styles */
151  .buttonColor, .buttonColor-hilite {
152  cursor: default;
153  border: 1px solid;
154  border-color: #9E86AA #725B7D #725B7D #9E86AA;
155  }
156 
157  .buttonColor-hilite {
158  border-color: #402F48;
159  }
160 
161  .buttonColor-chooser, .buttonColor-nocolor, .buttonColor-nocolor-hilite {
162  height: 0.6em;
163  border: 1px solid;
164  padding: 0px 1em;
165  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
166  }
167 
168  .buttonColor-nocolor, .buttonColor-nocolor-hilite { padding: 0px; }
169  .buttonColor-nocolor-hilite { background: #402F48; color: #FFFFFF; }
170  </style>
171  </head>
172 
173  <body onload="Javascript: Init();">
174  <div class="title"><?php echo translate('insert_abbreviation'); ?></div>
175  <form action="" method="get" name="main_form">
176  <table width="100%" >
177  <tr>
178  <td valign="top" width="100%">
179  <fieldset>
180  <legend><b><?php echo translate('general'); ?></b></legend>
181  <table style="width:100%">
182  <script type="text/javascript">
183  buildForm();
184  </script>
185  </table>
186  </fieldset>
187  </td>
188  </tr>
189  </table>
190 
191  <div style="margin-top: 5px; margin-right: 5px; text-align: right;">
192  <hr />
193  <script type="text/javascript" language="javascript">
194  document.write('<button type="button" name="ok" onclick="return onOK();"><?php echo translate('ok'); ?></button>');
195  </script>
196  <button type="button" name="cancel" onclick="return onCancel();"><?php echo translate('cancel'); ?></button>
197  </div>
198  </form>
199  </body>
200 </html>