This repository has been archived on 2021-09-15. You can view files and clone it, but cannot push or open issues or pull requests.
DUT2Curling/c/CtrlCheckLinks.rb

61 lines
2.2 KiB
Ruby
Raw Normal View History

modified: c/CtrlCheckLinks.rb modified: c/CtrlHistoLink.rb modified: c/Main.rb new file: doc/rdoc/CtrlCheckLinks.html new file: doc/rdoc/CtrlHistoLink.html new file: doc/rdoc/Menu.html new file: doc/rdoc/ReadFile.html new file: doc/rdoc/Vue1.html new file: doc/rdoc/VueHisto.html new file: doc/rdoc/VueMenu.html new file: doc/rdoc/VueResult.html new file: doc/rdoc/c/CtrlCheckLinks_rb.html new file: doc/rdoc/c/CtrlHistoLink_rb.html new file: doc/rdoc/c/Main_rb.html new file: doc/rdoc/c/hello_rb.html new file: doc/rdoc/created.rid new file: doc/rdoc/images/brick.png new file: doc/rdoc/images/brick_link.png new file: doc/rdoc/images/bug.png new file: doc/rdoc/images/bullet_black.png new file: doc/rdoc/images/bullet_toggle_minus.png new file: doc/rdoc/images/bullet_toggle_plus.png new file: doc/rdoc/images/date.png new file: doc/rdoc/images/find.png new file: doc/rdoc/images/loadingAnimation.gif new file: doc/rdoc/images/macFFBgHack.png new file: doc/rdoc/images/package.png new file: doc/rdoc/images/page_green.png new file: doc/rdoc/images/page_white_text.png new file: doc/rdoc/images/page_white_width.png new file: doc/rdoc/images/plugin.png new file: doc/rdoc/images/ruby.png new file: doc/rdoc/images/tag_green.png new file: doc/rdoc/images/wrench.png new file: doc/rdoc/images/wrench_orange.png new file: doc/rdoc/images/zoom.png new file: doc/rdoc/index.html new file: doc/rdoc/m/ReadFile_rb.html new file: doc/rdoc/rdoc.css new file: doc/rdoc/v/Vue1_rb.html new file: doc/rdoc/v/VueHisto_rb.html new file: doc/rdoc/v/VueMenu_rb.html new file: doc/rdoc/v/VueResult_rb.html modified: m/ReadFile.rb modified: v/Vue1.rb modified: v/VueHisto.rb modified: v/VueMenu.rb modified: v/VueResult.rb
2014-01-17 08:20:36 +00:00
# Controleur de la vérification de la validité des liens ainsi que la vue Vue1 et VueResult
class CtrlCheckLinks
modified: c/CtrlCheckLinks.rb modified: c/CtrlHistoLink.rb modified: c/Main.rb new file: doc/rdoc/CtrlCheckLinks.html new file: doc/rdoc/CtrlHistoLink.html new file: doc/rdoc/Menu.html new file: doc/rdoc/ReadFile.html new file: doc/rdoc/Vue1.html new file: doc/rdoc/VueHisto.html new file: doc/rdoc/VueMenu.html new file: doc/rdoc/VueResult.html new file: doc/rdoc/c/CtrlCheckLinks_rb.html new file: doc/rdoc/c/CtrlHistoLink_rb.html new file: doc/rdoc/c/Main_rb.html new file: doc/rdoc/c/hello_rb.html new file: doc/rdoc/created.rid new file: doc/rdoc/images/brick.png new file: doc/rdoc/images/brick_link.png new file: doc/rdoc/images/bug.png new file: doc/rdoc/images/bullet_black.png new file: doc/rdoc/images/bullet_toggle_minus.png new file: doc/rdoc/images/bullet_toggle_plus.png new file: doc/rdoc/images/date.png new file: doc/rdoc/images/find.png new file: doc/rdoc/images/loadingAnimation.gif new file: doc/rdoc/images/macFFBgHack.png new file: doc/rdoc/images/package.png new file: doc/rdoc/images/page_green.png new file: doc/rdoc/images/page_white_text.png new file: doc/rdoc/images/page_white_width.png new file: doc/rdoc/images/plugin.png new file: doc/rdoc/images/ruby.png new file: doc/rdoc/images/tag_green.png new file: doc/rdoc/images/wrench.png new file: doc/rdoc/images/wrench_orange.png new file: doc/rdoc/images/zoom.png new file: doc/rdoc/index.html new file: doc/rdoc/m/ReadFile_rb.html new file: doc/rdoc/rdoc.css new file: doc/rdoc/v/Vue1_rb.html new file: doc/rdoc/v/VueHisto_rb.html new file: doc/rdoc/v/VueMenu_rb.html new file: doc/rdoc/v/VueResult_rb.html modified: m/ReadFile.rb modified: v/Vue1.rb modified: v/VueHisto.rb modified: v/VueMenu.rb modified: v/VueResult.rb
2014-01-17 08:20:36 +00:00
# <b>Controleur de la saisie pour vérification de lien, controleur Vue1</b>
# * int type : permet de modifier la vue si 1 -> fichier sinon dossier
# * string title : titre fenetre de la vue qui va etre genere
# * return : String des urls trouvés
def saisie(type, title)
@v1 = Vue1.new(self, title, type) #creation vue principal
@v1.getWindow.show_all # affichage
Gtk.main
end
modified: c/CtrlCheckLinks.rb modified: c/CtrlHistoLink.rb modified: c/Main.rb new file: doc/rdoc/CtrlCheckLinks.html new file: doc/rdoc/CtrlHistoLink.html new file: doc/rdoc/Menu.html new file: doc/rdoc/ReadFile.html new file: doc/rdoc/Vue1.html new file: doc/rdoc/VueHisto.html new file: doc/rdoc/VueMenu.html new file: doc/rdoc/VueResult.html new file: doc/rdoc/c/CtrlCheckLinks_rb.html new file: doc/rdoc/c/CtrlHistoLink_rb.html new file: doc/rdoc/c/Main_rb.html new file: doc/rdoc/c/hello_rb.html new file: doc/rdoc/created.rid new file: doc/rdoc/images/brick.png new file: doc/rdoc/images/brick_link.png new file: doc/rdoc/images/bug.png new file: doc/rdoc/images/bullet_black.png new file: doc/rdoc/images/bullet_toggle_minus.png new file: doc/rdoc/images/bullet_toggle_plus.png new file: doc/rdoc/images/date.png new file: doc/rdoc/images/find.png new file: doc/rdoc/images/loadingAnimation.gif new file: doc/rdoc/images/macFFBgHack.png new file: doc/rdoc/images/package.png new file: doc/rdoc/images/page_green.png new file: doc/rdoc/images/page_white_text.png new file: doc/rdoc/images/page_white_width.png new file: doc/rdoc/images/plugin.png new file: doc/rdoc/images/ruby.png new file: doc/rdoc/images/tag_green.png new file: doc/rdoc/images/wrench.png new file: doc/rdoc/images/wrench_orange.png new file: doc/rdoc/images/zoom.png new file: doc/rdoc/index.html new file: doc/rdoc/m/ReadFile_rb.html new file: doc/rdoc/rdoc.css new file: doc/rdoc/v/Vue1_rb.html new file: doc/rdoc/v/VueHisto_rb.html new file: doc/rdoc/v/VueMenu_rb.html new file: doc/rdoc/v/VueResult_rb.html modified: m/ReadFile.rb modified: v/Vue1.rb modified: v/VueHisto.rb modified: v/VueMenu.rb modified: v/VueResult.rb
2014-01-17 08:20:36 +00:00
# <b>Controleur de recuperation et verification de liens dans 1 fichiers</b>
# * string str : chemin d'accès au fichier à traiter
def recupUrls(str)
f = ReadFile.new(str)
@urls = f.getUrls
self.vueResult(self.verifLiens(@urls), str)
s = CtrlHistoLink.new #on enregistre dans l'histo le verif du lien
s.sauv(str, @urls)
end
modified: c/CtrlCheckLinks.rb modified: c/CtrlHistoLink.rb modified: c/Main.rb new file: doc/rdoc/CtrlCheckLinks.html new file: doc/rdoc/CtrlHistoLink.html new file: doc/rdoc/Menu.html new file: doc/rdoc/ReadFile.html new file: doc/rdoc/Vue1.html new file: doc/rdoc/VueHisto.html new file: doc/rdoc/VueMenu.html new file: doc/rdoc/VueResult.html new file: doc/rdoc/c/CtrlCheckLinks_rb.html new file: doc/rdoc/c/CtrlHistoLink_rb.html new file: doc/rdoc/c/Main_rb.html new file: doc/rdoc/c/hello_rb.html new file: doc/rdoc/created.rid new file: doc/rdoc/images/brick.png new file: doc/rdoc/images/brick_link.png new file: doc/rdoc/images/bug.png new file: doc/rdoc/images/bullet_black.png new file: doc/rdoc/images/bullet_toggle_minus.png new file: doc/rdoc/images/bullet_toggle_plus.png new file: doc/rdoc/images/date.png new file: doc/rdoc/images/find.png new file: doc/rdoc/images/loadingAnimation.gif new file: doc/rdoc/images/macFFBgHack.png new file: doc/rdoc/images/package.png new file: doc/rdoc/images/page_green.png new file: doc/rdoc/images/page_white_text.png new file: doc/rdoc/images/page_white_width.png new file: doc/rdoc/images/plugin.png new file: doc/rdoc/images/ruby.png new file: doc/rdoc/images/tag_green.png new file: doc/rdoc/images/wrench.png new file: doc/rdoc/images/wrench_orange.png new file: doc/rdoc/images/zoom.png new file: doc/rdoc/index.html new file: doc/rdoc/m/ReadFile_rb.html new file: doc/rdoc/rdoc.css new file: doc/rdoc/v/Vue1_rb.html new file: doc/rdoc/v/VueHisto_rb.html new file: doc/rdoc/v/VueMenu_rb.html new file: doc/rdoc/v/VueResult_rb.html modified: m/ReadFile.rb modified: v/Vue1.rb modified: v/VueHisto.rb modified: v/VueMenu.rb modified: v/VueResult.rb
2014-01-17 08:20:36 +00:00
# <b>Controleur de recuperation et verification de liens dans 1 dossier</b>
# * string str : chemin d'accès au fichier à traiter
def recupUrlsDoss(str)
d = Dir.open(str)
liste_exclus = [".", ".."]
liste_dir = d.sort - liste_exclus
liste_dir.each { |fichier| #pour chaque fichier touvé
if (File.ftype(str + "/" + fichier) == "file")
self.recupUrls(str + "/" + fichier)
end
}
end
modified: c/CtrlCheckLinks.rb modified: c/CtrlHistoLink.rb modified: c/Main.rb new file: doc/rdoc/CtrlCheckLinks.html new file: doc/rdoc/CtrlHistoLink.html new file: doc/rdoc/Menu.html new file: doc/rdoc/ReadFile.html new file: doc/rdoc/Vue1.html new file: doc/rdoc/VueHisto.html new file: doc/rdoc/VueMenu.html new file: doc/rdoc/VueResult.html new file: doc/rdoc/c/CtrlCheckLinks_rb.html new file: doc/rdoc/c/CtrlHistoLink_rb.html new file: doc/rdoc/c/Main_rb.html new file: doc/rdoc/c/hello_rb.html new file: doc/rdoc/created.rid new file: doc/rdoc/images/brick.png new file: doc/rdoc/images/brick_link.png new file: doc/rdoc/images/bug.png new file: doc/rdoc/images/bullet_black.png new file: doc/rdoc/images/bullet_toggle_minus.png new file: doc/rdoc/images/bullet_toggle_plus.png new file: doc/rdoc/images/date.png new file: doc/rdoc/images/find.png new file: doc/rdoc/images/loadingAnimation.gif new file: doc/rdoc/images/macFFBgHack.png new file: doc/rdoc/images/package.png new file: doc/rdoc/images/page_green.png new file: doc/rdoc/images/page_white_text.png new file: doc/rdoc/images/page_white_width.png new file: doc/rdoc/images/plugin.png new file: doc/rdoc/images/ruby.png new file: doc/rdoc/images/tag_green.png new file: doc/rdoc/images/wrench.png new file: doc/rdoc/images/wrench_orange.png new file: doc/rdoc/images/zoom.png new file: doc/rdoc/index.html new file: doc/rdoc/m/ReadFile_rb.html new file: doc/rdoc/rdoc.css new file: doc/rdoc/v/Vue1_rb.html new file: doc/rdoc/v/VueHisto_rb.html new file: doc/rdoc/v/VueMenu_rb.html new file: doc/rdoc/v/VueResult_rb.html modified: m/ReadFile.rb modified: v/Vue1.rb modified: v/VueHisto.rb modified: v/VueMenu.rb modified: v/VueResult.rb
2014-01-17 08:20:36 +00:00
# <b>Controleur permettant de detruire la vue Vue1</b>
def destructionFen
@v1.getWindow.destroy
Gtk.main_quit
end
modified: c/CtrlCheckLinks.rb modified: c/CtrlHistoLink.rb modified: c/Main.rb new file: doc/rdoc/CtrlCheckLinks.html new file: doc/rdoc/CtrlHistoLink.html new file: doc/rdoc/Menu.html new file: doc/rdoc/ReadFile.html new file: doc/rdoc/Vue1.html new file: doc/rdoc/VueHisto.html new file: doc/rdoc/VueMenu.html new file: doc/rdoc/VueResult.html new file: doc/rdoc/c/CtrlCheckLinks_rb.html new file: doc/rdoc/c/CtrlHistoLink_rb.html new file: doc/rdoc/c/Main_rb.html new file: doc/rdoc/c/hello_rb.html new file: doc/rdoc/created.rid new file: doc/rdoc/images/brick.png new file: doc/rdoc/images/brick_link.png new file: doc/rdoc/images/bug.png new file: doc/rdoc/images/bullet_black.png new file: doc/rdoc/images/bullet_toggle_minus.png new file: doc/rdoc/images/bullet_toggle_plus.png new file: doc/rdoc/images/date.png new file: doc/rdoc/images/find.png new file: doc/rdoc/images/loadingAnimation.gif new file: doc/rdoc/images/macFFBgHack.png new file: doc/rdoc/images/package.png new file: doc/rdoc/images/page_green.png new file: doc/rdoc/images/page_white_text.png new file: doc/rdoc/images/page_white_width.png new file: doc/rdoc/images/plugin.png new file: doc/rdoc/images/ruby.png new file: doc/rdoc/images/tag_green.png new file: doc/rdoc/images/wrench.png new file: doc/rdoc/images/wrench_orange.png new file: doc/rdoc/images/zoom.png new file: doc/rdoc/index.html new file: doc/rdoc/m/ReadFile_rb.html new file: doc/rdoc/rdoc.css new file: doc/rdoc/v/Vue1_rb.html new file: doc/rdoc/v/VueHisto_rb.html new file: doc/rdoc/v/VueMenu_rb.html new file: doc/rdoc/v/VueResult_rb.html modified: m/ReadFile.rb modified: v/Vue1.rb modified: v/VueHisto.rb modified: v/VueMenu.rb modified: v/VueResult.rb
2014-01-17 08:20:36 +00:00
# <b>Controleur de verification de liens</b>
# * string[] : tableau des urls à vérifier
# * return : string contenant le resultat des pings
def verifLiens(urls)
resultats = ""
urls.each { |n| # pour chaque urls on realise un ping -> mise des resultats en chaine de caractere
p = Net::Ping::HTTP.new n , 80, 5
if p.ping?
resultats += "#{n} est vivant\n"
else
resultats += "#{n} est mort\n"
end
}
return resultats
end
modified: c/CtrlCheckLinks.rb modified: c/CtrlHistoLink.rb modified: c/Main.rb new file: doc/rdoc/CtrlCheckLinks.html new file: doc/rdoc/CtrlHistoLink.html new file: doc/rdoc/Menu.html new file: doc/rdoc/ReadFile.html new file: doc/rdoc/Vue1.html new file: doc/rdoc/VueHisto.html new file: doc/rdoc/VueMenu.html new file: doc/rdoc/VueResult.html new file: doc/rdoc/c/CtrlCheckLinks_rb.html new file: doc/rdoc/c/CtrlHistoLink_rb.html new file: doc/rdoc/c/Main_rb.html new file: doc/rdoc/c/hello_rb.html new file: doc/rdoc/created.rid new file: doc/rdoc/images/brick.png new file: doc/rdoc/images/brick_link.png new file: doc/rdoc/images/bug.png new file: doc/rdoc/images/bullet_black.png new file: doc/rdoc/images/bullet_toggle_minus.png new file: doc/rdoc/images/bullet_toggle_plus.png new file: doc/rdoc/images/date.png new file: doc/rdoc/images/find.png new file: doc/rdoc/images/loadingAnimation.gif new file: doc/rdoc/images/macFFBgHack.png new file: doc/rdoc/images/package.png new file: doc/rdoc/images/page_green.png new file: doc/rdoc/images/page_white_text.png new file: doc/rdoc/images/page_white_width.png new file: doc/rdoc/images/plugin.png new file: doc/rdoc/images/ruby.png new file: doc/rdoc/images/tag_green.png new file: doc/rdoc/images/wrench.png new file: doc/rdoc/images/wrench_orange.png new file: doc/rdoc/images/zoom.png new file: doc/rdoc/index.html new file: doc/rdoc/m/ReadFile_rb.html new file: doc/rdoc/rdoc.css new file: doc/rdoc/v/Vue1_rb.html new file: doc/rdoc/v/VueHisto_rb.html new file: doc/rdoc/v/VueMenu_rb.html new file: doc/rdoc/v/VueResult_rb.html modified: m/ReadFile.rb modified: v/Vue1.rb modified: v/VueHisto.rb modified: v/VueMenu.rb modified: v/VueResult.rb
2014-01-17 08:20:36 +00:00
# <b>Controleur permettant d'afficher la vue secondaire d'affichage de resultats, controleur VueResult</b>
# * string resultats : contient les resultats à affiché
# * string nom : nom du fichier qui contient les urls traités
def vueResult(resultats, nom)
v = VueResult.new(resultats, nom)
v.getWindow.show_all
Gtk.main
end
end