Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a98adbb

Browse files
committedOct 14, 2017
3.0.2; CodeMirror updates for FT3 compatibility
1 parent e19e099 commit a98adbb

File tree

6 files changed

+63
-59
lines changed

6 files changed

+63
-59
lines changed
 

‎code/Module.class.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,19 @@ class Module extends FormToolsModule
2626
protected $author = "Ben Keen";
2727
protected $authorEmail = "ben.keen@gmail.com";
2828
protected $authorLink = "http://formtools.org";
29-
protected $version = "3.0.1";
30-
protected $date = "2017-10-07";
29+
protected $version = "3.0.2";
30+
protected $date = "2017-10-14";
3131
protected $originLanguage = "en_us";
3232
protected $jsFiles = array(
3333
"{MODULEROOT}/scripts/admin.js",
3434
"{FTROOT}/global/scripts/sortable.js",
35-
"{FTROOT}/global/codemirror/js/codemirror.js"
35+
"{FTROOT}/global/codemirror/lib/codemirror.js",
36+
"{FTROOT}/global/codemirror/mode/smarty/smarty.js"
37+
);
38+
protected $cssFiles = array(
39+
"{MODULEROOT}/css/styles.css",
40+
"{FTROOT}/global/codemirror/lib/codemirror.css"
3641
);
37-
protected $cssFiles = array("css/styles.css");
3842

3943
protected $nav = array(
4044
"module_name" => array("index.php", false),

‎css/styles.css

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
}
3535
.export_type_list .header_row .col3 {
3636
width: 350px;
37-
padding-left: 0px;
37+
padding-left: 0;
3838
}
3939
.export_type_list .col3 {
4040
width: 348px;
@@ -56,8 +56,8 @@
5656
border-radius: 4px;
5757
}
5858
.inner_nav ul {
59-
margin: 0px;
60-
padding: 0px;
59+
margin: 0;
60+
padding: 0;
6161
list-style: none;
6262
}
6363
.inner_nav ul li {
@@ -67,8 +67,8 @@
6767

6868
ul.icon_list {
6969
list-style: none;
70-
margin: 0px;
71-
padding: 0px;
70+
margin: 0;
71+
padding: 0;
7272
}
7373
ul.icon_list li {
7474
padding: 2px 4px;
@@ -97,18 +97,18 @@ ul.icon_list li.no_icon {
9797
.overflow_panel {
9898
background-color: white;
9999
border: 1px solid #999999;
100-
border-bottom: 0px;
100+
border-bottom: 0;
101101
width: 95%;
102102
height: 100%;
103103
overflow-y: scroll;
104104
}
105105
.overflow_panel ul {
106106
list-style: none;
107-
margin: 0px;
108-
padding: 0px;
107+
margin: 0;
108+
padding: 0;
109109
}
110110
.overflow_panel ul li {
111-
padding: 2px 0px 2px 2px;
111+
padding: 2px 0 2px 2px;
112112
}
113113
.overflow_panel ul li:hover {
114114
background-color: #efefef;
@@ -121,8 +121,8 @@ ul.icon_list li.no_icon {
121121
display: block;
122122
}
123123
.overflow_panel h2 {
124-
padding: 0px 0px 0px 5px;
125-
margin: 0px;
124+
padding: 0 0 0 5px;
125+
margin: 0;
126126
color: #336699;
127127
}
128128
.overflow_panel .view_group {
@@ -132,3 +132,13 @@ ul.icon_list li.no_icon {
132132
color: #666666;
133133
font-style: italic;
134134
}
135+
136+
.editor_wrapper {
137+
border: 1px solid #999999;
138+
padding: 3px;
139+
width: 555px;
140+
margin-bottom: 10px;
141+
}
142+
.editor_wrapper .CodeMirror {
143+
height: 100%;
144+
}

‎export_groups/page_add_export_type.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
$page_vars["page"] = "add_export_type";
66
$page_vars["export_group_info"] = ExportGroups::getExportGroup($export_group_id);
7-
$page_vars["head_string"] = "<script type=\"text/javascript\" src=\"$root_url/global/codemirror/js/codemirror.js\"></script>";
87
$page_vars["head_title"] = "{$L["module_name"]} - {$L["phrase_add_export_type"]}";
98
$page_vars["export_group_id"] = $export_group_id;
109
$page_vars["head_js"] = "

‎templates/export_groups/tab_add_export_type.tpl

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
<input type="hidden" name="export_group_id" value="{$export_group_id}" />
66

77
<table cellspacing="1" cellpadding="2" border="0">
8-
<tr>
9-
<td width="120" class="medium_grey">{$L.phrase_export_type_name}</td>
10-
<td>
11-
<input type="text" name="export_type_name" value="" style="width:200px" maxlength="50" />
12-
</td>
8+
<tr>
9+
<td width="120" class="medium_grey">{$L.phrase_export_type_name}</td>
10+
<td>
11+
<input type="text" name="export_type_name" value="" style="width:200px" maxlength="50" />
12+
</td>
1313
</tr>
1414
<tr>
1515
<td valign="top" class="medium_grey">{$L.word_visibility}</td>
@@ -26,27 +26,25 @@
2626
<td class="medium_grey">{$L.word_filename}</td>
2727
<td>
2828
<input type="text" name="filename" value="{literal}submissions-{$M}.{$j}.html{/literal}" style="width:200px" maxlength="50" />
29-
<a href="http://modules.formtools.org/export_manager/documentation.php?page=filename_placeholders">{$L.phrase_view_available_placeholders}</a>
29+
<a href="http://modules.formtools.org/export_manager/documentation.php?page=filename_placeholders">{$L.phrase_view_available_placeholders}</a>
3030
</td>
3131
</tr>
32-
</table>
33-
34-
<p class="bold">{$L.phrase_smarty_template}</p>
35-
36-
<div style="border: 1px solid #666666; padding: 3px">
37-
<textarea name="smarty_template" id="smarty_template" style="width:100%; height:340px"></textarea>
38-
</div>
39-
40-
<script type="text/javascript">
41-
var html_editor = new CodeMirror.fromTextArea("smarty_template", {literal}{{/literal}
42-
parserfile: ["parsexml.js"],
43-
path: "{$g_root_url}/global/codemirror/js/",
44-
stylesheet: "{$g_root_url}/global/codemirror/css/xmlcolors.css"
45-
{literal}});{/literal}
46-
</script>
32+
</table>
33+
34+
<p class="bold">{$L.phrase_smarty_template}</p>
35+
36+
<div class="editor_wrapper" style="width: 100%">
37+
<textarea name="smarty_template" id="smarty_template"></textarea>
38+
</div>
39+
40+
<script type="text/javascript">
41+
var html_editor = new CodeMirror.fromTextArea(document.getElementById("smarty_template"), {literal}{{/literal}
42+
mode: "smarty"
43+
{literal}});{/literal}
44+
</script>
4745
4846
<p>
4947
<input type="submit" name="add_export_type" value="{$L.phrase_add_export_type}" />
5048
</p>
5149
52-
</form>
50+
</form>

‎templates/export_groups/tab_edit_export_type.tpl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,13 @@
3636

3737
<p class="bold">{$L.phrase_smarty_template}</p>
3838

39-
<div style="border: 1px solid #666666; padding: 3px">
40-
<textarea name="smarty_template" id="smarty_template" style="width:100%; height:400px">{$export_type.export_type_smarty_template}</textarea>
39+
<div class="editor_wrapper" style="width: 100%">
40+
<textarea name="smarty_template" id="smarty_template">{$export_type.export_type_smarty_template}</textarea>
4141
</div>
4242

4343
<script>
44-
var html_editor = new CodeMirror.fromTextArea("smarty_template", {literal}{{/literal}
45-
parserfile: ["parsexml.js"],
46-
path: "{$g_root_url}/global/codemirror/js/",
47-
stylesheet: "{$g_root_url}/global/codemirror/css/xmlcolors.css"
44+
var html_editor = new CodeMirror.fromTextArea(document.getElementById("smarty_template"), {literal}{{/literal}
45+
mode: "smarty"
4846
{literal}});{/literal}
4947
</script>
5048

‎templates/export_groups/tab_main.tpl

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,13 @@
6969
<td valign="top" class="medium_grey">{$L.word_headers}</td>
7070
<td>
7171

72-
<div style="border: 1px solid #666666; padding: 3px">
73-
<textarea style="width:100%; height: 80px;" name="headers" id="headers"
74-
{if $export_group_info.action == "file"}disabled{/if}>{$export_group_info.headers}</textarea>
72+
<div class="editor_wrapper">
73+
<textarea name="headers" id="headers" {if $export_group_info.action == "file"}disabled{/if}>{$export_group_info.headers}</textarea>
7574
</div>
7675

77-
<script type="text/javascript">
78-
var html_editor = new CodeMirror.fromTextArea("headers", {literal}{{/literal}
79-
parserfile: ["parsexml.js"],
80-
path: "{$g_root_url}/global/codemirror/js/",
81-
stylesheet: "{$g_root_url}/global/codemirror/css/xmlcolors.css"
76+
<script>
77+
var html_editor = new CodeMirror.fromTextArea(document.getElementById("headers"), {literal}{{/literal}
78+
mode: "smarty"
8279
{literal}});{/literal}
8380
</script>
8481
@@ -87,15 +84,13 @@
8784
<tr>
8885
<td valign="top" class="medium_grey">{$L.phrase_smarty_template}</td>
8986
<td>
90-
<div style="border: 1px solid #666666; padding: 3px">
91-
<textarea style="width:100%; height: 300px;" name="smarty_template" id="smarty_template">{$export_group_info.smarty_template}</textarea>
87+
<div class="editor_wrapper">
88+
<textarea name="smarty_template" id="smarty_template">{$export_group_info.smarty_template}</textarea>
9289
</div>
9390
94-
<script type="text/javascript">
95-
var html_editor = new CodeMirror.fromTextArea("smarty_template", {literal}{{/literal}
96-
parserfile: ["parsexml.js"],
97-
path: "{$g_root_url}/global/codemirror/js/",
98-
stylesheet: "{$g_root_url}/global/codemirror/css/xmlcolors.css"
91+
<script>
92+
var html_editor = new CodeMirror.fromTextArea(document.getElementById("smarty_template"), {literal}{{/literal}
93+
mode: "smarty"
9994
{literal}});{/literal}
10095
</script>
10196
</td>

0 commit comments

Comments
 (0)
Please sign in to comment.