Ignore:
Timestamp:
2013-04-10T12:45:37+12:00 (11 years ago)
Author:
sjm84
Message:

Enabled the functionality to go to the template that is called by xsl:call-template

File:
1 edited

Legend:

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

    r27153 r27163  
    549549            _vEditor.selectRootElement();
    550550
     551            _vEditor.setFileLocation(location);
     552            _vEditor.setFileName(fileName);
     553
    551554            if(!_isVisualEditor)
    552555            {
     
    604607            _greenbug.changeCurrentTemplate(location, fileName, nodename, namespace, name, match);
    605608        });
     609    }
     610   
     611    //Turns a filename into it's location (i.e. interface/site/collection) and name
     612    this.fileNameToLocationAndName = function(filepath)
     613    {
     614        var location;
     615        var fileName;
     616        //Use the filepath to work out where this file is from
     617        if(filepath.search(/[\/\\]interfaces[\/\\]/) != -1)
     618        {
     619            location = "interface";
     620            fileName = filepath.replace(/.*[\/\\]transform[\/\\]/, "");
     621        }
     622        else if(filepath.search(/[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]etc[\/\\]/) != -1)
     623        {
     624            location = "collectionConfig";
     625            fileName = filepath.replace(/.*[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]etc[\/\\]/, "");
     626        }
     627        else if(filepath.search(/[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]transform[\/\\]/) != -1)
     628        {
     629            location = "collection";
     630            fileName = filepath.replace(/.*[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]transform[\/\\]/, "");
     631        }
     632        else if(filepath.search(/[\/\\]sites[\/\\].*[\/\\]transform[\/\\]/) != -1)
     633        {
     634            location = "site";
     635            fileName = filepath.replace(/.*[\/\\]sites[\/\\].*[\/\\]transform[\/\\]/, "");
     636        }
     637       
     638        return {location:location, filename:fileName};
    606639    }
    607640
     
    668701                    var match = $(this).attr("match");
    669702
    670                     var location;
    671                     var fileName;
    672                     //Use the filepath to work out where this file is from
    673                     if(filepath.search(/[\/\\]interfaces[\/\\]/) != -1)
    674                     {
    675                         location = "interface";
    676                         fileName = filepath.replace(/.*[\/\\]transform[\/\\]/, "");
    677                     }
    678                     else if(filepath.search(/[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]etc[\/\\]/) != -1)
    679                     {
    680                         location = "collectionConfig";
    681                         fileName = filepath.replace(/.*[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]etc[\/\\]/, "");
    682                     }
    683                     else if(filepath.search(/[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]transform[\/\\]/) != -1)
    684                     {
    685                         location = "collection";
    686                         fileName = filepath.replace(/.*[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]transform[\/\\]/, "");
    687                     }
    688                     else if(filepath.search(/[\/\\]sites[\/\\].*[\/\\]transform[\/\\]/) != -1)
    689                     {
    690                         location = "site";
    691                         fileName = filepath.replace(/.*[\/\\]sites[\/\\].*[\/\\]transform[\/\\]/, "");
    692                     }
     703                    var file = _greenbug.fileNameToLocationAndName(filepath);
    693704
    694705                    var infoContainer = $("<option>");
     
    696707                    _elements.push(infoContainer);
    697708
    698                     addChangeEventToInfoContainer(infoContainer, fileName, location, nodename, namespace, name, match);
     709                    addChangeEventToInfoContainer(infoContainer, file.filename, file.location, nodename, namespace, name, match);
    699710
    700711                    if(name && name.length > 0)
Note: See TracChangeset for help on using the changeset viewer.