PluginProbe
Comments Extra Fields For Post,Pages and CPT / 1.7
Comments Extra Fields For Post,Pages and CPT v1.7
trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 2.2 2.3 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 5.0 5.1 5.2
wp-comment-fields / templates / admin / file-meta.php

file-meta.php in Comments Extra Fields For Post,Pages and CPT 1.7, at templates/admin/file-meta.php

470 lines 16.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * this file is managinga all checkout fieds in three sections
4 * 1- Billing
5 * 2- Shipping
6 * 3- More
7 */
8
9
10 global $nmwpcomment;
11 ?>
12
13 <style>
14 <!--
15 .clearfix{
16 clear: both;
17 display:block;
18 }
19
20 #nmcontact-form-meta{
21 width: 100%;
22 }
23
24 #container-1 {
25 width: 40%;
26 border: 1px solid #E6E6E6;
27 }
28
29 .s-font {
30 font-size: 11px;
31 color: #AFAFAF;
32 margin: 0px;
33 }
34 .headings {
35 vertical-align: top;
36 padding-top: 5px;
37 font-weight: bold;
38 width: 20%;
39 }
40
41 .form-meta-bttons{
42 width: 20%;
43 border: 1px solid;
44 padding: 7px;
45 float: left;
46 }
47
48 .form-meta-bttons table{
49 display:none;
50 }
51
52 .form-meta-bttons > p{border: none; text-align: justify}
53
54 .form-meta-bttons .top-heading-text{ float:left;padding:8px 0 0 5px;cursor: move;display: block;width: 90%;}
55 .form-meta-bttons .top-heading-icons{ float:right;}
56
57 .form-meta-setting .top-heading-text{ float:left;padding:0;cursor: move;display: block;width: 90%;}
58 .form-meta-setting .top-heading-icons{ float:right;}
59
60
61 .form-meta-setting{
62 float: right;
63 width: 75%;
64 /* border: 1px solid #d3d3d3; */
65 min-height: 350px;
66 }
67
68 .form-meta-setting table{
69 display: table-cell;
70 }
71
72 .form-meta-setting table tr{line-height: 15px}
73
74 .form-meta-setting h3{
75 padding: 5px;
76 font-weight: bold;
77 cursor: pointer;
78 }
79
80 .form-meta-setting ul{
81 min-height: 300px;
82 /* border: 1px solid; */
83 }
84
85 .input-type-item{
86 text-align: center;
87 border: 1px solid;
88 line-height: 0px;
89 cursor: move;
90 }
91
92 .form-meta-setting .input-item-heading{
93 cursor: move;
94 border-bottom-color: #dfdfdf;
95 text-shadow: #fff 0 1px 0;
96 -webkit-box-shadow: 0 1px 0 #fff;
97 box-shadow: 0 1px 0 #fff;
98 background: #f1f1f1;
99 background-image: -webkit-gradient(linear,left bottom,left top,from(#ececec),to(#f9f9f9));
100 background-image: -webkit-linear-gradient(bottom,#ececec,#f9f9f9);
101 background-image: -moz-linear-gradient(bottom,#ececec,#f9f9f9);
102 background-image: -o-linear-gradient(bottom,#ececec,#f9f9f9);
103 background-image: linear-gradient(to top,#ececec,#f9f9f9);
104 }
105
106 .table-column-title{width: 20%}
107 .table-column-input{width: 25%}
108 .table-column-desc{font-size: 11px;color: #AFAFAF;}
109
110 table#form-main-settings td{padding: 10px 0};
111 //-->
112 </style>
113
114 <h2>
115 <?php echo __('File meta settings', 'nm-wpcomments')?>
116 </h2>
117
118 <div id="cofm-tabs">
119
120 <!-- File meta field -->
121 <div id="billing-f">
122
123 <div id="billing-section-fields">
124
125 <div class="form-meta-bttons">
126 <p>
127 <?php _e('select input type below and drag it on right side. Then set more options', 'nm-wpcomments')?>
128 </p>
129
130 <ul id="nm-input-types">
131 <?php
132
133 $comment_meta = get_option('wpcomment_meta');
134 //filemanager_pa($comment_meta);
135
136 $supported_types = array('text', 'textarea', 'select', 'radio', 'checkbox', 'date', 'masked');
137
138 foreach ( $nmwpcomment -> inputs as $type => $meta ) {
139
140 if(in_array($type, $supported_types)){
141
142 echo '<li class="input-type-item" data-inputtype="' . $type . '">';
143 echo '<div><h3><span class="top-heading-text">' . $meta -> title . '</span>';
144 echo '<span class="top-heading-icons ui-icon ui-icon-arrow-4"></span>';
145 echo '<span class="top-heading-icons ui-icon-placehorder"></span>';
146 echo '<span style="clear:both;display:block"></span>';
147 echo '</h3>';
148
149 // this function Defined below
150 echo render_input_settings ( $meta -> settings, false );
151
152 echo '</div></li>';
153 }
154 }
155 ?>
156 </ul>
157 </div>
158
159
160 <div class="form-meta-setting postbox-container">
161
162 <div class="postbox">
163 <h3>
164 <span style="float: left"><?php _e('Drage form fields here', 'nm-wpcomments')?></span>
165 <span style="float: right"><span style="float: right"
166 title="<?php _e('Collapse all', 'nm-wpcomments')?>"
167 class="ui-icon ui-icon-circle-triangle-n"></span><span
168 title="<?php _e('Expand all', 'nm-wpcomments')?>"
169 class="ui-icon ui-icon-circle-triangle-s"></span></span> <span
170 class="clearfix"></span>
171 </h3>
172 <div class="inside" style="background-color: #fff;">
173 <ul id="file-meta-input-holder">
174 <?php render_existing_form_meta($comment_meta, $nmwpcomment -> inputs)?>
175 </ul>
176 </div>
177 </div>
178
179 <p>
180 <button class="button-primary button" onclick="save_file_meta()"><?php _e('Save all changes', 'nm-wpcomments')?></button>
181 <span id="nm-saving-form"></span>
182 </p>
183
184 </div>
185
186 <div class="clearfix"></div>
187 </div>
188
189
190 </div>
191
192 <!-- File meta field -->
193
194
195 </div>
196
197 <!-- ui dialogs -->
198 <div id="remove-meta-confirm"
199 title="<?php _e('Are you sure?', 'nm-wpcomments')?>">
200 <p>
201 <span class="ui-icon ui-icon-alert"
202 style="float: left; margin: 0 7px 20px 0;"></span>
203 <?php _e('Are you sure to remove this input field?', 'nm-personalizedproduct')?></p>
204 </div>
205 <?php
206
207
208 function render_input_settings($settings, $values = '') {
209
210 $setting_html = '<table>';
211 foreach ( $settings as $meta_type => $data ) {
212
213 // nm_personalizedproduct_pa($data);
214 $colspan = ($data ['type'] == 'html-conditions' ? 'colspan="2"' : '');
215
216
217 $setting_html .= '<tr>';
218 $setting_html .= '<td class="table-column-title">' . $data ['title'] . '</td>';
219
220 $data_options = (isset( $data ['options'] ) ? $data ['options'] : '' );
221 if ($values){
222 $meta_value = (isset( $values [$meta_type] ) ? $values [$meta_type] : '' );
223 $setting_html .= '<td '.$colspan.' class="table-column-input" data-type="' . $data ['type'] . '" data-name="' . $meta_type . '">' . render_input_types ( $data ['type'], $meta_type, $meta_value, $data_options ) . '</td>';
224 }else{
225
226 $setting_html .= '<td '.$colspan.' class="table-column-input" data-type="' . $data ['type'] . '" data-name="' . $meta_type . '">' . render_input_types ( $data ['type'], $meta_type, '', $data_options ) . '</td>';
227 }
228
229
230 //removing the desc column for type: html-conditions
231 if ($data ['type'] != 'html-conditions') {
232 $setting_html .= '<td class="table-column-desc">' . $data ['desc'] . '</td>';;
233 }
234
235 $setting_html .= '</tr>';
236 }
237
238 $setting_html .= '</table>';
239
240 return $setting_html;
241 }
242
243 /*
244 * this function is rendring input field for settings
245 */
246 function render_input_types($type, $name, $value = '', $options = '') {
247 global $nmwpcomment;
248 $html_input = '';
249
250 // var_dump($value);
251 if(!is_array($value))
252 $value = stripslashes($value);
253
254 switch ($type) {
255
256 case 'text' :
257 $html_input .= '<input type="text" name="' . $name . '" value="' . esc_html( $value ). '">';
258 break;
259
260 case 'textarea' :
261 $html_input .= '<textarea name="' . $name . '">' . esc_html( $value ) . '</textarea>';
262 break;
263
264 case 'select' :
265 $html_input .= '<select name="' . $name . '">';
266 foreach ( $options as $key => $val ) {
267 $selected = ($key == $value) ? 'selected="selected"' : '';
268 $html_input .= '<option value="' . $key . '" ' . $selected . '>' . esc_html( $val ) . '</option>';
269 }
270 $html_input .= '</select>';
271 break;
272
273 case 'paired' :
274
275 if($value){
276 foreach ($value as $option){
277 $html_input .= '<div class="data-options" style="border: dashed 1px;">';
278 $html_input .= '<input type="text" name="options[option]" value="'.$option['option'].'" placeholder="'.__('option','nm-wpcomments').'">';
279 $html_input .= '<input type="text" name="options[price]" value="'.$option['price'].'" placeholder="'.__('price (if any)','nm-wpcomments').'">';
280 $html_input .= '<img class="add_option" src="'.$nmwpcomment->plugin_meta['url'].'/images/plus.png" title="add rule" alt="add rule" style="cursor:pointer; margin:0 3px;">';
281 $html_input .= '<img class="remove_option" src="'.$nmwpcomment->plugin_meta['url'].'/images/minus.png" title="remove rule" alt="remove rule" style="cursor:pointer; margin:0 3px;">';
282 $html_input .= '</div>';
283 }
284 }else{
285 $html_input .= '<div class="data-options" style="border: dashed 1px;">';
286 $html_input .= '<input type="text" name="options[option]" placeholder="'.__('option','nm-wpcomments').'">';
287 $html_input .= '<input type="text" name="options[price]" placeholder="'.__('price (if any)','nm-wpcomments').'">';
288 $html_input .= '<img class="add_option" src="'.$nmwpcomment->plugin_meta['url'].'/images/plus.png" title="add rule" alt="add rule" style="cursor:pointer; margin:0 3px;">';
289 $html_input .= '<img class="remove_option" src="'.$nmwpcomment->plugin_meta['url'].'/images/minus.png" title="remove rule" alt="remove rule" style="cursor:pointer; margin:0 3px;">';
290 $html_input .= '</div>';
291 }
292
293 break;
294
295 case 'checkbox' :
296
297 if ($options) {
298 foreach ( $options as $key => $val ) {
299
300 parse_str ( $value, $saved_data );
301 $checked = '';
302 $editing_tools = (isset( $saved_data ['editing_tools'] ) ? $saved_data ['editing_tools'] : '');
303 if ($editing_tools) {
304 if (in_array($key, $editing_tools)) {
305 $checked = 'checked="checked"';
306 }
307 }
308 // $html_input .= '<option value="' . $key . '" ' . $selected . '>' . $val . '</option>';
309 $html_input .= '<input type="checkbox" value="' . $key . '" name="' . $name . '[]" ' . $checked . '> ' . $val . '<br>';
310 }
311 } else {
312 $checked = ($value != '' ? 'checked = "checked"' : '' );
313 $html_input .= '<input type="checkbox" name="' . $name . '" ' . $checked . '>';
314 }
315 break;
316
317 case 'html-conditions' :
318
319 // nm_personalizedproduct_pa($value);
320 $rule_i = 1;
321 if($value){
322
323
324 $visibility_show = ($value['visibility'] == 'Show') ? 'selected="selected"' : '';
325 $visibility_hide = ($value['visibility'] == 'Hide') ? 'selected="selected"' : '';
326
327 $html_input = '<select name="condition_visibility">';
328 $html_input .= '<option '.$visibility_show.'>'.__('Show','nm-wpcomments').'</option>';
329 $html_input .= '<option '.$visibility_hide.'>'.__('Hide', 'nm-wpcomments').'</option>';
330 $html_input .= '</select> ';
331
332
333 $html_input .= __('only if', 'nm-wpcomments');
334
335 $bound_all = ($value['bound'] == 'All') ? 'selected="selected"' : '';
336 $bound_any = ($value['bound'] == 'Any') ? 'selected="selected"' : '';
337
338 $html_input .= '<select name="condition_bound">';
339 $html_input .= '<option '.$bound_all.'>'.__('All','nm-wpcomments').'</option>';
340 $html_input .= '<option '.$bound_any.'>'.__('Any', 'nm-wpcomments').'</option>';
341 $html_input .= '</select> ';
342
343 $html_input .= __(' of the following matches', 'nm-wpcomments');
344
345
346 foreach ($value['rules'] as $condition){
347
348
349 // conditional elements
350 $html_input .= '<div class="webcontact-rules" id="rule-box-'.$rule_i.'">';
351 $html_input .= '<br><strong>'.__('Rule # ', 'nm-wpcomments') . $rule_i++ .'</strong><br>';
352 $html_input .= '<select name="condition_elements" data-existingvalue="'.$condition['elements'].'" onblur="load_conditional_values(this)"></select>';
353
354 // is
355
356 $operator_is = ($condition['operators'] == 'is') ? 'selected="selected"' : '';
357 $operator_not = ($condition['operators'] == 'not') ? 'selected="selected"' : '';
358 $operator_greater = ($condition['operators'] == 'greater then') ? 'selected="selected"' : '';
359 $operator_less = ($condition['operators'] == 'less then') ? 'selected="selected"' : '';
360
361 $html_input .= '<select name="condition_operators">';
362 $html_input .= '<option '.$operator_is.'>'.__('is','nm-wpcomments').'</option>';
363 $html_input .= '<option '.$operator_not.'>'.__('not', 'nm-wpcomments').'</option>';
364 $html_input .= '<option '.$operator_greater.'>'.__('greater then', 'nm-wpcomments').'</option>';
365 $html_input .= '<option '.$operator_less.'>'.__('less then', 'nm-wpcomments').'</option>';
366 $html_input .= '</select> ';
367
368 // conditional elements values
369 $html_input .= '<select name="condition_element_values" data-existingvalue="'.$condition['element_values'].'"></select>';
370 $html_input .= '<img class="add_rule" src="'.$nmwpcomment->plugin_meta['url'].'/images/plus.png" title="add rule" alt="add rule" style="cursor:pointer; margin:0 3px;">';
371 $html_input .= '<img class="remove_rule" src="'.$nmwpcomment->plugin_meta['url'].'/images/minus.png" title="remove rule" alt="remove rule" style="cursor:pointer; margin:0 3px;">';
372 $html_input .= '</div>';
373
374 }
375 }else{
376
377
378 $html_input = '<select name="condition_visibility">';
379 $html_input .= '<option>'.__('Show','nm-wpcomments').'</option>';
380 $html_input .= '<option>'.__('Hide', 'nm-wpcomments').'</option>';
381 $html_input .= '</select> ';
382
383 $html_input .= '<select name="condition_bound">';
384 $html_input .= '<option>'.__('All','nm-wpcomments').'</option>';
385 $html_input .= '<option>'.__('Any', 'nm-wpcomments').'</option>';
386 $html_input .= '</select> ';
387
388 $html_input .= __(' of the following matches', 'nm-wpcomments');
389 // conditional elements
390
391 $html_input .= '<div class="webcontact-rules" id="rule-box-'.$rule_i.'">';
392 $html_input .= '<br><strong>'.__('Rule # ', 'nm-wpcomments') . $rule_i++ .'</strong><br>';
393 $html_input .= '<select name="condition_elements" onblur="load_conditional_values(this)"></select>';
394
395 // is
396
397 $html_input .= '<select name="condition_operators">';
398 $html_input .= '<option>'.__('is','nm-wpcomments').'</option>';
399 $html_input .= '<option>'.__('not', 'nm-wpcomments').'</option>';
400 $html_input .= '<option>'.__('greater then', 'nm-wpcomments').'</option>';
401 $html_input .= '<option>'.__('less then', 'nm-wpcomments').'</option>';
402 $html_input .= '</select> ';
403
404 // conditional elements values
405 $html_input .= '<select name="condition_element_values"></select>';
406 $html_input .= '<img class="add_rule" src="'.$nmwpcomment->plugin_meta['url'].'/images/plus.png" title="add rule" alt="add rule" style="cursor:pointer; margin:0 3px;">';
407 $html_input .= '<img class="remove_rule" src="'.$nmwpcomment->plugin_meta['url'].'/images/minus.png" title="remove rule" alt="remove rule" style="cursor:pointer; margin:0 3px;">';
408 $html_input .= '</div>';
409 }
410
411 break;
412
413 case 'pre-images' :
414
415
416 //$html_input .= '<textarea name="pre_upload_images">'.$pre_uploaded_images.'</textarea>';
417 $html_input .= '<div class="pre-upload-box">';
418 $html_input .= '<input name="pre_upload_image_button" type="button" value="'.__('Select/Upload Image', 'nm-wpcomments').'" />';
419 // nm_personalizedproduct_pa($value);
420 if ($value) {
421 foreach ($value as $pre_uploaded_image){
422
423 $html_input .='<table>';
424 $html_input .= '<tr>';
425 $html_input .= '<td><img width="75" src="'.$pre_uploaded_image['link'].'">';
426 $html_input .= '<input type="hidden" name="pre-upload-link" value="'.$pre_uploaded_image['link'].'"></td>';
427 $html_input .= '<td><input style="width:100px" type="text" value="'.stripslashes($pre_uploaded_image['title']).'" name="pre-upload-title"><br>';
428 //$html_input .= '<input style="width:100px" type="text" value="'.stripslashes($pre_uploaded_image['price']).'" name="pre-upload-price"><br>';
429 $html_input .= '<input style="width:100px; color:red" name="pre-upload-delete" type="button" class="button" value="Delete"><br>';
430 $html_input .= '</td></tr>';
431 $html_input .= '</table><br>';
432
433 }
434 //$pre_uploaded_images = $value;
435 }
436
437 $html_input .= '</div>';
438
439 break;
440 }
441
442 return $html_input;
443 }
444
445
446 /*
447 * this function is rendering the existing form meta
448 */
449 function render_existing_form_meta($product_meta, $types) {
450 if ($product_meta) {
451 foreach ( $product_meta as $key => $meta ) {
452
453 $type = $meta ['type'];
454
455 // nm_personalizedproduct_pa($meta);
456
457 echo '<li data-inputtype="' . $type . '"><div class="postbox">';
458 echo '<h3><span class="top-heading-text">' . $meta ['title'] . ' (' . $type . ')</span>';
459 echo '<span class="top-heading-icons ui-icon ui-icon-carat-2-n-s"></span>';
460 echo '<span class="top-heading-icons ui-icon ui-icon-trash"></span>';
461 echo '<span style="clear:both;display:block"></span></h3>';
462
463 echo render_input_settings ( $types[$type] -> settings, $meta );
464
465 echo '</div></li>';
466 }
467 }
468 }
469
470 ?>