Changeset 27110 for main


Ignore:
Timestamp:
2013-03-21T16:52:48+13:00 (11 years ago)
Author:
sjm84
Message:

Some major improvements including the functionality to select arbitrary files to modify

Location:
main/trunk/greenstone3/web/interfaces/default
Files:
3 edited

Legend:

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

    r27082 r27110  
    44    //Private member variables
    55    //************************
     6   
     7    //The this variable
     8    var _greenbug = this;
    69   
    710    //Debugger state-keeping variables
     
    1922    var _vEditor;
    2023   
     24    var _navArea;
     25    var _fileSelector;
    2126    var _templateSelector;
    2227    var _editor;
     
    2934   
    3035    //Editor state-keeping variables
    31     var _currentFilepath;
     36    var _currentFileName;
     37    var _currentLocation;
    3238    var _currentNodename;
    3339    var _currentName;
     
    8692    }
    8793   
    88     var createDebugDiv = function()
    89     {
    90         _mainDiv = $("<div>", {"id":"debugDiv"});
    91         _mainDiv.css(
    92         {
    93             "position":"fixed",
    94             "font-size":"0.8em",
    95             "bottom":"0px",
    96             "width":"100%",
    97             "background":"white",
    98             "border":"1px black solid",
    99             "padding":"5px",
    100             "z-index":100
    101         });
    102 
    103         _editingDiv = $("<div>");
    104         var toolBarDiv = $("<div>");
    105         toolBarDiv.css({"height":"40px"});
    106 
    107         var buttonDiv = $("<div>");
    108         toolBarDiv.append(buttonDiv);
    109 
    110         _templateSelector = $("<div>", {"id":"templateSelector"});
    111         _templateSelector.css({"overflow":"auto", "width":"100%"});
    112 
    113         var pickElementButton = $("<button>Enable debugging</button>");
     94    var createButtonDiv = function(buttonDiv)
     95    {
     96        var pickElementButton = $("<button>Enable selector</button>");
    11497        pickElementButton.click(function()
    11598        {
    11699            if(!_debugOn)
    117100            {
    118                 pickElementButton.button("option", "label", "Disable debugging");
     101                pickElementButton.button("option", "label", "Disable selector");
    119102                $("a").click(function(e)
    120103                {
     
    125108            else
    126109            {
    127                 pickElementButton.button("option", "label", "Enable debugging");
     110                pickElementButton.button("option", "label", "Enable selector");
    128111                $("a").off("click");
    129112                clearAll();
     
    191174               
    192175                var url = gs.xsltParams.library_name;
    193                 var parameters = {"a":"g", "rt":"r", "s":"SaveXMLTemplateToFile", "s1.filePath":_currentFilepath, "s1.namespace":_currentNamespace, "s1.nodename":_currentNodename, "s1.xml":xmlString};
     176                var parameters = {"a":"g", "rt":"r", "s":"SaveXMLTemplateToFile", "s1.locationName":_currentLocation, "s1.fileName":_currentFileName, "s1.interfaceName":gs.xsltParams.interface_name, "s1.siteName":gs.xsltParams.site_name, "s1.collectionName":gs.cgiParams.c, "s1.namespace":_currentNamespace, "s1.nodename":_currentNodename, "s1.xml":xmlString};
    194177
    195178                if(_currentName && _currentName.length > 0){parameters["s1.name"] = _currentName;}
     
    284267        });
    285268        _styleFunctions.push(function(){undoButton.button({icons:{primary:"ui-icon-arrowreturnthick-1-w"}})});
    286 
     269       
     270        buttonDiv.append(pickElementButton);
     271        buttonDiv.append(_unpauseButton);
     272        buttonDiv.append(_closeEditorButton);
     273        buttonDiv.append(_saveButton);
     274        buttonDiv.append(_swapEditorButton);
     275        buttonDiv.append(undoButton);
     276    }
     277   
     278    var createXMLStatusBar = function(buttonDiv)
     279    {
    287280        _xmlStatusBar = $("<span>");
    288281        _xmlStatusBar.css("padding", "5px");
     
    327320           
    328321        }, 2000);
    329        
    330         var clear = $("<span>");
    331         clear.css("clear", "both");
    332         toolBarDiv.append(clear);
    333        
    334         buttonDiv.append(pickElementButton);
    335         buttonDiv.append(_unpauseButton);
    336         buttonDiv.append(_closeEditorButton);
    337         buttonDiv.append(_saveButton);
    338         buttonDiv.append(_swapEditorButton);
    339         buttonDiv.append(undoButton);
    340322        buttonDiv.append(_xmlStatusBar);
     323    }
     324   
     325    var createDebugDiv = function()
     326    {
     327        _mainDiv = $("<div>", {"id":"debugDiv"});
     328        _mainDiv.css(
     329        {
     330            "position":"fixed",
     331            "font-size":"0.8em",
     332            "bottom":"0px",
     333            "width":"100%",
     334            "background":"white",
     335            "border":"1px black solid",
     336            "padding":"5px",
     337            "z-index":100
     338        });
     339
     340        _editingDiv = $("<div>");
     341        var toolBarDiv = $("<div>");
     342        toolBarDiv.css({"height":"40px"});
     343        toolBarDiv.append("<div>", {style:"clear:both;"});
     344
     345        var buttonDiv = $("<div>");
     346        toolBarDiv.append(buttonDiv);
     347        createButtonDiv(buttonDiv);
     348        createXMLStatusBar(buttonDiv);
     349       
     350        _navArea = $("<div>", {"id":"veNavArea"});
     351        _templateSelector = $("<div>", {"id":"veTemplateSelector"});
     352        _fileSelector = $("<div>", {"id":"veFileSelector", "class":"ui-state-default ui-corner-all"});
     353        _navArea.append(_fileSelector);
     354        _navArea.append(_templateSelector);
     355        _navArea.append("<div>", {style:"clear:both;"});
     356       
     357        //Populate the file selector
     358        var url = gs.xsltParams.library_name + "?a=g&rt=r&s=GetXSLTFilesForCollection&s1.interfaceName=" + gs.xsltParams.interface_name + "&s1.siteName=" + gs.xsltParams.site_name + "&s1.collectionName=" + gs.cgiParams.c;
     359        $.ajax(url)
     360        .success(function(response)
     361        {
     362            var listStartIndex = response.indexOf("<fileListJSON>") + "<fileListJSON>".length;
     363            var listEndIndex = response.indexOf("</fileListJSON>");
     364           
     365            var listString = response.substring(listStartIndex, listEndIndex).replace(/&quot;/g, "\"").replace(/\\/g, "/");
     366            var list = eval(listString);
     367           
     368            var selectBox = $("<select>");
     369            selectBox.append($("<option>-- Select a file --</option>", {value:"none"}));
     370            _fileSelector.append("<span>Files: </span>");
     371            _fileSelector.append(selectBox);
     372            for(var i = 0; i < list.length; i++)
     373            {
     374                var item = list[i];
     375                var option = $("<option>" + item.path + " (" + item.location + ")</option>", {value:item.path});
     376                option.data("fileItem", item);
     377                selectBox.append(option);
     378            }
     379
     380            selectBox.change(function()
     381            {
     382                var selectedItem = selectBox.find(":selected");
     383               
     384                var getURL = gs.xsltParams.library_name + "?a=g&rt=r&s=GetTemplateListFromFile&s1.fileName=" + selectedItem.data("fileItem").path + "&s1.locationName=" + selectedItem.data("fileItem").location + "&s1.interfaceName=" + gs.xsltParams.interface_name + "&s1.siteName=" + gs.xsltParams.site_name + "&s1.collectionName=" + gs.cgiParams.c;
     385                $.ajax(getURL)
     386                .success(function(templateResponse)
     387                {
     388                    var templateListStart = templateResponse.indexOf("<templateList>") + "<templateList>".length;
     389                    var templateListEnd = templateResponse.indexOf("</templateList>");
     390                    var templateListString = templateResponse.substring(templateListStart, templateListEnd).replace(/&quot;/g, "\"");
     391                    var templateList = eval(templateListString);
     392                   
     393                    clearAll();
     394                   
     395                    for(var i = 0; i < templateList.length; i++)
     396                    {
     397                        var fileName = selectedItem.data("fileItem").path;
     398                        var location = selectedItem.data("fileItem").location;
     399                        var namespace = templateList[i].namespace;
     400                        var nodename = "template";
     401                        var name = templateList[i].name;
     402                        var match = templateList[i].match;
     403                       
     404                        if(name)
     405                        {
     406                            name = templateList[i].name.replace(/&apos;/g, "'").replace(/&quot;/g, "\"").replace(/&amp;/g, "&");
     407                        }
     408                        if(match)
     409                        {
     410                            match = templateList[i].match.replace(/&apos;/g, "'").replace(/&quot;/g, "\"").replace(/&amp;/g, "&");
     411                        }
     412                       
     413                        var infoContainer = $("<div>", {"class":"gbTemplateContainer ui-state-default ui-corner-all"});
     414                       
     415                        _elements.push(infoContainer);
     416                       
     417                        addMouseEventsToInfoContainer(infoContainer, fileName, location, nodename, namespace, name, match);
     418                       
     419                        if(name && name.length > 0)
     420                        {
     421                            infoContainer.text(name);
     422                        }
     423                        if(match && match.length > 0)
     424                        {
     425                            infoContainer.text(match);
     426                        }
     427                       
     428                        if(_templateSelector.children("div").length > 0)
     429                        {/*
     430                            var spacer = $("<div>&gt;&gt;</div>");
     431                            spacer.addClass("gbSpacer");
     432
     433                            _templateSelector.prepend(spacer);
     434                            _elements.push(spacer);
     435                            */
     436                        }
     437                       
     438                        _templateSelector.prepend(infoContainer);
     439                       
     440                        //resizeContainers();
     441                    }
     442                });
     443            });
     444        })
     445        .error(function()
     446        {
     447            console.log("Error retrieving XSLT files");
     448        });
    341449       
    342450        _styleFunctions.push(function(){$(".ui-button").css({"margin-right":"0.5em"});});
     
    344452        _mainDiv.append(toolBarDiv);
    345453        _mainDiv.append(_editingDiv);
    346         _mainDiv.append("<div>Templates:</div>");
    347         _mainDiv.append(_templateSelector);
     454        _mainDiv.append(_navArea);
    348455    }
    349456   
     
    377484    }
    378485   
    379     var addMouseEventsToInfoContainer = function(infoContainer, filepath, nodename, namespace, name, match)
     486    this.changeCurrentTemplate = function(location, fileName, nodename, namespace, name, match)
     487    {
     488        var responseName = "requestedNameTemplate";
     489       
     490        var url = gs.xsltParams.library_name + "?a=g&rt=r&s=GetXMLTemplateFromFile&s1.fileName=" + fileName + "&s1.interfaceName=" + gs.xsltParams.interface_name + "&s1.siteName=" + gs.xsltParams.site_name + "&s1.collectionName=" + gs.cgiParams.c + "&s1.locationName=" + location + "&s1.namespace=" + namespace + "&s1.nodename=" + nodename;
     491        if(match && match.length > 0){url += "&s1.match=" + match; responseName = "requestedMatchTemplate";}
     492        if(name && name.length > 0){url += "&s1.name=" + name;}
     493
     494        $.ajax(url)
     495        .success(function(response)
     496        {
     497            var template;
     498            if(response.search(responseName) != -1)
     499            {
     500                var startIndex = response.indexOf("<" + responseName + ">") + responseName.length + 2;
     501                var endIndex = response.indexOf("</" + responseName + ">");
     502                template = response.substring(startIndex, endIndex);
     503            }
     504            else
     505            {
     506                return;
     507            }
     508       
     509            _textEditor = $("<div>", {"id":"textEditor"});
     510            _textEditor.css({"width":"100%", "height":"300px"});
     511            _textEditor.val(template);
     512           
     513            if(_isVisualEditor)
     514            {
     515                _textEditor.hide();
     516            }
     517           
     518            _editingDiv.empty();
     519            _editingDiv.append($("<p>Location: " + location + " <br/>Filename: " + fileName + "</p>"));
     520            _editingDiv.append(_textEditor);
     521           
     522            _vEditor = new visualXMLEditor(template);
     523            _editingDiv.append(_vEditor.getMainDiv());
     524            _vEditor.setGreenbug(_greenbug);
     525            _vEditor.selectRootElement();
     526           
     527            if(!_isVisualEditor)
     528            {
     529                _vEditor.getMainDiv().hide();
     530            }
     531           
     532            _editor = ace.edit("textEditor");
     533            _editor.getSession().setMode("ace/mode/xml");
     534            _editor.getSession().setUseSoftTabs(false);
     535            _editor.setValue(template);
     536            _editor.clearSelection();
     537            var UndoManager = require("ace/undomanager").UndoManager;
     538            _editor.getSession().setUndoManager(new UndoManager());
     539           
     540            _textEditor.css({"min-height":"200px", "border-top":"5px solid #444"});
     541            _textEditor.resizable({handles: 'n', resize:function()
     542            {
     543                _textEditor.css({top:"0px"});
     544                _editor.resize();
     545            }});
     546
     547            _closeEditorButton.button("option", "disabled", false);
     548            if(_closeEditorButton.button("option", "label") == "Open editor")
     549            {
     550                _closeEditorButton.button("option", "label", "Close editor");
     551                _editingDiv.show();
     552            }
     553        })
     554        .error(function()
     555        {
     556            console.log("ERROR");
     557        });
     558    }
     559   
     560    var addMouseEventsToInfoContainer = function(infoContainer, fileName, location, nodename, namespace, name, match)
    380561    {
    381562        infoContainer.click(function()
     
    389570            _selectedTemplate.css("border", "red 1px solid");
    390571       
    391             _currentFilepath = filepath;
     572            _currentFileName = fileName;
     573            _currentLocation = location;
    392574            _currentNodename = nodename;
    393575            _currentNamespace = namespace;
     
    395577            _currentMatch = match;
    396578       
    397             var responseName = "requestedNameTemplate";
    398        
    399             var url = gs.xsltParams.library_name + "?a=g&rt=r&s=RetrieveXMLTemplateFromFile&s1.filePath=" + _currentFilepath + "&s1.namespace=" + _currentNamespace + "&s1.nodename=" + _currentNodename;
    400             if(_currentMatch && _currentMatch.length > 0){url += "&s1.match=" + _currentMatch; responseName = "requestedMatchTemplate";}
    401             if(_currentName && _currentName.length > 0){url += "&s1.name=" + _currentName;}
    402             $.ajax(url)
    403             .success(function(response)
    404             {
    405                 var template;
    406                 if(response.search(responseName) != -1)
    407                 {
    408                     var startIndex = response.indexOf("<" + responseName + ">") + responseName.length + 2;
    409                     var endIndex = response.indexOf("</" + responseName + ">");
    410                     template = response.substring(startIndex, endIndex);
    411                 }
    412                 else
    413                 {
    414                     return;
    415                 }
    416            
    417                 _textEditor = $("<div>", {"id":"textEditor"});
    418                 _textEditor.css({"width":"100%", "height":"300px"});
    419                 _textEditor.val(template);
    420                
    421                 if(_isVisualEditor)
    422                 {
    423                     _textEditor.hide();
    424                 }
    425                
    426                 _editingDiv.empty();
    427                 _editingDiv.append($("<p>" + filepath + "</p>"));
    428                 _editingDiv.append(_textEditor);
    429                
    430                 _vEditor = new visualXMLEditor(template);
    431                 _editingDiv.append(_vEditor.getMainDiv());
    432                 _vEditor.selectRootElement();
    433                
    434                 if(!_isVisualEditor)
    435                 {
    436                     _vEditor.getMainDiv().hide();
    437                 }
    438                
    439                 _editor = ace.edit("textEditor");
    440                 _editor.getSession().setMode("ace/mode/xml");
    441                 _editor.getSession().setUseSoftTabs(false);
    442                 _editor.setValue(template);
    443                 _editor.clearSelection();
    444                 var UndoManager = require("ace/undomanager").UndoManager;
    445                 _editor.getSession().setUndoManager(new UndoManager());
    446                
    447                 _textEditor.css({"min-height":"200px", "border-top":"5px solid #444"});
    448                 _textEditor.resizable({handles: 'n', resize:function()
    449                 {
    450                     _textEditor.css({top:"0px"});
    451                     _editor.resize();
    452                 }});
    453 
    454                 _closeEditorButton.button("option", "disabled", false);
    455                 if(_closeEditorButton.button("option", "label") == "Open editor")
    456                 {
    457                     _closeEditorButton.button("option", "label", "Close editor");
    458                     _editingDiv.show();
    459                 }
    460             })
    461             .error(function()
    462             {
    463                 console.log("ERROR");
    464             });
     579            _greenbug.changeCurrentTemplate(location, fileName, nodename, namespace, name, match);
    465580        });
    466581        infoContainer.mouseover(function()
    467582        {
    468             $(this).data("background", $(this).css("background"));
    469             $(this).css("background", "yellow");
     583            $(this).removeClass("ui-state-default");
     584            $(this).addClass("ui-state-active");
    470585        });
    471586        infoContainer.mouseout(function()
    472587        {
    473             $(this).css("background", $(this).data("background"));
     588            $(this).addClass("ui-state-default");
     589            $(this).removeClass("ui-state-active");
    474590        });
    475591    }
     
    490606            if(_debugOn && !_pauseSelector)
    491607            {
     608                _fileSelector.find("select").val("none");
     609           
    492610                var nodes = new Array();
    493611                if($(this).is("table, tr"))
     
    518636                    nodes.push(this);
    519637                }
    520                
     638
    521639                $(nodes).each(function()
    522640                {
     
    528646                    var name = $(this).attr("name");
    529647                    var match = $(this).attr("match");
    530                    
    531                     var infoContainer = $("<div>");
    532                     infoContainer.addClass("gbTemplateContainer");
    533                    
     648
     649                    var location;
     650                    var fileName;
     651                    if(filepath.search(/[\/\\]interfaces[\/\\]/) != -1)
     652                    {
     653                        location = "interface";
     654                        fileName = filepath.replace(/.*[\/\\]transform[\/\\]/, "");
     655                    }
     656                    else if(filepath.search(/[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]etc[\/\\]/) != -1)
     657                    {
     658                        location = "collectionConfig";
     659                        fileName = filepath.replace(/.*[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]etc[\/\\]/, "");
     660                    }
     661                    else if(filepath.search(/[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]transform[\/\\]/) != -1)
     662                    {
     663                        location = "collection";
     664                        fileName = filepath.replace(/.*[\/\\]sites[\/\\].*[\/\\]collect[\/\\].*[\/\\]transform[\/\\]/, "");
     665                    }
     666                    else if(filepath.search(/[\/\\]sites[\/\\].*[\/\\]transform[\/\\]/) != -1)
     667                    {
     668                        location = "site";
     669                        fileName = filepath.replace(/.*[\/\\]sites[\/\\].*[\/\\]transform[\/\\]/, "");
     670                    }
     671
     672                    var infoContainer = $("<div>", {"class":"gbTemplateContainer ui-state-default ui-corner-all"});
     673
    534674                    _elements.push(infoContainer);
    535                    
    536                     addMouseEventsToInfoContainer(infoContainer, filepath, nodename, namespace, name, match);
    537                    
    538                     /*
    539                     var attrstr = "";
    540                     var illegalNames = ["nodename", "filename", "style", "debug", "id", "class"];
    541 
    542                     var attributes = ((this.tempAttrs) ? this.tempAttrs : this.attributes);
    543                    
    544                     $(attributes).each(function()
    545                     {
    546                         for(var i = 0; i < illegalNames.length; i++)
    547                         {
    548                             if(this.name == illegalNames[i]){return;}
    549                         }
    550                         attrstr += this.name + "=\"" + this.value + "\" ";
    551                     });
    552 
    553                     infoContainer.text("<" + fullNodename + " " + attrstr + ">");
    554                     */
    555                    
     675
     676                    addMouseEventsToInfoContainer(infoContainer, fileName, location, nodename, namespace, name, match);
     677
    556678                    if(name && name.length > 0)
    557679                    {
     
    562684                        infoContainer.text(match);
    563685                    }
    564                    
     686
    565687                    if(_templateSelector.children("div").length > 0)
    566688                    {
     689                        /*
    567690                        var spacer = $("<div>&gt;&gt;</div>");
    568691                        spacer.addClass("gbSpacer");
     
    570693                        _templateSelector.prepend(spacer);
    571694                        _elements.push(spacer);
    572                     }
    573                    
     695                        */
     696                    }
     697
    574698                    _templateSelector.prepend(infoContainer);
    575                    
    576                     resizeContainers();
     699
     700                    //resizeContainers();
    577701                });
    578702               
     
    626750                var url = document.URL;
    627751                url = url.replace("debug=0", "");
    628                 if(url.indexOf("?") != -1)
     752
     753                if(url.indexOf("?") == url.length - 1)
     754                {
     755                    document.location.href = url += "debug=1";
     756                }
     757                else if(url.indexOf("?") != -1)
    629758                {
    630759                    document.location.href = url += "&debug=1";
    631                 }
    632                 else if(url.indexOf("?") == url.length - 1)
    633                 {
    634                     document.location.href = url += "debug=1";
    635760                }
    636761                else
  • main/trunk/greenstone3/web/interfaces/default/js/visual-xml-editor.js

    r27072 r27110  
    66function visualXMLEditor(xmlString)
    77{
    8     var thisEditor = this;
     8    var _thisEditor = this;
     9    var _greenbug;
    910
    1011    var _globalID = 0;
     
    8990    };
    9091   
     92    this.setGreenbug = function(gb)
     93    {
     94        _greenbug = gb;
     95    }
     96   
    9197    this.getXML = function()
    9298    {
     
    243249    var retrieveGSLIBTemplates = function(callback)
    244250    {
    245         var url = gs.xsltParams.library_name + "?a=g&rt=r&s=GetGSLIBElementsFromFile&s1.interfaceName=" + gs.xsltParams.interface_name;
     251        var url = gs.xsltParams.library_name + "?a=g&rt=r&s=GetTemplateListFromFile&s1.locationName=interface&s1.interfaceName=" + gs.xsltParams.interface_name + "&s1.fileName=gslib.xsl";
    246252
    247253        $.ajax(url)
     
    253259            var listString = response.substring(startIndex, endIndex);
    254260            var list = eval(listString.replace(/&quot;/g, "\""));
    255            
    256             _elemList["gslib"] = list;
     261            var modifiedList = new Array();
     262           
     263            for(var i = 0; i < list.length; i++)
     264            {
     265                var current = list[i];
     266                if(current.name)
     267                {
     268                    modifiedList.push(current.name);
     269                }
     270            }
     271           
     272            _elemList["gslib"] = modifiedList;
    257273           
    258274            if(callback)
     
    569585   
    570586        var _textEditor = $("<div>");
    571         var _textTitle = $("<div>Text:</div>");
    572587        var _nodeText = $("<div>");
    573588        _nodeText.text(_xmlNode.nodeValue);
    574589
    575         _textEditor.append(_textTitle);
    576590        _textEditor.append(_nodeText);
    577591       
     
    10681082        this.populateInformationDiv = function()
    10691083        {
    1070             thisEditor.savePendingEdits();
     1084            _thisEditor.savePendingEdits();
    10711085            _infoDiv.empty();
    10721086
    1073             var nameElement = $("<p>");
    10741087            if(_xmlNode.nodeType == 1)
    10751088            {
    1076                 nameElement.text("Name: " + _xmlNode.nodeName);
     1089                var nameElementTitle = $("<div>", {"class":"ui-state-default ui-corner-all veInfoDivTitle"}).text("Element name:");
     1090                _infoDiv.append(nameElementTitle);
     1091                _infoDiv.append($("<p>").text(_xmlNode.nodeName));
    10771092            }
    10781093            else
    10791094            {
    1080                 nameElement.text("[text node]");
    1081             }
    1082             _infoDiv.append(nameElement);
     1095                var textElementTitle = $("<div>", {"class":"ui-state-default ui-corner-all veInfoDivTitle"}).text("Text node:");
     1096                _infoDiv.append(textElementTitle);
     1097            }
    10831098
    10841099            if(_xmlNode.nodeType == 1)
    10851100            {
    1086                 var attributeTableTitle = $("<p>Attributes:<p/>");
     1101                var attributeTableTitle = $("<div>", {"class":"ui-state-default ui-corner-all veInfoDivTitle"});
     1102                attributeTableTitle.text("Attributes:");
    10871103                var attributeTable = $("<table>");
    10881104                attributeTable.addClass("veAttributeTableContainer");
     
    10991115                _infoDiv.append(attributeTable);
    11001116               
     1117                var addDiv = $("<div>", {"class":"veInfoDivTitle"});
    11011118                var addSelect = $("<select>");
    11021119                addSelect.append("<option>[blank]</option>", {value:"[blank]"});
     
    11491166                    _transactions.push({type:"addAttr", row:row})
    11501167                });
    1151                 _infoDiv.append(addSelect);
    1152                 _infoDiv.append(addButton);
     1168                addDiv.append(addSelect);
     1169                addDiv.append(addButton);
     1170                _infoDiv.append(addDiv);
    11531171                addButton.button();
     1172               
     1173                /*
     1174                if(_xmlNode.tagName == "xsl:call-template" && _xmlNode.getAttribute("name").length > 0)
     1175                {
     1176                    var extraOptionsTitle = $("<div>", {"class":"ui-state-default ui-corner-all veInfoDivTitle"}).text("Additional options:");
     1177                    var visitTemplateOption = $("<button>View called template</button>");
     1178                   
     1179                    _infoDiv.append(extraOptionsTitle);
     1180                    _infoDiv.append(visitTemplateOption);
     1181                   
     1182                    visitTemplateOption.button();
     1183                    visitTemplateOption.click(function()
     1184                    {
     1185                        var template = "";
     1186                        template += '<xsl:template match="/">';
     1187                        template +=   '<calledTemplate>';
     1188                        var params = $(_xmlNode).children("xsl\\:with-param");
     1189                        if(!params.length)
     1190                        {
     1191                            template += '<xsl:call-template name="' + _xmlNode.getAttribute("name") + '"/>';
     1192                        }
     1193                        else
     1194                        {
     1195                            template += '<xsl:call-template name="' + _xmlNode.getAttribute("name") + '">';
     1196                            for(var i = 0; i < params.length; i++)
     1197                            {
     1198                                var param = params.eq(i);
     1199                                template += "<xsl:with-param";
     1200                                for(var j = 0; j < param[0].attributes.length; j++)
     1201                                {
     1202                                    var attr = param[0].attributes[j];
     1203                                    template += " " + attr.name + "=\"" + attr.value + "\"";
     1204                                }
     1205                                template += "/>";
     1206                            }
     1207                            template += '</xsl:call-template>';
     1208                        }
     1209                        template +=   '</calledTemplate>';
     1210                        template += '</xsl:template>';
     1211                        template = template.replace(" ", "%20");
     1212                       
     1213                        var url = document.URL;
     1214                        if(url.indexOf("?") == url.length - 1)
     1215                        {
     1216                            url += "ilt=" + template;
     1217                        }
     1218                        else if(url.indexOf("?") != -1)
     1219                        {
     1220                            url += "&ilt=" + template;
     1221                        }
     1222                        else
     1223                        {
     1224                            url += "?ilt=" + template;
     1225                        }
     1226                       
     1227                        $.ajax(url)
     1228                        .success(function(response)
     1229                        {
     1230                            var xml = $.parseXML(response);
     1231                            var debug = $(xml).find("calledTemplate debug");
     1232
     1233                            _greenbug.changeCurrentTemplate(debug[0].getAttribute("filename"), "template", "xsl", debug[0].getAttribute("name"), null);
     1234                            $(".gbTemplateContainer").css("border", "1px dashed #AAAAAA");
     1235                        });
     1236                    });
     1237                }
     1238                */
    11541239            }
    11551240
     
    11591244                _infoDiv.append(textNode.getDiv());
    11601245            }
    1161         }
    1162        
    1163         this.remove = function()
    1164         {
    1165             var divParent = _div.parents(".veElement");
    1166             _transactions.push({type:"remMvElem", vElemParent:_div.parent(), vElemPos:_div.index(), vElem:_div});
    1167             _div.data("expanded", "normal");
    1168             $(_xmlNode).remove();
    1169             _div.detach();
    1170             _infoDiv.empty();
    1171            
    1172             if(divParent.length)
    1173             {
    1174                 divParent.first().trigger("click");
    1175             }
    1176            
    1177             $("#veTrash").children("img").attr("src", gs.imageURLs.trashFull);
    11781246        }
    11791247
     
    12471315            return false;
    12481316        }
     1317       
     1318        this.remove = function()
     1319        {
     1320            var divParent = _div.parents(".veElement");
     1321            _transactions.push({type:"remMvElem", vElemParent:_div.parent(), vElemPos:_div.index(), vElem:_div});
     1322            _div.data("expanded", "normal");
     1323            $(_xmlNode).remove();
     1324            _div.detach();
     1325            _infoDiv.empty();
     1326           
     1327            if(divParent.length)
     1328            {
     1329                divParent.first().trigger("click");
     1330            }
     1331           
     1332            $("#veTrash").children("img").attr("src", gs.imageURLs.trashFull);
     1333        }
    12491334
    12501335        this.expand = function()
  • main/trunk/greenstone3/web/interfaces/default/style/core.css

    r27080 r27110  
    897897    float:left;
    898898    cursor:pointer;
    899     border:1px dashed #AAAAAA;
    900     margin:0;
     899    margin:0 1em;
    901900    font-size:1.1em;
    902901    text-align:center;
     902    overflow:hidden;
     903    min-width:4em;
     904    padding: 0.5em;
    903905}
    904906
     
    914916    margin:0;
    915917    padding:0;
     918}
     919
     920#veNavArea{
     921    width:100%;
     922}
     923
     924#veTemplateSelector{
     925    width:75%;
     926    float:right;
     927}
     928
     929#veFileSelector{
     930    float:left;
     931    padding:0.5em;
    916932}
    917933
     
    10101026}
    10111027
     1028.veInfoDivTitle{
     1029    text-align:center;
     1030    margin-bottom:1em;
     1031}
     1032
    10121033.veAttributeTableContainer{
    10131034    text-align:center;
    10141035    width:100%;
    1015     margin-bottom:2em;
     1036    margin-bottom:1em;
    10161037}
    10171038
Note: See TracChangeset for help on using the changeset viewer.