如何在浏览页面中添加额外的阿拉伯字母(在dspace-6.0的Mirage2主题中)

时间:2017-10-30 09:07:00

标签: arabic dspace

enter image description here

我尝试使用下面的代码在浏览页面添加阿拉伯字母,但我没有成功,阿拉伯字母没有出现在浏览页面。

我尝试的代码如下: -

else
        {
            // Create a clickable list of the alphabet
        List jumpList = jump.addList("jump-list", List.TYPE_SIMPLE, "alphabet");


            // browse params for each letter are all the query params
            // WITHOUT the second-stage browse value, and add STARTS_WITH.
  Map<String, String> letterQuery = new HashMap<String, String>(queryParamsGET);
            for (String valueKey : BrowseParams.FILTER_VALUE)
            {
                letterQuery.remove(valueKey);
            }
            letterQuery.put(BrowseParams.STARTS_WITH, "0");
   jumpList.addItemXref(super.generateURL(BROWSE_URL_BASE, letterQuery), "0-9");

            for (char c = 'A'; c <= 'Z'; c++)
            {
             letterQuery.put(BrowseParams.STARTS_WITH, Character.toString(c));
jumpList.addItemXref(super.generateURL(BROWSE_URL_BASE, letterQuery), Character
                        .toString(c));
            }

        //I HAVE ADDED BELOW CODE TO CREATE A BROWSE LIST FOR ARABIC TEXT

            // I HAVE CREATED A LIST FOR ARABIC CHARACTERS 
    List jumpList2 = jump.addList("jump-list2", List.TYPE_SIMPLE, "alphabet");

              // I HAVE CREATED A HASHMAP FOR ARABIC CHARACTERS 
      Map<String, String> ddQuery = new HashMap<String, String>(queryParamsGET);
            for (String valueKey : BrowseParams.FILTER_VALUE)
            {
                ddQuery.remove(valueKey);
            } 

            //I HAVE ADDED BELOW CODE TO CREATE A BROWSE LIST FOR ARABIC TEXT
            for (char d = 'ا'; d <= 'ى'; d++)

            {   
         ddQuery.put(BrowseParams.STARTS_WITH, Character.toString(d));
 jumpList2.addItemXref(super.generateURL(BROWSE_URL_BASE, ddQuery), Character
                        .toString(d));
            }  

1 个答案:

答案 0 :(得分:1)

我用javascript来做,因为我无法重建dspace。

window.addEventListener('DOMContentLoaded', function(event){
    var elem = jQuery('ul.alphabet.list-inline li:first-child').clone()
    if (elem.length){
        jQuery('ul.alphabet.list-inline').append('&lt;br&gt;')
        var href = elem.children('a').attr('href');
        var str = 'ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی'
        for (var i = 0; i != str.length ; i++){
            var c = str.charAt(i)
            elem.children('a').text(c)
            elem.children('a').attr('href',href.replace('starts_with=0','starts_with='+c));
            jQuery('ul.alphabet.list-inline').append(elem.clone())
            jQuery('ul.alphabet.list-inline').append(' ')
        }
    }
});