Changeset 33049 for main/trunk


Ignore:
Timestamp:
2019-05-06T13:45:54+12:00 (5 years ago)
Author:
kjdon
Message:

moved the basket item display to its own function so it can easily be customised. also removed a debug thing which got left in by mistake

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/berrybasket/berrybasket.js

    r33041 r33049  
    199199        var berryElement = document.createElement('li');
    200200        list.appendChild(berryElement);
    201         var title = berryItem.getAttribute('Title');
    202         var root_title = berryItem.getAttribute('root_Title');
    203         //var id = berryItem.getAttribute('collection')+":"+berryItem.getAttribute('name');
    204 
    205         if (root_title != null){
    206             title = root_title+":"+title;
    207         }
    208             title += " ("+berryItem.getAttribute('collection')+")";
    209         if (title.length > 76){
    210             title = title.substring(0,30)+" ... "+title.substr(title.length-45,45);
    211         }
    212        
     201       
     202                var title = berryTitle(berryItem);   
    213203        berryElement.setAttribute("class","berryitem");
    214204        berryElement.setAttribute("title",title);
    215         berryElement.innerHTML = title;
     205        berryElement.innerHTML = title; 
    216206        height +=40;
    217207    }
     
    254244}
    255245
     246function berryTitle(berryItem) {
     247
     248    var title = berryItem.getAttribute('Title');                   
     249    var root_title = berryItem.getAttribute('root_Title');         
     250    //var id = berryItem.getAttribute('collection')+":"+berryItem.getAttribute('name');                                                           
     251   
     252    if (root_title != null){                                       
     253        title = root_title+":"+title;                               
     254    }                                                               
     255    title += " ("+berryItem.getAttribute('collection')+")";         
     256    if (title.length > 76){                                         
     257        title = title.substring(0,30)+" ... "+title.substr(title.length-45,45);                                                               
     258    }                                                               
     259
     260    return title;
     261}
     262
    256263function hideBasket() {
    257264//alert( arguments.callee );
     
    291298
    292299function addBerry(el){
    293     var addurl = gs.xsltParams.library_name + "?a=pr&rt=r&ro=1&s=AddItem&c=&s1.id=2&o=XML&hhf="+makeURLComponentSafe("[{\"name\":\"Cache-Control\", \"value\":\"no-cache\"}]")+"&poo=1&s1.item=" + el.id;
     300    var addurl = gs.xsltParams.library_name + "?a=pr&rt=r&ro=1&s=AddItem&c=&s1.id=2&o=XML&hhf="+makeURLComponentSafe("[{\"name\":\"Cache-Control\", \"value\":\"no-cache\"}]")+"&s1.item=" + el.id;
    294301
    295302    var addSuccess = function(o){
Note: See TracChangeset for help on using the changeset viewer.