Method: WidgetList::List#build_column_link

Defined in:
lib/widget_list.rb

Parameters:



3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
# File 'lib/widget_list.rb', line 3571

def build_column_link(column,j)

  links      = @items['links'][column].dup
  if links.key?('page')
    page      = links['page'].dup
  end
  url        = {'PAGE_ID' => @items['pageId']}
  function   = @items['linkFunction']
  parameters = []

  if links.key?('tags')
    tags = links['tags'].dup
    all_wildcard = false
    if links['tags'].first[0] == 'all'
      all_wildcard = true
      tags = {}
      @results.keys.each { |tag|
        tags[tag.downcase] = tag.downcase
      }
    end

    tags.each { | tagName, tag |

      if links.key?('page') && links['page'].include?(tag.downcase) && @results.key?(tag.upcase)
        page.gsub!(tag.downcase,@results[tag.upcase][j])
      else
        if @results[tag.upcase][j]
          url[tagName] = @results[tag.upcase][j]
        else
          url[tagName] = tag
        end
      end
    }
  end

  if links.key?('onclick')
    function = links['onclick']

    if links.key?('tags')
      tags.each { | tagName, tag |
        if @results.key?(tag.upcase)
          parameters << "'" + @results[tag.upcase][j].gsub(/'/,"\\\\'") + "'"
        end
      }
    end
  end

  if links.key?('page')
    linkUrl = page
    return "#{function}('#{linkUrl}')"
  else
    url['SQL_HASH']      = @sqlHash
    linkUrl = WidgetList::Utils::build_url(@items['pageId'], url, (!$_REQUEST.key?('BUTTON_VALUE')))
    if !parameters.empty?
      return "#{function}(#{parameters.join(',')})"
    else
      return "#{function}('#{linkUrl}')"
    end
  end
end