Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
edit_cell.php
1 <?php
24 require_once dirname(__FILE__).'/../../../../core/include/init.inc';
25 require_once dirname(__FILE__).'/../../wysiwyg_plugin.inc';
26 
27 if (empty($GLOBALS['SQ_SYSTEM']->user) || !($GLOBALS['SQ_SYSTEM']->user->canAccessBackend() || $GLOBALS['SQ_SYSTEM']->user->type() == 'simple_edit_user')){
28  exit;
29 }
30 
31 $wysiwyg = null;
32 $plugin = new wysiwyg_plugin($wysiwyg);
33 $_GET['f_bgcolor'] = preg_replace('/[^a-zA-Z_0-9 ]+/', '', $_GET['f_bgcolor']);
34 $_GET['f_color'] = preg_replace('/[^a-zA-Z_0-9 ]+/', '', $_GET['f_color']);
35 $_GET['f_borderColor'] = preg_replace('/[^a-zA-Z_0-9 ]+/', '', $_GET['f_borderColor']);
36 ?>
37 
38 <html style="width:380px; height:270px;">
39 
40  <head>
41  <title>Edit Cell Properties</title>
42  <script type="text/javascript" src="../../core/popup.js"></script>
43  <script type="text/javascript" src="../../core/dialog.js"></script>
44 
45  <script type="text/javascript">
46  function colorPopup(id) {
47  var field = document.getElementById(id);
48  var span = document.getElementById(id + "_chooser");
49  var color = field.value;
50 
51  var strPage = "<?php echo $_SERVER['PHP_SELF'].'/../../'.$plugin->get_popup_href('select_color.html', 'select_color')?>";
52 
53  openModalDialog("selectColor", strPage, 238, 163, function(color) {
54  if (color) {
55  span.style.backgroundColor = "#" + color;
56  field.value = color;
57  }
58  }, color);
59  };
60 
61  function nullColor(id) {
62  var field = document.getElementById(id);
63  var span = document.getElementById(id + "_chooser");
64  span.style.backgroundColor = "";
65  field.value = "";
66  };
67 
68  function colorButton(id, classname) {
69  var btn = document.getElementById(id + "_button");
70  btn.className = classname;
71  };
72 
73  function Init() {
74  __dlg_init("editCellProperties");
75  };
76 
77  function onOK() {
78  var fields = ["f_width", "f_height", "f_widthUnit",
79  "f_heightUnit", "f_align", "f_valign",
80  "f_bgcolor", "f_color", "f_borderColor",
81  "f_borderWidth", "f_borderStyle"];
82  var params = new Object();
83  for (var i in fields) {
84  var id = fields[i];
85  var el = document.getElementById(id);
86  params[id] = el.value;
87  }
88  __dlg_close("editCellProperties", params);
89  return false;
90  };
91 
92  function onCancel() {
93  __dlg_close("editCellProperties", null);
94  return false;
95  };
96 
97  </script>
98 
99  <style type="text/css">
100  html, body {
101  background: #FCFCFC;
102  color: #000000;
103  font: 11px Tahoma,Verdana,sans-serif;
104  margin: 0px;
105  padding: 0px;
106  padding: 5px;
107  }
108 
109  table {
110  font: 11px Tahoma,Verdana,sans-serif;
111  }
112 
113  /* main popup title */
114  .title {
115  background: #402F48;
116  color: #FFFFFF;
117  font-weight: bold;
118  font-size: 120%;
119  padding: 3px 10px;
120  margin-bottom: 10px;
121  border-bottom: 1px solid black;
122  letter-spacing: 4px;
123  }
124 
125  /* fieldset styles */
126  fieldset {
127  padding: 0px 10px 5px 5px;
128  border-color: #725B7D;
129  }
130 
131  .fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
132  .fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }
133 
134  /* form and form fields */
135  form { padding: 0px; margin: 0px; }
136 
137  select, input, button {
138  font: 11px Tahoma,Verdana,sans-serif;
139  }
140 
141  button {
142  width: 70px;
143  }
144 
145  /* colour picker button styles */
146  .buttonColor, .buttonColor-hilite {
147  cursor: default;
148  border: 1px solid;
149  border-color: #9E86AA #725B7D #725B7D #9E86AA;
150  }
151 
152  .buttonColor-hilite {
153  border-color: #402F48;
154  }
155 
156  .buttonColor-chooser, .buttonColor-nocolor, .buttonColor-nocolor-hilite {
157  height: 0.6em;
158  border: 1px solid;
159  padding: 0px 1em;
160  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
161  }
162 
163  .buttonColor-nocolor, .buttonColor-nocolor-hilite { padding: 0px; }
164  .buttonColor-nocolor-hilite { background: #402F48; color: #FFFFFF; }
165  </style>
166 
167  </head>
168 
169  <body onLoad="Init();">
170 
171  <div class="title">Cell Properties</div>
172 
173  <form action="" method="get">
174  <table width="100%">
175  <tr>
176  <td>
177  <table width="100%" cellspacing="0" cellpadding="0">
178  <tr>
179  <td valign="top" width="50%">
180  <fieldset>
181  <legend><b>Dimensions</b></legend>
182  <table style="width:100%">
183  <tr>
184  <td class="label">Width:</td>
185  <td>
186  <input type="text" id="f_width" size="5" value="<?php echo htmlspecialchars($_GET['f_width']); ?>" />
187  <select id="f_widthUnit">
188  <option value="px" <?php echo ($_GET['f_widthUnit'] == 'px') ? 'selected' : ''; ?>>px</option>
189  <option value="%" <?php echo ($_GET['f_widthUnit'] == '%') ? 'selected' : ''; ?>>%</option>
190  </select>
191  </td>
192  </tr>
193  <tr>
194  <td class="label">Height:</td>
195  <td>
196  <input type="text" id="f_height" size="5" value="<?php echo htmlspecialchars($_GET['f_height']); ?>" />
197  <select id="f_heightUnit">
198  <option value="px" <?php echo ($_GET['f_heightUnit'] == 'px') ? 'selected' : ''; ?>>px</option>
199  <option value="%" <?php echo ($_GET['f_heightUnit'] == '%') ? 'selected' : ''; ?>>%</option>
200  </select>
201  </td>
202  </tr>
203  </table>
204  </fieldset>
205  </td>
206  <td>&nbsp;</td>
207  <td valign="top" width="50%">
208  <fieldset>
209  <legend><b>Alignment</b></legend>
210  <table style="width:100%">
211  <tr>
212  <td class="label">Horiz:</td>
213  <td>
214  <select id="f_align">
215  <option value="">none</option>
216  <option value="left" <?php echo ($_GET['f_align'] == 'left') ? 'selected' : ''; ?>>left</option>
217  <option value="center" <?php echo ($_GET['f_align'] == 'center') ? 'selected' : ''; ?>>center</option>
218  <option value="rigth" <?php echo ($_GET['f_align'] == 'right') ? 'selected' : ''; ?>>right</option>
219  </select>
220  </td>
221  </tr>
222  <tr>
223  <td class="label">Vert:</td>
224  <td>
225  <select id="f_valign">
226  <option value="">none</option>
227  <option value="top" <?php echo ($_GET['f_valign'] == 'top') ? 'selected' : ''; ?>>top</option>
228  <option value="middle" <?php echo ($_GET['f_valign'] == 'middle') ? 'selected' : ''; ?>>middle</option>
229  <option value="bottom" <?php echo ($_GET['f_valign'] == 'bottom') ? 'selected' : ''; ?>>bottom</option>
230  </select>
231  </td>
232  </tr>
233  </table>
234  </fieldset>
235  </td>
236  </tr>
237  </table>
238  </td>
239  </tr>
240  <tr>
241  <td width="100%">
242  <fieldset>
243  <legend><b>Cell Styles / Colours</b></legend>
244  <table width="100%">
245  <tr>
246  <td class="label">Background:</td>
247  <td width="100%">
248  <input type="hidden" id="f_bgcolor" value="<?php echo htmlspecialchars($_GET['f_bgcolor']); ?>">
249  <span class="buttonColor" id="f_bgcolor_button"><span class="buttonColor-chooser" id="f_bgcolor_chooser" style="background-color: #<?php echo htmlspecialchars($_GET['f_bgcolor']); ?>" onClick="Javascript: colorPopup('f_bgcolor');" onMouseOver="Javascript: colorButton('f_bgcolor', 'buttonColor-hilite');" onMouseOut="Javascript: colorButton('f_bgcolor', 'buttonColor');"></span><span title="Unset Colour" class="buttonColor-nocolor" id="f_bgcolor_unset" style="background-color: #<?php echo htmlspecialchars($_GET['f_bgcolor']); ?>" onClick="Javascript: nullColor('f_bgcolor');" onMouseOver="Javascript: colorButton('f_bgcolor', 'buttonColor-hilite'); this.className = 'buttonColor-nocolor-hilite';" onMouseOut="Javascript: colorButton('f_bgcolor', 'buttonColor'); this.className = 'buttonColor-nocolor';">&#x00d7;</span></span>
250  </td>
251  </tr>
252  <tr>
253  <td class="label">Foreground:</td>
254  <td width="100%">
255  <input type="hidden" id="f_color" value="<?php echo htmlspecialchars($_GET['f_color']); ?>">
256  <span class="buttonColor" id="f_color_button"><span class="buttonColor-chooser" id="f_color_chooser" style="background-color: #<?php echo htmlspecialchars($_GET['f_color']); ?>" onClick="Javascript: colorPopup('f_color');" onMouseOver="Javascript: colorButton('f_color', 'buttonColor-hilite');" onMouseOut="Javascript: colorButton('f_color', 'buttonColor');"></span><span title="Unset Colour" class="buttonColor-nocolor" id="f_color_unset" style="background-color: #<?php echo htmlspecialchars($_GET['f_color']); ?>" onClick="Javascript: nullColor('f_color');" onMouseOver="Javascript: colorButton('f_color', 'buttonColor-hilite'); this.className = 'buttonColor-nocolor-hilite';" onMouseOut="Javascript: colorButton('f_color', 'buttonColor'); this.className = 'buttonColor-nocolor';">&#x00d7;</span></span>
257  </td>
258  </tr>
259  <tr>
260  <td class="label" valign="top">Border:</td>
261  <td width="100%" valign="top">
262  <input type="hidden" id="f_borderColor" value="<?php echo htmlspecialchars($_GET['f_borderColor']); ?>">
263  <span class="buttonColor" id="f_borderColor_button"><span class="buttonColor-chooser" id="f_borderColor_chooser" style="background-color: #<?php echo htmlspecialchars($_GET['f_borderColor']); ?>" onClick="Javascript: colorPopup('f_borderColor');" onMouseOver="Javascript: colorButton('f_borderColor', 'buttonColor-hilite');" onMouseOut="Javascript: colorButton('f_borderColor', 'buttonColor');"></span><span title="Unset Colour" class="buttonColor-nocolor" id="f_borderColor_unset" style="background-color: #<?php echo htmlspecialchars($_GET['f_borderColor']); ?>" onClick="Javascript: nullColor('f_borderColor');" onMouseOver="Javascript: colorButton('f_borderColor', 'buttonColor-hilite'); this.className = 'buttonColor-nocolor-hilite';" onMouseOut="Javascript: colorButton('f_borderColor', 'buttonColor'); this.className = 'buttonColor-nocolor';">&#x00d7;</span></span>
264  &nbsp;
265  <select id="f_borderStyle">
266  <option value="none" <?php echo ($_GET['f_borderStyle'] == 'none') ? 'selected' : ''; ?>>None</option>
267  <option value="dotted" <?php echo ($_GET['f_borderStyle'] == 'dotted') ? 'selected' : ''; ?>>Dotted</option>
268  <option value="dashed" <?php echo ($_GET['f_borderStyle'] == 'dashed') ? 'selected' : ''; ?>>Dashed</option>
269  <option value="solid" <?php echo ($_GET['f_borderStyle'] == 'solid') ? 'selected' : ''; ?>>Solid</option>
270  <option value="double" <?php echo ($_GET['f_borderStyle'] == 'double') ? 'selected' : ''; ?>>Double</option>
271  <option value="groove" <?php echo ($_GET['f_borderStyle'] == 'groove') ? 'selected' : ''; ?>>Grooved</option>
272  <option value="ridge" <?php echo ($_GET['f_borderStyle'] == 'ridge') ? 'selected' : ''; ?>>Ridged</option>
273  <option value="inset" <?php echo ($_GET['f_borderStyle'] == 'inset') ? 'selected' : ''; ?>>Inset</option>
274  <option value="outset" <?php echo ($_GET['f_borderStyle'] == 'outset') ? 'selected' : ''; ?>>Outset</option>
275  </select>
276  &nbsp;
277  <input type="text" id="f_borderWidth" size="5" value="<?php echo htmlspecialchars($_GET['f_borderWidth']); ?>" /> px
278  </td>
279  </tr>
280  </table>
281  </fieldset>
282  </td>
283  </tr>
284  </table>
285 
286  <div style="text-align: right;">
287  <hr />
288  <button type="button" name="ok" onclick="return onOK();">OK</button>
289  &nbsp;
290  <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
291  </div>
292  </form>
293  </body>
294 </html>