Jump to content

Archived

This topic is now archived and is closed to further replies.

Alex_tm

Cancelar carregamento dinâmico de imagens

Recommended Posts

Bom dia a todos!

 

Estou trabalhando em um projeto de personalização de um portal que dá acesso online a um ERP rodando no servidor do cliente.

 

Estou com 80% das alterações concluídas. Porém, por não conhecer java, C#, entre outras, estou tendo dificuldade em alterar algumas coisas.

 

A primeira delas diz respeito a algumas imagens que são carregadas dinamicamente. Elas ficam localizadas a esquerda dos links. Consegui retirá-las através das folhas de estilo e do xml, zerando o tamanho delas e apagando as referências no xml, mas isso é gambiarra e não posso entregar dessa forma (ou posso, está correto?). Preciso retirar o código que carrega essas imagens. Acredito que o código abaixo é o responsável pelo carregamento. Também já apaguei todas as linhas que continham "ico" e "img", mas não resolveu.

 

Alguém consegue me dar uma orientação?

 

Agradeço antecipadamente a atenção e ajuda de todos.

 

Forte abraço!

/*<RMJSDep>SharedServices\ClientScripts\RMWJSResource.js.aspx;</RMJSDep>*/

//RMWAjaxTreeView
RM.Lib.WebForms.RMWAjaxTreeView = function(element){
  this._nodes = [];
  this._selectedNodeIndex = 0;
  this._pageType = '';
  this._populateChildNodesMethod;
  this._selectedNode = null;

  RM.Lib.WebForms.RMWAjaxTreeView.initializeBase(this, [element]);
}

RM.Lib.WebForms.RMWAjaxTreeView.prototype = {
  initialize : function(){
    RM.Lib.WebForms.RMWAjaxTreeView.callBaseMethod(this, 'initialize');
  },
  
  dispose: function(){
    RM.Lib.WebForms.RMWAjaxTreeView.callBaseMethod(this, 'dispose');
  },
  
  //properties
  get_PageType : function(){
    return this._pageType;
  },
  
  set_PageType : function(value){
    this._pageType = value;
  },
  
  get_PopulateChildNodesMethod : function(){
    return this._populateChildNodesMethod;
  },
  
  set_PopulateChildNodesMethod : function(value){
    this._populateChildNodesMethod = value;
  },
  
  get_SelectedNode : function(){
    return this._selectedNode;
  },
  
  set_SelectedNode : function(value){
    if (this._selectedNode){
      Sys.UI.DomElement.removeCssClass(this._selectedNode.get_CaptionCell(), "AjaxTreeViewCaptionCellSelected");//donotlocalize
      this._selectedNode._selected = false;
    }
      
    this._selectedNode = value;
    if (this._selectedNode.get_CaptionCell())
      Sys.UI.DomElement.addCssClass(this._selectedNode.get_CaptionCell(), "AjaxTreeViewCaptionCellSelected");//donotlocalize
  }
}

RM.Lib.WebForms.RMWAjaxTreeView.registerClass("RM.Lib.WebForms.RMWAjaxTreeView", Sys.UI.Control);

//RMWAccordionItemStatus
RM.Lib.WebForms.RMWAjaxTreeNodeStatus = function(){};
RM.Lib.WebForms.RMWAjaxTreeNodeStatus.prototype = {
  Loaded : 0,
  Loading : 1,
  NotLoaded : 2,
  Error : 3
}
RM.Lib.WebForms.RMWAjaxTreeNodeStatus.registerEnum("RM.Lib.WebForms.RMWAjaxTreeNodeStatus");//donotlocalize

//RMWAjaxTreeNode
RM.Lib.WebForms.RMWAjaxTreeNode = function(element){
  this._childNodes = [];
  this._selectedNodeIndex = -1;
  this._indentModeArray = [];
  this._parentTreeView = null;
  this._parentNode = null;
  this._childNodesContainer = null;
  this._childNodesContainerRow = null;
  this._buttonExpColl = null;
  this._childrenVisible = true;
  this._expandButtonImagePath = '';
  this._collapseButtonImagePath = '';
  this._identBlankImagePath = '';
  this._identIImagePath = '';
  this._identTImagePath = '';
  this._identLImagePath = '';
  this._iconPath = '';
  this._siblings = 0;
  this._caption = '';
  this._captionCell = null;
  this._value = '';
  this._navigateUrl = '';
  this._skipPopulateOnDemand = false;
  this._expanded = false;
  this._status = RM.Lib.WebForms.RMWAjaxTreeNodeStatus.NotLoaded;
  this._selected = false;
  this._executeOnload = false;

  RM.Lib.WebForms.RMWAjaxTreeNode.initializeBase(this, [element]);
}

RM.Lib.WebForms.RMWAjaxTreeNode.prototype = {
  initialize : function(){
    RM.Lib.WebForms.RMWAjaxTreeNode.callBaseMethod(this, 'initialize');

    if (this._parentTreeView && this._selected)
      this._parentTreeView.set_SelectedNode(this);
      
    if (this._executeOnload)
    {
      if (this._captionCell){
        var anchors = this._captionCell.getElementsByTagName('A');
        if (anchors && anchors[0])
          anchors[0].click();
      }
    }
  },
  
  dispose: function(){
    RM.Lib.WebForms.RMWAjaxTreeNode.callBaseMethod(this, 'dispose');
  },
  
  _onNodeClick : function(){
    this.get_ParentTreeView().set_SelectedNode(this);
  },
  
  _onButtonExpCollClick : function(){
    var buttonExpColl = this.get_ButtonExpColl();
    var childNodesContainerRow = this.get_ChildNodesContainerRow();
    var childrenVisible = this.get_ChildrenVisible();

    if (childrenVisible){
      buttonExpColl.src = this.get_ExpandButtonImagePath();
      childNodesContainerRow.style.display = 'none';
    }
    else{
      buttonExpColl.src = this.get_CollapseButtonImagePath();
      childNodesContainerRow.style.display = '';

      if (this._status == RM.Lib.WebForms.RMWAjaxTreeNodeStatus.NotLoaded)
        this._setLoading();
    }
      
    this.set_ChildrenVisible(!childrenVisible);
  },
   
  _setLoading : function(){
    this._status = RM.Lib.WebForms.RMWAjaxTreeNodeStatus.Loading;
    RM.Lib.WebForms.RMWAjaxTreeViewServices.PopulateChildNodes(
      this._parentTreeView.get_PageType(),
      this._parentTreeView.get_PopulateChildNodesMethod(),
      this._value,
      Function.createDelegate(this, this._successCallBack),
      Function.createDelegate(this, this._failureCallBack));
      
    var childNodesContainer = this.get_ChildNodesContainer();
    if (childNodesContainer){
      var control = this._createTreeNodeControl(
        SLibWebWaitCaption,
        "",
        "SharedServices/Images/loading.gif",//donotlocalize
        true,
        0);
      control._renderTreeNode();
      while (childNodesContainer.firstNode)
        childNodesContainer.firstNode.removeChild();
      var tbody = document.createElement('TBODY');
      tbody.appendChild(control.get_element());
      childNodesContainer.appendChild(tbody);
      this._childNodes = [control];
    }
  },
  
  _successCallBack : function(result, context, methodName){
    this._status = RM.Lib.WebForms.RMWAccordionItemStatus.Error;
    var childNodesContainer = this.get_ChildNodesContainer();
    if (childNodesContainer){
      while (childNodesContainer.firstChild)
        childNodesContainer.removeChild(childNodesContainer.firstChild);

      this._childNodes = [];
      var siblings = result.length - 1;
      for ( var i = 0; i < result.length; i++){
        var control = this._createTreeNodeControl(
          result[i].Caption,
          result[i].NavigateUrl,
          result[i].IconPath,
          result[i].SkipPopulateOnDemand,
          siblings--,
          result[i].Value);
        control._renderTreeNode();
        var tbody = document.createElement('TBODY');
        tbody.appendChild(control.get_element());
        if (control._renderChildNodesRow())
          tbody.appendChild(control.get_ChildNodesContainerRow());
       childNodesContainer.appendChild(tbody);
      }
    }
  },
  
  _failureCallBack : function(error, context, methodName){
    $ShowModalMessageBox(RM.Lib.WebForms.ModalMessageBoxType.Error, error._message, error._stackTrace);

    this._status = RM.Lib.WebForms.RMWAccordionItemStatus.Error;
    var childNodesContainer = this.get_ChildNodesContainer();
    if (childNodesContainer){
      var control = this._createTreeNodeControl(
        SLibTreeViewErrorCaption,
        "",
        "SharedServices/Images/loading.gif",//donotlocalize
        true,
        0);
      control._renderTreeNode();
      while (childNodesContainer.firstChild)
        childNodesContainer.removeChild(childNodesContainer.firstChild);
      var tbody = document.createElement('TBODY');
      tbody.appendChild(control.get_element());
      childNodesContainer.appendChild(tbody);
      this._childNodes = [control];
    }
  },
  
  _createTreeNodeControl : function(Caption, NavigateUrl, IconPath, SkipPopulateOnDemand, Siblings, Value){
    var indentModeArray = Array.clone(this.get_IndentModeArray());
    if (this.get_Siblings() == 0)
      Array.add(indentModeArray, 0);
    else
      Array.add(indentModeArray, 1);
      
    var nodeContainerRow = document.createElement('TR');
    var childNodesContainerRow = document.createElement('TR');
    
    var control = $create(
      RM.Lib.WebForms.RMWAjaxTreeNode, 
      {
        "Caption":Caption,//donotlocalize
        "NavigateUrl":NavigateUrl,//donotlocalize
        "ChildNodesContainerRow":childNodesContainerRow,//donotlocalize
        "ChildrenVisible":false,//donotlocalize
        "CollapseButtonImagePath":this.get_CollapseButtonImagePath(),//donotlocalize
        "ExpandButtonImagePath":this.get_ExpandButtonImagePath(),//donotlocalize
        "IdentBlankImagePath":this.get_IdentBlankImagePath(),//donotlocalize
        "IdentIImagePath":this.get_IdentIImagePath(),//donotlocalize
        "IdentLImagePath":this.get_IdentLImagePath(),//donotlocalize
        "IdentTImagePath":this.get_IdentTImagePath(),//donotlocalize
        "IconPath" : IconPath,//donotlocalize
        "IndentModeArray":indentModeArray,//donotlocalize
        "Siblings":Siblings,//donotlocalize
        "SkipPopulateOnDemand":SkipPopulateOnDemand,//donotlocalize
        "ParentTreeView":this.get_ParentTreeView(),//donotlocalize
        "ParentNode":this,//donotlocalize
        "Value" : Value//donotlocalize
      },
      null, 
      null, 
      nodeContainerRow
    );
    return control;
  },

  _populateOnDemand : function(){
    var hadPopulateChildNodesMethod = false;
    var parentTreeView = this.get_ParentTreeView();
    if (parentTreeView)
      hadPopulateChildNodesMethod = parentTreeView.get_PopulateChildNodesMethod().trim() != '';
    return (hadPopulateChildNodesMethod &&
            !this.get_SkipPopulateOnDemand());
  },
  
  _renderChildNodesRow : function(){
    return (this._populateOnDemand() || this._containsChildren());
  },
  
  _displayChildNodesRow : function(){
    return (this._containsChildren() && this._expanded);
  },
  
  _renderTreeNode : function(){
    var nodeContainerRow = this.get_element();
    nodeContainerRow.innerHTML = '';
    
    var nodeConteinerCell = document.createElement('TD');
    
    nodeConteinerCell.appendChild(this._createNodeContents());
    nodeContainerRow.appendChild(nodeConteinerCell);
    
    var childNodesContainerRow = this.get_ChildNodesContainerRow();
    var childNodesContainerCell = document.createElement('TD');
    
    var childNodesTable = document.createElement('TABLE');
    childNodesTable.cellPadding = 0;
    childNodesTable.cellSpacing = 0;
    
    var Tbody = document.createElement('TBODY');

    childNodesTable.appendChild(Tbody);
    childNodesContainerCell.appendChild(childNodesTable);
    childNodesContainerRow.appendChild(childNodesContainerCell);
    childNodesContainerRow.style.display = 'none';
  },
  
  _createNodeContents : function (){
    var table = document.createElement('TABLE');
    table.cellPadding = 0;
    table.cellSpacing = 0;
    
    var tbody = document.createElement('TBODY');
    var row = document.createElement('TR');
    var cell = document.createElement('TD');
    var img = null;
    cell.className = 'AjaxTreeViewIdentationCell';
    cell.vAlign = 'middle';//donotlocalize
    
    //Identation
    var identModeArray = this.get_IndentModeArray();
  
    for (var i = 0; i < identModeArray.length; i++)
      cell.appendChild(this._createIdentationImage(identModeArray[i]));

    if (this.get_Siblings() > 0)
      cell.style.backgroundImage = String.format("url({0})", this.get_IdentTImagePath());//donotlocalize
    else
      cell.style.backgroundImage = String.format("url({0})", this.get_IdentLImagePath());//donotlocalize
   
    if (this._renderChildNodesRow())
    {
      img = document.createElement('IMG');
      img.className = 'AjaxTreeViewExpCollButton';
      this.set_ButtonExpColl(img);
      
      if (this._displayChildNodesRow())
        img.src = this.get_CollapseButtonImagePath();
      else
        img.src = this.get_ExpandButtonImagePath();

      cell.appendChild(img);
    }
    else
      cell.appendChild(this._createIdentationImage(0));

    row.appendChild(cell);
    
    //Icon
    cell = document.createElement('TD');
    cell.className = 'AjaxTreeViewIconCell';
    cell.vAlign = 'middle';//donotlocalize
    
    img = document.createElement('IMG');
    img.style.width = '16px';
    img.style.height = '16px';
    img.src = this.get_IconPath();
    
    cell.appendChild(img);
    row.appendChild(cell);
    
    //Caption
    cell = document.createElement('TD');
    cell.className = 'AjaxTreeViewCaptionCell';
    cell.vAlign = 'middle';//donotlocalize
    cell.CssClass = "AjaxTreeViewCaptionCell";//donotlocalize
    
    var anchor = document.createElement('A');
    var navigateUrl = this.get_NavigateUrl();
    if (navigateUrl.trim() != '')
    {
      anchor.href = navigateUrl;
      cell.className += ' AjaxTreeViewCaptionCellWithLink';//donotlocalize
    }
    
    anchor.appendChild(document.createTextNode(this.get_Caption()));
    cell.appendChild(anchor);
    row.appendChild(cell);
    
    tbody.appendChild(row);
    table.appendChild(tbody);
    
    return table;
  },
  
  _createIdentationImage : function(IdentationMode){
    var identationImage = document.createElement('IMG');
    identationImage.style.width = '18px';
    identationImage.style.height = '18px';

    switch (IdentationMode)
    {
      case 0:
        identationImage.src = this.get_IdentBlankImagePath();
        break;
      case 1:
        identationImage.src = this.get_IdentIImagePath();
        break;
    }

    return identationImage;
  },
  
  _containsChildren : function(){
    this._childNodes.length > 0;
  },
 
  //Properties
  get_IndentModeArray : function(){
    return this._indentModeArray;
  },
  
  set_IndentModeArray : function(value){
    this._indentModeArray = value;
  },

  get_ParentNode : function(){
    return this._parentNode;
  },
  
  set_ParentNode : function(value){
    this._parentNode = value;
    Array.add(this._parentNode._childNodes, this);
    this._parentNode._status = RM.Lib.WebForms.RMWAjaxTreeNodeStatus.Loaded;
  },

  get_ParentTreeView : function(){
    return this._parentTreeView;
  },
  
  set_ParentTreeView : function(value){
    this._parentTreeView = value;
  },

  get_IconPath : function(){
    return this._iconPath;
  },
  
  set_IconPath : function(value){
    this._iconPath = value;
  },

  get_NavigateUrl : function(){
    return this._navigateUrl;
  },
  
  set_NavigateUrl : function(value){
    this._navigateUrl = value;
  },

  get_SkipPopulateOnDemand : function(){
    return this._skipPopulateOnDemand;
  },
  
  set_SkipPopulateOnDemand : function(value){
    this._skipPopulateOnDemand = StringToBoolean(value);
  },
  
  get_ExpandButtonImagePath : function(){
    return this._expandButtonImagePath;
  },
  
  set_ExpandButtonImagePath : function(value){
    this._expandButtonImagePath = value;
  },
  
  get_CollapseButtonImagePath : function(){
    return this._collapseButtonImagePath;
  },
  
  set_CollapseButtonImagePath : function(value){
    this._collapseButtonImagePath = value;
  },
  
  get_IdentBlankImagePath : function(){
    return this._identBlankImagePath;
  },
  
  set_IdentBlankImagePath : function(value){
    this._identBlankImagePath = value;
  },
  
  get_IdentIImagePath : function(){
    return this._identIImagePath;
  },
  
  set_IdentIImagePath : function(value){
    this._identIImagePath = value;
  },
  
  get_IdentTImagePath : function(){
    return this._identTImagePath;
  },
  
  set_IdentTImagePath : function(value){
    this._identTImagePath = value;
  },
  
  get_IdentLImagePath : function(){
    return this._identLImagePath;
  },
  
  set_IdentLImagePath : function(value){
    this._identLImagePath = value;
  },
  
  get_Siblings : function(){
    return this._siblings;
  },
  
  set_Siblings : function(value){
    this._siblings = value;
  },
  
  get_CaptionCell : function(){
    return this._captionCell;
  },
  
  set_CaptionCell : function(value){
    if (value){
      var anchors = value.getElementsByTagName('A');
      if (anchors && anchors[0])
      $addHandlers(anchors[0],
        {click: this._onNodeClick}, this);
    }
    this._captionCell = value;
  },
  
  get_Caption : function(){
    return this._caption;
  },
  
  set_Caption : function(value){
    this._caption = value;
  },
   
  get_Value : function(){
    return this._value;
  },
  
  set_Value : function(value){
    this._value = value;
  },
   
  get_ExecuteOnload : function(){ return this._executeOnload; },  
  set_ExecuteOnload : function(value){ this._executeOnload = value; },
 
  get_ChildrenVisible : function(){
    return this._childrenVisible;
  },
  
  set_ChildrenVisible : function(value){
    this._childrenVisible = value;
  },
  
  get_ButtonExpColl : function(){
    return this._buttonExpColl;
  },
  
  set_ButtonExpColl : function(value){
    if (this._buttonExpColl){
      $clearHandlers(this._buttonExpColl);
    }
    this._buttonExpColl = value;
    if (this._buttonExpColl){
      $addHandlers(this._buttonExpColl, 
        { click : this._onButtonExpCollClick }, this);
    }
  },
  
  get_ChildNodesContainer : function(){
    if (this._childNodesContainer)
      return this._childNodesContainer;
    var childNodesContainerRow = this.get_ChildNodesContainerRow();
    var innerTables = childNodesContainerRow.getElementsByTagName('TABLE');
    return this._childNodesContainer = innerTables[0];
  },
  
  get_ChildNodesContainerRow : function(){
    return this._childNodesContainerRow;
  },
  
  set_ChildNodesContainerRow : function(value){
    this._childNodesContainerRow = value;
  },
  
  get_Selected : function(){
    return this._selected;
  },
  
  set_Selected : function(value){
    this._selected = StringToBoolean(value);
  }
}

RM.Lib.WebForms.RMWAjaxTreeNode.registerClass("RM.Lib.WebForms.RMWAjaxTreeNode", Sys.UI.Control);

Share this post


Link to post
Share on other sites

KhaosDoctor, obrigado pelo retorno.

 

No html não tem nada, apenas as divs que receberão os conteúdos.

É justamente isso que está gerando dificuldade, pois tudo é carregado dinamicamente.

Existem também cores de links, por exemplo, que não consigo modificar via CSS.

 

Abs,

Share this post


Link to post
Share on other sites

×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.