Skip to content

Commit 8f2c64f

Browse files
committed
sync
1 parent ae24b99 commit 8f2c64f

4 files changed

Lines changed: 16 additions & 22 deletions

File tree

add.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@
1717
list($success, $message) = Fields::addField($_POST, $L);
1818
}
1919

20-
$page_vars = array();
21-
$page_vars["head_title"] = $L["phrase_add_field"];
22-
$page_vars["js_messages"] = array("word_delete");
20+
$page_vars = array(
21+
"g_success" => $success,
22+
"g_message" => $message,
23+
"head_title" => $L["phrase_add_field"],
24+
"js_messages" => array("word_delete")
25+
);
26+
2327
$page_vars["head_js"] =<<< EOF
2428
var rules = [];
2529
rules.push("required,template_hook,{$L["validation_no_template_hook"]}");

code/Fields.class.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public static function addField($info, $L)
5757
if (!isset($info["field_option_text_$i"]) || empty($info["field_option_text_$i"])) {
5858
continue;
5959
}
60-
6160
$option_text = $info["field_option_text_$i"];
6261

6362
$db->query("
@@ -391,9 +390,9 @@ public static function displayFields($location, $template_vars)
391390
return "";
392391
}
393392

394-
$smarty = Core::$smarty;
393+
$smarty = new Smarty();
394+
$smarty->setCompileDir("$root_dir/themes/default/cache/");
395395
$smarty->setTemplateDir("$root_dir/modules/extended_client_fields/smarty_plugins/");
396-
// $smarty->setCompileDir("$root_dir/themes/default/cache/");
397396

398397
// now look through the incoming client settings, passed through $template_vars and determine
399398
// the selected value for each field
@@ -665,16 +664,15 @@ private static function getNextFieldOrder ()
665664
$db->query("
666665
SELECT field_order
667666
FROM {PREFIX}module_extended_client_fields
668-
ORDER BY field_order
669-
DESC LIMIT 1
667+
ORDER BY field_order DESC LIMIT 1
670668
");
671669
$db->execute();
672670

673-
$result = $db->fetch(PDO::FETCH_COLUMN);
671+
$count = $db->fetch(PDO::FETCH_COLUMN);
674672

675673
$next_order = 1;
676-
if (!empty($result)) {
677-
$next_order = $result["field_order"] + 1;
674+
if (!empty($count)) {
675+
$next_order = $count + 1;
678676
}
679677

680678
return $next_order;

scripts/field_options.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ ecf_ns.change_field_type = function(choice) {
108108
}
109109
if (choice == "radios" || choice == "checkboxes" || choice == "select" || choice == "multi-select") {
110110
if ($("#field_options_div")[0].style.display == "none") {
111-
$("#field_options_div").show(200);
111+
$("#field_options_div").show();
112112
}
113113
if (choice == "radios" || choice == "checkboxes") {
114114
$("#fo1, #fo2").attr("disabled", "");
@@ -123,7 +123,7 @@ ecf_ns.change_field_type = function(choice) {
123123
}
124124
} else {
125125
if ($("#field_options_div")[0].style.display != "none") {
126-
$("#field_options_div").hide(200);
126+
$("#field_options_div").hide();
127127
}
128128
}
129129

templates/add.tpl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,7 @@
127127
<th>{$LANG.phrase_display_text}</th>
128128
<th class="del"></th>
129129
</tr>
130-
{foreach from=$field_info.options item=option name=row}
131-
{assign var=count value=$smarty.foreach.row.iteration}
132-
<tr id="row_{$count}">
133-
<td class="medium_grey" align="center" id="field_option_{$count}_order">{$count}</td>
134-
<td><input type="text" style="width:99%" name="field_option_text_{$count}" value="{$option.option_text|escape}" /></td>
135-
<td class="del"><a href="#" onclick="ecf_ns.delete_field_option({$count})"></a></td>
136-
</tr>
137-
{/foreach}
138-
</tbody>
130+
</tbody>
139131
</table>
140132

141133
<div>

0 commit comments

Comments
 (0)