updated UserManager for home/work contact information; added Sequencer;
Showing
8 changed files
with
443 additions
and
36 deletions
| ... | @@ -3,6 +3,7 @@ namespace Tz\WordPress\Tools\Notifications; | ... | @@ -3,6 +3,7 @@ namespace Tz\WordPress\Tools\Notifications; |
| 3 | 3 | ||
| 4 | use Tz\Common; | 4 | use Tz\Common; |
| 5 | use Tz\WordPress\Tools; | 5 | use Tz\WordPress\Tools; |
| 6 | use Tz\WordPress\Tools\Sequencer; | ||
| 6 | use Tz\WordPress\CBV; | 7 | use Tz\WordPress\CBV; |
| 7 | use WP_User; | 8 | use WP_User; |
| 8 | use Exception, StdClass; | 9 | use Exception, StdClass; |
| ... | @@ -228,7 +229,10 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), | ... | @@ -228,7 +229,10 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), |
| 228 | if(empty($notices)) { | 229 | if(empty($notices)) { |
| 229 | $notices = array(); | 230 | $notices = array(); |
| 230 | } | 231 | } |
| 231 | $notices[] = $insert; | 232 | |
| 233 | $sequence = Sequencer\generate('NTC'); | ||
| 234 | |||
| 235 | $notices[$sequence] = $insert; | ||
| 232 | 236 | ||
| 233 | 237 | ||
| 234 | update_user_meta($user->ID,'notices',$notices); | 238 | update_user_meta($user->ID,'notices',$notices); | ... | ... |
com/Sequencer/Sequencer.php
0 → 100644
| 1 | <?php | ||
| 2 | /** | ||
| 3 | * ID Sequencer | ||
| 4 | * | ||
| 5 | * Generates a unique ID, based on a prefix code and a 7 digit zero-filled number in sequencial order | ||
| 6 | * | ||
| 7 | * @package WordPress | ||
| 8 | * @subpackage Sequencer | ||
| 9 | * @author Tenzing Communications Inc. | ||
| 10 | * @link http://www.gotenzing.com | ||
| 11 | */ | ||
| 12 | |||
| 13 | namespace Tz\WordPress\Tools\Sequencer; | ||
| 14 | use Tz, Tz\Common, Tz\WordPress\Tools; | ||
| 15 | use Exception; | ||
| 16 | |||
| 17 | call_user_func(function() { | ||
| 18 | Tools\add_actions(__NAMESPACE__ . '\Actions'); | ||
| 19 | }); | ||
| 20 | |||
| 21 | /** | ||
| 22 | * Generate New ID | ||
| 23 | * | ||
| 24 | * @param (String) Prefix (EVT, NCE, GRP) | ||
| 25 | * @return (String) ID | ||
| 26 | */ | ||
| 27 | function generate($prefix = "") { | ||
| 28 | global $wpdb; | ||
| 29 | $row = $wpdb->get_row("SELECT `current`,`end` FROM `".$wpdb->prefix."sequencer` WHERE `prefix`='".$prefix."'"); | ||
| 30 | |||
| 31 | if (!empty($row)) { | ||
| 32 | |||
| 33 | $current = (int) $row->current; | ||
| 34 | $end = (int) $row->end; | ||
| 35 | $next = ($current + 1); | ||
| 36 | |||
| 37 | $allowable_length = 7; | ||
| 38 | |||
| 39 | if ($next >= $end) { | ||
| 40 | throw new Exception("The prefix [$prefix] has reached it's limit of: ".$end); | ||
| 41 | } else { | ||
| 42 | |||
| 43 | $length = strlen($next); | ||
| 44 | $zeros = $allowable_length - $length; | ||
| 45 | |||
| 46 | $return = ""; | ||
| 47 | |||
| 48 | if ($zeros > 0) { | ||
| 49 | for($i=0; $i < $zeros; $i++) { | ||
| 50 | $return .= "0"; | ||
| 51 | } | ||
| 52 | } else { | ||
| 53 | $return = ""; | ||
| 54 | } | ||
| 55 | |||
| 56 | $wpdb->query("UPDATE `".$wpdb->prefix."sequencer` SET `current`=$next WHERE `prefix`='$prefix' LIMIT 1"); | ||
| 57 | |||
| 58 | return $prefix.$return.$next; | ||
| 59 | } | ||
| 60 | |||
| 61 | } else { | ||
| 62 | $wpdb->query("INSERT INTO `".$wpdb->prefix."sequencer` (`prefix`,`start`,`end`,`current`) VALUES ('$prefix',0,9999999,0)"); | ||
| 63 | generate($prefix); | ||
| 64 | } | ||
| 65 | |||
| 66 | } | ||
| 67 | |||
| 68 | /** | ||
| 69 | * Standard Action Class for WordPress | ||
| 70 | * | ||
| 71 | * Checks to see if the table exists in the database, if not, creates it. | ||
| 72 | */ | ||
| 73 | class Actions { | ||
| 74 | |||
| 75 | // Does the Sequencer table exist? If not, create it. | ||
| 76 | public static function init() { | ||
| 77 | global $wpdb; | ||
| 78 | $create_table_statement = " | ||
| 79 | CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."sequencer` ( | ||
| 80 | `prefix` varchar(3) NOT NULL, | ||
| 81 | `start` int(7) unsigned zerofill NOT NULL DEFAULT '0000000', | ||
| 82 | `end` int(7) unsigned zerofill NOT NULL DEFAULT '9999999', | ||
| 83 | `current` int(7) unsigned zerofill DEFAULT '0000000', | ||
| 84 | `last_used` int(16) NOT NULL DEFAULT '0', | ||
| 85 | PRIMARY KEY (`prefix`), | ||
| 86 | UNIQUE KEY `prefix` (`prefix`) | ||
| 87 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| 88 | "; | ||
| 89 | $wpdb->query($create_table_statement); | ||
| 90 | //$wpdb->query("INSERT INTO `wp_sequencer` (`prefix`, `start`, `end`, `current`, `last_used`) VALUES ('EVT', 0000000, 9999999, 0000000, 0),('NTC', 0000000, 9999999, 0000000, 0),('CEH', 0000000, 9999999, 0000000, 0);"); | ||
| 91 | } | ||
| 92 | |||
| 93 | } | ||
| 94 | |||
| 95 | ?> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -11,6 +11,7 @@ namespace Tz\WordPress\Tools\UserManager; | ... | @@ -11,6 +11,7 @@ namespace Tz\WordPress\Tools\UserManager; |
| 11 | use Tz\Common; | 11 | use Tz\Common; |
| 12 | use Tz\WordPress\Tools; | 12 | use Tz\WordPress\Tools; |
| 13 | use Tz\WordPress\Tools\Auth; | 13 | use Tz\WordPress\Tools\Auth; |
| 14 | use Tz\WordPress\Tools\Sequencer; | ||
| 14 | use Tz\WordPress\UAM; | 15 | use Tz\WordPress\UAM; |
| 15 | use Tz\WordPress\Tools\HTML; | 16 | use Tz\WordPress\Tools\HTML; |
| 16 | use Tz\WordPress\CBV; | 17 | use Tz\WordPress\CBV; |
| ... | @@ -194,63 +195,103 @@ class ProfileValidation extends Common\Validation { | ... | @@ -194,63 +195,103 @@ class ProfileValidation extends Common\Validation { |
| 194 | update_user_meta($_POST['uid'], __FUNCTION__, $val); | 195 | update_user_meta($_POST['uid'], __FUNCTION__, $val); |
| 195 | } | 196 | } |
| 196 | 197 | ||
| 197 | public function address($val) { | 198 | public function home_address($val) { |
| 198 | update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val)); | 199 | update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val)); |
| 199 | } | 200 | } |
| 200 | 201 | ||
| 201 | public function address2($val) { | 202 | public function home_address2($val) { |
| 202 | update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val)); | 203 | update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val)); |
| 203 | } | 204 | } |
| 204 | 205 | ||
| 205 | public function city($val) { | 206 | public function home_city($val) { |
| 206 | update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val)); | 207 | update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val)); |
| 207 | } | 208 | } |
| 208 | 209 | ||
| 209 | public function province($val) { | 210 | public function home_province($val) { |
| 210 | if (empty($val)) { | 211 | if (empty($val)) { |
| 211 | throw new Exception('Province field can not be empty'); | 212 | throw new Exception('Province field can not be empty'); |
| 212 | } | 213 | } |
| 213 | update_user_meta($_POST['uid'], __FUNCTION__, $val); | 214 | update_user_meta($_POST['uid'], __FUNCTION__, $val); |
| 214 | } | 215 | } |
| 215 | 216 | ||
| 216 | public function postal($val) { | 217 | public function home_postal($val) { |
| 217 | update_user_meta($_POST['uid'], __FUNCTION__, $val); | 218 | update_user_meta($_POST['uid'], __FUNCTION__, $val); |
| 218 | } | 219 | } |
| 219 | 220 | ||
| 220 | public function country($val) { | 221 | public function home_country($val) { |
| 221 | if (empty($val)) { | 222 | if (empty($val)) { |
| 222 | throw new Exception('Country field can not be empty'); | 223 | throw new Exception('Country field can not be empty'); |
| 223 | } | 224 | } |
| 224 | update_user_meta($_POST['uid'], __FUNCTION__, $val); | 225 | update_user_meta($_POST['uid'], __FUNCTION__, $val); |
| 225 | } | 226 | } |
| 226 | 227 | ||
| 227 | public function phone($val) { | 228 | public function home_phone($val) { |
| 228 | update_user_meta($_POST['uid'], __FUNCTION__, $val); | 229 | update_user_meta($_POST['uid'], __FUNCTION__, $val); |
| 229 | } | 230 | } |
| 230 | 231 | ||
| 231 | public function fax($val) { | ||
| 232 | update_user_meta($_POST['uid'], __FUNCTION__, $val); | ||
| 233 | } | ||
| 234 | 232 | ||
| 235 | public function mobile($val) { | 233 | public function home_mobile($val) { |
| 236 | update_user_meta($_POST['uid'], __FUNCTION__, $val); | 234 | update_user_meta($_POST['uid'], __FUNCTION__, $val); |
| 237 | } | 235 | } |
| 238 | 236 | ||
| 239 | public function email($val) { | 237 | public function home_email($val) { |
| 240 | if (!empty($val)) { | 238 | if (!empty($val)) { |
| 241 | if (!(boolean)preg_match(CBV\VALID_EMAIL, (string)$val)) { | 239 | if (!(boolean)preg_match(CBV\VALID_EMAIL, (string)$val)) { |
| 242 | throw new Exception('An invalid email address was entered in Email'); | 240 | throw new Exception('An invalid email address was entered in Email'); |
| 243 | } | 241 | } |
| 244 | } else { | 242 | } |
| 245 | throw new Exception('Email field can not be empty'); | 243 | update_user_meta($_POST['uid'], 'home_email', $val); |
| 244 | } | ||
| 245 | |||
| 246 | public function work_address($val) { | ||
| 247 | update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val)); | ||
| 248 | } | ||
| 249 | |||
| 250 | public function work_address2($val) { | ||
| 251 | update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val)); | ||
| 252 | } | ||
| 253 | |||
| 254 | public function work_city($val) { | ||
| 255 | update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val)); | ||
| 256 | } | ||
| 257 | |||
| 258 | public function work_province($val) { | ||
| 259 | if (empty($val)) { | ||
| 260 | throw new Exception('Province field can not be empty'); | ||
| 261 | } | ||
| 262 | update_user_meta($_POST['uid'], __FUNCTION__, $val); | ||
| 263 | } | ||
| 264 | |||
| 265 | public function work_postal($val) { | ||
| 266 | update_user_meta($_POST['uid'], __FUNCTION__, $val); | ||
| 246 | } | 267 | } |
| 247 | 268 | ||
| 248 | // update user email. | 269 | public function work_country($val) { |
| 249 | wp_update_user( Array ('ID'=>$_POST['uid'] , 'user_email'=>$val) ); | 270 | if (empty($val)) { |
| 271 | throw new Exception('Country field can not be empty'); | ||
| 272 | } | ||
| 273 | update_user_meta($_POST['uid'], __FUNCTION__, $val); | ||
| 274 | } | ||
| 250 | 275 | ||
| 251 | //update_user_meta($_POST['uid'], 'email', $val); | 276 | public function work_phone($val) { |
| 277 | update_user_meta($_POST['uid'], __FUNCTION__, $val); | ||
| 252 | } | 278 | } |
| 253 | 279 | ||
| 280 | |||
| 281 | public function work_mobile($val) { | ||
| 282 | update_user_meta($_POST['uid'], __FUNCTION__, $val); | ||
| 283 | } | ||
| 284 | |||
| 285 | public function work_email($val) { | ||
| 286 | if (!empty($val)) { | ||
| 287 | if (!(boolean)preg_match(CBV\VALID_EMAIL, (string)$val)) { | ||
| 288 | throw new Exception('An invalid email address was entered in Email'); | ||
| 289 | } | ||
| 290 | } | ||
| 291 | update_user_meta($_POST['uid'], 'work_email', $val); | ||
| 292 | } | ||
| 293 | |||
| 294 | |||
| 254 | public function company($val) { | 295 | public function company($val) { |
| 255 | update_user_meta($_POST['uid'],'company', User\clean_string($val)); | 296 | update_user_meta($_POST['uid'],'company', User\clean_string($val)); |
| 256 | } | 297 | } |
| ... | @@ -259,6 +300,9 @@ class ProfileValidation extends Common\Validation { | ... | @@ -259,6 +300,9 @@ class ProfileValidation extends Common\Validation { |
| 259 | update_user_meta($_POST['uid'], 'title', User\clean_string($val)); | 300 | update_user_meta($_POST['uid'], 'title', User\clean_string($val)); |
| 260 | } | 301 | } |
| 261 | 302 | ||
| 303 | public function fax($val) { | ||
| 304 | update_user_meta($_POST['uid'], __FUNCTION__, $val); | ||
| 305 | } | ||
| 262 | 306 | ||
| 263 | public function website($val) { | 307 | public function website($val) { |
| 264 | 308 | ||
| ... | @@ -438,13 +482,15 @@ class Actions { | ... | @@ -438,13 +482,15 @@ class Actions { |
| 438 | if ($user_role != "member") { unset($_POST['member_id']); } | 482 | if ($user_role != "member") { unset($_POST['member_id']); } |
| 439 | $password = $_POST['password']; unset($_POST['password']); unset($_POST['password2']); | 483 | $password = $_POST['password']; unset($_POST['password']); unset($_POST['password2']); |
| 440 | 484 | ||
| 485 | $fp = strtolower($_POST['profile_preference'])."_"; | ||
| 486 | |||
| 441 | // register the user. | 487 | // register the user. |
| 442 | $user_details = Array( | 488 | $user_details = Array( |
| 443 | 'first_name' => User\clean_string($_POST['first_name']) | 489 | 'first_name' => User\clean_string($_POST['first_name']) |
| 444 | , 'last_name' => User\clean_string($_POST['last_name']) | 490 | , 'last_name' => User\clean_string($_POST['last_name']) |
| 445 | , 'province' => $_POST['province'] | 491 | , $fp.'province' => $_POST['province'] |
| 446 | , 'country' => $_POST['country'] | 492 | , $fp.'country' => $_POST['country'] |
| 447 | , 'email' => $email | 493 | , $fp.'email' => $email |
| 448 | ); | 494 | ); |
| 449 | unset($user_details['email']); | 495 | unset($user_details['email']); |
| 450 | 496 | ||
| ... | @@ -622,8 +668,12 @@ class Actions { | ... | @@ -622,8 +668,12 @@ class Actions { |
| 622 | 668 | ||
| 623 | $timestamp = CEHours\mysqldatetime_to_timestamp($_POST['date']); | 669 | $timestamp = CEHours\mysqldatetime_to_timestamp($_POST['date']); |
| 624 | 670 | ||
| 671 | if ($_POST['indexed']=="") { | ||
| 672 | $_POST['indexed'] = Sequencer\generate('KCB'); | ||
| 673 | } | ||
| 674 | |||
| 625 | 675 | ||
| 626 | $cehours[$timestamp] = Array( | 676 | $cehours[$_POST['indexed']] = Array( |
| 627 | 'type' => $_POST['type'] | 677 | 'type' => $_POST['type'] |
| 628 | , 'date' => $timestamp | 678 | , 'date' => $timestamp |
| 629 | , 'activity' => $_POST['activity'] | 679 | , 'activity' => $_POST['activity'] | ... | ... |
com/UserManager/jquery.maskedinput.js
0 → 100644
| 1 | /* | ||
| 2 | Masked Input plugin for jQuery | ||
| 3 | Copyright (c) 2007-2010 Josh Bush (digitalbush.com) | ||
| 4 | Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license) | ||
| 5 | Version: 1.2.3 | ||
| 6 | */ | ||
| 7 | (function($) { | ||
| 8 | var pasteEventName = ($.browser.msie ? 'paste' : 'input') + ".mask"; | ||
| 9 | var iPhone = (window.orientation != undefined); | ||
| 10 | |||
| 11 | $.mask = { | ||
| 12 | //Predefined character definitions | ||
| 13 | definitions: { | ||
| 14 | '9': "[0-9]", | ||
| 15 | 'a': "[A-Za-z]", | ||
| 16 | '*': "[A-Za-z0-9]" | ||
| 17 | } | ||
| 18 | }; | ||
| 19 | |||
| 20 | $.fn.extend({ | ||
| 21 | //Helper Function for Caret positioning | ||
| 22 | caret: function(begin, end) { | ||
| 23 | if (this.length == 0) return; | ||
| 24 | if (typeof begin == 'number') { | ||
| 25 | end = (typeof end == 'number') ? end : begin; | ||
| 26 | return this.each(function() { | ||
| 27 | if (this.setSelectionRange) { | ||
| 28 | this.focus(); | ||
| 29 | this.setSelectionRange(begin, end); | ||
| 30 | } else if (this.createTextRange) { | ||
| 31 | var range = this.createTextRange(); | ||
| 32 | range.collapse(true); | ||
| 33 | range.moveEnd('character', end); | ||
| 34 | range.moveStart('character', begin); | ||
| 35 | range.select(); | ||
| 36 | } | ||
| 37 | }); | ||
| 38 | } else { | ||
| 39 | if (this[0].setSelectionRange) { | ||
| 40 | begin = this[0].selectionStart; | ||
| 41 | end = this[0].selectionEnd; | ||
| 42 | } else if (document.selection && document.selection.createRange) { | ||
| 43 | var range = document.selection.createRange(); | ||
| 44 | begin = 0 - range.duplicate().moveStart('character', -100000); | ||
| 45 | end = begin + range.text.length; | ||
| 46 | } | ||
| 47 | return { begin: begin, end: end }; | ||
| 48 | } | ||
| 49 | }, | ||
| 50 | unmask: function() { return this.trigger("unmask"); }, | ||
| 51 | mask: function(mask, settings) { | ||
| 52 | if (!mask && this.length > 0) { | ||
| 53 | var input = $(this[0]); | ||
| 54 | var tests = input.data("tests"); | ||
| 55 | return $.map(input.data("buffer"), function(c, i) { | ||
| 56 | return tests[i] ? c : null; | ||
| 57 | }).join(''); | ||
| 58 | } | ||
| 59 | settings = $.extend({ | ||
| 60 | placeholder: "_", | ||
| 61 | completed: null | ||
| 62 | }, settings); | ||
| 63 | |||
| 64 | var defs = $.mask.definitions; | ||
| 65 | var tests = []; | ||
| 66 | var partialPosition = mask.length; | ||
| 67 | var firstNonMaskPos = null; | ||
| 68 | var len = mask.length; | ||
| 69 | |||
| 70 | $.each(mask.split(""), function(i, c) { | ||
| 71 | if (c == '?') { | ||
| 72 | len--; | ||
| 73 | partialPosition = i; | ||
| 74 | } else if (defs[c]) { | ||
| 75 | tests.push(new RegExp(defs[c])); | ||
| 76 | if(firstNonMaskPos==null) | ||
| 77 | firstNonMaskPos = tests.length - 1; | ||
| 78 | } else { | ||
| 79 | tests.push(null); | ||
| 80 | } | ||
| 81 | }); | ||
| 82 | |||
| 83 | return this.each(function() { | ||
| 84 | var input = $(this); | ||
| 85 | var buffer = $.map(mask.split(""), function(c, i) { if (c != '?') return defs[c] ? settings.placeholder : c }); | ||
| 86 | var ignore = false; //Variable for ignoring control keys | ||
| 87 | var focusText = input.val(); | ||
| 88 | |||
| 89 | input.data("buffer", buffer).data("tests", tests); | ||
| 90 | |||
| 91 | function seekNext(pos) { | ||
| 92 | while (++pos <= len && !tests[pos]); | ||
| 93 | return pos; | ||
| 94 | }; | ||
| 95 | |||
| 96 | function shiftL(pos) { | ||
| 97 | while (!tests[pos] && --pos >= 0); | ||
| 98 | for (var i = pos; i < len; i++) { | ||
| 99 | if (tests[i]) { | ||
| 100 | buffer[i] = settings.placeholder; | ||
| 101 | var j = seekNext(i); | ||
| 102 | if (j < len && tests[i].test(buffer[j])) { | ||
| 103 | buffer[i] = buffer[j]; | ||
| 104 | } else | ||
| 105 | break; | ||
| 106 | } | ||
| 107 | } | ||
| 108 | writeBuffer(); | ||
| 109 | input.caret(Math.max(firstNonMaskPos, pos)); | ||
| 110 | }; | ||
| 111 | |||
| 112 | function shiftR(pos) { | ||
| 113 | for (var i = pos, c = settings.placeholder; i < len; i++) { | ||
| 114 | if (tests[i]) { | ||
| 115 | var j = seekNext(i); | ||
| 116 | var t = buffer[i]; | ||
| 117 | buffer[i] = c; | ||
| 118 | if (j < len && tests[j].test(t)) | ||
| 119 | c = t; | ||
| 120 | else | ||
| 121 | break; | ||
| 122 | } | ||
| 123 | } | ||
| 124 | }; | ||
| 125 | |||
| 126 | function keydownEvent(e) { | ||
| 127 | var pos = $(this).caret(); | ||
| 128 | var k = e.keyCode; | ||
| 129 | ignore = (k < 16 || (k > 16 && k < 32) || (k > 32 && k < 41)); | ||
| 130 | |||
| 131 | //delete selection before proceeding | ||
| 132 | if ((pos.begin - pos.end) != 0 && (!ignore || k == 8 || k == 46)) | ||
| 133 | clearBuffer(pos.begin, pos.end); | ||
| 134 | |||
| 135 | //backspace, delete, and escape get special treatment | ||
| 136 | if (k == 8 || k == 46 || (iPhone && k == 127)) {//backspace/delete | ||
| 137 | shiftL(pos.begin + (k == 46 ? (tests[pos.begin]?0:1) : -1)); | ||
| 138 | return false; | ||
| 139 | } else if (k == 27) {//escape | ||
| 140 | input.val(focusText); | ||
| 141 | input.caret(0, checkVal()); | ||
| 142 | return false; | ||
| 143 | } | ||
| 144 | }; | ||
| 145 | |||
| 146 | function keypressEvent(e) { | ||
| 147 | if (ignore) { | ||
| 148 | ignore = false; | ||
| 149 | //Fixes Mac FF bug on backspace | ||
| 150 | return (e.keyCode == 8) ? false : null; | ||
| 151 | } | ||
| 152 | e = e || window.event; | ||
| 153 | var k = e.charCode || e.keyCode || e.which; | ||
| 154 | var pos = $(this).caret(); | ||
| 155 | |||
| 156 | if (e.ctrlKey || e.altKey || e.metaKey) {//Ignore | ||
| 157 | return true; | ||
| 158 | } else if ((k >= 32 && k <= 125) || k > 186) {//typeable characters | ||
| 159 | var p = seekNext(pos.begin - 1); | ||
| 160 | if (p < len) { | ||
| 161 | var c = String.fromCharCode(k); | ||
| 162 | if (tests[p].test(c)) { | ||
| 163 | shiftR(p); | ||
| 164 | buffer[p] = c; | ||
| 165 | writeBuffer(); | ||
| 166 | var next = seekNext(p); | ||
| 167 | $(this).caret(next); | ||
| 168 | if (settings.completed && next >= len) | ||
| 169 | settings.completed.call(input); | ||
| 170 | } | ||
| 171 | } | ||
| 172 | } | ||
| 173 | return false; | ||
| 174 | }; | ||
| 175 | |||
| 176 | function clearBuffer(start, end) { | ||
| 177 | for (var i = start; i < end && i < len; i++) { | ||
| 178 | if (tests[i]) | ||
| 179 | buffer[i] = settings.placeholder; | ||
| 180 | } | ||
| 181 | }; | ||
| 182 | |||
| 183 | function writeBuffer() { return input.val(buffer.join('')).val(); }; | ||
| 184 | |||
| 185 | function checkVal(allow) { | ||
| 186 | //try to place characters where they belong | ||
| 187 | var test = input.val(); | ||
| 188 | var lastMatch = -1; | ||
| 189 | for (var i = 0, pos = 0; i < len; i++) { | ||
| 190 | if (tests[i]) { | ||
| 191 | buffer[i] = settings.placeholder; | ||
| 192 | while (pos++ < test.length) { | ||
| 193 | var c = test.charAt(pos - 1); | ||
| 194 | if (tests[i].test(c)) { | ||
| 195 | buffer[i] = c; | ||
| 196 | lastMatch = i; | ||
| 197 | break; | ||
| 198 | } | ||
| 199 | } | ||
| 200 | if (pos > test.length) | ||
| 201 | break; | ||
| 202 | } else if (buffer[i] == test.charAt(pos) && i!=partialPosition) { | ||
| 203 | pos++; | ||
| 204 | lastMatch = i; | ||
| 205 | } | ||
| 206 | } | ||
| 207 | if (!allow && lastMatch + 1 < partialPosition) { | ||
| 208 | input.val(""); | ||
| 209 | clearBuffer(0, len); | ||
| 210 | } else if (allow || lastMatch + 1 >= partialPosition) { | ||
| 211 | writeBuffer(); | ||
| 212 | if (!allow) input.val(input.val().substring(0, lastMatch + 1)); | ||
| 213 | } | ||
| 214 | return (partialPosition ? i : firstNonMaskPos); | ||
| 215 | }; | ||
| 216 | |||
| 217 | if (!input.attr("readonly")) | ||
| 218 | input | ||
| 219 | .one("unmask", function() { | ||
| 220 | input | ||
| 221 | .unbind(".mask") | ||
| 222 | .removeData("buffer") | ||
| 223 | .removeData("tests"); | ||
| 224 | }) | ||
| 225 | .bind("focus.mask", function() { | ||
| 226 | focusText = input.val(); | ||
| 227 | var pos = checkVal(); | ||
| 228 | writeBuffer(); | ||
| 229 | setTimeout(function() { | ||
| 230 | if (pos == mask.length) | ||
| 231 | input.caret(0, pos); | ||
| 232 | else | ||
| 233 | input.caret(pos); | ||
| 234 | }, 0); | ||
| 235 | }) | ||
| 236 | .bind("blur.mask", function() { | ||
| 237 | checkVal(); | ||
| 238 | if (input.val() != focusText) | ||
| 239 | input.change(); | ||
| 240 | }) | ||
| 241 | .bind("keydown.mask", keydownEvent) | ||
| 242 | .bind("keypress.mask", keypressEvent) | ||
| 243 | .bind(pasteEventName, function() { | ||
| 244 | setTimeout(function() { input.caret(checkVal(true)); }, 0); | ||
| 245 | }); | ||
| 246 | |||
| 247 | checkVal(); //Perform initial check for existing values | ||
| 248 | }); | ||
| 249 | } | ||
| 250 | }); | ||
| 251 | })(jQuery); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -60,10 +60,6 @@ unset($rc, $roles['administrator']); | ... | @@ -60,10 +60,6 @@ unset($rc, $roles['administrator']); |
| 60 | <td><input type="text" name="username" required /></td> | 60 | <td><input type="text" name="username" required /></td> |
| 61 | </tr> | 61 | </tr> |
| 62 | <tr> | 62 | <tr> |
| 63 | <th>Email:</th> | ||
| 64 | <td><input type="text" name="email" required /></td> | ||
| 65 | </tr> | ||
| 66 | <tr> | ||
| 67 | <th>First Name:</th> | 63 | <th>First Name:</th> |
| 68 | <td><input type="text" name="first_name" required /></td> | 64 | <td><input type="text" name="first_name" required /></td> |
| 69 | </tr> | 65 | </tr> |
| ... | @@ -71,6 +67,15 @@ unset($rc, $roles['administrator']); | ... | @@ -71,6 +67,15 @@ unset($rc, $roles['administrator']); |
| 71 | <th>Last Name:</th> | 67 | <th>Last Name:</th> |
| 72 | <td><input type="text" name="last_name" id="create_last_name" required /></td> | 68 | <td><input type="text" name="last_name" id="create_last_name" required /></td> |
| 73 | </tr> | 69 | </tr> |
| 70 | <tr><td colspan="2"> </td></tr> | ||
| 71 | <tr> | ||
| 72 | <th> </th> | ||
| 73 | <td><select name="profile_preference" id="profile_preference"><option value="Home">Home </option><option value="Work">Work </option></select></td> | ||
| 74 | </tr> | ||
| 75 | <tr> | ||
| 76 | <th>Email:</th> | ||
| 77 | <td><input type="text" name="email" required /></td> | ||
| 78 | </tr> | ||
| 74 | <tr> | 79 | <tr> |
| 75 | <th>Country:</th> | 80 | <th>Country:</th> |
| 76 | <td> | 81 | <td> | ... | ... |
| ... | @@ -40,7 +40,7 @@ else: | ... | @@ -40,7 +40,7 @@ else: |
| 40 | </tr> | 40 | </tr> |
| 41 | </thead> | 41 | </thead> |
| 42 | <tbody> | 42 | <tbody> |
| 43 | <?php foreach($cehours as $ce): | 43 | <?php foreach($cehours as $index=>$ce): |
| 44 | $ce_date = date('F j, Y',$ce['date']); | 44 | $ce_date = date('F j, Y',$ce['date']); |
| 45 | ?> | 45 | ?> |
| 46 | <tr> | 46 | <tr> |
| ... | @@ -48,7 +48,7 @@ else: | ... | @@ -48,7 +48,7 @@ else: |
| 48 | <td><?php echo $ce['activity']; ?></td> | 48 | <td><?php echo $ce['activity']; ?></td> |
| 49 | <td><?php echo ($ce['type']=="structured") ? $ce['hours'] : 0;?></td> | 49 | <td><?php echo ($ce['type']=="structured") ? $ce['hours'] : 0;?></td> |
| 50 | <td><?php echo ($ce['type']=="unstructured") ? $ce['hours'] : 0;?></td> | 50 | <td><?php echo ($ce['type']=="unstructured") ? $ce['hours'] : 0;?></td> |
| 51 | <td class="cehours-remove-td"><a href="/wp-admin/admin-ajax.php?ajax=yes&action=build_cehour_form&uid=<?php echo $uid?>&indexed=<?php echo $ce['date'];?>" class="cehours-edit" rel="<?php echo $ce['date'];?>">edit</a> | <a href="#" class="cehours-remove" rel="<?php echo $ce['date'];?>">remove</a></td> | 51 | <td class="cehours-remove-td"><a href="/wp-admin/admin-ajax.php?ajax=yes&action=build_cehour_form&uid=<?php echo $uid?>&indexed=<?php echo $index;?>" class="cehours-edit" rel="<?php echo $index;?>">edit</a> | <a href="#" class="cehours-remove" rel="<?php echo $index;?>">remove</a></td> |
| 52 | </tr> | 52 | </tr> |
| 53 | <?php endforeach; ?> | 53 | <?php endforeach; ?> |
| 54 | </tbody> | 54 | </tbody> | ... | ... |
This diff is collapsed.
Click to expand it.
| ... | @@ -21,8 +21,10 @@ | ... | @@ -21,8 +21,10 @@ |
| 21 | cursor: default; | 21 | cursor: default; |
| 22 | padding: 0em; padding:3px 10px 3px 10px; | 22 | padding: 0em; padding:3px 10px 3px 10px; |
| 23 | margin: 0em; | 23 | margin: 0em; |
| 24 | |||
| 24 | } | 25 | } |
| 25 | 26 | ||
| 27 | |||
| 26 | form { | 28 | form { |
| 27 | display: block; | 29 | display: block; |
| 28 | margin-right:20px; | 30 | margin-right:20px; |
| ... | @@ -34,6 +36,8 @@ | ... | @@ -34,6 +36,8 @@ |
| 34 | 36 | ||
| 35 | <body> | 37 | <body> |
| 36 | 38 | ||
| 39 | <div style="display:block; width:500px;"> | ||
| 40 | |||
| 37 | <div class="title-link" style="display:block;color:#f7bd55; font-size: 12px;font-weight: bold;text-align: left;line-height: 1.75em; background-color: #3b0d32; border: solid 1px #FFF; border-bottom: solid 1px #999; cursor: default; padding: 0em; padding:3px 10px 3px 10px; margin: 0em;">Edit <?php echo $name; ?>'s CE Hours:</div> | 41 | <div class="title-link" style="display:block;color:#f7bd55; font-size: 12px;font-weight: bold;text-align: left;line-height: 1.75em; background-color: #3b0d32; border: solid 1px #FFF; border-bottom: solid 1px #999; cursor: default; padding: 0em; padding:3px 10px 3px 10px; margin: 0em;">Edit <?php echo $name; ?>'s CE Hours:</div> |
| 38 | 42 | ||
| 39 | <form method="post" action="" id="edit-cehours-form"> | 43 | <form method="post" action="" id="edit-cehours-form"> |
| ... | @@ -69,21 +73,19 @@ | ... | @@ -69,21 +73,19 @@ |
| 69 | <th>Hours:</th> | 73 | <th>Hours:</th> |
| 70 | <td><input type="text" name="hours" value="<?php echo $hours;?>" /></td> | 74 | <td><input type="text" name="hours" value="<?php echo $hours;?>" /></td> |
| 71 | </tr> | 75 | </tr> |
| 76 | |||
| 77 | <tr> | ||
| 78 | <th> </th> | ||
| 79 | <td><div><input type="submit" value="<?php echo ($action=="edit") ? "Update" : "Apply"; ?>" /></div> </td> | ||
| 80 | </tr> | ||
| 72 | </tbody> | 81 | </tbody> |
| 73 | </table> | 82 | </table> |
| 74 | 83 | ||
| 75 | </div> | 84 | </div> |
| 76 | </div> | 85 | </div> |
| 77 | 86 | ||
| 78 | <div class="dashboard-section" style="margin-left:20px;margin-top:10px;"> | ||
| 79 | <div class="dashboard-section-title"></div> | ||
| 80 | <div class="dashboard-section-links"></div> | ||
| 81 | <div class="dashboard-section-content small"> | ||
| 82 | <div><input type="submit" value="<?php echo ($action=="edit") ? "Update" : "Apply"; ?>" /></div> | ||
| 83 | </div> | ||
| 84 | </div> | ||
| 85 | 87 | ||
| 86 | </form> | 88 | </form> |
| 87 | 89 | </div> | |
| 88 | </body> | 90 | </body> |
| 89 | </html> | 91 | </html> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment