Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
benkeen committed Oct 18, 2017
1 parent ae24b99 commit 8f2c64f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
10 changes: 7 additions & 3 deletions add.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
list($success, $message) = Fields::addField($_POST, $L);
}

$page_vars = array();
$page_vars["head_title"] = $L["phrase_add_field"];
$page_vars["js_messages"] = array("word_delete");
$page_vars = array(
"g_success" => $success,
"g_message" => $message,
"head_title" => $L["phrase_add_field"],
"js_messages" => array("word_delete")
);

$page_vars["head_js"] =<<< EOF
var rules = [];
rules.push("required,template_hook,{$L["validation_no_template_hook"]}");
Expand Down
14 changes: 6 additions & 8 deletions code/Fields.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public static function addField($info, $L)
if (!isset($info["field_option_text_$i"]) || empty($info["field_option_text_$i"])) {
continue;
}

$option_text = $info["field_option_text_$i"];

$db->query("
Expand Down Expand Up @@ -391,9 +390,9 @@ public static function displayFields($location, $template_vars)
return "";
}

$smarty = Core::$smarty;
$smarty = new Smarty();
$smarty->setCompileDir("$root_dir/themes/default/cache/");
$smarty->setTemplateDir("$root_dir/modules/extended_client_fields/smarty_plugins/");
// $smarty->setCompileDir("$root_dir/themes/default/cache/");

// now look through the incoming client settings, passed through $template_vars and determine
// the selected value for each field
Expand Down Expand Up @@ -665,16 +664,15 @@ private static function getNextFieldOrder ()
$db->query("
SELECT field_order
FROM {PREFIX}module_extended_client_fields
ORDER BY field_order
DESC LIMIT 1
ORDER BY field_order DESC LIMIT 1
");
$db->execute();

$result = $db->fetch(PDO::FETCH_COLUMN);
$count = $db->fetch(PDO::FETCH_COLUMN);

$next_order = 1;
if (!empty($result)) {
$next_order = $result["field_order"] + 1;
if (!empty($count)) {
$next_order = $count + 1;
}

return $next_order;
Expand Down
4 changes: 2 additions & 2 deletions scripts/field_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ ecf_ns.change_field_type = function(choice) {
}
if (choice == "radios" || choice == "checkboxes" || choice == "select" || choice == "multi-select") {
if ($("#field_options_div")[0].style.display == "none") {
$("#field_options_div").show(200);
$("#field_options_div").show();
}
if (choice == "radios" || choice == "checkboxes") {
$("#fo1, #fo2").attr("disabled", "");
Expand All @@ -123,7 +123,7 @@ ecf_ns.change_field_type = function(choice) {
}
} else {
if ($("#field_options_div")[0].style.display != "none") {
$("#field_options_div").hide(200);
$("#field_options_div").hide();
}
}

Expand Down
10 changes: 1 addition & 9 deletions templates/add.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,7 @@
<th>{$LANG.phrase_display_text}</th>
<th class="del"></th>
</tr>
{foreach from=$field_info.options item=option name=row}
{assign var=count value=$smarty.foreach.row.iteration}
<tr id="row_{$count}">
<td class="medium_grey" align="center" id="field_option_{$count}_order">{$count}</td>
<td><input type="text" style="width:99%" name="field_option_text_{$count}" value="{$option.option_text|escape}" /></td>
<td class="del"><a href="#" onclick="ecf_ns.delete_field_option({$count})"></a></td>
</tr>
{/foreach}
</tbody>
</tbody>
</table>

<div>
Expand Down

0 comments on commit 8f2c64f

Please sign in to comment.