Changeset 374
- Timestamp:
- 04/09/08 18:35:28 (8 months ago)
- Location:
- trunk/app
- Files:
-
- 1 added
- 5 modified
-
app_controller.php (modified) (1 diff)
-
controllers/confirms_controller.php (modified) (2 diffs)
-
controllers/users_controller.php (modified) (4 diffs)
-
views/layouts/flash.ctp (added)
-
views/users/validate.ctp (modified) (2 diffs)
-
webroot/js/prototype.js (modified) (32 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/app_controller.php
r356 r374 8 8 class AppController extends Controller { 9 9 10 public $components = array('Auth', 'Cookie', 'Security' );10 public $components = array('Auth', 'Cookie', 'Security', 'Session'); 11 11 12 12 public $helpers = array('Html', 'Form', 'Session'); -
trunk/app/controllers/confirms_controller.php
r339 r374 51 51 if ($this->User->save($this->data) && $this->Confirm->delete($data['Confirm']['id'])) 52 52 { 53 $this->flash('Your account has been activated', '/users/login' );53 $this->flash('Your account has been activated', '/users/login', 2); 54 54 } 55 55 else … … 60 60 else 61 61 { 62 $this->flash('There is not such account', '/users/login' );62 $this->flash('There is not such account', '/users/login', 2); 63 63 } 64 64 } -
trunk/app/controllers/users_controller.php
r373 r374 286 286 if (strlen($this->data['User']['pwd']) < 6) 287 287 { 288 $message['pwd_wrong'] = "The password have less than 6 characters ";288 $message['pwd_wrong'] = 'The password have less than 6 characters '; 289 289 } 290 290 291 291 if (strpos($this->data['User']['username'], ' ')) // no spaces 292 292 { 293 $message['username_spaces'] = "Your username should not contain spaces";293 $message['username_spaces'] = 'Your username should not contain spaces'; 294 294 } 295 295 … … 324 324 325 325 /** Check the user **/ 326 $username = $this->User->field('username', array( "username"=> $this->data['User']['username']));326 $username = $this->User->field('username', array('username' => $this->data['User']['username'])); 327 327 328 328 if ($username != null) 329 329 { 330 $message['username_exist'] = "The username already exist ";330 $message['username_exist'] = 'The username already exist '; 331 331 } 332 332 … … 336 336 if ($email != null) 337 337 { 338 $message['email_exist'] = "The email already exist ";338 $message['email_exist'] = 'The email already exist '; 339 339 } 340 340 … … 351 351 $this->set('message', $message); 352 352 $this->render('validate', 'ajax'); //if error exist, stop here 353 exit;354 353 } 355 354 -
trunk/app/views/users/validate.ctp
r373 r374 1 1 <?php 2 //die(print_r($message)); 3 foreach ($message as $m) 4 { 5 echo $m . " <br />"; 6 } 7 8 if ( isset($ok) ) 9 { 2 foreach ($message as $m): 3 echo $m . ' <br />'; 4 endforeach; 10 5 6 if ( isset($ok) ): 11 7 ?> 12 8 <script type="text/javascript"> … … 22 18 </script> 23 19 24 <?php }?>20 <?php endif; ?> -
trunk/app/webroot/js/prototype.js
r334 r374 1 /* Prototype JavaScript framework, version 1.6.0. 12 * (c) 2005-200 7Sam Stephenson1 /* Prototype JavaScript framework, version 1.6.0.2 2 * (c) 2005-2008 Sam Stephenson 3 3 * 4 4 * Prototype is freely distributable under the terms of an MIT-style license. … … 8 8 9 9 var Prototype = { 10 Version: '1.6.0. 1',10 Version: '1.6.0.2', 11 11 12 12 Browser: { … … 111 111 if (Object.isUndefined(object)) return 'undefined'; 112 112 if (object === null) return 'null'; 113 return object.inspect ? object.inspect() : object.toString();113 return object.inspect ? object.inspect() : String(object); 114 114 } catch (e) { 115 115 if (e instanceof RangeError) return '...'; … … 172 172 173 173 isArray: function(object) { 174 return object && object.constructor === Array; 174 return object != null && typeof object == "object" && 175 'splice' in object && 'join' in object; 175 176 }, 176 177 … … 579 580 580 581 return before + String.interpret(ctx); 581 } .bind(this));582 }); 582 583 } 583 584 }); … … 813 814 814 815 if (Prototype.Browser.WebKit) { 815 function $A(iterable) {816 $A = function(iterable) { 816 817 if (!iterable) return []; 817 818 if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') && … … 820 821 while (length--) results[length] = iterable[length]; 821 822 return results; 822 } 823 }; 823 824 } 824 825 … … 1299 1300 var contentType = response.getHeader('Content-type'); 1300 1301 if (this.options.evalJS == 'force' 1301 || (this.options.evalJS && contentType1302 || (this.options.evalJS && this.isSameOrigin() && contentType 1302 1303 && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) 1303 1304 this.evalResponse(); … … 1317 1318 }, 1318 1319 1320 isSameOrigin: function() { 1321 var m = this.url.match(/^\s*https?:\/\/[^\/]*/); 1322 return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({ 1323 protocol: location.protocol, 1324 domain: document.domain, 1325 port: location.port ? ':' + location.port : '' 1326 })); 1327 }, 1328 1319 1329 getHeader: function(name) { 1320 1330 try { … … 1392 1402 json = decodeURIComponent(escape(json)); 1393 1403 try { 1394 return json.evalJSON(this.request.options.sanitizeJSON); 1404 return json.evalJSON(this.request.options.sanitizeJSON || 1405 !this.request.isSameOrigin()); 1395 1406 } catch (e) { 1396 1407 this.request.dispatchException(e); … … 1405 1416 return null; 1406 1417 try { 1407 return this.responseText.evalJSON(options.sanitizeJSON); 1418 return this.responseText.evalJSON(options.sanitizeJSON || 1419 !this.request.isSameOrigin()); 1408 1420 } catch (e) { 1409 1421 this.request.dispatchException(e); … … 1611 1623 var content, insert, tagName, childNodes; 1612 1624 1613 for ( position in insertions) {1625 for (var position in insertions) { 1614 1626 content = insertions[position]; 1615 1627 position = position.toLowerCase(); … … 1675 1687 1676 1688 descendants: function(element) { 1677 return $(element). getElementsBySelector("*");1689 return $(element).select("*"); 1678 1690 }, 1679 1691 … … 1864 1876 while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode); 1865 1877 } 1866 if (nextAncestor) return (e > a && e < nextAncestor.sourceIndex); 1878 if (nextAncestor && nextAncestor.sourceIndex) 1879 return (e > a && e < nextAncestor.sourceIndex); 1867 1880 } 1868 1881 … … 2008 2021 if (element.tagName == 'BODY') break; 2009 2022 var p = Element.getStyle(element, 'position'); 2010 if (p == 'relative' || p == 'absolute') break;2023 if (p !== 'static') break; 2011 2024 } 2012 2025 } while (element); … … 2201 2214 2202 2215 else if (Prototype.Browser.IE) { 2203 $w('positionedOffset getOffsetParent viewportOffset').each(function(method) { 2216 // IE doesn't report offsets correctly for static elements, so we change them 2217 // to "relative" to get the values, then change them back. 2218 Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap( 2219 function(proceed, element) { 2220 element = $(element); 2221 var position = element.getStyle('position'); 2222 if (position !== 'static') return proceed(element); 2223 element.setStyle({ position: 'relative' }); 2224 var value = proceed(element); 2225 element.setStyle({ position: position }); 2226 return value; 2227 } 2228 ); 2229 2230 $w('positionedOffset viewportOffset').each(function(method) { 2204 2231 Element.Methods[method] = Element.Methods[method].wrap( 2205 2232 function(proceed, element) { 2206 2233 element = $(element); 2207 2234 var position = element.getStyle('position'); 2208 if (position != 'static') return proceed(element); 2235 if (position !== 'static') return proceed(element); 2236 // Trigger hasLayout on the offset parent so that IE6 reports 2237 // accurate offsetTop and offsetLeft values for position: fixed. 2238 var offsetParent = element.getOffsetParent(); 2239 if (offsetParent && offsetParent.getStyle('position') === 'fixed') 2240 offsetParent.setStyle({ zoom: 1 }); 2209 2241 element.setStyle({ position: 'relative' }); 2210 2242 var value = proceed(element); … … 2288 2320 2289 2321 Element._attributeTranslations.write = { 2290 names: Object.clone(Element._attributeTranslations.read.names), 2322 names: Object.extend({ 2323 cellpadding: 'cellPadding', 2324 cellspacing: 'cellSpacing' 2325 }, Element._attributeTranslations.read.names), 2291 2326 values: { 2292 2327 checked: function(element, value) { … … 2408 2443 } 2409 2444 2410 if ( document.createElement('div').outerHTML) {2445 if ('outerHTML' in document.createElement('div')) { 2411 2446 Element.Methods.replace = function(element, content) { 2412 2447 element = $(element); … … 2902 2937 2903 2938 criteria: { 2904 tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',2905 className: 'n = h.className(n, r, "#{1}", c); c = false;',2906 id: 'n = h.id(n, r, "#{1}", c); c = false;',2907 attrPresence: 'n = h.attrPresence(n, r, "#{1}" ); c = false;',2939 tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;', 2940 className: 'n = h.className(n, r, "#{1}", c); c = false;', 2941 id: 'n = h.id(n, r, "#{1}", c); c = false;', 2942 attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;', 2908 2943 attr: function(m) { 2909 2944 m[3] = (m[5] || m[6]); 2910 return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}" ); c = false;').evaluate(m);2945 return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m); 2911 2946 }, 2912 2947 pseudo: function(m) { … … 2958 2993 attr: function(element, matches) { 2959 2994 var nodeValue = Element.readAttribute(element, matches[1]); 2960 return Selector.operators[matches[2]](nodeValue, matches[3]);2995 return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]); 2961 2996 } 2962 2997 }, … … 2973 3008 // marks an array of nodes for counting 2974 3009 mark: function(nodes) { 3010 var _true = Prototype.emptyFunction; 2975 3011 for (var i = 0, node; node = nodes[i]; i++) 2976 node._counted =true;3012 node._countedByPrototype = _true; 2977 3013 return nodes; 2978 3014 }, … … 2980 3016 unmark: function(nodes) { 2981 3017 for (var i = 0, node; node = nodes[i]; i++) 2982 node._counted = undefined;3018 node._countedByPrototype = undefined; 2983 3019 return nodes; 2984 3020 }, … … 2988 3024 // rather than nth-child 2989 3025 index: function(parentNode, reverse, ofType) { 2990 parentNode._counted = true;3026 parentNode._countedByPrototype = Prototype.emptyFunction; 2991 3027 if (reverse) { 2992 3028 for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) { 2993 3029 var node = nodes[i]; 2994 if (node.nodeType == 1 && (!ofType || node._counted )) node.nodeIndex = j++;3030 if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++; 2995 3031 } 2996 3032 } else { 2997 3033 for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++) 2998 if (node.nodeType == 1 && (!ofType || node._counted )) node.nodeIndex = j++;3034 if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++; 2999 3035 } 3000 3036 }, … … 3005 3041 var results = [], n; 3006 3042 for (var i = 0, l = nodes.length; i < l; i++) 3007 if (!(n = nodes[i])._counted ) {3008 n._counted = true;3043 if (!(n = nodes[i])._countedByPrototype) { 3044 n._countedByPrototype = Prototype.emptyFunction; 3009 3045 results.push(Element.extend(n)); 3010 3046 } … … 3118 3154 }, 3119 3155 3120 attrPresence: function(nodes, root, attr ) {3156 attrPresence: function(nodes, root, attr, combinator) { 3121 3157 if (!nodes) nodes = root.getElementsByTagName("*"); 3158 if (nodes && combinator) nodes = this[combinator](nodes); 3122 3159 var results = []; 3123 3160 for (var i = 0, node; node = nodes[i]; i++) … … 3126 3163 }, 3127 3164 3128 attr: function(nodes, root, attr, value, operator ) {3165 attr: function(nodes, root, attr, value, operator, combinator) { 3129 3166 if (!nodes) nodes = root.getElementsByTagName("*"); 3167 if (nodes && combinator) nodes = this[combinator](nodes); 3130 3168 var handler = Selector.operators[operator], results = []; 3131 3169 for (var i = 0, node; node = nodes[i]; i++) { … … 3206 3244 h.mark(nodes); 3207 3245 for (var i = 0, node; node = nodes[i]; i++) { 3208 if (!node.parentNode._counted ) {3246 if (!node.parentNode._countedByPrototype) { 3209 3247 h.index(node.parentNode, reverse, ofType); 3210 3248 indexed.push(node.parentNode); … … 3244 3282 h.mark(exclusions); 3245 3283 for (var i = 0, results = [], node; node = nodes[i]; i++) 3246 if (!node._counted ) results.push(node);3284 if (!node._countedByPrototype) results.push(node); 3247 3285 h.unmark(exclusions); 3248 3286 return results; … … 3278 3316 }, 3279 3317 3318 split: function(expression) { 3319 var expressions = []; 3320 expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) { 3321 expressions.push(m[1].strip()); 3322 }); 3323 return expressions; 3324 }, 3325 3280 3326 matchElements: function(elements, expression) { 3281 var matches = new Selector(expression).findElements(), h = Selector.handlers;3327 var matches = $$(expression), h = Selector.handlers; 3282 3328 h.mark(matches); 3283 3329 for (var i = 0, results = [], element; element = elements[i]; i++) 3284 if (element._counted ) results.push(element);3330 if (element._countedByPrototype) results.push(element); 3285 3331 h.unmark(matches); 3286 3332 return results; … … 3295 3341 3296 3342 findChildElements: function(element, expressions) { 3297 var exprs = expressions.join(','); 3298 expressions = []; 3299 exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) { 3300 expressions.push(m[1].strip()); 3301 }); 3343 expressions = Selector.split(expressions.join(',')); 3302 3344 var results = [], h = Selector.handlers; 3303 3345 for (var i = 0, l = expressions.length, selector; i < l; i++) { … … 3310 3352 3311 3353 if (Prototype.Browser.IE) { 3312 // IE returns comment nodes on getElementsByTagName("*"). 3313 // Filter them out. 3314 Selector.handlers.concat = function(a, b) { 3315 for (var i = 0, node; node = b[i]; i++) 3316 if (node.tagName !== "!") a.push(node); 3317 return a; 3318 }; 3354 Object.extend(Selector.handlers, { 3355 // IE returns comment nodes on getElementsByTagName("*"). 3356 // Filter them out. 3357 concat: function(a, b) { 3358 for (var i = 0, node; node = b[i]; i++) 3359 if (node.tagName !== "!") a.push(node); 3360 return a; 3361 }, 3362 3363 // IE improperly serializes _countedByPrototype in (inner|outer)HTML. 3364 unmark: function(nodes) { 3365 for (var i = 0, node; node = nodes[i]; i++) 3366 node.removeAttribute('_countedByPrototype'); 3367 return nodes; 3368 } 3369 }); 3319 3370 } 3320 3371 … … 3794 3845 3795 3846 function getEventID(element) { 3796 if (element._ eventID) return element._eventID;3847 if (element._prototypeEventID) return element._prototypeEventID[0]; 3797 3848 arguments.callee.id = arguments.callee.id || 1; 3798 return element._ eventID = ++arguments.callee.id;3849 return element._prototypeEventID = [++arguments.callee.id]; 3799 3850 } 3800 3851
