Ignore:
Timestamp:
Jan 28, 2011, 4:54:02 PM (13 years ago)
Author:
grum
Message:

release 3.4.0
fix bug:1984, bug:2109
js file are minified, remove packed files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GrumPluginClasses/js/ui.categorySelector.js

    r7181 r8961  
    22 * -----------------------------------------------------------------------------
    33 * file: ui.categorySelector.js
    4  * file version: 1.0.1
    5  * date: 2010-10-10
     4 * file version: 1.1.0
     5 * date: 2011-01-12
    66 *
    77 * A jQuery plugin provided by the piwigo's plugin "GrumPluginClasses"
     
    2828 * |         |            | * add 'name' property
    2929 * |         |            |
     30 * | 1.1.0   | 2011/01/12 | * checkbox moved between +/- button and text
     31 * |         |            |
     32 * |         |            | * dropdown list is managed like dropdown list on
     33 * |         |            |   <select> object (hidden only when object loose
     34 * |         |            |   focus )
     35 * |         |            |
     36 * |         |            | * selected values are dislayed like tags
     37 * |         |            |
     38 * |         |            | * add 'isValid' method
     39 * |         |            |
     40 * |         |            | * add 'displayPath' property
     41 * |         |            |
    3042 * |         |            |
    3143 *
     
    6173                      levelIndent:16,
    6274                      iconWidthEC:15,
    63                       iconWidthCheck:18,
    6475                      serverUrl:'plugins/GrumPluginClasses/gpc_ajax.php',
    6576                      filter:'accessible',
     
    6879                      load:null,
    6980                      multiple:false,
    70                       userMode:'public'
     81                      userMode:'public',
     82                      popupMode:'click',
     83                      displayPath:false,
     84                      downArrow:'&dArr;'
    7185                    };
    7286
     
    86100                    categories:[],
    87101                    labelStatus:['', ''],
     102                    mouseOver:false,
     103                    isValid:true
    88104                  }
    89105                );
     
    98114                        {
    99115                          'class':'ui-category-selector',
     116                          tabindex:0,
    100117                          css:{
    101118                            width:'100%'
     
    106123                        {
    107124                          privateMethods.displaySelector($this, !$this.data('properties').selectorVisible);
     125                          $(this).focus();
    108126                        }
    109127                      ),
     
    111129                      {
    112130                        html: '&nbsp;',
    113                         'class':'ui-category-selector-name',
     131                        'class':'ui-category-selector-name'
    114132                      }
    115133                    ),
     134                    containerList:null,
    116135                    containerStatus:$('<div/>',
    117136                      {
     
    132151                        }
    133152                      }
     153                    ).bind('mousedown',
     154                        function ()
     155                        {
     156                          $(this).addClass('ui-category-selector-arrow-active');
     157                        }
     158                    ).bind('mouseup',
     159                        function ()
     160                        {
     161                          $(this).removeClass('ui-category-selector-arrow-active');
     162                        }
    134163                    ),
    135 
    136164                    listContainer:$('<div/>',
    137165                        {
     
    144172                          }
    145173                        }
    146                     ).bind('mouseleave.categorySelector',
    147                         function ()
    148                         {
    149                           privateMethods.displaySelector($this, false);
    150                         }
    151                       ),
     174                    ),
    152175                    list:$('<ul/>',
    153176                      {
     
    160183                    )
    161184                  };
    162 
    163                 $this
    164                   .html('')
    165                   .append(objects.container.append(objects.containerArrow).append(objects.containerStatus).append(objects.containerName))
    166                   .append(objects.listContainer.append(objects.list));
    167 
    168                 $this.data('objects', objects);
    169               }
     185              }
     186
     187              $this.data('objects', objects);
    170188
    171189              privateMethods.setOptions($this, opt);
     190
     191
     192              if($this.html()!='') privateMethods.setItems($this, $this.html());
     193
     194              $this
     195                .html('')
     196                .append(objects.container.append(objects.containerArrow).append(objects.containerStatus).append(objects.containerName))
     197                .append(objects.listContainer.append(objects.list));
     198
    172199            }
    173200          );
     
    258285      listMaxWidth: function (value)
    259286        {
    260           if(value)
     287          if(value!=null)
    261288          {
    262289            return this.each(function()
     
    283310      listMaxHeight: function (value)
    284311        {
    285           if(value)
     312          if(value!=null)
    286313          {
    287314            return this.each(function()
     
    333360      levelIndent: function (value)
    334361        {
    335           if(value)
     362          if(value!=null)
    336363          {
    337364            return this.each(function()
     
    358385      serverUrl: function (value)
    359386        {
    360           if(value)
     387          if(value!=null)
    361388          {
    362389            return this.each(function()
     
    383410      filter: function (value)
    384411        {
    385           if(value)
     412          if(value!=null)
    386413          {
    387414            return this.each(function()
     
    428455      iconWidthEC: function (value)
    429456        {
    430           if(value)
     457          if(value!=null)
    431458          {
    432459            return this.each(function()
     
    451478        }, // iconWidthEC
    452479
    453       iconWidthCheck: function (value)
    454         {
    455           if(value)
     480      userMode: function (value)
     481        {
     482          if(value!=null)
    456483          {
    457484            return this.each(function()
    458485              {
    459                 privateMethods.setIconWidthCheck($(this), value);
     486                privateMethods.setUserMode($(this), value);
    460487              }
    461488            );
     
    467494            if(options)
    468495            {
    469               return(options.iconWidthCheck);
     496              return(options.userMode);
    470497            }
    471498            else
     
    474501            }
    475502          }
    476         }, // iconWidthCheck
    477 
    478       userMode: function (value)
    479         {
    480           if(value)
    481           {
    482             return this.each(function()
    483               {
    484                 privateMethods.setUserMode($(this), value);
    485               }
    486             );
    487           }
    488           else
    489           {
    490             var options = this.data('options');
    491 
    492             if(options)
    493             {
    494               return(options.userMode);
    495             }
    496             else
    497             {
    498               return(0);
    499             }
    500           }
    501503        }, // userMode
    502504
     
    504506        {
    505507          var options=this.data('options'),
    506               properties=this.data('properties'),
    507               objects=this.data('objects');
     508              properties=this.data('properties');
    508509
    509510          if(!options.multiple)
     
    522523        }, // userMode
    523524
     525      popupMode: function (value)
     526        {
     527          if(value!=null)
     528          {
     529            return this.each(function()
     530              {
     531                privateMethods.setPopupMode($(this), value);
     532              }
     533            );
     534          }
     535          else
     536          {
     537            var options = this.data('options');
     538
     539            if(options)
     540            {
     541              return(options.popupMode);
     542            }
     543            else
     544            {
     545              return(0);
     546            }
     547          }
     548        }, // popupMode
     549
     550      displayPath: function (value)
     551        {
     552          if(value!=null)
     553          {
     554            return this.each(function()
     555              {
     556                privateMethods.setDisplayPath($(this), value);
     557              }
     558            );
     559          }
     560          else
     561          {
     562            var options = this.data('options');
     563
     564            if(options)
     565            {
     566              return(options.displayPath);
     567            }
     568            else
     569            {
     570              return(0);
     571            }
     572          }
     573        }, // displayPath
     574
     575      downArrow: function (value)
     576        {
     577          if(value!=null)
     578          {
     579            return this.each(function()
     580              {
     581                privateMethods.setDownArrow($(this), value);
     582              }
     583            );
     584          }
     585          else
     586          {
     587            var options = this.data('options');
     588
     589            if(options)
     590            {
     591              return(options.downArrow);
     592            }
     593            else
     594            {
     595              return('');
     596            }
     597          }
     598        }, // downArrow
     599
    524600      value: function (value)
    525601        {
    526           if(value)
     602          if(value!=null)
    527603          {
    528604            // set selected value
     
    559635          }
    560636        }, // value
     637
     638      isValid: function (value)
     639        {
     640          if(value!=null)
     641          {
     642            return this.each(function()
     643              {
     644                privateMethods.setIsValid($(this), value);
     645              }
     646            );
     647          }
     648          else
     649          {
     650            var properties=this.data('properties');
     651            return(properties.isValid);
     652          }
     653        }, // isValid
     654
    561655      load: function (value)
    562656        {
     
    634728          }
    635729        }, // popup
     730
    636731      numberOfCategories: function ()
    637732        {
     
    647742          }
    648743        }, // numberOfCategories
     744
    649745      properties: function (value)
    650746        {
    651           var properties=this.data('properties');
     747          var properties=this.data('properties'),
     748              options=this.data('options');
    652749
    653750          if(properties && value==':first' && properties.categories.length>0)
     
    657754          else if(properties && properties.index!=null && (value==':selected' || value==null) && properties.categories.length>0)
    658755          {
    659             if(!option.multiple && properties.index>-1 && properties.index<properties.categories.length)
     756            if(!options.multiple && properties.index>-1 && properties.index<properties.categories.length)
    660757            {
    661758              return(properties.categories[properties.index]);
    662759            }
    663             else if(option.multiple)
     760            else if(options.multiple)
    664761            {
    665762              var returned=[];
     
    686783            return(null);
    687784          }
    688         }, // numberOfCategories
     785        } // numberOfCategories
    689786    }; // methods
    690787
     
    711808          privateMethods.setLevelIndent(object, (value.levelIndent!=null)?value.levelIndent:options.levelIndent);
    712809          privateMethods.setIconWidthEC(object, (value.iconWidthEC!=null)?value.iconWidthEC:options.iconWidthEC);
    713           privateMethods.setIconWidthCheck(object, (value.iconWidthCheck!=null)?value.iconWidthCheck:options.iconWidthCheck);
    714810          privateMethods.setServerUrl(object, (value.serverUrl!=null)?value.serverUrl:options.serverUrl);
    715811          privateMethods.setFilter(object, (value.filter!=null)?value.filter:options.filter);
    716812          privateMethods.setUserMode(object, (value.userMode!=null)?value.userMode:options.userMode);
     813          privateMethods.setPopupMode(object, (value.popupMode!=null)?value.popupMode:options.popupMode);
     814          privateMethods.setDisplayPath(object, (value.displayPath!=null)?value.displayPath:options.displayPath);
     815          privateMethods.setDownArrow(object, (value.downArrow!=null)?value.downArrow:options.downArrow);
    717816          privateMethods.setEventPopup(object, (value.popup!=null)?value.popup:options.popup);
    718817          privateMethods.setEventChange(object, (value.change!=null)?value.change:options.change);
     
    725824        },
    726825
     826      setIsValid : function (object, value)
     827        {
     828          var objects=object.data('objects'),
     829              properties=object.data('properties');
     830
     831          if(properties.isValid!=value)
     832          {
     833            properties.isValid=value;
     834            if(properties.isValid)
     835            {
     836              objects.container.removeClass('ui-error');
     837            }
     838            else
     839            {
     840              objects.container.addClass('ui-error');
     841            }
     842          }
     843          return(properties.isValid);
     844        },
     845
    727846      setAutoLoad : function (object, value)
    728847        {
    729848          var options=object.data('options'),
    730849              properties=object.data('properties');
     850
    731851          if((!properties.initialized || options.autoLoad!=value) && (value==true || value==false))
    732852          {
     
    740860          var options=object.data('options'),
    741861              properties=object.data('properties');
     862
    742863          if((!properties.initialized || options.galleryRoot!=value) && (value==true || value==false))
    743864          {
     
    753874              properties=object.data('properties'),
    754875              objects=object.data('objects');
     876
    755877          if((!properties.initialized || options.listMaxWidth!=value) && value>=0)
    756878          {
     
    773895              properties=object.data('properties'),
    774896              objects=object.data('objects');
     897
    775898          if((!properties.initialized || options.listMaxHeight!=value) && value>=0)
    776899          {
     
    793916              properties=object.data('properties'),
    794917              objects=object.data('objects');
     918
    795919          if((!properties.initialized || options.displayStatus!=value) && (value==true || value==false))
    796920          {
     
    813937              properties=object.data('properties'),
    814938              objects=object.data('objects');
     939
    815940          if((!properties.initialized || options.levelIndent!=value) && value>=0)
    816941          {
     
    819944              function ()
    820945              {
    821                 $(this).css('padding-left', (options.iconWidthEC+options.iconWidthCheck+$(this).attr('level')*options.levelIndent)+'px');
     946                $(this).css('padding-left', (options.iconWidthEC+$(this).attr('level')*options.levelIndent)+'px');
    822947              }
    823948            );
     
    830955          var options=object.data('options'),
    831956              properties=object.data('properties');
     957
    832958          if(!properties.initialized || options.serverUrl!=value)
    833959          {
     
    838964        },
    839965
    840 
    841966      setFilter : function (object, value)
    842967        {
    843968          var options=object.data('options'),
    844969              properties=object.data('properties');
     970
    845971          if((!properties.initialized || options.filter!=value) && (value=='none' || value=='accessible' || value=='public'))
    846972          {
     
    856982              properties=object.data('properties'),
    857983              objects=object.data('objects');
     984
    858985          if((!properties.initialized || options.iconWidthEC!=value) && value>=0)
    859986          {
     
    862989              function ()
    863990              {
    864                 $(this).css('padding-left', (options.iconWidthEC+options.iconWidthCheck+$(this).attr('level')*options.levelIndent)+'px');
    865               }
    866             );
    867           }
    868           return(options.filter);
    869         },
    870 
    871       setIconWidthCheck : function (object, value)
     991                $(this).css('padding-left', (options.iconWidthEC+$(this).attr('level')*options.levelIndent)+'px');
     992              }
     993            );
     994          }
     995          return(options.iconWidthEC);
     996        },
     997
     998      setMultiple : function (object, value)
    872999        {
    8731000          var options=object.data('options'),
    8741001              properties=object.data('properties'),
    8751002              objects=object.data('objects');
    876           if((!properties.initialized || options.iconWidthCheck!=value) && (value>=0 && options.multiple || !options.multiple && value==0))
    877           {
    878             options.iconWidthCheck=value;
    879             objects.list.find('.ui-category-selector-item').each(
    880               function ()
    881               {
    882                 $(this).css('padding-left', (options.iconWidthEC+options.iconWidthCheck+$(this).attr('level')*options.levelIndent)+'px');
    883               }
    884             );
    885           }
    886           return(options.filter);
    887         },
    888 
    889       setMultiple : function (object, value)
     1003
     1004          if((!properties.initialized || options.multiple!=value) && (value==true || value==false))
     1005          {
     1006            if(!value)
     1007            {
     1008              properties.index=-1;
     1009              if(objects.containerList!=null)
     1010              {
     1011                objects.containerList.remove();
     1012                objects.containerList=null;
     1013              }
     1014            }
     1015            else
     1016            {
     1017              properties.index=[];
     1018              objects.listContainer.addClass('ui-category-selector-multiple');
     1019              if(objects.containerList==null)
     1020              {
     1021                objects.containerList=$('<ul/>',
     1022                  {
     1023                    css: {
     1024                      listStyle:'none',
     1025                      padding:'0px',
     1026                      margin:'0px',
     1027                      overflow:"auto"
     1028                    },
     1029                    html:'<li>&nbsp;</li>'
     1030                  }
     1031                );
     1032                objects.containerName.html('').append(objects.containerList);
     1033              }
     1034            }
     1035            options.multiple=value;
     1036          }
     1037          return(options.multiple);
     1038        }, //setMultiple
     1039
     1040      setUserMode : function (object, value)
     1041        {
     1042          var options=object.data('options'),
     1043              properties=object.data('properties');
     1044
     1045          if((!properties.initialized || options.userMode!=value) && (value=='admin' || value=='public'))
     1046          {
     1047            options.userMode=value;
     1048            if(options.autoLoad && properties.initialized) privateMethods.load(object);
     1049          }
     1050          return(options.userMode);
     1051        }, //setUserMode
     1052
     1053      setPopupMode : function (object, value)
    8901054        {
    8911055          var options=object.data('options'),
    8921056              properties=object.data('properties'),
    8931057              objects=object.data('objects');
    894           if((!properties.initialized || options.multiple!=value) && (value==true || value==false))
    895           {
    896             if(!value)
    897             {
    898               privateMethods.setIconWidthCheck(object, 0);
    899               properties.index=-1;
    900             }
    901             else
    902             {
    903               properties.index=[];
    904               objects.listContainer.addClass('ui-category-selector-multiple');
    905             }
    906             options.multiple=value;
    907           }
    908           return(options.filter);
    909         }, //setMultiple
    910 
    911       setUserMode : function (object, value)
     1058
     1059          if((!properties.initialized || options.popupMode!=value) && (value=='click' || value=='mouseout'))
     1060          {
     1061            options.popupMode=value;
     1062
     1063            if(value=='mouseout')
     1064            {
     1065              objects.listContainer
     1066                .unbind('mouseleave.categorySelector')
     1067                .unbind('mouseenter.categorySelector')
     1068                .bind('mouseleave.categorySelector',
     1069                  function ()
     1070                  {
     1071                    privateMethods.displaySelector(object, false);
     1072                  }
     1073                );
     1074            }
     1075            else
     1076            {
     1077              objects.listContainer
     1078                .unbind('mouseleave.categorySelector')
     1079                .bind('mouseleave.categorySelector',
     1080                  function ()
     1081                  {
     1082                    properties.mouseOver=false;
     1083                  }
     1084                )
     1085                .bind('mouseenter.categorySelector',
     1086                  function ()
     1087                  {
     1088                    properties.mouseOver=true;
     1089                  }
     1090                );
     1091              $(document).bind('focusout focusin',
     1092                function (event)
     1093                {
     1094                  if(!properties.mouseOver) privateMethods.displaySelector(object, false);
     1095                }
     1096              );
     1097            }
     1098          }
     1099          return(options.popupMode);
     1100        }, //setUserMode
     1101
     1102
     1103      setDisplayPath : function (object, value)
    9121104        {
    9131105          var options=object.data('options'),
    9141106              properties=object.data('properties'),
    9151107              objects=object.data('objects');
    916           if((!properties.initialized || options.userMode!=value) && (value=='admin' || value=='public'))
    917           {
    918             options.userMode=value;
    919             if(options.autoLoad && properties.initialized) privateMethods.load(object);
    920           }
    921           return(options.filter);
    922         }, //setUserMode
     1108
     1109          if((!properties.initialized || options.displayPath!=value) && (value==true || value==false))
     1110          {
     1111            options.displayPath=value;
     1112
     1113          }
     1114          return(options.userMode);
     1115        }, //setDisplayPath
     1116
     1117      setDownArrow : function (object, value)
     1118        {
     1119          var options=object.data('options'),
     1120              properties=object.data('properties'),
     1121              objects=object.data('objects');
     1122
     1123          if(!properties.initialized || options.downArrow!=value)
     1124          {
     1125            options.downArrow=value;
     1126            objects.containerArrow.html(options.downArrow);
     1127          }
     1128          return(options.downArrow);
     1129        }, //setDownArrow
     1130
     1131
     1132      setItems : function (object, value)
     1133        {
     1134          var properties=object.data('properties'),
     1135              options=object.data('options'),
     1136              objects=object.data('objects');
     1137
     1138          if(value=='' || value==null)
     1139          {
     1140            value={
     1141              status:['',''],
     1142              categories:[]
     1143            }
     1144          }
     1145          else if($.isArray(value))
     1146          {
     1147            value={
     1148              status:'public',
     1149              categories:value
     1150            }
     1151          }
     1152          else
     1153          {
     1154            try
     1155            {
     1156              value=$.parseJSON($.trim(value));
     1157            }
     1158            catch (e)
     1159            {
     1160              return(false);
     1161            }
     1162          }
     1163
     1164          properties.labelStatus=value.status;
     1165          privateMethods.listClear(object);
     1166          if(value.categories.length>0) privateMethods.listAddItems(object, value.categories, objects.list);
     1167
     1168          properties.initialized=false;
     1169          if(options.multiple)
     1170          {
     1171            privateMethods.setValue(object, ':none');
     1172          }
     1173          else
     1174          {
     1175            privateMethods.setValue(object, ':first');
     1176          }
     1177          properties.initialized=true;
     1178
     1179          if(options.load) object.trigger('categorySelectorLoad');
     1180        },
    9231181
    9241182      /**
     
    11981456          if(!options.multiple && (!properties.initialized || properties.index!=index) && index>-1)
    11991457          {
     1458
    12001459            objects.list.find('.ui-category-selector-selected-item').removeClass('ui-category-selector-selected-item');
    12011460            objects.list.find('[catId="'+value+'"]').addClass('ui-category-selector-selected-item');
     1461            title=privateMethods.getParentName(object, objects.list.find('[catId="'+value+'"] div.ui-category-selector-name')).replace('&amp;', '&').replace('&gt;', '>').replace('&lt;', '<');
    12021462            properties.index=index;
    1203             objects.containerName.html(properties.categories[properties.index].name);
     1463            objects.containerName.html(properties.categories[properties.index].name).attr('title', title);
    12041464            objects.containerStatus.html(properties.labelStatus[properties.categories[properties.index].status]);
    12051465            if(trigger && options.change) object.trigger('categorySelectorChange', [properties.categories[properties.index].id]);
     
    12321492              tmp.push(properties.categories[index[i]].id);
    12331493            }
    1234             containerHtml='';
     1494            objects.containerList.html('');
    12351495            objects.list.find('.ui-category-selector-selected-item div.ui-category-selector-name').each(
    12361496              function ()
    12371497              {
    1238                 containerHtml+=((containerHtml=='')?'':'&nbsp;; ')+$(this).html();
    1239               }
    1240             );
    1241             if(containerHtml=='') containerHtml="&nbsp;";
    1242             objects.containerName.html(containerHtml);
     1498                var path='';
     1499
     1500                title=privateMethods.getParentName(object, $(this)).replace('&amp;', '&').replace('&gt;', '>').replace('&lt;', '<');
     1501                if(!options.displayPath)
     1502                {
     1503                  path=$(this).html();
     1504                }
     1505                else
     1506                {
     1507                  path=title;
     1508                }
     1509
     1510                objects.containerList.append(
     1511                  $('<li/>',
     1512                    {
     1513                      html:path,
     1514                      title:title,
     1515                      'class':'ui-category-selector-selected-cat'
     1516                    }
     1517                  ).prepend(
     1518                      $('<span/>',
     1519                        {
     1520                          html:'x'
     1521                        }
     1522                       ).bind('click.categorySelector',
     1523                          {object:object, value:$(this).parent().parent().attr('catid')},
     1524                          function (event)
     1525                          {
     1526                            event.stopPropagation();
     1527                            privateMethods.setValue(event.data.object, event.data.value);
     1528                          }
     1529                        )
     1530                      )
     1531                )
     1532              }
     1533            );
     1534
     1535            if(objects.containerList.children().length==0) objects.containerList.append('<li>&nbsp;</li>');
     1536
    12431537            if(trigger && options.change) object.trigger('categorySelectorChange', [tmp]);
    12441538            return(tmp);
     
    12461540          return(null);
    12471541        },
     1542
     1543      getParentName : function (object, item)
     1544      {
     1545        if(item==null || item.length==0) return('');
     1546        foundItem=item.parent().parent().parent().prev().find('div.ui-category-selector-name');
     1547
     1548        if(foundItem.length==0) return(item.html());
     1549
     1550        return(privateMethods.getParentName(object, foundItem)+' / '+item.html());
     1551      },
    12481552
    12491553      displaySelector : function (object, value)
     
    12521556              properties=object.data('properties'),
    12531557              objects=object.data('objects');
     1558
    12541559          if(properties.selectorVisible!=value)
    12551560          {
     
    12661571                  }
    12671572                );
     1573
    12681574              if($.isArray(properties.index))
    12691575              {
     
    12891595          // load datas from server through an asynchronous ajax call
    12901596          var options=object.data('options'),
    1291               properties=object.data('properties'),
    12921597              objects=object.data('objects');
     1598
     1599          if(options.serverUrl=='') return(false);
    12931600
    12941601          $.ajax(
     
    13061613              success: function(msg)
    13071614                {
    1308                   list=$.parseJSON(msg);
    1309 
    1310                   properties.labelStatus=list.status;
    1311                   privateMethods.listClear(object);
    1312                   privateMethods.listAddItems(object, list.categories, objects.list);
    1313 
    1314                   properties.initialized=false;
    1315                   privateMethods.setValue(object, ':first');
    1316                   properties.initialized=true;
    1317 
    1318                   if(options.load) object.trigger('categorySelectorLoad');
     1615                  privateMethods.setItems(object, msg);
    13191616                },
    13201617              error: function(msg)
    13211618                {
    13221619                  objects.listContainer.html('Error ! '+msg);
    1323                 },
     1620                }
    13241621            }
    13251622         );
     
    13451642          properties.categories=[];
    13461643        },
     1644
    13471645      listAddItems : function (object, listItems, parent)
    13481646        {
     
    13741672            }
    13751673
    1376             var spaceWidth = (options.iconWidthEC+options.iconWidthCheck+listItems[i].level*options.levelIndent),
     1674            var spaceWidth = (options.iconWidthEC+listItems[i].level*options.levelIndent),
    13771675                li=$('<li/>',
    13781676                      {
     
    13891687                        function (event)
    13901688                        {
    1391                           if(!event.layerX && event.offsetX)
    1392                           {
    1393                             // trick for IE..
    1394                             event.layerX=event.offsetX;
    1395                             event.layerY=event.offsetY;
    1396                           }
     1689                          event.layerX=event.pageX-$(event.currentTarget).offset().left;
     1690                          event.layerY=event.pageY-$(event.currentTarget).offset().top;
    13971691
    13981692                          if(event.layerX<event.data.expandArea && event.data.nbchilds>0 )
     
    14241718                            }
    14251719                          }
     1720
     1721                          if(options.multiple) objects.container.focus();
    14261722                        }
    14271723                      );
    14281724            if(listItems[i].childs.length>0)
    14291725            {
    1430               li.addClass('ui-category-selector-collapsable-item').css('background-position', (options.iconWidthCheck+options.levelIndent*listItems[i].level)+'px 0px');
     1726              li.addClass('ui-category-selector-collapsable-item').css('background-position', (options.levelIndent*listItems[i].level)+'px 0px');
    14311727            }
    14321728
    14331729            if(options.multiple)
    14341730            {
    1435               li.prepend('<div class="ui-category-selector-check"></div>');
     1731              li.children().prepend('<div class="ui-category-selector-check"></div>');
    14361732            }
    14371733
     
    14651761           */
    14661762          var properties=object.data('properties');
     1763
    14671764          for(var i=0;i<properties.categories.length;i++)
    14681765          {
     
    14711768          return(-1);
    14721769        },
     1770
    14731771      setEventPopup : function (object, value)
    14741772        {
    14751773          var options=object.data('options');
     1774
    14761775          options.popup=value;
    14771776          object.unbind('categorySelectorPopup');
     
    14791778          return(options.popup);
    14801779        },
     1780
    14811781      setEventChange : function (object, value)
    14821782        {
    14831783          var options=object.data('options');
     1784
    14841785          options.change=value;
    14851786          object.unbind('categorySelectorChange');
     
    14871788          return(options.change);
    14881789        },
     1790
    14891791      setEventLoad : function (object, value)
    14901792        {
    14911793          var options=object.data('options');
     1794
    14921795          options.load=value;
    14931796          object.unbind('categorySelectorLoad');
Note: See TracChangeset for help on using the changeset viewer.