<commit_before>module DistributionsHelper
  
  #shows a repository in a div
  #params:
  #repos=dist to show
  #style=div-class
  def repository_view repos, style
    
    header = Array.new Package.security_types.length
    security_types = Package.security_types
    header.length.times do |i|
      header[i] = "<div class='" + style + "'><b>" + security_types[i] + ":</b><br/><table cellspacing='0' width='100%'>"
    end
    
    repos.each do |repo|
        css = cycle("packageList0", "packageList1")
        if is_admin?
          link = (link_to (repo.url + " " + repo.subtype), { :controller => :repositories, :action => :edit,\
            :id => repo.id, :distribution_id => repo.distribution_id })
          sync_link = (link_to (tag "img", { :src => "/images/view-refresh.png", :width => "22", :height => "22",\
            :alt => "Repository synchronisieren", :class => "link_img"}) ,\
            { :controller => :admin, :action => :sync_package, :id => repo.id})
          del_link =  (link_to (tag "img", { :src => "/images/edit-delete.png", :width => "22", :height => "22",\
            :alt => "Repository löschen", :class => "link_img"}) ,\
             "/repositories/destroy/#{repo.id}")
          row = "<tr><td class='" + css + "' valign='middle'>" + sync_link +\
             "</td><td class='" + css + "' valign='middle'>" + link + "</td>" +\
             "<td class='" + css + "' valign='middle'>" + del_link + "</td></tr>"
        else
           row = "<tr><td class='" + css + "'><i>" + repo.url + " " + repo.subtype  + "</i></td></tr>"
        end
        
        header[repo.security_type] += row
    end
    
    return (header.join "</table></div>") + "</table></div>" 
  end
  
  #shows a dist in a div
  #params:
  #dist=dist to show
  #style=div-class
  #with_buttons=should buttons be displayed?
  def dist_show dist, style, with_buttons = true
    out = "<div class='" + style + "'><span class='headline'>" +\
          (if dist.url.nil? then dist.name else (link_to dist.name, dist.url, :target=>'blank') end)+\
          "</span><p>" + dist.description + "</p>"
    
    if with_buttons
     out += (link_to 'Anzeigen/Quellen hinzufügen', dist) + " | " + (link_to 'Bündel anzeigen', distribution_metapackages_path(dist.id)) +\
      " | " + (link_to 'Alle Pakete anzeigen', (distribution_packages_path dist.id))
      
    
      if is_admin?
        out += " | " + (link_to 'Bearbeiten', edit_distribution_path(dist)) + " | " +\
        (link_to 'Löschen', dist, :confirm => 'Bist du sicher?', :method => :delete)
      end
    end
    out + "</div>"
  end
end<commit_msg>removed package buttons for distributions - packages are distribution independent<commit_after>module DistributionsHelper
  
  #shows a repository in a div
  #params:
  #repos=dist to show
  #style=div-class
  def repository_view repos, style
    
    header = Array.new Package.security_types.length
    security_types = Package.security_types
    header.length.times do |i|
      header[i] = "<div class='" + style + "'><b>" + security_types[i] + ":</b><br/><table cellspacing='0' width='100%'>"
    end
    
    repos.each do |repo|
        css = cycle("packageList0", "packageList1")
        if is_admin?
          link = (link_to (repo.url + " " + repo.subtype), { :controller => :repositories, :action => :edit,\
            :id => repo.id, :distribution_id => repo.distribution_id })
          sync_link = (link_to (tag "img", { :src => "/images/view-refresh.png", :width => "22", :height => "22",\
            :alt => "Repository synchronisieren", :class => "link_img"}) ,\
            { :controller => :admin, :action => :sync_package, :id => repo.id})
          del_link =  (link_to (tag "img", { :src => "/images/edit-delete.png", :width => "22", :height => "22",\
            :alt => "Repository löschen", :class => "link_img"}) ,\
             "/repositories/destroy/#{repo.id}")
          row = "<tr><td class='" + css + "' valign='middle'>" + sync_link +\
             "</td><td class='" + css + "' valign='middle'>" + link + "</td>" +\
             "<td class='" + css + "' valign='middle'>" + del_link + "</td></tr>"
        else
           row = "<tr><td class='" + css + "'><i>" + repo.url + " " + repo.subtype  + "</i></td></tr>"
        end
        
        header[repo.security_type] += row
    end
    
    return (header.join "</table></div>") + "</table></div>" 
  end
  
  #shows a dist in a div
  #params:
  #dist=dist to show
  #style=div-class
  #with_buttons=should buttons be displayed?
  def dist_show dist, style, with_buttons = true
    out = "<div class='" + style + "'><span class='headline'>" +\
          (if dist.url.nil? then dist.name else (link_to dist.name, dist.url, :target=>'blank') end)+\
          "</span><p>" + dist.description + "</p>"
    
    if with_buttons
     out += (link_to 'Anzeigen/Quellen hinzufügen', dist)
    
      if is_admin?
        out += " | " + (link_to 'Bearbeiten', edit_distribution_path(dist)) + " | " +\
        (link_to 'Löschen', dist, :confirm => 'Bist du sicher?', :method => :delete)
      end
    end
    out + "</div>"
  end
end
{'fraction_non_alphanumeric': 0.18908382066276802, 'fraction_numerical': 0.005458089668615985, 'mean_word_length': 2.5656706045865185, 'pattern_counts': {'":': 2, '<': 61, '<?xml version=': 0, '>': 101, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6700736', 'n_tokens_mistral': 1721, 'n_tokens_neox': 1680, 'n_words': 409}