Changeset 1937055
- Timestamp:
- 09/06/2018 07:11:15 PM (8 years ago)
- Location:
- point-tracker
- Files:
-
- 10 edited
- 21 copied
-
tags/1.4 (copied) (copied from point-tracker/trunk)
-
tags/1.4/README.md (copied) (copied from point-tracker/trunk/README.md)
-
tags/1.4/README.txt (copied) (copied from point-tracker/trunk/README.txt) (3 diffs)
-
tags/1.4/admin/class-point-tracker-admin.php (copied) (copied from point-tracker/trunk/admin/class-point-tracker-admin.php) (3 diffs)
-
tags/1.4/admin/js/point-tracker-admin.min.js (copied) (copied from point-tracker/trunk/admin/js/point-tracker-admin.min.js)
-
tags/1.4/admin/partials/point-tracker-log-pg.php (copied) (copied from point-tracker/trunk/admin/partials/point-tracker-log-pg.php)
-
tags/1.4/admin/partials/point-tracker-main-pg.php (copied) (copied from point-tracker/trunk/admin/partials/point-tracker-main-pg.php)
-
tags/1.4/admin/partials/point-tracker-participant-pg.php (copied) (copied from point-tracker/trunk/admin/partials/point-tracker-participant-pg.php)
-
tags/1.4/includes/ajax/activity-ajax.php (copied) (copied from point-tracker/trunk/includes/ajax/activity-ajax.php)
-
tags/1.4/includes/ajax/challenge-ajax.php (copied) (copied from point-tracker/trunk/includes/ajax/challenge-ajax.php)
-
tags/1.4/includes/ajax/entry-ajax.php (copied) (copied from point-tracker/trunk/includes/ajax/entry-ajax.php) (2 diffs)
-
tags/1.4/includes/ajax/participant-ajax.php (copied) (copied from point-tracker/trunk/includes/ajax/participant-ajax.php) (2 diffs)
-
tags/1.4/includes/class-point-tracker-activator.php (copied) (copied from point-tracker/trunk/includes/class-point-tracker-activator.php) (6 diffs)
-
tags/1.4/includes/class-point-tracker-deactivator.php (copied) (copied from point-tracker/trunk/includes/class-point-tracker-deactivator.php)
-
tags/1.4/includes/class-point-tracker.php (copied) (copied from point-tracker/trunk/includes/class-point-tracker.php) (1 diff)
-
tags/1.4/point-tracker.php (copied) (copied from point-tracker/trunk/point-tracker.php) (2 diffs)
-
tags/1.4/public/class-point-tracker-public.php (copied) (copied from point-tracker/trunk/public/class-point-tracker-public.php) (1 diff)
-
tags/1.4/public/js/point-tracker-public.min.js (copied) (copied from point-tracker/trunk/public/js/point-tracker-public.min.js) (1 diff)
-
tags/1.4/public/partials/point-tracker-challenge-list-pg.php (copied) (copied from point-tracker/trunk/public/partials/point-tracker-challenge-list-pg.php)
-
tags/1.4/public/partials/point-tracker-challenge-pg.php (copied) (copied from point-tracker/trunk/public/partials/point-tracker-challenge-pg.php) (4 diffs)
-
tags/1.4/public/partials/point-tracker-my-activity-pg.php (copied) (copied from point-tracker/trunk/public/partials/point-tracker-my-activity-pg.php)
-
trunk/README.txt (modified) (3 diffs)
-
trunk/admin/class-point-tracker-admin.php (modified) (3 diffs)
-
trunk/includes/ajax/entry-ajax.php (modified) (2 diffs)
-
trunk/includes/ajax/participant-ajax.php (modified) (2 diffs)
-
trunk/includes/class-point-tracker-activator.php (modified) (6 diffs)
-
trunk/includes/class-point-tracker.php (modified) (1 diff)
-
trunk/point-tracker.php (modified) (2 diffs)
-
trunk/public/class-point-tracker-public.php (modified) (1 diff)
-
trunk/public/js/point-tracker-public.min.js (modified) (1 diff)
-
trunk/public/partials/point-tracker-challenge-pg.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
point-tracker/tags/1.4/README.txt
r1930326 r1937055 6 6 Requires PHP: 5.6 7 7 Tested up to: 4.9.8 8 Stable tag: 1. 3.18 Stable tag: 1.4 9 9 License: Apache-2.0 10 10 License URI: https://www.apache.org/licenses/LICENSE-2.0 … … 54 54 = How can I create a custom page = 55 55 56 After you've created a challenge copy the unique code for that challenge. Create a new page at Page -> Add New. Give it a name and whatever content you'd like. Then where you'd like to put the challenge form simply type [challenge chal={challenge code you copied}][/challenge], then publish the page. That is all.56 After you've created a challenge, copy the unique code for that challenge. Create a new page at Pages -> Add New. Give it a name and whatever content you'd like. Then where you'd like to put the challenge form simply type `[challenge chal={challenge code you copied}][/challenge]`, then publish the page. That is all. You can also create an activity page using the shortcode `[my_activity chal={code}][/my_activity]`. 57 57 58 58 = I'd like a leader board = … … 92 92 * Fixed bug in showing challenge list 93 93 94 = 1.4 = 95 * Fix bug in admin with start and end date formats 96 * Add documentation for creating custom challenge and activity pages 97 * Add Upgrade admin submenu (not linked right now) 98 * Extended the size of the label for radio buttons and checkboxes and answer 99 * Added a span below text fields to show character count 100 94 101 == Upgrade Notice == 95 102 -
point-tracker/tags/1.4/admin/class-point-tracker-admin.php
r1929974 r1937055 173 173 )); 174 174 175 add_submenu_page('point-tracker-menu', 'Upgrade!', 'Upgrade!', 'manage_options', 'point-tracker-upgrade', [ 176 $this, 177 'display_upgrade_page' 178 ]); 179 175 180 add_options_page("Point Tracker Settings", "PT Settings", "manage_options", "pt-settings", array( 176 181 $this, … … 191 196 "m/d/Y" => "mm/dd/yy", 192 197 "M j, Y" => "M d, yy", 193 "F j, Y" => "MM MMd, yy",198 "F j, Y" => "MM d, yy", 194 199 "d/m/Y" => "dd/mm/yy" 195 200 ]; … … 231 236 } 232 237 238 239 public function display_upgrade_page() 240 { 241 print <<<EOL 242 <h2>Upgrade to Point Tracker Pro</h2> 243 <p>Take your challenges to the next level with <a href='' target='_blank'>Point Tracker Pro</a></p> 244 EOL; 245 } 246 233 247 /** 234 248 * Render the admin options page -
point-tracker/tags/1.4/includes/ajax/entry-ajax.php
r1929974 r1937055 133 133 $member_id = filter_input(INPUT_POST, 'member-id', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); 134 134 $user_name = sanitize_text_field(filter_input(INPUT_POST, 'user-name', FILTER_SANITIZE_STRING, FILTER_NULL_ON_FAILURE)); 135 $user_email = s anitize_email(filter_input(INPUT_POST, 'user-email', FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE));135 $user_email = strtolower(sanitize_email(filter_input(INPUT_POST, 'user-email', FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE))); 136 136 137 137 if (! $member_id) { … … 380 380 $tp = 0; 381 381 $member_id = filter_input(INPUT_POST, 'member-id', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); 382 $email = s anitize_email(filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL, FILTER_NULL_ON_FAILURE));382 $email = strtolower(sanitize_email(filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL, FILTER_NULL_ON_FAILURE))); 383 383 $chal_id = filter_input(INPUT_POST, 'chal-id', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); 384 384 -
point-tracker/tags/1.4/includes/ajax/participant-ajax.php
r1929974 r1937055 226 226 $member_id = filter_input(INPUT_POST, 'member-id', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); 227 227 $name = sanitize_text_field(filter_input(INPUT_POST, 'user-name', FILTER_SANITIZE_STRING, FILTER_NULL_ON_FAILURE)); 228 $email = s anitize_email(filter_input(INPUT_POST, 'user-email', FILTER_SANITIZE_EMAIL, FILTER_NULL_ON_FAILURE));228 $email = strtolower(sanitize_email(filter_input(INPUT_POST, 'user-email', FILTER_SANITIZE_EMAIL, FILTER_NULL_ON_FAILURE))); 229 229 $now = new DateTime("now", new DateTimeZone(get_option("timezone_string"))); 230 230 … … 319 319 320 320 $name = sanitize_text_field(filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING, FILTER_NULL_ON_FAILURE)); 321 $email = s anitize_email(filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE));321 $email = strtolower(sanitize_email(filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE))); 322 322 323 323 $now = new DateTime("now", new DateTimeZone(get_option("timezone_string"))); -
point-tracker/tags/1.4/includes/class-point-tracker-activator.php
r1929974 r1937055 130 130 $res = $wpdb->get_row("SHOW TABLES LIKE '{$wpdb->prefix}pt_challenges'", ARRAY_N); 131 131 if (! is_array($res) || ! count($res)) { 132 return new WP_Error('db_failure', "Failed to create table '{$wpdb->prefix}pt_challenges");132 return new WP_Error('db_failure', "Failed to create table {$wpdb->prefix}pt_challenges"); 133 133 } 134 134 … … 139 139 `points` decimal(4,1) DEFAULT NULL, 140 140 `type` enum('checkbox','radio','text','number') NOT NULL, 141 `label` varchar(45)DEFAULT NULL,141 `label` mediumtext DEFAULT NULL, 142 142 `question` varchar(100) DEFAULT NULL, 143 143 `min` int(11) DEFAULT '0', … … 151 151 $res = $wpdb->get_row("SHOW TABLES LIKE '{$wpdb->prefix}pt_activities'", ARRAY_N); 152 152 if (! is_array($res) || ! count($res)) { 153 return new WP_Error('db_failure', "Failed to create table '{$wpdb->prefix}pt_activities");153 return new WP_Error('db_failure', "Failed to create table {$wpdb->prefix}pt_activities"); 154 154 } 155 155 … … 168 168 $res = $wpdb->get_row("SHOW TABLES LIKE '{$wpdb->prefix}pt_participants'", ARRAY_N); 169 169 if (! is_array($res) || ! count($res)) { 170 return new WP_Error('db_failure', "Failed to create table '{$wpdb->prefix}pt_participants");170 return new WP_Error('db_failure', "Failed to create table {$wpdb->prefix}pt_participants"); 171 171 } 172 172 … … 176 176 `log_date` date NOT NULL, 177 177 `log_time` time NOT NULL, 178 `value` varchar(255)NOT NULL DEFAULT '',178 `value` text NOT NULL DEFAULT '', 179 179 PRIMARY KEY (`user_id`,`activity_id`,`log_date`) 180 180 )"; … … 182 182 $res = $wpdb->get_row("SHOW TABLES LIKE '{$wpdb->prefix}pt_log'", ARRAY_N); 183 183 if (! is_array($res) || ! count($res)) { 184 return new WP_Error('db_failure', "Failed to create table '{$wpdb->prefix}pt_log");184 return new WP_Error('db_failure', "Failed to create table {$wpdb->prefix}pt_log"); 185 185 } 186 186 } -
point-tracker/tags/1.4/includes/class-point-tracker.php
r1930304 r1937055 70 70 public function __construct() 71 71 { 72 if (defined('PT_ PLUGIN_NAME_VERSION')) {73 $this->version = PT_ PLUGIN_NAME_VERSION;72 if (defined('PT_VERSION')) { 73 $this->version = PT_VERSION; 74 74 } else { 75 $this->version = '1. 3.1';75 $this->version = '1.4'; 76 76 } 77 77 $this->plugin_name = 'point-tracker'; -
point-tracker/tags/1.4/point-tracker.php
r1930304 r1937055 16 16 * Plugin Name: Point Tracker 17 17 * Plugin URI: https://github.com/godsgood33/point-tracker 18 * Description: Allow network marketingleaders to create challenges and let people track their points.19 * Version: 1. 3.118 * Description: Allow leaders to create challenges and let people track their points. 19 * Version: 1.4 20 20 * Author: Ryan Prather 21 21 * Author URI: https://github.com/godsgood33 … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define('PT_ PLUGIN_NAME_VERSION', '1.3.1');38 define('PT_VERSION', '1.4'); 39 39 40 40 /** -
point-tracker/tags/1.4/public/class-point-tracker-public.php
r1929974 r1937055 172 172 "m/d/Y" => "mm/dd/yy", 173 173 "M j, Y" => "M d, yy", 174 "F j, Y" => "MM MMd, yy",174 "F j, Y" => "MM d, yy", 175 175 "d/m/Y" => "dd/mm/yy" 176 176 ]; -
point-tracker/tags/1.4/public/js/point-tracker-public.min.js
r1929974 r1937055 3 3 return false;}else{if(!$("#email").val()){$("#msg").append("<div>Please enter your email</div>");$("#msg").slideToggle(300);$("#msg").addClass("warn-msg");setTimeout(function(){$("#msg").slideToggle(300);},5000);return false;}}$.ajax(ajax_object.ajax_url,{data:{action:"get-my-activity","member-id":$("#member-id").val(),"email":$("#email").val(),"chal-id":$("#chal-id").val()},beforeSend:beforeAjaxSend,complete:ajaxComplete,success:function(data){if(!check_for_error(data)){return;}$("#total-points").html(data.total_points); 4 4 if($.fn.DataTable.isDataTable("#my-activity-table")){table.destroy();$("#my-activity-table").empty();}table=$("#my-activity-table").DataTable({data:data.data.slice(0),columns:data.columns.slice(0),paging:false,buttons:["copyHtml5","csv","excel","pdf","print"],dom:"Bfrtip",searching:false});$(".fa-trash-alt").click(delete_activity);},error:function(xhr,status,error){console.error(error);},method:"post",dataType:"json"});}function save_activity(){var start=$(this).parent().parent();var type=$(start).find(".type").val(); 5 var value="";if(!validate_entry(start)){return;}if(type=="checkbox"){var length=$(start).find("input[type='checkbox']:checked").length;if(length>1){value=[];for(var x=0;x<length;x++){value.push($(start).find("input[type='checkbox']:checked").eq(x).val());}}else{value=$(start).find("input[type='checkbox']:checked").val();}}else{if(type=="radio"){value=$(start).find("input[type='radio']:checked").val();}else{value=$(start).find("input.value").val();}}$.ajax(ajax_object.ajax_url,{data:{"action":"save-entry","chal-link":$("#chal-link").val(),"act-id":$(start).find(".id").val(),"type":type,"value":value,"member-id":$("#member-id").val(),"user-name":$("#user-name").val(),"user-email":$("#user-email").val()},beforeSend:beforeAjaxSend,complete:ajaxComplete,success:function(data){$("#msg"). html("");5 var value="";if(!validate_entry(start)){return;}if(type=="checkbox"){var length=$(start).find("input[type='checkbox']:checked").length;if(length>1){value=[];for(var x=0;x<length;x++){value.push($(start).find("input[type='checkbox']:checked").eq(x).val());}}else{value=$(start).find("input[type='checkbox']:checked").val();}}else{if(type=="radio"){value=$(start).find("input[type='radio']:checked").val();}else{value=$(start).find("input.value").val();}}$.ajax(ajax_object.ajax_url,{data:{"action":"save-entry","chal-link":$("#chal-link").val(),"act-id":$(start).find(".id").val(),"type":type,"value":value,"member-id":$("#member-id").val(),"user-name":$("#user-name").val(),"user-email":$("#user-email").val()},beforeSend:beforeAjaxSend,complete:ajaxComplete,success:function(data){$("#msg").empty(); 6 6 $("#msg").removeClass("err-msg,warn-msg");var duration=1500;if(data.error){$("#msg").html("<p>"+data.error+"</p>");$("#msg").addClass("err-msg");duration=5000;}else{if(data.warning){$("#msg").html("<p>"+data.warning+"</p>");$("#msg").addClass("warn-msg");duration=3000;}else{$("#msg").html("<p>Activity saved</p>");}}$("#msg").css("top",$(start).position().top+5);$("#msg").height($(start).height()+2);$("#msg").slideToggle(300);setTimeout(function(){$("#msg").slideToggle(300);},duration);},error:function(xhr,status,error){console.error(error); 7 7 },dataType:"json",method:"post"});}function delete_activity(){var button=$(this);$.ajax(ajax_object.ajax_url,{data:{"action":"delete-participant-activity","act-id":$(this).data("act-id"),"user-id":$(this).data("user-id"),"log-date":$(this).data("log-date"),"security":$("#_wpnonce").val()},beforeSend:beforeAjaxSend,complete:ajaxComplete,success:function(data){if(!check_for_error(data)){return;}table.row($(button).closest("tr").index()).remove().draw();},error:function(xhr,status,error){console.error(error);},dataType:"json",method:"post"}); 8 }function validate_entry(act){var numeric=/^\d+$/;var ret=true;var type=$(act).find("input.type").val();$("#msg div").remove();$("#msg").removeClass("err-msg");$("#msg").removeClass("warn-msg");if(!$("#member-id").val()||!$("#member-id").val().match(numeric)){$("#msg").append("<div>That is an invalid member ID</div>");ret=false;}if(!$("#user-name").val()){$("#msg").append("<div>You need to put your name in the form</div>");ret=false;}if(!$("#user-email").val()){$("#msg").append("<div>You need to enter your e-mail address</div>"); 9 ret=false;}if(type=="checkbox"||type=="radio"){if(!$(act).find("input[type="+type+"]:checked").length){$("#msg").append("<div>You must select one of the options</div>");ret=false;}}else{if(type=="text"){if(!$(act).find('input[type="text"]').val().length){$("#msg").append("<div>Invalid entry for this activity</div>");ret=false;}}else{if(type=="number"){var num=$(act).find('input[type="number"]').val();if(!num.match(numeric)){$("#msg").append("<div>Invalid entry for this activity</div>");ret=false;}else{if(parseInt(num)<1){$("#msg").append("<div>Invalid entry for this activity, positive numbers only</div>"); 10 ret=false;}}}}}if(!ret){$("#msg").slideToggle(300);$("#msg").addClass("warn-msg");setTimeout(function(){$("#msg").slideToggle(300);},5000);}return ret;}function check_for_error(data){$("#msg div").remove();$("#msg").removeClass("err-msg,warn-msg");var err=false;if(data=="0"){$("#msg").html("<div>There was an error</div>");$("#msg").addClass("err-msg");err=true;}else{if(data.error){$("#msg").html("<div>"+data.error+"</div>");$("#msg").addClass("err-msg");err=true;}else{if(data.warning){$("#msg").html("<div>"+data.warning+"</div>"); 11 $("#msg").addClass("warn-msg");err=true;}else{if(data.success){$("#msg").html("<div>"+data.success+"</div>");}}}}if($("#msg").html()){$("#msg").show(300);}if(err){setTimeout(function(){$("#msg").hide(300);$("#msg").html("");},3000);}else{setTimeout(function(){$("#msg").hide(300);$("#msg").html("");},1500);}return !err;}function beforeAjaxSend(){$("#loading,#waiting").show();$("#waiting").animate({"opacity":"0.5"},300,"linear");}function ajaxComplete(){$("#loading,#waiting").hide();$("#waiting").animate({"opacity":"0"},300,"linear"); 12 }var opts={lines:25,length:25,width:5,radius:50,scale:1,corners:1,color:"#000",opacity:0.25,rotate:0,direction:1,speed:0.5,trail:60,fps:20,zIndex:2000000000,className:"spinner",top:"50%",left:"50%",shadow:false,hwaccel:false,position:"absolute"};var target,spinner,table;$("#registered-challenges,#upcoming-challenges,#past-challenges").DataTable({paging:false,searching:false});$(".tooltip-field").tooltip({show:{effect:"slideDown",delay:100},hide:{effect:"slideUp",delay:250}});dialog=$("#dialog-form").dialog({autoOpen:false,height:500,width:350,modal:true,buttons:{"Join Challenge":join_challenge,Cancel:function(){dialog.dialog("close"); 13 }},close:function(){form[0].reset();}});form=dialog.find("form").on("submit",function(event){event.preventDefault();join_challenge();});$("#join-challenge").button().on("click",function(){dialog.dialog("open");});$(".save").click(save_activity);$("#get-activity").click(get_my_activity);$("#msg").hide();if($("#loading")){target=document.getElementById("loading");spinner=new Spinner(opts).spin(target);}if($("#my-activity-body tr").length){table=$("#my-activity-table").DataTable({paging:false,buttons:["copyHtml5","csv","excel","pdf","print"],dom:"Bfrtip",searching:false,stripClasses:["odd-row","even-row"],order:[[0,"asc"],[2,"asc"]]}); 14 $(".fa-trash-alt").click(delete_activity);}}); 8 }function validate_entry(act){var numeric=/^\d+$/;var ret=true;var start=$(act);var type=$(act).find("input.type").val();$("#msg").empty();$("#msg").removeClass("err-msg");$("#msg").removeClass("warn-msg");$("#msg").css("top",$(start).position().top+5);$("#msg").height($(start).height()+2);if(!$("#member-id").val()||!$("#member-id").val().match(numeric)){$("#msg").append("<p>That is an invalid member ID</p>");ret=false;}if(!$("#user-name").val()){$("#msg").append("<p>You need to put your name in the form</p>"); 9 ret=false;}if(!$("#user-email").val()){$("#msg").append("<p>You need to enter your e-mail address</p>");ret=false;}if(type=="checkbox"||type=="radio"){if(!$(act).find("input[type="+type+"]:checked").length){$("#msg").append("<p>You must select one of the options</p>");ret=false;}}else{if(type=="text"){if(!$(act).find('input[type="text"]').val().length){$("#msg").append("<p>Invalid entry for this activity</p>");ret=false;}}else{if(type=="number"){var field=$(act).find('input[type="number"]');var num=$(field).val(); 10 var min=($(field).attr("min")?$(field).attr("min"):0);var max=($(field).attr("max")?$(field).attr("max"):0);if(!num.match(numeric)){$("#msg").append("<p>Invalid entry for this activity</p>");ret=false;}else{if(parseInt(num)<1){$("#msg").append("<p>Invalid entry for this activity, positive numbers only</p>");ret=false;}else{if(parseInt(num)<min){$("#msg").append("<p>Invalid entry for this activity, number must be greater than or equal to "+min+"</p>");ret=false;}else{if(parseInt(num)>max){$("#msg").append("<p>Invalid entry for this activity, number must be lesser than or equal to "+max+"</p>"); 11 ret=false;}}}}}}}if(!ret){$("#msg").slideToggle(300);$("#msg").addClass("warn-msg");setTimeout(function(){$("#msg").slideToggle(300);$("#msg").empty();},5000);}return ret;}function check_for_error(data){$("#msg").empty();$("#msg").removeClass("err-msg,warn-msg");var err=false;if(data=="0"){$("#msg").html("<p>There was an error</p>");$("#msg").addClass("err-msg");err=true;}else{if(data.error){$("#msg").html("<p>"+data.error+"</p>");$("#msg").addClass("err-msg");err=true;}else{if(data.warning){$("#msg").html("<p>"+data.warning+"</p>"); 12 $("#msg").addClass("warn-msg");err=true;}else{if(data.success){$("#msg").html("<p>"+data.success+"</p>");}}}}if($("#msg").html()){$("#msg").show(300);}if(err){setTimeout(function(){$("#msg").hide(300);$("#msg").empty();},3000);}else{setTimeout(function(){$("#msg").hide(300);$("#msg").empty();},1500);}return !err;}function beforeAjaxSend(){$("#loading,#waiting").show();$("#waiting").animate({"opacity":"0.5"},300,"linear");}function ajaxComplete(){$("#loading,#waiting").hide();$("#waiting").animate({"opacity":"0"},300,"linear"); 13 }var opts={lines:25,length:25,width:5,radius:50,scale:1,corners:1,color:"#000",opacity:0.25,rotate:0,direction:1,speed:0.5,trail:60,fps:20,zIndex:2000000000,className:"spinner",top:"50%",left:"50%",shadow:false,hwaccel:false,position:"absolute"};var target,spinner,table;$(".text-max").keyup(function(){$("#text-len-"+$(this).attr("id")).text($(this).val().length);});$("#registered-challenges,#upcoming-challenges,#past-challenges").DataTable({paging:false,searching:false});$(".tooltip-field").tooltip({show:{effect:"slideDown",delay:100},hide:{effect:"slideUp",delay:250}}); 14 dialog=$("#dialog-form").dialog({autoOpen:false,height:500,width:350,modal:true,buttons:{"Join Challenge":join_challenge,Cancel:function(){dialog.dialog("close");}},close:function(){form[0].reset();}});form=dialog.find("form").on("submit",function(event){event.preventDefault();join_challenge();});$("#join-challenge").button().on("click",function(){dialog.dialog("open");});$(".save").click(save_activity);$("#get-activity").click(get_my_activity);$("#msg").hide();if($("#loading")){target=document.getElementById("loading"); 15 spinner=new Spinner(opts).spin(target);}if($("#my-activity-body tr").length){table=$("#my-activity-table").DataTable({paging:false,buttons:["copyHtml5","csv","excel","pdf","print"],dom:"Bfrtip",searching:false,stripClasses:["odd-row","even-row"],order:[[0,"asc"],[2,"asc"]]});$(".fa-trash-alt").click(delete_activity);}}); -
point-tracker/tags/1.4/public/partials/point-tracker-challenge-pg.php
r1929974 r1937055 126 126 127 127 print <<<EOR 128 < label for='$id'>$label</label> 129 < input type='{$act->type}' class='value' id='$id' value='$label' /><br />128 <input type='{$act->type}' class='value' id='$id' value='$label' /> 129 <label for='$id'>$label</label><br /> 130 130 EOR; 131 131 } … … 138 138 139 139 $inputmode = ($act->type == 'number' ? " inputmode='numeric' pattern='[0-9]*'" : null); 140 141 print "<input type='{$act->type}' class='value' id='$id'$inputmode $min $max $val /> "; 140 $text_max = ($act->type == 'text' && $act->max ? " text-max" : null); 141 142 print "<input type='{$act->type}' class='value$text_max' id='$id'$inputmode $min $max $val /> "; 143 print ($act->type == 'text' && $act->max ? "<br />(<span id='text-len-{$id}'>0</span> / {$act->max})" : null); 142 144 } 143 145 … … 220 222 221 223 print <<<EOR 222 < label for='$id'>$label</label> 223 < input type='{$act->type}' class='value' id='$id' value='$label' /><br />224 <input type='{$act->type}' class='value' id='$id' value='$label' /> 225 <label for='$id'>$label</label><br /> 224 226 EOR; 225 227 } … … 232 234 233 235 $inputmode = ($act->type == 'number' ? " inputmode='numeric' pattern='[0-9]*'" : null); 234 235 print "<input type='{$act->type}' class='value' id='$id'$inputmode $min $max $val /> "; 236 $text_max = ($act->type == 'text' && $act->max ? " text-max" : null); 237 238 print "<input type='{$act->type}' class='value$text_max' id='$id'$inputmode $min $max $val /> "; 239 print ($act->type == 'text' && $act->max ? "<br />(<span id='text-len-{$id}'>0</span> / {$act->max})" : null); 236 240 } 237 241 -
point-tracker/trunk/README.txt
r1930326 r1937055 6 6 Requires PHP: 5.6 7 7 Tested up to: 4.9.8 8 Stable tag: 1. 3.18 Stable tag: 1.4 9 9 License: Apache-2.0 10 10 License URI: https://www.apache.org/licenses/LICENSE-2.0 … … 54 54 = How can I create a custom page = 55 55 56 After you've created a challenge copy the unique code for that challenge. Create a new page at Page -> Add New. Give it a name and whatever content you'd like. Then where you'd like to put the challenge form simply type [challenge chal={challenge code you copied}][/challenge], then publish the page. That is all.56 After you've created a challenge, copy the unique code for that challenge. Create a new page at Pages -> Add New. Give it a name and whatever content you'd like. Then where you'd like to put the challenge form simply type `[challenge chal={challenge code you copied}][/challenge]`, then publish the page. That is all. You can also create an activity page using the shortcode `[my_activity chal={code}][/my_activity]`. 57 57 58 58 = I'd like a leader board = … … 92 92 * Fixed bug in showing challenge list 93 93 94 = 1.4 = 95 * Fix bug in admin with start and end date formats 96 * Add documentation for creating custom challenge and activity pages 97 * Add Upgrade admin submenu (not linked right now) 98 * Extended the size of the label for radio buttons and checkboxes and answer 99 * Added a span below text fields to show character count 100 94 101 == Upgrade Notice == 95 102 -
point-tracker/trunk/admin/class-point-tracker-admin.php
r1929974 r1937055 173 173 )); 174 174 175 add_submenu_page('point-tracker-menu', 'Upgrade!', 'Upgrade!', 'manage_options', 'point-tracker-upgrade', [ 176 $this, 177 'display_upgrade_page' 178 ]); 179 175 180 add_options_page("Point Tracker Settings", "PT Settings", "manage_options", "pt-settings", array( 176 181 $this, … … 191 196 "m/d/Y" => "mm/dd/yy", 192 197 "M j, Y" => "M d, yy", 193 "F j, Y" => "MM MMd, yy",198 "F j, Y" => "MM d, yy", 194 199 "d/m/Y" => "dd/mm/yy" 195 200 ]; … … 231 236 } 232 237 238 239 public function display_upgrade_page() 240 { 241 print <<<EOL 242 <h2>Upgrade to Point Tracker Pro</h2> 243 <p>Take your challenges to the next level with <a href='' target='_blank'>Point Tracker Pro</a></p> 244 EOL; 245 } 246 233 247 /** 234 248 * Render the admin options page -
point-tracker/trunk/includes/ajax/entry-ajax.php
r1929974 r1937055 133 133 $member_id = filter_input(INPUT_POST, 'member-id', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); 134 134 $user_name = sanitize_text_field(filter_input(INPUT_POST, 'user-name', FILTER_SANITIZE_STRING, FILTER_NULL_ON_FAILURE)); 135 $user_email = s anitize_email(filter_input(INPUT_POST, 'user-email', FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE));135 $user_email = strtolower(sanitize_email(filter_input(INPUT_POST, 'user-email', FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE))); 136 136 137 137 if (! $member_id) { … … 380 380 $tp = 0; 381 381 $member_id = filter_input(INPUT_POST, 'member-id', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); 382 $email = s anitize_email(filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL, FILTER_NULL_ON_FAILURE));382 $email = strtolower(sanitize_email(filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL, FILTER_NULL_ON_FAILURE))); 383 383 $chal_id = filter_input(INPUT_POST, 'chal-id', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); 384 384 -
point-tracker/trunk/includes/ajax/participant-ajax.php
r1929974 r1937055 226 226 $member_id = filter_input(INPUT_POST, 'member-id', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); 227 227 $name = sanitize_text_field(filter_input(INPUT_POST, 'user-name', FILTER_SANITIZE_STRING, FILTER_NULL_ON_FAILURE)); 228 $email = s anitize_email(filter_input(INPUT_POST, 'user-email', FILTER_SANITIZE_EMAIL, FILTER_NULL_ON_FAILURE));228 $email = strtolower(sanitize_email(filter_input(INPUT_POST, 'user-email', FILTER_SANITIZE_EMAIL, FILTER_NULL_ON_FAILURE))); 229 229 $now = new DateTime("now", new DateTimeZone(get_option("timezone_string"))); 230 230 … … 319 319 320 320 $name = sanitize_text_field(filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING, FILTER_NULL_ON_FAILURE)); 321 $email = s anitize_email(filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE));321 $email = strtolower(sanitize_email(filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE))); 322 322 323 323 $now = new DateTime("now", new DateTimeZone(get_option("timezone_string"))); -
point-tracker/trunk/includes/class-point-tracker-activator.php
r1929974 r1937055 130 130 $res = $wpdb->get_row("SHOW TABLES LIKE '{$wpdb->prefix}pt_challenges'", ARRAY_N); 131 131 if (! is_array($res) || ! count($res)) { 132 return new WP_Error('db_failure', "Failed to create table '{$wpdb->prefix}pt_challenges");132 return new WP_Error('db_failure', "Failed to create table {$wpdb->prefix}pt_challenges"); 133 133 } 134 134 … … 139 139 `points` decimal(4,1) DEFAULT NULL, 140 140 `type` enum('checkbox','radio','text','number') NOT NULL, 141 `label` varchar(45)DEFAULT NULL,141 `label` mediumtext DEFAULT NULL, 142 142 `question` varchar(100) DEFAULT NULL, 143 143 `min` int(11) DEFAULT '0', … … 151 151 $res = $wpdb->get_row("SHOW TABLES LIKE '{$wpdb->prefix}pt_activities'", ARRAY_N); 152 152 if (! is_array($res) || ! count($res)) { 153 return new WP_Error('db_failure', "Failed to create table '{$wpdb->prefix}pt_activities");153 return new WP_Error('db_failure', "Failed to create table {$wpdb->prefix}pt_activities"); 154 154 } 155 155 … … 168 168 $res = $wpdb->get_row("SHOW TABLES LIKE '{$wpdb->prefix}pt_participants'", ARRAY_N); 169 169 if (! is_array($res) || ! count($res)) { 170 return new WP_Error('db_failure', "Failed to create table '{$wpdb->prefix}pt_participants");170 return new WP_Error('db_failure', "Failed to create table {$wpdb->prefix}pt_participants"); 171 171 } 172 172 … … 176 176 `log_date` date NOT NULL, 177 177 `log_time` time NOT NULL, 178 `value` varchar(255)NOT NULL DEFAULT '',178 `value` text NOT NULL DEFAULT '', 179 179 PRIMARY KEY (`user_id`,`activity_id`,`log_date`) 180 180 )"; … … 182 182 $res = $wpdb->get_row("SHOW TABLES LIKE '{$wpdb->prefix}pt_log'", ARRAY_N); 183 183 if (! is_array($res) || ! count($res)) { 184 return new WP_Error('db_failure', "Failed to create table '{$wpdb->prefix}pt_log");184 return new WP_Error('db_failure', "Failed to create table {$wpdb->prefix}pt_log"); 185 185 } 186 186 } -
point-tracker/trunk/includes/class-point-tracker.php
r1930304 r1937055 70 70 public function __construct() 71 71 { 72 if (defined('PT_ PLUGIN_NAME_VERSION')) {73 $this->version = PT_ PLUGIN_NAME_VERSION;72 if (defined('PT_VERSION')) { 73 $this->version = PT_VERSION; 74 74 } else { 75 $this->version = '1. 3.1';75 $this->version = '1.4'; 76 76 } 77 77 $this->plugin_name = 'point-tracker'; -
point-tracker/trunk/point-tracker.php
r1930304 r1937055 16 16 * Plugin Name: Point Tracker 17 17 * Plugin URI: https://github.com/godsgood33/point-tracker 18 * Description: Allow network marketingleaders to create challenges and let people track their points.19 * Version: 1. 3.118 * Description: Allow leaders to create challenges and let people track their points. 19 * Version: 1.4 20 20 * Author: Ryan Prather 21 21 * Author URI: https://github.com/godsgood33 … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define('PT_ PLUGIN_NAME_VERSION', '1.3.1');38 define('PT_VERSION', '1.4'); 39 39 40 40 /** -
point-tracker/trunk/public/class-point-tracker-public.php
r1929974 r1937055 172 172 "m/d/Y" => "mm/dd/yy", 173 173 "M j, Y" => "M d, yy", 174 "F j, Y" => "MM MMd, yy",174 "F j, Y" => "MM d, yy", 175 175 "d/m/Y" => "dd/mm/yy" 176 176 ]; -
point-tracker/trunk/public/js/point-tracker-public.min.js
r1929974 r1937055 3 3 return false;}else{if(!$("#email").val()){$("#msg").append("<div>Please enter your email</div>");$("#msg").slideToggle(300);$("#msg").addClass("warn-msg");setTimeout(function(){$("#msg").slideToggle(300);},5000);return false;}}$.ajax(ajax_object.ajax_url,{data:{action:"get-my-activity","member-id":$("#member-id").val(),"email":$("#email").val(),"chal-id":$("#chal-id").val()},beforeSend:beforeAjaxSend,complete:ajaxComplete,success:function(data){if(!check_for_error(data)){return;}$("#total-points").html(data.total_points); 4 4 if($.fn.DataTable.isDataTable("#my-activity-table")){table.destroy();$("#my-activity-table").empty();}table=$("#my-activity-table").DataTable({data:data.data.slice(0),columns:data.columns.slice(0),paging:false,buttons:["copyHtml5","csv","excel","pdf","print"],dom:"Bfrtip",searching:false});$(".fa-trash-alt").click(delete_activity);},error:function(xhr,status,error){console.error(error);},method:"post",dataType:"json"});}function save_activity(){var start=$(this).parent().parent();var type=$(start).find(".type").val(); 5 var value="";if(!validate_entry(start)){return;}if(type=="checkbox"){var length=$(start).find("input[type='checkbox']:checked").length;if(length>1){value=[];for(var x=0;x<length;x++){value.push($(start).find("input[type='checkbox']:checked").eq(x).val());}}else{value=$(start).find("input[type='checkbox']:checked").val();}}else{if(type=="radio"){value=$(start).find("input[type='radio']:checked").val();}else{value=$(start).find("input.value").val();}}$.ajax(ajax_object.ajax_url,{data:{"action":"save-entry","chal-link":$("#chal-link").val(),"act-id":$(start).find(".id").val(),"type":type,"value":value,"member-id":$("#member-id").val(),"user-name":$("#user-name").val(),"user-email":$("#user-email").val()},beforeSend:beforeAjaxSend,complete:ajaxComplete,success:function(data){$("#msg"). html("");5 var value="";if(!validate_entry(start)){return;}if(type=="checkbox"){var length=$(start).find("input[type='checkbox']:checked").length;if(length>1){value=[];for(var x=0;x<length;x++){value.push($(start).find("input[type='checkbox']:checked").eq(x).val());}}else{value=$(start).find("input[type='checkbox']:checked").val();}}else{if(type=="radio"){value=$(start).find("input[type='radio']:checked").val();}else{value=$(start).find("input.value").val();}}$.ajax(ajax_object.ajax_url,{data:{"action":"save-entry","chal-link":$("#chal-link").val(),"act-id":$(start).find(".id").val(),"type":type,"value":value,"member-id":$("#member-id").val(),"user-name":$("#user-name").val(),"user-email":$("#user-email").val()},beforeSend:beforeAjaxSend,complete:ajaxComplete,success:function(data){$("#msg").empty(); 6 6 $("#msg").removeClass("err-msg,warn-msg");var duration=1500;if(data.error){$("#msg").html("<p>"+data.error+"</p>");$("#msg").addClass("err-msg");duration=5000;}else{if(data.warning){$("#msg").html("<p>"+data.warning+"</p>");$("#msg").addClass("warn-msg");duration=3000;}else{$("#msg").html("<p>Activity saved</p>");}}$("#msg").css("top",$(start).position().top+5);$("#msg").height($(start).height()+2);$("#msg").slideToggle(300);setTimeout(function(){$("#msg").slideToggle(300);},duration);},error:function(xhr,status,error){console.error(error); 7 7 },dataType:"json",method:"post"});}function delete_activity(){var button=$(this);$.ajax(ajax_object.ajax_url,{data:{"action":"delete-participant-activity","act-id":$(this).data("act-id"),"user-id":$(this).data("user-id"),"log-date":$(this).data("log-date"),"security":$("#_wpnonce").val()},beforeSend:beforeAjaxSend,complete:ajaxComplete,success:function(data){if(!check_for_error(data)){return;}table.row($(button).closest("tr").index()).remove().draw();},error:function(xhr,status,error){console.error(error);},dataType:"json",method:"post"}); 8 }function validate_entry(act){var numeric=/^\d+$/;var ret=true;var type=$(act).find("input.type").val();$("#msg div").remove();$("#msg").removeClass("err-msg");$("#msg").removeClass("warn-msg");if(!$("#member-id").val()||!$("#member-id").val().match(numeric)){$("#msg").append("<div>That is an invalid member ID</div>");ret=false;}if(!$("#user-name").val()){$("#msg").append("<div>You need to put your name in the form</div>");ret=false;}if(!$("#user-email").val()){$("#msg").append("<div>You need to enter your e-mail address</div>"); 9 ret=false;}if(type=="checkbox"||type=="radio"){if(!$(act).find("input[type="+type+"]:checked").length){$("#msg").append("<div>You must select one of the options</div>");ret=false;}}else{if(type=="text"){if(!$(act).find('input[type="text"]').val().length){$("#msg").append("<div>Invalid entry for this activity</div>");ret=false;}}else{if(type=="number"){var num=$(act).find('input[type="number"]').val();if(!num.match(numeric)){$("#msg").append("<div>Invalid entry for this activity</div>");ret=false;}else{if(parseInt(num)<1){$("#msg").append("<div>Invalid entry for this activity, positive numbers only</div>"); 10 ret=false;}}}}}if(!ret){$("#msg").slideToggle(300);$("#msg").addClass("warn-msg");setTimeout(function(){$("#msg").slideToggle(300);},5000);}return ret;}function check_for_error(data){$("#msg div").remove();$("#msg").removeClass("err-msg,warn-msg");var err=false;if(data=="0"){$("#msg").html("<div>There was an error</div>");$("#msg").addClass("err-msg");err=true;}else{if(data.error){$("#msg").html("<div>"+data.error+"</div>");$("#msg").addClass("err-msg");err=true;}else{if(data.warning){$("#msg").html("<div>"+data.warning+"</div>"); 11 $("#msg").addClass("warn-msg");err=true;}else{if(data.success){$("#msg").html("<div>"+data.success+"</div>");}}}}if($("#msg").html()){$("#msg").show(300);}if(err){setTimeout(function(){$("#msg").hide(300);$("#msg").html("");},3000);}else{setTimeout(function(){$("#msg").hide(300);$("#msg").html("");},1500);}return !err;}function beforeAjaxSend(){$("#loading,#waiting").show();$("#waiting").animate({"opacity":"0.5"},300,"linear");}function ajaxComplete(){$("#loading,#waiting").hide();$("#waiting").animate({"opacity":"0"},300,"linear"); 12 }var opts={lines:25,length:25,width:5,radius:50,scale:1,corners:1,color:"#000",opacity:0.25,rotate:0,direction:1,speed:0.5,trail:60,fps:20,zIndex:2000000000,className:"spinner",top:"50%",left:"50%",shadow:false,hwaccel:false,position:"absolute"};var target,spinner,table;$("#registered-challenges,#upcoming-challenges,#past-challenges").DataTable({paging:false,searching:false});$(".tooltip-field").tooltip({show:{effect:"slideDown",delay:100},hide:{effect:"slideUp",delay:250}});dialog=$("#dialog-form").dialog({autoOpen:false,height:500,width:350,modal:true,buttons:{"Join Challenge":join_challenge,Cancel:function(){dialog.dialog("close"); 13 }},close:function(){form[0].reset();}});form=dialog.find("form").on("submit",function(event){event.preventDefault();join_challenge();});$("#join-challenge").button().on("click",function(){dialog.dialog("open");});$(".save").click(save_activity);$("#get-activity").click(get_my_activity);$("#msg").hide();if($("#loading")){target=document.getElementById("loading");spinner=new Spinner(opts).spin(target);}if($("#my-activity-body tr").length){table=$("#my-activity-table").DataTable({paging:false,buttons:["copyHtml5","csv","excel","pdf","print"],dom:"Bfrtip",searching:false,stripClasses:["odd-row","even-row"],order:[[0,"asc"],[2,"asc"]]}); 14 $(".fa-trash-alt").click(delete_activity);}}); 8 }function validate_entry(act){var numeric=/^\d+$/;var ret=true;var start=$(act);var type=$(act).find("input.type").val();$("#msg").empty();$("#msg").removeClass("err-msg");$("#msg").removeClass("warn-msg");$("#msg").css("top",$(start).position().top+5);$("#msg").height($(start).height()+2);if(!$("#member-id").val()||!$("#member-id").val().match(numeric)){$("#msg").append("<p>That is an invalid member ID</p>");ret=false;}if(!$("#user-name").val()){$("#msg").append("<p>You need to put your name in the form</p>"); 9 ret=false;}if(!$("#user-email").val()){$("#msg").append("<p>You need to enter your e-mail address</p>");ret=false;}if(type=="checkbox"||type=="radio"){if(!$(act).find("input[type="+type+"]:checked").length){$("#msg").append("<p>You must select one of the options</p>");ret=false;}}else{if(type=="text"){if(!$(act).find('input[type="text"]').val().length){$("#msg").append("<p>Invalid entry for this activity</p>");ret=false;}}else{if(type=="number"){var field=$(act).find('input[type="number"]');var num=$(field).val(); 10 var min=($(field).attr("min")?$(field).attr("min"):0);var max=($(field).attr("max")?$(field).attr("max"):0);if(!num.match(numeric)){$("#msg").append("<p>Invalid entry for this activity</p>");ret=false;}else{if(parseInt(num)<1){$("#msg").append("<p>Invalid entry for this activity, positive numbers only</p>");ret=false;}else{if(parseInt(num)<min){$("#msg").append("<p>Invalid entry for this activity, number must be greater than or equal to "+min+"</p>");ret=false;}else{if(parseInt(num)>max){$("#msg").append("<p>Invalid entry for this activity, number must be lesser than or equal to "+max+"</p>"); 11 ret=false;}}}}}}}if(!ret){$("#msg").slideToggle(300);$("#msg").addClass("warn-msg");setTimeout(function(){$("#msg").slideToggle(300);$("#msg").empty();},5000);}return ret;}function check_for_error(data){$("#msg").empty();$("#msg").removeClass("err-msg,warn-msg");var err=false;if(data=="0"){$("#msg").html("<p>There was an error</p>");$("#msg").addClass("err-msg");err=true;}else{if(data.error){$("#msg").html("<p>"+data.error+"</p>");$("#msg").addClass("err-msg");err=true;}else{if(data.warning){$("#msg").html("<p>"+data.warning+"</p>"); 12 $("#msg").addClass("warn-msg");err=true;}else{if(data.success){$("#msg").html("<p>"+data.success+"</p>");}}}}if($("#msg").html()){$("#msg").show(300);}if(err){setTimeout(function(){$("#msg").hide(300);$("#msg").empty();},3000);}else{setTimeout(function(){$("#msg").hide(300);$("#msg").empty();},1500);}return !err;}function beforeAjaxSend(){$("#loading,#waiting").show();$("#waiting").animate({"opacity":"0.5"},300,"linear");}function ajaxComplete(){$("#loading,#waiting").hide();$("#waiting").animate({"opacity":"0"},300,"linear"); 13 }var opts={lines:25,length:25,width:5,radius:50,scale:1,corners:1,color:"#000",opacity:0.25,rotate:0,direction:1,speed:0.5,trail:60,fps:20,zIndex:2000000000,className:"spinner",top:"50%",left:"50%",shadow:false,hwaccel:false,position:"absolute"};var target,spinner,table;$(".text-max").keyup(function(){$("#text-len-"+$(this).attr("id")).text($(this).val().length);});$("#registered-challenges,#upcoming-challenges,#past-challenges").DataTable({paging:false,searching:false});$(".tooltip-field").tooltip({show:{effect:"slideDown",delay:100},hide:{effect:"slideUp",delay:250}}); 14 dialog=$("#dialog-form").dialog({autoOpen:false,height:500,width:350,modal:true,buttons:{"Join Challenge":join_challenge,Cancel:function(){dialog.dialog("close");}},close:function(){form[0].reset();}});form=dialog.find("form").on("submit",function(event){event.preventDefault();join_challenge();});$("#join-challenge").button().on("click",function(){dialog.dialog("open");});$(".save").click(save_activity);$("#get-activity").click(get_my_activity);$("#msg").hide();if($("#loading")){target=document.getElementById("loading"); 15 spinner=new Spinner(opts).spin(target);}if($("#my-activity-body tr").length){table=$("#my-activity-table").DataTable({paging:false,buttons:["copyHtml5","csv","excel","pdf","print"],dom:"Bfrtip",searching:false,stripClasses:["odd-row","even-row"],order:[[0,"asc"],[2,"asc"]]});$(".fa-trash-alt").click(delete_activity);}}); -
point-tracker/trunk/public/partials/point-tracker-challenge-pg.php
r1929974 r1937055 126 126 127 127 print <<<EOR 128 < label for='$id'>$label</label> 129 < input type='{$act->type}' class='value' id='$id' value='$label' /><br />128 <input type='{$act->type}' class='value' id='$id' value='$label' /> 129 <label for='$id'>$label</label><br /> 130 130 EOR; 131 131 } … … 138 138 139 139 $inputmode = ($act->type == 'number' ? " inputmode='numeric' pattern='[0-9]*'" : null); 140 141 print "<input type='{$act->type}' class='value' id='$id'$inputmode $min $max $val /> "; 140 $text_max = ($act->type == 'text' && $act->max ? " text-max" : null); 141 142 print "<input type='{$act->type}' class='value$text_max' id='$id'$inputmode $min $max $val /> "; 143 print ($act->type == 'text' && $act->max ? "<br />(<span id='text-len-{$id}'>0</span> / {$act->max})" : null); 142 144 } 143 145 … … 220 222 221 223 print <<<EOR 222 < label for='$id'>$label</label> 223 < input type='{$act->type}' class='value' id='$id' value='$label' /><br />224 <input type='{$act->type}' class='value' id='$id' value='$label' /> 225 <label for='$id'>$label</label><br /> 224 226 EOR; 225 227 } … … 232 234 233 235 $inputmode = ($act->type == 'number' ? " inputmode='numeric' pattern='[0-9]*'" : null); 234 235 print "<input type='{$act->type}' class='value' id='$id'$inputmode $min $max $val /> "; 236 $text_max = ($act->type == 'text' && $act->max ? " text-max" : null); 237 238 print "<input type='{$act->type}' class='value$text_max' id='$id'$inputmode $min $max $val /> "; 239 print ($act->type == 'text' && $act->max ? "<br />(<span id='text-len-{$id}'>0</span> / {$act->max})" : null); 236 240 } 237 241
Note: See TracChangeset
for help on using the changeset viewer.