Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
edit_div_props.php
1 <?php
28 header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
29 header('Pragma: no-cache');
30 header('Expires: '.gmdate('D, d M Y H:i:s',time()-3600).' GMT');
31 
32 include(dirname(__FILE__).'/header.php');
33 ?>
34 <script type="text/javascript" src="<?php echo sq_web_path('lib')?>/js/general.js"></script>
35 <script type="text/javascript">
36 
37  function popup_init() {
38 
39  var data = owner.bodycopy_current_edit["data"]["attributes"];
40  available_types = owner.bodycopy_current_edit["data"]["available_types"];
41  var f = document.main_form;
42 
43  f.identifier.value = (data['identifier'] == null) ? "" : data['identifier'];
44  f.desc.value = (data['desc'] == null) ? "" : data['desc'];
45  f.dir.value = (data['dir'] == null) ? "" : data['dir'];
46  f.css_class.value = (data['css_class'] == null) ? "" : data['css_class'];
47 
48  css_class_list = owner.bodycopy_current_edit["data"]["available_classes"];
49  if (css_class_list != null) {
50  var checked = 0;
51  var i = 1;
52  for (var key in css_class_list) {
53  f.css_class_list.options[i] = new Option(css_class_list[key], key);
54  if (key == f.css_class.value) {
55  f.css_class_list.value = f.css_class.value;
56  checked = 1;
57  }
58  i++;
59  }
60  if (checked == 0) {
61  f.css_class_list.options[0].value = f.css_class.value;
62  }
63  }
64 
65  f.divid.value = owner.bodycopy_current_edit["data"]["divid"];
66  f.bodycopy_name.value = owner.bodycopy_current_edit["bodycopy_name"];
67  owner.highlight_combo_value(f.layout_type, data['layout_type']);
68 
69  // remove the existing values
70  for(var i = f.content_type.options.length - 1; i >= 0; i--) {
71  f.content_type.options[i] = null;
72  }
73  var i = 0;
74 
75  // add default "Leave Unchanged" value to the top
76  f.content_type.options[i] = new Option('<?php echo translate('content_type_no_change'); ?>', "");
77  i++;
78  for(var key in available_types) {
79  if (available_types[key] == null) continue;
80  if(available_types[key]["name"] != null) {
81  f.content_type.options[i] = new Option(available_types[key]["name"], key);
82  i++;
83  }
84  }
85 
86  if (typeof data["content_type"] == 'undefined' && typeof available_types['content_type_wysiwyg'] != 'undefined')
87  data["content_type"] = 'content_type_wysiwyg';
88  owner.highlight_combo_value(f.content_type, '');
89  f.disable_keywords.checked = (data["disable_keywords"] == "1");
90 
91  }// end popup_init()
92 
93  function popup_save(f) {
94  var data = new Object();
95  data["identifier"] = owner.form_element_value(f.identifier);
96  data["desc"] = owner.form_element_value(f.desc);
97  data["css_class"] = owner.form_element_value(f.css_class);
98  data["layout_type"] = owner.form_element_value(f.layout_type);
99  data["content_type"] = owner.form_element_value(f.content_type);
100  data["disable_keywords"] = owner.form_element_value(f.disable_keywords);
101  data["dir"] = owner.form_element_value(f.dir);
102  if (f.css_class_list.options.length > 1) {
103  classes = new Array();
104  for(var i = 1; i < f.css_class_list.options.length; i++) {
105  classes.push(f.css_class_list.options[i].value);
106  }
107  data["css_class_list"] = classes;
108  }
109  owner.bodycopy_save_div_properties(data);
110  }
111 
112  function set_class(value) {
113  document.main_form.css_class.value = value;
114  }
115 
116 </script>
117 
118 <div class="title">
119  <?php echo translate('div_properties'); ?>
120 </div>
121 <script type="text/javascript">
122 if (owner.bodycopy_current_edit["can_delete"] == false) { document.getElementById('sq_edit_div_props_delete').innerHTML = '&nbsp;'; }
123 </script>
124 <form name="main_form">
125 <input type="hidden" name="bodycopy_name" value="">
126 <input type="hidden" name="divid" value="">
127 <table width="100%" border="0">
128  <tr>
129  <td>
130  <fieldset>
131  <legend><b><?php echo translate('identification'); ?></b></legend>
132  <table style="width:100%">
133  <tr>
134  <td class="label"><?php echo translate('name'); ?>:</td>
135  <td><input type="text" name="identifier" value="" size="25"></td>
136  </tr>
137  <tr>
138  <td class="label"><?php echo translate('description'); ?>:</td>
139  <td><textarea name="desc" rows="3" size="25" value=""></textarea></td>
140  </tr>
141  </table>
142  </fieldset>
143  <fieldset>
144  <legend><b><?php echo translate('style_information'); ?></b></legend>
145  <table style="width:100%">
146  <tr>
147  <td class="bodycopy-popup-heading"><?php echo translate('presentation'); ?>:</td>
148  <td>
149  <select name="layout_type">
150  <option value="div" ><?php echo translate('block-level'); ?></option>
151  <option value="span"><?php echo translate('inline'); ?></option>
152  <option value="none"><?php echo translate('raw_html'); ?></option>
153  </select>
154  </td>
155  </tr>
156  <tr>
157  <td class="label"><?php echo translate('class'); ?>:</td>
158  <td>
159  <input type="text" name="css_class" value="" size="15"><br />
160  <select name="css_class_list" onchange="set_class(this.value);">
161  <option value=""><?php echo translate('content_type_no_change'); ?></option>
162  </select>
163  </td>
164  </tr>
165  </table>
166  </fieldset>
167  </td>
168  </tr>
169  <tr>
170  <td>
171  <fieldset>
172  <legend><b><?php echo translate('text_direction'); ?></b></legend>
173  <table style="width:100%">
174  <tr>
175  <td class="bodycopy-popup-heading"><?php echo translate('bodycopy_direction'); ?></td>
176  <td>
177  <select name="dir">
178  <option value=""><?php echo translate('content_type_no_change'); ?></option>
179  <option value="ltr"><?php echo translate('bodycopy_left_to_right'); ?></option>
180  <option value="rtl"><?php echo translate('bodycopy_right_to_left'); ?></option>
181  </select>
182  </td>
183  </tr>
184  </table>
185  </fieldset>
186  </td>
187  </tr>
188  <tr>
189  <td>
190  <fieldset>
191  <legend><b><?php echo translate('content_type'); ?></b></legend>
192  <table style="width:100%">
193  <tr>
194  <?php
195  if ($this->status & SQ_SC_STATUS_SAFE_EDITING) {
196  echo translate('changing_div_not_allowed_in_safe_edit');
197  }
198  else {
199  ?>
200  <td class="label"><?php echo translate('content_type'); ?>:</td>
201  <td>
202  <select name="content_type">
203  <option value="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
204  <option value="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
205  <option value="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
206  </select>
207  </td>
208  </tr>
209  <?php
210  }
211  ?>
212  <tr>
213  <td class="label"><?php echo translate('disable_keywords'); ?>:</td>
214  <td><input type="checkbox" name="disable_keywords" value="1"></td>
215  </tr>
216  </table>
217  </fieldset>
218  </td>
219  </tr>
220  <tr>
221  <td>
222  <fieldset>
223  <legend><b><?php echo translate('delete_this_div'); ?></b></legend>
224  <?php
225  // if asset is in safe edit we dont want user to delete it
226  if ($this->status & SQ_SC_STATUS_SAFE_EDITING) {
227  echo translate('delete_this_div_not_allowed_safe_edit');
228  }
229  // if delete div is disabled by user preference, do not print the icon
230  else if ($GLOBALS['SQ_SYSTEM']->getUserPrefs('bodycopy_container', 'SQ_DIV_DISABLE_DELETE') === 'yes'){
231  echo translate('bodycopy_pref_cannot_insert_new');
232  }
233  // else print the icon and let user do as he please
234  else {
235  ?>
236 
237  <table>
238  <tr>
239  <td class="label"><?php echo translate('click_icon_to_delete'); ?>:</td>
240  <td>
241  <?php sq_print_icon(sq_web_path('data').'/asset_types/bodycopy/images/icons/delete.png', 16, 16, 'Delete this Div', 'Delete this Div', 'onclick="owner.bodycopy_delete_div(document.main_form.bodycopy_name.value, document.main_form.divid.value);" style="cursor: pointer;"'); ?>
242  </td>
243  </tr>
244  </table>
245  <?php
246  }
247  ?>
248  </fieldset>
249  </td>
250  </tr>
251  <tr>
252  <td>
253  <div style="text-align: center;">
254  <button type="button" name="ok" onClick="javascript: popup_save(this.form)"><?php echo translate('ok'); ?></button>
255  &nbsp;
256  <button type="button" name="cancel" onClick="javascript: popup_close();"><?php echo translate('cancel'); ?></button>
257  </div>
258  </td>
259  </tr>
260 </table>
261 </form>
262 
263 <?php include(dirname(__FILE__).'/footer.php'); ?>