Changeset 5908
- Timestamp:
- 04/10/12 17:47:50 (12 years ago)
- Location:
- trunk/prototype/api
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/api/controller.php
r5905 r5908 602 602 603 603 if( isset( self::$fallbackHandlers[ $code ] ) ) 604 return self::$fallbackHandlers[ $code ]( $exception ); 604 { 605 $fn = self::$fallbackHandlers[ $code ]; 606 return $fn( $exception ); 607 } 605 608 606 609 error_log( $exception->getMessage() ); -
trunk/prototype/api/datalayer.js
r5724 r5908 460 460 461 461 remove: function( concept, id, oneSide ){ 462 462 463 if( arguments.length === 2 && typeof id === "boolean" ) 464 { 465 oneSide = id; 466 id = false; 467 } 468 463 469 var bothSides = (typeof oneSide === "undefined"), 464 470 … … 472 478 current.id = id; 473 479 474 if( notArray = ( $.type( current ) !== "array" ))480 if( id ) 475 481 current = [ current ]; 476 482 477 for( var i = 0; i < current.length; i++)483 $.each( current, function(i, o) 478 484 { 479 485 var currentId = ids[ ids.length ] = current[i].id; 480 486 481 487 if( bothSides ) 482 this.report( concept, currentId, false );488 DataLayer.report( concept, currentId, false ); 483 489 484 490 if( bothSides || !oneSide ) 485 this.del( concept, currentId );491 DataLayer.del( concept, currentId ); 486 492 487 493 for( var link in links ) 488 494 { 489 if( !current[i][link] ) 490 continue; 491 492 if( this.hasOne( concept, link ) ) 493 current[i][link] = [ current[i][link] ]; 494 495 $.each( current[i][link], function( ii, el ){ 496 497 el = DataLayer.storage.cache[links[link]][el]; 498 499 if( notArrayNested = ( $.type( el[ nestedLinks[link] ] ) !== "array" ) ) 500 el[ nestedLinks[link] ] = [ el[nestedLinks[link]] ]; 501 502 el[ nestedLinks[link] ] = $.grep( el[ nestedLinks[link] ], function( nested, iii ){ 503 return ( currentId !== nested ); 495 if( !current[i][link] ) 496 continue; 497 498 if( this.hasOne( concept, link ) ) 499 current[i][link] = [ current[i][link] ]; 500 501 $.each( current[i][link], function( ii, el ){ 502 503 el = DataLayer.storage.cache[links[link]][el]; 504 505 if( notArrayNested = ( $.type( el[ nestedLinks[link] ] ) !== "array" ) ) 506 el[ nestedLinks[link] ] = [ el[nestedLinks[link]] ]; 507 508 el[ nestedLinks[link] ] = $.grep( el[ nestedLinks[link] ], function( nested, iii ){ 509 return ( currentId !== nested ); 510 }); 511 512 if( notArrayNested ) 513 el[ nestedLinks[link] ] = el[ nestedLinks[link] ][0] || false; 514 if(!el[ nestedLinks[link] ] || !el[ nestedLinks[link] ].length) 515 delete el[ nestedLinks[link] ]; 504 516 }); 505 506 if( notArrayNested )507 el[ nestedLinks[link] ] = el[ nestedLinks[link] ][0] || false;508 if(!el[ nestedLinks[link] ] || !el[ nestedLinks[link] ].length)509 delete el[ nestedLinks[link] ];510 });511 517 } 512 } 518 }); 513 519 514 520 if( oneSide )
Note: See TracChangeset
for help on using the changeset viewer.