|
|
@@ -649,6 +649,8 @@ MWF.xApplication.Selector.Person = new Class({
|
|
|
},
|
|
|
|
|
|
loadShuttleNode : function(){
|
|
|
+ if(this.shuttleNode)return;
|
|
|
+
|
|
|
this.shuttleNode = new Element("div.shuttleNode", {
|
|
|
"styles": this.css.shuttleNode
|
|
|
}).inject(this.contentNode);
|
|
|
@@ -1365,21 +1367,6 @@ MWF.xApplication.Selector.Person = new Class({
|
|
|
}
|
|
|
},
|
|
|
afterLoadSelectItem : function(){
|
|
|
- if( !this.selectedContainerNode ){
|
|
|
- if( this.options.contentUrl ){
|
|
|
- }else{
|
|
|
- if (layout.mobile){
|
|
|
- }else{
|
|
|
- this.loadSelectedNode( function () {
|
|
|
- this._afterLoadSelectItem();
|
|
|
- }.bind(this));
|
|
|
- }
|
|
|
- }
|
|
|
- }else{
|
|
|
- this._afterLoadSelectItem();
|
|
|
- }
|
|
|
- },
|
|
|
- _afterLoadSelectItem : function(){
|
|
|
if( this.items.length === 0 && this.subItems.length === 0 && this.subCategorys.length === 0 ){
|
|
|
this.noSelectableItemTextDiv = new Element("div", {
|
|
|
text : MWF.SelectorLP.noSelectableItemText,
|
|
|
@@ -1388,70 +1375,86 @@ MWF.xApplication.Selector.Person = new Class({
|
|
|
}
|
|
|
|
|
|
if( this.options.selectSingleItem ){
|
|
|
- var checkItem = function () {
|
|
|
- if(this.items.length === 1 || this.subItems.length === 1 ){
|
|
|
- if( this.items.length === 1 && this.subItems.length === 0 ){
|
|
|
+ this.selectSingleItem()
|
|
|
+ }
|
|
|
+ this.fireEvent("afterLoadSelectItem", [this]);
|
|
|
+ },
|
|
|
+ selectSingleItem: function(){
|
|
|
+ if( !this.options.contentUrl && !layout.mobile){
|
|
|
+ if( this.options.hasShuttle && !this.shuttleNode ){
|
|
|
+ this.loadShuttleNode();
|
|
|
+ }
|
|
|
+ if( !this.selectedContainerNode ) {
|
|
|
+ this.loadSelectedNode(function () {
|
|
|
+ this._selectSingleItem();
|
|
|
+ }.bind(this));
|
|
|
+ }else{
|
|
|
+ this._selectSingleItem();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ _selectSingleItem : function(){
|
|
|
+ var checkItem = function () {
|
|
|
+ if(this.items.length === 1 || this.subItems.length === 1 ){
|
|
|
+ if( this.items.length === 1 && this.subItems.length === 0 ){
|
|
|
+ if( !this.items[0].isSelected )this.items[0].clickItem();
|
|
|
+ }else if( this.items.length === 0 && this.subItems.length === 1 ){
|
|
|
+ if( !this.items[0].isSelected )this.subItems[0].clickItem();
|
|
|
+ }else if( this.items.length === 1 && this.subItems.length === 1 ){
|
|
|
+ if( this.items[0] === this.subItems[0] ){
|
|
|
if( !this.items[0].isSelected )this.items[0].clickItem();
|
|
|
- }else if( this.items.length === 0 && this.subItems.length === 1 ){
|
|
|
- if( !this.items[0].isSelected )this.subItems[0].clickItem();
|
|
|
- }else if( this.items.length === 1 && this.subItems.length === 1 ){
|
|
|
- if( this.items[0] === this.subItems[0] ){
|
|
|
- if( !this.items[0].isSelected )this.items[0].clickItem();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
- }.bind(this);
|
|
|
+ }
|
|
|
+ }.bind(this);
|
|
|
|
|
|
- var checkCategoryItem = function (category) {
|
|
|
- if( !category.subCategorys || category.subCategorys.length === 0 ){
|
|
|
- if( category.subItems && category.subItems.length === 1 ){
|
|
|
- if( !category.subItems[0].isSelected )category.subItems[0].clickItem();
|
|
|
- }
|
|
|
- }else if(category.subCategorys.length === 1){
|
|
|
- if( !category.subCategorys[0]._hasChild || !category.subCategorys[0]._hasChild() ){ //category.subCategorys[0].isItem &&
|
|
|
- if( !category.subItems[0].isSelected )category.subItems[0].clickItem();
|
|
|
- }else{
|
|
|
- checkCategory( category.subCategorys[0] )
|
|
|
- }
|
|
|
+ var checkCategoryItem = function (category) {
|
|
|
+ if( !category.subCategorys || category.subCategorys.length === 0 ){
|
|
|
+ if( category.subItems && category.subItems.length === 1 ){
|
|
|
+ if( !category.subItems[0].isSelected )category.subItems[0].clickItem();
|
|
|
+ }
|
|
|
+ }else if(category.subCategorys.length === 1){
|
|
|
+ if( !category.subCategorys[0]._hasChild || !category.subCategorys[0]._hasChild() ){ //category.subCategorys[0].isItem &&
|
|
|
+ if( !category.subItems[0].isSelected )category.subItems[0].clickItem();
|
|
|
}else{
|
|
|
- var list = [];
|
|
|
- for( var i=0; i<category.subCategorys.length; i++ ){
|
|
|
- if( category.subCategorys[i]._hasChild && category.subCategorys[i]._hasChild() ){
|
|
|
- list.push( category.subCategorys[i] );
|
|
|
- }
|
|
|
+ checkCategory( category.subCategorys[0] )
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ var list = [];
|
|
|
+ for( var i=0; i<category.subCategorys.length; i++ ){
|
|
|
+ if( category.subCategorys[i]._hasChild && category.subCategorys[i]._hasChild() ){
|
|
|
+ list.push( category.subCategorys[i] );
|
|
|
}
|
|
|
- if( list.length === 1 ){
|
|
|
- if( !category.subItems || category.subItems.length === 0 ){
|
|
|
- checkCategory( list[0] );
|
|
|
- }
|
|
|
+ }
|
|
|
+ if( list.length === 1 ){
|
|
|
+ if( !category.subItems || category.subItems.length === 0 ){
|
|
|
+ checkCategory( list[0] );
|
|
|
}
|
|
|
- if( list.length === 0 ){
|
|
|
- if( category.subItems && category.subItems.length === 1 ){
|
|
|
- if( !category.subItems[0].isSelected )category.subItems[0].clickItem();
|
|
|
- }
|
|
|
+ }
|
|
|
+ if( list.length === 0 ){
|
|
|
+ if( category.subItems && category.subItems.length === 1 ){
|
|
|
+ if( !category.subItems[0].isSelected )category.subItems[0].clickItem();
|
|
|
}
|
|
|
}
|
|
|
- };
|
|
|
-
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
- var checkCategory = function ( category ) {
|
|
|
- if( category.loaded ){
|
|
|
- checkCategoryItem( category )
|
|
|
- }else if( category.loading ){
|
|
|
- window.setTimeout( function () {
|
|
|
- checkCategory( category )
|
|
|
- }, 100 )
|
|
|
- }
|
|
|
- };
|
|
|
|
|
|
- if( this.subCategorys.length === 1 ) {
|
|
|
- checkCategory( this.subCategorys[0] );
|
|
|
- }else if( this.subCategorys.length === 0 ){
|
|
|
- checkItem();
|
|
|
+ var checkCategory = function ( category ) {
|
|
|
+ if( category.loaded ){
|
|
|
+ checkCategoryItem( category )
|
|
|
+ }else if( category.loading ){
|
|
|
+ window.setTimeout( function () {
|
|
|
+ checkCategory( category )
|
|
|
+ }, 100 )
|
|
|
}
|
|
|
+ };
|
|
|
|
|
|
+ if( this.subCategorys.length === 1 ) {
|
|
|
+ checkCategory( this.subCategorys[0] );
|
|
|
+ }else if( this.subCategorys.length === 0 ){
|
|
|
+ checkItem();
|
|
|
}
|
|
|
- this.fireEvent("afterLoadSelectItem", [this]);
|
|
|
},
|
|
|
setSize : function(){
|
|
|
|