Ignore:
Timestamp:
Sep 13, 2010, 8:40:44 PM (14 years ago)
Author:
grum
Message:

Implement metadata search, release 0.5.1
bug:1846, bug:1691

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMetaData/admin/amd_metadata_personnal.tpl

    r6731 r6891  
    44{known_script id="gpc.external.interface" src=$ROOT_URL|@cat:"plugins/GrumPluginClasses/js/external/interface/interface.js"}
    55{known_script id="gpc.external.inestedsortable" src=$ROOT_URL|@cat:"plugins/GrumPluginClasses/js/external/inestedsortable.pack.js"}
     6{known_script id="tagListSelector" src=$ROOT_URL|@cat:"plugins/AMetaData/js/tagListSelector.js"}
     7
    68
    79{literal}
    810<script type="text/javascript">
    9 
    10   /**
    11    * sorry, tagListSelector is coded like a pork, but I don't have the time to
    12    * code something better... ^^;
    13    */
    14   function tagListSelector(itemId)
    15   {
    16     options = {
    17       itemId:'',
    18       selectorId:'',
    19       width:'auto',
    20       height:'auto',
    21       maxHeight:250,
    22       selectedClass:'gcText3',
    23       selectorClass:'ruleTypeM gcTextInput gcBgInput gcBorderInput',
    24       selectorItems:'ruleTypeM',
    25     }
    26 
    27     this.init = function (itemId)
    28     {
    29       options.itemId=itemId;
    30       $('body').append("<div id='iTLSDiv' class='"+options.selectorClass+"' style='padding:0px;z-index:5000;overflow:auto;display:none;position:absolute;max-height:"+options.maxHeight+"px'></div>");
    31       $('#iTLSDiv')
    32         .prepend($('#'+itemId))
    33         .bind('mouseleave', function ()
    34           {
    35             $('#iTLSDiv').css('display', 'none');
    36           }
    37         );
    38       $('#'+itemId).css('display', 'block');
    39       $('#iTLSDiv li').bind('click', function ()
    40         {
    41           $('#'+options.selectorId).attr('value', $(this).attr('value'));
    42           $('#'+options.selectorId+' span.ruleContent').html($(this).html());
    43           $('#iTLSDiv').css('display', 'none');
    44         }
    45       );
    46     }
    47 
    48     this.display = function (fromId)
    49     {
    50       selectedItem=$('#'+fromId).attr('value');
    51 
    52       top=$('#'+fromId).offset().top+$('#'+fromId).outerHeight()-1;
    53       left=$('#'+fromId).offset().left;
    54       width=$('#'+fromId).innerWidth();
    55       $('#iTLSDiv li').removeClass(options.selectedClass);
    56       $('#iTagListItem'+selectedItem).addClass(options.selectedClass);
    57       $('#iTLSDiv').css(
    58         {
    59           top:top+'px',
    60           left:left+'px',
    61           width:width+'px',
    62           display:'block'
    63         }
    64       );
    65       options.selectorId=fromId;
    66     }
    67 
    68     this.init(itemId);
    69   }
    7011
    7112
     
    7516      numId:'',
    7617      newRuleId:1,
     18      optimalHeight:0,
    7719    }
    7820
     
    10749          }
    10850        );
     51
    10952      $('#iBDTagId').bind('keyup focusout', function (event)
    11053        {
     
    158101            }
    159102
    160             $('#mdRulesArea').css('height', ($('#iDialogEdit').height()-$('#mdRulesArea').position().top)+'px' );
     103            options.optimalHeight=$('#iDialogEdit').height()-$('#mdRulesArea').position().top;
     104            $('#mdRulesArea').css('height', options.optimalHeight+'px' );
    161105          }
    162106        )
     
    309253                }
    310254              );
     255              checkDialogHeight();
    311256            },
    312257          onHover: function (draggedItem)
     
    381326      }
    382327      applyNested();
     328      checkDialogHeight();
    383329    }
    384330
     
    395341        }
    396342      );
     343      checkDialogHeight();
    397344    }
    398345
     
    423370        $('#iBDRuleTypeC'+id).css('display', 'inline-block');
    424371      }
     372      checkDialogHeight();
    425373    }
    426374
     
    439387        $('#iBDRuleTypeCIfValue'+id).css('display', 'inline');
    440388      }
     389      checkDialogHeight();
    441390    }
    442391
     
    456405      {
    457406        $('#iBDRuleType'+value).get(0).disabled=false;
     407      }
     408    }
     409
     410    /**
     411     * check if it necessary to calculate the height of the dialogbox
     412     */
     413    var checkDialogHeight = function()
     414    {
     415      if($('#iBDRules').height() < options.optimalHeight &&
     416         $('#mdRulesArea').get(0).scrollHeight > options.optimalHeight)
     417      {
     418        $('#iDialogEdit').height(options.optimalHeight+$('#mdRulesArea').get(0).offsetTop);
     419        $('#mdRulesArea').height(options.optimalHeight);
     420      }
     421      else if($('#mdRulesArea').get(0).scrollHeight > options.optimalHeight)
     422      {
     423        $('#iDialogEdit').height($('#mdRulesArea').get(0).scrollHeight+$('#mdRulesArea').get(0).offsetTop);
     424        $('#mdRulesArea').height($('#mdRulesArea').get(0).scrollHeight);
    458425      }
    459426    }
     
    749716                    <option value='%'>{'g003_typeCIfLike'|@translate}</option>
    750717                    <option value='!%'>{'g003_typeCIfNotLike'|@translate}</option>
    751                   </select>
     718                    <option value='^%'>{'g003_typeCIfBeginWith'|@translate}</option>
     719                    <option value='!^%'>{'g003_typeCIfNotBeginWith'|@translate}</option>
     720                    <option value='$%'>{'g003_typeCIfEndWith'|@translate}</option>
     721                    <option value='!$%'>{'g003_typeCIfNotEndWith'|@translate}</option>                  </select>
    752722                  <input type='text' id='iBDRuleTypeCIfValueZZZZZ' value='' maxlength=200 size=26 style='display:none;'>
    753723                </div>
     
    770740</ul>
    771741
     742{literal}
    772743<script type="text/javascript">
    773744  var udm=new userDefManage();
    774   var tls=new tagListSelector('iTagList');
     745  var tls=new tagListSelector({itemId:'iTagList'});
    775746</script>
     747{/literal}
Note: See TracChangeset for help on using the changeset viewer.