Skip to content

Commit d5e0b9a

Browse files
committed
2.0.4; closes #6
1 parent a57f8ee commit d5e0b9a

File tree

7 files changed

+33
-18
lines changed

7 files changed

+33
-18
lines changed

activity_charts/edit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343

4444
// start compiling the page vars here (save duplicate code!)
4545
$page_vars = array(
46-
"success" => $success,
47-
"message" => $message,
46+
"g_success" => $success,
47+
"g_message" => $message,
4848
"page" => $page,
4949
"tabs" => $tabs,
5050
"show_tabset_nav_links" => true,

activity_charts/page_permissions.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@
99
$page_vars["vis_info"] = $vis_info;
1010
$page_vars["views"] = $views;
1111
$page_vars["access_views"] = $access_views;
12-
$page_vars["js_messages"] = array("phrase_please_select", "phrase_please_select_form", "word_edit", "word_delete", "word_yes", "word_no");
13-
$page_vars["module_js_messages"] = array("phrase_delete_visualization", "confirm_delete_visualization");
12+
$page_vars["js_messages"] = array(
13+
"phrase_please_select", "phrase_please_select_form", "word_edit", "word_delete", "word_yes", "word_no"
14+
);
15+
$page_vars["module_js_messages"] = array(
16+
"phrase_delete_visualization", "confirm_delete_visualization"
17+
);
1418

1519
$page_vars["head_js"] =<<< END
1620
$(function() {

activity_charts/settings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
}
3434

3535
$page_vars = array(
36-
"success" => $success,
37-
"message" => $message,
36+
"g_success" => $success,
37+
"g_message" => $message,
3838
"module_settings" => $module->getSettings()
3939
);
4040

code/ActivityCharts.class.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ private static function updateVisualizationMainTab($vis_id, $info)
492492
SET vis_name = :vis_name,
493493
form_id = :form_id,
494494
cache_update_frequency = :cache_update_frequency
495-
WHERE vis_id = $vis_id
495+
WHERE vis_id = :vis_id
496496
");
497497
$db->bindAll(array(
498498
"vis_name" => $info["vis_name"],
@@ -506,6 +506,8 @@ private static function updateVisualizationMainTab($vis_id, $info)
506506

507507
private static function updateVisualizationAppearanceTab($vis_id, $info)
508508
{
509+
$db = Core::$db;
510+
509511
$db->query("
510512
UPDATE {PREFIX}module_data_visualizations
511513
SET chart_type = :chart_type,
@@ -546,8 +548,8 @@ private static function updateVisualizationPermissionsTab($vis_id, $info)
546548
VALUES ($vis_id, $account_id)
547549
");
548550
$db->bindAll(array(
549-
"vis_id" => $vis_id,
550-
"account_id" => $account_id
551+
"vis_id" => $vis_id,
552+
"account_id" => $account_id
551553
));
552554
$db->execute();
553555
}
@@ -572,5 +574,6 @@ private static function updateVisualizationPermissionsTab($vis_id, $info)
572574
"access_views" => $access_views,
573575
"vis_id" => $vis_id
574576
));
577+
$db->execute();
575578
}
576579
}

code/Module.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class Module extends FormToolsModule
1616
protected $moduleDesc = "This module utilizes Google Charts API to create custom graphs and charts of your form submission data, providing an alternative, visual interpretation of your data.";
1717
protected $author = "Ben Keen";
1818
protected $authorEmail = "[email protected]";
19-
protected $authorLink = "http://formtools.org";
20-
protected $version = "2.0.3";
21-
protected $date = "2017-11-22";
19+
protected $authorLink = "https://formtools.org";
20+
protected $version = "2.0.4";
21+
protected $date = "2017-11-29";
2222
protected $originLanguage = "en_us";
2323
protected $jsFiles = array(
2424
"https://www.gstatic.com/charts/loader.js",

code/Visualizations.class.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,10 @@ public static function getTabsetLinks($vis_id)
520520

521521
$results = self::searchVisualizations($search_criteria);
522522

523-
$return_info = array("prev_link" => "", "next_link" => "");
523+
$return_info = array(
524+
"prev_link" => "",
525+
"next_link" => ""
526+
);
524527

525528
// it's possible that there are NO visualization IDs: the user may have done a search that returns no results
526529
// but be editing a visualization on a different tab
@@ -536,8 +539,13 @@ public static function getTabsetLinks($vis_id)
536539
}
537540
$current_index = array_search($vis_id, $sorted_vis_ids);
538541

542+
if (!$current_index) {
543+
return $return_info;
544+
}
545+
546+
$num_results = count($sorted_vis_ids);
539547
if ($current_index === 0) {
540-
if (count($sorted_vis_ids) > 1) {
548+
if ($num_results > 1) {
541549
$next_vis_id = $sorted_vis_ids[$current_index + 1];
542550
if ($vis_id_to_types[$next_vis_id] == "activity") {
543551
$return_info["next_link"] = "../activity_charts/edit.php?vis_id=$next_vis_id";
@@ -546,8 +554,8 @@ public static function getTabsetLinks($vis_id)
546554
}
547555
}
548556
} else {
549-
if ($current_index === count($sorted_vis_ids) - 1) {
550-
if (count($sorted_vis_ids) > 1) {
557+
if ($current_index === $num_results - 1) {
558+
if ($num_results > 1) {
551559
$prev_vis_id = $sorted_vis_ids[$current_index - 1];
552560
if ($vis_id_to_types[$prev_vis_id] == "activity") {
553561
$return_info["prev_link"] = "../activity_charts/edit.php?vis_id=$prev_vis_id";

field_charts/settings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
}
3636

3737
$page_vars = array(
38-
"success" => $success,
39-
"message" => $message,
38+
"g_success" => $success,
39+
"g_message" => $message,
4040
"module_settings" => $module->getSettings()
4141
);
4242

0 commit comments

Comments
 (0)