| @@ -1,4 +1,8 @@ | ||
| 1 | +<?php | |
| 2 | +global $post, $pagenow; | |
| 3 | +$cf7_key = $post->post_name; | |
| 4 | + ?> | |
| 1 | 5 | <h2><?php echo esc_html( __cf7sg( 'Form' ) ); ?></h2> |
| 2 | 6 | <div id="top-tags"> |
| 3 | 7 | <?php |
| 4 | 8 | $tag_generator = WPCF7_TagGenerator::get_instance(); |
| @@ -4,21 +8,92 @@ | ||
| 4 | 8 | $tag_generator = WPCF7_TagGenerator::get_instance(); |
| 5 | 9 | $tag_generator->print_buttons(); |
| 6 | 10 | ?> |
| 7 | 11 | </div> |
| 8 | -<div id="form-editor-tabs"> | |
| 9 | - <ul> | |
| 10 | - <li><a href="#cf7-editor-grid"><?=__('Grid','cf7-grid-layout')?></a></li> | |
| 11 | - <li><a href="#cf7-codemirror"><?=__('Text','cf7-grid-layout')?></a></li> | |
| 12 | - </ul> | |
| 13 | - <div id="cf7-editor-grid"> | |
| 14 | - <div id="grid-form"></div> | |
| 12 | +<?php require_once plugin_dir_path( __FILE__ ) .'helpers/cf7sg-js-events.php'; ?> | |
| 13 | +<div id="editors"> | |
| 14 | + <?php | |
| 15 | + $js_file = str_replace(ABSPATH, '', get_stylesheet_directory()."/js/{$cf7_key}.js"); | |
| 16 | + $js_file_exists = file_exists(ABSPATH.$js_file); | |
| 17 | + $jscm_required = $js_file_exists ? ' required':''; | |
| 18 | + $editor_disable = ('post-new.php'==$pagenow) ? ' disabled':''; | |
| 19 | + $css_file = str_replace(ABSPATH, '', get_stylesheet_directory()."/css/{$cf7_key}.css"); | |
| 20 | + $css_file_exists = file_exists(ABSPATH.$css_file); | |
| 21 | + $csscm_required = $css_file_exists ? ' required':''; | |
| 22 | + ?> | |
| 23 | + | |
| 24 | + <div id="optional-editors"> | |
| 25 | + <a class="button jstab cf7sg-cmtab<?=$jscm_required.$editor_disable?>" href="javascript:void(0);"><?=__('Add custom JS','cf7-grid-layout')?></a> | |
| 26 | + <div id="cf7-js-codemirror" class="display-none"> | |
| 27 | + <div class="codemirror-theme"><?=__('Editor theme:','cf7-grid-layout')?> | |
| 28 | + <?php $user_js_theme = get_user_meta(get_current_user_id(),'_cf7sg_js_cm_theme', true); ?> | |
| 29 | + <label> | |
| 30 | + <input type="radio" value="light" name="cf7sg_js_codemirror_theme"<?=('light'==$user_js_theme ? ' checked' : '')?>/><?=__('Light','cf7-grid-layout')?> | |
| 31 | + </label> | |
| 32 | + <label> | |
| 33 | + <input type="radio" value="dark" name="cf7sg_js_codemirror_theme" <?=('dark'==$user_js_theme ? ' checked' : '')?>/><?=__('Dark','cf7-grid-layout')?> | |
| 34 | + </label> | |
| 35 | + <input type="hidden" name="cf7sg_prev_js_file" class="prev-file" /> | |
| 36 | + </div> | |
| 37 | + <textarea id="cf7-form-js" class="cf7-sg-hidden" data-file="<?=__('File','cf7-grid-layout')?> >> /<?=$js_file?>" name="cf7sg_js_file" data-form=""> | |
| 38 | + <?php | |
| 39 | + if($js_file_exists){ | |
| 40 | + $file = file_get_contents(ABSPATH.$js_file); | |
| 41 | + echo esc_textarea( $file ); | |
| 42 | + }else{ | |
| 43 | + do_action('cf7sg_default_custom_js_template', $cf7_key); | |
| 44 | + } | |
| 45 | + ?> | |
| 46 | + </textarea> | |
| 47 | + </div> | |
| 48 | + <a class="button csstab cf7sg-cmtab<?=$csscm_required.$editor_disable?>" href=""><?=__('Add custom CSS','cf7-grid-layout')?></a> | |
| 49 | + <div id="cf7-css-codemirror" class="display-none"> | |
| 50 | + <div class="codemirror-theme"><?=__('Editor theme:','cf7-grid-layout')?> | |
| 51 | + <?php $user_css_theme = get_user_meta(get_current_user_id(),'_cf7sg_css_cm_theme', true); ?> | |
| 52 | + <label> | |
| 53 | + <input type="radio" value="light" name="cf7sg_css_codemirror_theme"<?=('light'==$user_css_theme ? ' checked' : '')?>/><?=__('Light','cf7-grid-layout')?> | |
| 54 | + </label> | |
| 55 | + <label> | |
| 56 | + <input type="radio" value="dark" name="cf7sg_css_codemirror_theme" <?=('dark'==$user_css_theme ? ' checked' : '')?>/><?=__('Dark','cf7-grid-layout')?> | |
| 57 | + </label> | |
| 58 | + <input type="hidden" name="cf7sg_prev_css_file" class="prev-file" /> | |
| 59 | + </div> | |
| 60 | + <textarea id="cf7-form-css" class="cf7-sg-hidden" data-file="<?=__('File','cf7-grid-layout')?> >> /<?=$css_file?>" name="cf7sg_css_file" data-form=""> | |
| 61 | + <?php | |
| 62 | + if($css_file_exists){ | |
| 63 | + $file = file_get_contents(ABSPATH.$css_file); | |
| 64 | + echo esc_textarea( $file ); | |
| 65 | + }else{ | |
| 66 | + do_action('cf7sg_default_custom_css_template', $cf7_key); | |
| 67 | + } | |
| 68 | + ?> | |
| 69 | + </textarea> | |
| 70 | + </div> | |
| 15 | 71 | </div> |
| 16 | - <div id="cf7-codemirror"> | |
| 17 | - <textarea id="wpcf7-form" class="cf7-sg-hidden codemirror-cf7-update"> | |
| 18 | - <?= esc_textarea( $form_post->prop( 'form' ) ); | |
| 19 | - /** @since 2.8.3 rename codemirror textarea##wpcf7-form adn initially popullate with form. */?> | |
| 20 | - </textarea> | |
| 72 | + | |
| 73 | + <div id="form-editor-tabs"> | |
| 74 | + <ul> | |
| 75 | + <li><a class="button" href="#cf7-editor-grid"><?=__('Grid','cf7-grid-layout')?></a></li> | |
| 76 | + <li><a class="button" href="#cf7-codemirror"><HTML/></a></li> | |
| 77 | + </ul> | |
| 78 | + <div id="cf7-editor-grid"> | |
| 79 | + <div id="grid-form"></div> | |
| 80 | + </div> | |
| 81 | + <div id="cf7-codemirror"> | |
| 82 | + <div class="codemirror-theme"><?=__('Editor theme:','cf7-grid-layout')?> | |
| 83 | + <?php $user_theme = get_user_meta(get_current_user_id(),'_cf7sg_cm_theme', true);?> | |
| 84 | + <label> | |
| 85 | + <input type="radio" value="light" name="cf7sg_codemirror_theme"<?=('light'==$user_theme ? ' checked' : '')?>/><?=__('Light','cf7-grid-layout')?> | |
| 86 | + </label> | |
| 87 | + <label> | |
| 88 | + <input type="radio" value="dark" name="cf7sg_codemirror_theme" <?=('dark'==$user_theme ? ' checked' : '')?>/><?=__('Dark','cf7-grid-layout')?> | |
| 89 | + </label> | |
| 90 | + </div> | |
| 91 | + <textarea id="wpcf7-form" class="cf7-sg-hidden codemirror-cf7-update"> | |
| 92 | + <?= esc_textarea( $form_post->prop( 'form' ) ); | |
| 93 | + /** @since 2.8.3 rename codemirror textarea##wpcf7-form adn initially popullate with form. */?> | |
| 94 | + </textarea> | |
| 95 | + </div> | |
| 21 | 96 | </div> |
| 22 | 97 | </div> |
| 23 | 98 | <textarea id="wpcf7-form-hidden" name="wpcf7-form" class="hidden large-text code" data-config-field="form.body"><?= esc_textarea( $form_post->prop( 'form' ) );?></textarea> |
| 24 | 99 | <!-- cf7sg - track embeded sub-forms --> |
| @@ -25,12 +100,16 @@ | ||
| 25 | 100 | <input type="hidden" value="" id="cf7sg-embeded-forms" name="cf7sg-embeded-forms" /> |
| 26 | 101 | <input type="hidden" value="" id="cf7sg-tabs-fields" name="cf7sg-tabs-fields" /> |
| 27 | 102 | <input type="hidden" value="" id="cf7sg-table-fields" name="cf7sg-table-fields" /> |
| 28 | 103 | <input type="hidden" value="" id="cf7sg-toggle-fields" name="cf7sg-toggle-fields" /> |
| 104 | +<input type="hidden" value="" id="cf7sg-tabbed-toggles" name="cf7sg-tabbed-toggles" /> | |
| 105 | +<input type="hidden" value="" id="cf7sg-grouped-toggles" name="cf7sg-grouped-toggles" /> | |
| 106 | +<div id="bottom-tags"> | |
| 29 | 107 | <?php |
| 30 | 108 | $tag_generator = WPCF7_TagGenerator::get_instance(); |
| 31 | 109 | $tag_generator->print_buttons(); |
| 32 | 110 | ?> |
| 111 | +</div> | |
| 33 | 112 | <div id="grid-row"> |
| 34 | 113 | <div class="container"> |
| 35 | 114 | <div class="row"> |
| 36 | 115 | <div class="columns full"></div> |
| @@ -60,8 +139,9 @@ | ||
| 60 | 139 | <label class="cf7-sg-hidden tabs-row-label unique-mod"> |
| 61 | 140 | <?=__('Tabbed section','cf7-grid-layout')?> |
| 62 | 141 | <input type="checkbox" class="tabs-row" /> |
| 63 | 142 | </label> |
| 143 | + <a class="display-none button make-grid row-control" href="javascript:void(0);"><?= __('Make grid', 'cf7-grid-layout');?></a> | |
| 64 | 144 | </div> |
| 65 | 145 | </div> |
| 66 | 146 | </div> |
| 67 | 147 | </div> |
| @@ -112,14 +192,21 @@ | ||
| 112 | 192 | <span class="copy-helper"><?=__('Click to copy!','cf7-grid-layout')?></span> |
| 113 | 193 | <p><?=__('Click-to-copy & paste in your <em>functions.php</em> file.','cf7-grid-layout')?></p> |
| 114 | 194 | <ul class="cf7sg-helper-list"></ul> |
| 115 | 195 | </div> |
| 196 | +<div id="grid-js-helper"> | |
| 197 | + <span class="dashicons dashicons-no-alt"></span> | |
| 198 | + <span class="copy-helper"><?=__('Click to copy!','cf7-grid-layout')?></span> | |
| 199 | + <p class="js-help"><?= sprintf(__('Click-to-copy & paste in<br/><em><theme folder>/js/%s.js</em> file.','cf7-grid-layout'), $cf7_key);?></p> | |
| 200 | + <ul class="cf7sg-helper-list"></ul> | |
| 201 | +</div> | |
| 116 | 202 | <div id="grid-col"> |
| 117 | 203 | <div class="grid-column"> |
| 118 | 204 | <span class="dashicons dashicons-edit column-control"></span> |
| 119 | 205 | <span class="dashicons dashicons-no-alt column-control"></span> |
| 120 | 206 | <span class="dashicons dashicons-plus column-control"></span> |
| 121 | - <span class="dashicons dashicons-controls-repeat column-control" style="display:none;"></span> | |
| 207 | + <span class="dashicons php-icon column-control" style="display:none;"></span> | |
| 208 | + <span class="js-icon column-control" style="display:none;"></span> | |
| 122 | 209 | <span class="dashicons dashicons-trash column-control"></span> |
| 123 | 210 | <span class="dashicons dashicons-move column-control"></span> |
| 124 | 211 | <span class="icon-code column-control"></span> |
| 125 | 212 | <div class="grid-controls"> |
| @@ -150,12 +237,14 @@ | ||
| 150 | 237 | <option value="two-thirds"><?=__('eight (2/3<sup>rds</sup>)','cf7-grid-layout')?></option> |
| 151 | 238 | <option value="nine"><?=__('nine (3/4<sup>ths</sup>)','cf7-grid-layout')?></option> |
| 152 | 239 | <option value="ten"><?=__('ten (5/6<sup>ths</sup>)','cf7-grid-layout')?></option> |
| 153 | 240 | <option value="eleven"><?=__('eleven (11/12<sup>ths</sup>)','cf7-grid-layout')?></option> |
| 154 | - <option value="full" selected><?=__('full wifth','cf7-grid-layout')?></option> | |
| 241 | + <option value="full" selected><?=__('full width','cf7-grid-layout')?></option> | |
| 155 | 242 | </select> |
| 156 | - <a id="new-row" class="button make-grid" href="javascript:void(0);"><?= __('Make grid', 'cf7-grid-layout');?></a> | |
| 243 | + <a id="new-row" class="button make-grid column-control" href="javascript:void(0);"><?= __('Make grid', 'cf7-grid-layout');?></a> | |
| 157 | 244 | <a class="button external-form" href="javascript:void(0);"><?= __('Insert form', 'cf7-grid-layout');?></a> |
| 245 | + <label class="display-none accordion-label grouping-option"><input type="checkbox" name="grouping-option" class="accordion-rows column-control" /><?=__('Enable accordion','cf7-smart-grid')?></label><span class="popup display-none"><?= __('Group collapsible rows as jQuery accordion','cf7-smart-grid')?></span> | |
| 246 | + <label class="display-none slider-label grouping-option"><input type="checkbox" name="grouping-option" class="slider-rows column-control" /><?=__('Enable slider','cf7-smart-grid')?></label><span class="popup display-none"><?= __('Convert collapsible rows into sides','cf7-smart-grid')?></span> | |
| 158 | 247 | </div> |
| 159 | 248 | <div class="cf7-field-label cf7-field-inner"> |
| 160 | 249 | <p class="content"><?=__('Field label','cf7-grid-layout')?></p> |
| 161 | 250 | <input type="text" placeholder="<?=__('Field label','cf7-grid-layout')?>"/> |
| @@ -162,9 +251,9 @@ | ||
| 162 | 251 | <span class="dashicons dashicons-no-alt field-control"></span> |
| 163 | 252 | </div> |
| 164 | 253 | <div class="cf7-field-type cf7-field-inner"> |
| 165 | 254 | <p class="content"><?=__('[select a field]','cf7-grid-layout')?></p> |
| 166 | - <textarea placeholder="<?=__('select a field','cf7-grid-layout')?>"></textarea> | |
| 255 | + <textarea class="field-entry" placeholder="<?=__('select a field','cf7-grid-layout')?>"></textarea> | |
| 167 | 256 | <span class="dashicons dashicons-no-alt field-control"></span> |
| 168 | 257 | </div> |
| 169 | 258 | <div class="cf7-field-tip cf7-field-inner"> |
| 170 | 259 | <p class="content"><?=__('describe your field','cf7-grid-layout')?></p> |