From b6ca062670b342344df08b53fb216db619ef42bc Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Sun, 7 Aug 2016 16:39:42 +0200 Subject: Import legacy manman source Copied from www.ffgraz.net --- app/controllers/application.rb | 16 +++ app/controllers/export_controller.rb | 38 +++++++ app/controllers/location_controller.rb | 109 +++++++++++++++++++ app/controllers/net_controller.rb | 3 + app/controllers/node_controller.rb | 69 ++++++++++++ app/controllers/person_controller.rb | 177 +++++++++++++++++++++++++++++++ app/helpers/application_helper.rb | 11 ++ app/helpers/export_helper.rb | 2 + app/helpers/location_helper.rb | 3 + app/helpers/net_helper.rb | 2 + app/helpers/node_helper.rb | 2 + app/helpers/person_helper.rb | 2 + app/models/admin.rb | 5 + app/models/ip.rb | 5 + app/models/location.rb | 38 +++++++ app/models/nets.rb | 10 ++ app/models/node.rb | 28 +++++ app/models/password_mailer.rb | 12 +++ app/models/person.rb | 48 +++++++++ app/views/export/all.rxml | 31 ++++++ app/views/layouts/ip.rhtml | 13 +++ app/views/layouts/location.rhtml | 13 +++ app/views/layouts/nettype.rhtml | 13 +++ app/views/layouts/node.rhtml | 13 +++ app/views/layouts/person.rhtml | 13 +++ app/views/layouts/wlparm.rhtml | 13 +++ app/views/location/_form.rhtml | 34 ++++++ app/views/location/_plist.rhtml | 19 ++++ app/views/location/_pshow.rhtml | 29 +++++ app/views/location/edit.rhtml | 40 +++++++ app/views/location/list.rhtml | 4 + app/views/location/new.rhtml | 25 +++++ app/views/location/show.rhtml | 21 ++++ app/views/net/_plist.rhtml | 16 +++ app/views/node/_plist.rhtml | 17 +++ app/views/node/_pshow.rhtml | 54 ++++++++++ app/views/node/edit.rhtml | 34 ++++++ app/views/node/edit.rhtml.bak | 25 +++++ app/views/node/list.rhtml | 2 + app/views/node/new.rhtml | 44 ++++++++ app/views/password_mailer/password.rhtml | 14 +++ app/views/person/_form.rhtml | 25 +++++ app/views/person/_nav.rhtml | 11 ++ app/views/person/_pshow.rhtml | 20 ++++ app/views/person/change_pass.rhtml | 22 ++++ app/views/person/edit.rhtml | 26 +++++ app/views/person/list.rhtml | 20 ++++ app/views/person/login.rhtml | 19 ++++ app/views/person/new.rhtml | 8 ++ app/views/person/register.rhtml | 35 ++++++ app/views/person/revoke_pass.rhtml | 15 +++ app/views/person/show.rhtml | 8 ++ 52 files changed, 1276 insertions(+) create mode 100644 app/controllers/application.rb create mode 100644 app/controllers/export_controller.rb create mode 100644 app/controllers/location_controller.rb create mode 100644 app/controllers/net_controller.rb create mode 100644 app/controllers/node_controller.rb create mode 100644 app/controllers/person_controller.rb create mode 100644 app/helpers/application_helper.rb create mode 100644 app/helpers/export_helper.rb create mode 100644 app/helpers/location_helper.rb create mode 100644 app/helpers/net_helper.rb create mode 100644 app/helpers/node_helper.rb create mode 100644 app/helpers/person_helper.rb create mode 100644 app/models/admin.rb create mode 100644 app/models/ip.rb create mode 100644 app/models/location.rb create mode 100644 app/models/nets.rb create mode 100644 app/models/node.rb create mode 100644 app/models/password_mailer.rb create mode 100644 app/models/person.rb create mode 100644 app/views/export/all.rxml create mode 100644 app/views/layouts/ip.rhtml create mode 100644 app/views/layouts/location.rhtml create mode 100644 app/views/layouts/nettype.rhtml create mode 100644 app/views/layouts/node.rhtml create mode 100644 app/views/layouts/person.rhtml create mode 100644 app/views/layouts/wlparm.rhtml create mode 100644 app/views/location/_form.rhtml create mode 100644 app/views/location/_plist.rhtml create mode 100644 app/views/location/_pshow.rhtml create mode 100644 app/views/location/edit.rhtml create mode 100644 app/views/location/list.rhtml create mode 100644 app/views/location/new.rhtml create mode 100644 app/views/location/show.rhtml create mode 100644 app/views/net/_plist.rhtml create mode 100644 app/views/node/_plist.rhtml create mode 100644 app/views/node/_pshow.rhtml create mode 100644 app/views/node/edit.rhtml create mode 100644 app/views/node/edit.rhtml.bak create mode 100644 app/views/node/list.rhtml create mode 100644 app/views/node/new.rhtml create mode 100644 app/views/password_mailer/password.rhtml create mode 100644 app/views/person/_form.rhtml create mode 100644 app/views/person/_nav.rhtml create mode 100644 app/views/person/_pshow.rhtml create mode 100644 app/views/person/change_pass.rhtml create mode 100644 app/views/person/edit.rhtml create mode 100644 app/views/person/list.rhtml create mode 100644 app/views/person/login.rhtml create mode 100644 app/views/person/new.rhtml create mode 100644 app/views/person/register.rhtml create mode 100644 app/views/person/revoke_pass.rhtml create mode 100644 app/views/person/show.rhtml (limited to 'app') diff --git a/app/controllers/application.rb b/app/controllers/application.rb new file mode 100644 index 0000000..30f98da --- /dev/null +++ b/app/controllers/application.rb @@ -0,0 +1,16 @@ +# Filters added to this controller will be run for all controllers in the application. +# Likewise, all the methods added will be available for all controllers. +class ApplicationController < ActionController::Base + before_filter :authenticate, :except => [ :login, :sign_on, :register, :create, :revoke_pass, :do_revoke, :smokeping, :all ] + + +protected + def authenticate + #session[:url] = url_for + session[:url] = request.env["REQUEST_URI"] + unless session[:person] + redirect_to :controller => 'person', + :action => 'login' + end + end +end diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb new file mode 100644 index 0000000..5d2ef85 --- /dev/null +++ b/app/controllers/export_controller.rb @@ -0,0 +1,38 @@ +class ExportController < ApplicationController + def smokeping + @locations = Location.find(:all, :order => "name") + if @locations != nil + text = "" + @locations.each do |location| + @nodes = Node.find(:all, :conditions => { :location_id => location.id, :smokeping => true } ) + if @nodes != nil and not @nodes.empty? + text += "++ #{location.name}\n" + text += "menu = #{location.name}\n" + text += "title = #{location.name} connectivity\n" + @nodes.each do |node| + text += "+++ #{node.name}\n" + text += "menu = #{node.name}\n" + text += "title = #{node.name} connectivity\n" + # prefer interfaces named wifi, even if they are not the first in the list + ip = Ip.find(:first, :conditions => ["node_id = ? AND name like ?", node.id, 'wifi%']) + if ip != nil + text += "host = #{ip.ip}\n" + else + # no 'wifi' interface found, use any old interface... + ip = Ip.find(:first, :conditions => ["node_id = ?", node.id]) + if ip != nil + text += "host = #{ip.ip}\n" + end + end + end + end + end + render_text text + end + end + + def all + @locations = Location.find(:all, :order => "name") + render :layout => false + end +end diff --git a/app/controllers/location_controller.rb b/app/controllers/location_controller.rb new file mode 100644 index 0000000..0d2a64c --- /dev/null +++ b/app/controllers/location_controller.rb @@ -0,0 +1,109 @@ +class LocationController < ApplicationController +# model :person, :location + + def index + redirect_to :action => "list" + end + + def list + @person = @params[:person] + if @person != nil + @locations = Location.find(:all, + :conditions => ["person_id = ?", Person.find(:first, + :conditions => { :email => @person }).id], + :order => "name" ) + else + @locations = Location.find(:all, :order => 'name' ) + end + end + + + def edit + @location = Location.find(params[:id]) + @persons = Person.find(:all) + if ( session[:person] != @location.person ) and ( session[:person].email != 'nine@wirdorange.org' ) + flash[:notice] = 'Sie haben nicht die Berechtigung hierfür.' + redirect_to :back + end + end + + def update + @location = Location.find(params[:id]) + values = params[:location] + values[:time] = DateTime.now + if @location.update_attributes(params[:location]) + flash[:notice] = 'Location wurde erfolgreich upgedatet.' + redirect_to :action => 'show', :id => @location + else + flash[:notice] = 'Keine Änderung möglich.' + redirect_to :action => 'edit', :id => @location + end + end + + def destroy + render_text 'aktion nicht verfügbar' + end + + # show inforomation of location + # parameters: + # id = location_id + def show + begin + + @location = Location.find(params[:id]) + @person = @location.person + @nodes = Node.find(:all, :conditions => ["location_id=?", params[:id]] ) + @nets = Nets.find(:all, :conditions => ["location_id=?", params[:id]] ) + @googlemap = 'https://karte.graz.funkfeuer.at/?' + @googlemap += "lng=#{@location.lon}" + @googlemap += "&lat=#{@location.lat}" + @googlemap += "&res=17" + @googlemap += "&marker=all" + + rescue ActiveRecord::RecordNotFound + flash[:notice] = "Error, Location with ID #{params[:id]} not found!" + redirect_to :action => 'list' + end + end + + # display 'new location' form + def new + begin + if params[:c] == nil or params[:r] == nil or params[:z_x] == nil or params[:z_y] == nil + @location = Location.new(:pixel_x => params[:x], :pixel_y => params[:y] ) + else + x = params[:c].to_i * 100 + params[:z_x].to_i; + if x < 0 + x += 100; + end + @location = Location.new(:pixel_x => x , + :pixel_y => params[:r].to_i * 100 + params[:z_y].to_i ) + end + end + end + + + # create new location + def create + begin + values = params[:location] + values[:time] = DateTime.now + values[:creator_ip] = @request.env["REMOTE_ADDR"] + + + values[:person_id] = session[:person].id + + @location = Location.new(values) + if @location.save + flash[:notice] = 'Location gespeichert' + redirect_to :action => 'show', :id => @location + else + flash[:notice] = 'Location nicht gespeichert, bitte ueberpruefen Sie Ihre Eingabe' + redirect_to :back + end + end + end +end + + + diff --git a/app/controllers/net_controller.rb b/app/controllers/net_controller.rb new file mode 100644 index 0000000..a65e7c1 --- /dev/null +++ b/app/controllers/net_controller.rb @@ -0,0 +1,3 @@ +class NetController < ApplicationController + model :person +end diff --git a/app/controllers/node_controller.rb b/app/controllers/node_controller.rb new file mode 100644 index 0000000..6f827e3 --- /dev/null +++ b/app/controllers/node_controller.rb @@ -0,0 +1,69 @@ +class NodeController < ApplicationController + model :person + + def index + redirect_to :action => "list" + end + + def list + @location = @params[:location] + if @location != nil + @nodes = Node.find(:all, + :conditions => ["location_id = ?", Location.find_by_name(@params[:location]).id], + :order => 'location_id') + else + @nodes = Node.find(:all, :order => 'location_id') + end + end + + def destroy + end + + def edit + @persons = Person.find(:all) + @node = Node.find(params[:id]) + end + + def update + @node = Node.find(params[:id]) + values = params[:node] + if ( session[:person] != @node.location.person ) and ( session[:person].email != 'nine@wirdorange.org' ) + flash[:notice] = 'Sie sind nicht berechtigt.' + redirect_to :back + else if @node.update_attributes(params[:node]) + flash[:notice] = 'Node erfolgreich geaendert' + redirect_to :action => 'show', :controller => 'location', :id => @node.location + else + flash[:notice] = 'Änderung fehlgeschlagen' + redirect_to :action => 'show', :controller => 'location', :id => @node.location + end + end + end + + def new + @persons = Person.find(:all) + @location = Location.find(params[:location]) + @node = Node.new( :location_id => @location.id ) + end + + def do_new + node_values = params[:node] + node_values[:time] = DateTime.now + node_values[:creator_ip] = @request.env["REMOTE_ADDR"] + +# Nets.find(:first, :conditions => + + location = Location.find(node_values[:location_id]) + if ( session[:person] != location.person ) and ( session[:person].email != 'nine@wirdorange.org' ) + flash[:notice] = 'Sie sind nicht berechtigt.' + redirect_to :action => 'show', :controller => 'person', :id => session[:person].id + elsif Node.create_node(node_values) + flash[:notice] = 'Node erfolgreich erzeugt' + redirect_to :action => "show", :controller => "location", :id => node_values[:location_id] + else + flash[:notice] = 'error' + render_text 'error' + end + end +end + diff --git a/app/controllers/person_controller.rb b/app/controllers/person_controller.rb new file mode 100644 index 0000000..43cecb9 --- /dev/null +++ b/app/controllers/person_controller.rb @@ -0,0 +1,177 @@ + + +class PersonController < ApplicationController +# model :location, :person + +# before_filter :validate_person, :only => [:edit, :update, :do_change_pass] + + @person = '' + + def login + if session[:person] + reset_session + end + end + + def sign_on + person = Person.authenticate( params[:person][:email], + params[:person][:password]) + + if person + session[:person] = person + if session[:url] + redirect_to session[:url] + else + redirect_to :controller => "person", :action => "show", :id => session[:person].id + end + session[:url] = nil + else + flash[:notice] = "Login fehlgeschlagen." + redirect_to :action => "login" + end + end + + def logout + reset_session + redirect_to :action => "login" + end + def login + end + + def index + redirect_to :action => "list" + end + + # list all persons + def list + @persons = Person.find(:all, :order => :email ) + end + + # show information about a person + def show + begin + @person = Person.find(params[:id]) + + @locations = Location.find(:all, + :conditions => ["person_id = ?", params[:id]] ) + + rescue ActiveRecord::RecordNotFound + render_text "Error, Person not found" + end + end + + # edit a specific person identified by param person id + def edit + @person = Person.find(params[:id]) + if session[:person] != @person and session[:person].email != 'nine@wirdorange.org' + flash[:notice] = 'Sie haben nicht die Berechtigung hierfür.' + redirect_to :back + end + end + + # update the information about a person identified by person id + def update + @person = Person.find(params[:id]) + if session[:person] != @person and session[:person].email != 'nine@wirdorange.org' + flash[:notice] = 'Sie haben nicht die Berechtigung hierfür.' + redirect_to :back + else + if @person.update_attributes(params[:person]) + flash[:notice] = 'Person wurde erfolgreich upgedatet.' + redirect_to :action => 'show', :id => @person + else + flash[:notice] = 'Person wurde NICHT verändert.' + redirect_to :action => 'edit', :id => @person + end + end + end + + def register + end + + # create new person record + def create + if params[:password] == params[:password2] + values = params[:person] + values[:password] = params[:password] + @person = Person.new(values) + @person.password = params[:person][:password] + if @person.save + flash[:notice] = 'Person erfolgreich registriert' + redirect_to :action => 'show', :id => @person + else + params[:person][:password2] = ""; + params[:person][:password] = ""; + render :action => 'register', :person => params[:person] + end + else + flash[:notice] = 'Bitte überprüfen Sie ihre Eingabe' + render :action => 'register', :person => params[:person] + end + end + + # revoke password form + def revoke_pass + reset_session + end + + # generate new password and mail to the poor guy + def do_revoke + password = newpass( 8 ) + @person = Person.find( :first, + :conditions => [ "email = ?", params[:person][:email] ] ) + if @person == nil + flash[:notice] = 'Die angegebene Email Adresse ist nicht registriert.' + redirect_to :action => 'revoke_pass' + elsif @person.update_attribute( 'password', password ) + mail = PasswordMailer.deliver_password( @person, password ) + flash[:notice] = 'Ihr neues Passwort wird Ihnen via email zugesendet.' + redirect_to :action => 'login' + else + render :action => 'revoke_pass' + end + end + + def change_pass + @person = Person.find(params[:id]) + if session[:person] != @person + flash[:notice] = 'Sie haben nicht die Berechtigung hierfür.' + redirect_to :back + end + end + + def do_change_pass + person = Person.find( :first, :conditions => + [ "email = BINARY ? AND password = BINARY ?", + session[:person][:email], + Digest::MD5.hexdigest(params[:oldpassword]) ] ) + if person and params[:password] == params[:password2] + person.update_attribute( 'password', params[:password] ) + flash[:notice] = 'Ihr Passwort wurde geaendert.' + redirect_to :action => 'show', :id => session[:person][:id] + else + flash[:notice] = 'Ihr altes Passwort wurde falsch eingegeben.' + redirect_to :back + end + end + + +protected + # validate rights of person + def validate_person + if session[:person] != @person + flash[:notice] = 'Sie sind leider nicht berechtigt!' + redirect_to :back + end + end + +private + # generate alphanumeric password + def newpass( len ) + chars = ("a".."z").to_a + ("A".."Z").to_a + ("1".."9").to_a + newpass = "" + 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] } + return newpass + end + +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 0000000..ebf937a --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,11 @@ +# Methods added to this helper will be available to all templates in the application. +module ApplicationHelper + def ifnil(value=nil) + yield + rescue NoMethodError + raise unless $!.message =~ /:NilClass$/ + value + end + + +end diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb new file mode 100644 index 0000000..34acf5f --- /dev/null +++ b/app/helpers/export_helper.rb @@ -0,0 +1,2 @@ +module ExportHelper +end diff --git a/app/helpers/location_helper.rb b/app/helpers/location_helper.rb new file mode 100644 index 0000000..16aee7c --- /dev/null +++ b/app/helpers/location_helper.rb @@ -0,0 +1,3 @@ +module LocationHelper + +end diff --git a/app/helpers/net_helper.rb b/app/helpers/net_helper.rb new file mode 100644 index 0000000..908cd46 --- /dev/null +++ b/app/helpers/net_helper.rb @@ -0,0 +1,2 @@ +module NetHelper +end diff --git a/app/helpers/node_helper.rb b/app/helpers/node_helper.rb new file mode 100644 index 0000000..ff049b0 --- /dev/null +++ b/app/helpers/node_helper.rb @@ -0,0 +1,2 @@ +module NodeHelper +end diff --git a/app/helpers/person_helper.rb b/app/helpers/person_helper.rb new file mode 100644 index 0000000..f5c74cd --- /dev/null +++ b/app/helpers/person_helper.rb @@ -0,0 +1,2 @@ +module PersonHelper +end diff --git a/app/models/admin.rb b/app/models/admin.rb new file mode 100644 index 0000000..7cd133e --- /dev/null +++ b/app/models/admin.rb @@ -0,0 +1,5 @@ +class Admin < ActiveRecord::Base + set_table_name "admin" + has_many :person + +end diff --git a/app/models/ip.rb b/app/models/ip.rb new file mode 100644 index 0000000..c647078 --- /dev/null +++ b/app/models/ip.rb @@ -0,0 +1,5 @@ +class Ip < ActiveRecord::Base + set_table_name "ip" + belongs_to :node, :foreign_key => "node_id" + belongs_to :nets, :foreign_key => 'net_id' +end diff --git a/app/models/location.rb b/app/models/location.rb new file mode 100644 index 0000000..5171e5d --- /dev/null +++ b/app/models/location.rb @@ -0,0 +1,38 @@ +class Location < ActiveRecord::Base + set_table_name "location" + belongs_to :person + belongs_to :town + belongs_to :nets + has_many :node + + validates_presence_of :name, :person_id + validates_uniqueness_of :name + + validates_format_of :name, + :with => /^([0-9a-z]*)$/, + :on => :create + validates_format_of :name, + :with => /^([0-9a-z]*)$/, + :on => :save + + @@x_zero = 4080 + @@lon_zero = 15.43844103813 + @@dx_dlon = 50675.5176 + @@y_zero = 4806 + @@lat_zero = 47.07177327969 + @@dy_dlat = 75505.521 + + def lon + @@lon_zero + (self.pixel_x.to_f - @@x_zero) / @@dx_dlon + end + + def lat + @@lat_zero + (@@y_zero - self.pixel_y.to_f) / @@dy_dlat + end + + def comment + # nl2br + read_attribute(:comment).gsub("\n\r","
").gsub("\r", "").gsub("\n", "
") + end + +end diff --git a/app/models/nets.rb b/app/models/nets.rb new file mode 100644 index 0000000..59f43c6 --- /dev/null +++ b/app/models/nets.rb @@ -0,0 +1,10 @@ +class Nets < ActiveRecord::Base + set_table_name "net" + belongs_to :location + belongs_to :nettype + has_many :ip + + validates_presence_of :netip, :netmask + #validates_uniqueness_of :netip + +end diff --git a/app/models/node.rb b/app/models/node.rb new file mode 100644 index 0000000..d57b6b9 --- /dev/null +++ b/app/models/node.rb @@ -0,0 +1,28 @@ +require "mysql" + +class Node < ActiveRecord::Base + set_table_name "node" + belongs_to :location + belongs_to :person + has_many :ip + + validates_presence_of :name, :location_id + validates_uniqueness_of :name, :scope => 'location_id' + + validates_format_of :name, + :with => /^([0-9a-z]*)$/, + :on => :create + validates_format_of :name, + :with => /^([0-9a-z]*)$/, + :on => :save + + + def comment + # nl2br + read_attribute(:comment).gsub("\n\r","
").gsub("\r", "").gsub("\n", "
") + end + + def self.create_node(params) + Node.create(params) + end +end diff --git a/app/models/password_mailer.rb b/app/models/password_mailer.rb new file mode 100644 index 0000000..bf2fe82 --- /dev/null +++ b/app/models/password_mailer.rb @@ -0,0 +1,12 @@ +class PasswordMailer < ActionMailer::Base + + def password(person, password, sent_at = Time.now) + @subject = 'New Password' + @body = { :person => person, :password => password } + @recipients = person.email + @from = 'noreply@graz.funkfeuer.at' + @sent_on = sent_at + @headers = {} + end + +end diff --git a/app/models/person.rb b/app/models/person.rb new file mode 100644 index 0000000..26fa61f --- /dev/null +++ b/app/models/person.rb @@ -0,0 +1,48 @@ +require "digest/md5" + +class Person < ActiveRecord::Base + set_table_name "person" + belongs_to :admin + has_many :location + + attr_protected :password + + validates_presence_of :email, :password, :firstname, :lastname + validates_uniqueness_of :email + + validates_format_of :email, + :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i , + :on => :create + + + # operator overloading for updating passwords + def password=(str) + write_attribute(:password, Digest::MD5.hexdigest(str)) + end + + + def self.authenticate(user_name, password) + return Person.find( :first, :conditions => + ["email = BINARY ? AND password = BINARY ?", + user_name, + Digest::MD5.hexdigest(password)] ) + end + + def self.revoke_pass(email) + password = newpass( 8 ) + person = Person.find( :first, + :conditions => [ "email = ?", email] ) + # + + end + +private + # generate alphanumeric password + def newpass( len ) + chars = ("a".."z").to_a + ("A".."Z").to_a + ("1".."9").to_a + newpass = "" + 1.upto(len) { |i| newpass << chars[rand(chars.size-1)] } + return newpass + end + +end diff --git a/app/views/export/all.rxml b/app/views/export/all.rxml new file mode 100644 index 0000000..d1aa10e --- /dev/null +++ b/app/views/export/all.rxml @@ -0,0 +1,31 @@ +xml.instruct! :xml, :version=>"1.0" + +xml.network{ + for location in @locations + xml.location do + xml.name(location.name) + xml.street(location.street) + xml.streetnr(location.streetnr) + xml.comment(location.comment) + xml.gallery(location.gallery_link) + xml.lat(location.lat) + xml.lon(location.lon) + + for node in location.node + xml.node do + xml.name(node.name) + xml.comment(node.comment) + + for ip in node.ip + xml.ip do + xml.name(ip.name) + xml.address(ip.ip) + xml.dns("#{ip.name}.#{node.name}.#{location.name}") + end + end + + end + end + end + end +} diff --git a/app/views/layouts/ip.rhtml b/app/views/layouts/ip.rhtml new file mode 100644 index 0000000..ad4cb1b --- /dev/null +++ b/app/views/layouts/ip.rhtml @@ -0,0 +1,13 @@ + + + Ip: <%= controller.action_name %> + <%= stylesheet_link_tag 'scaffold' %> + + + +

<%= flash[:notice] %>

+ +<%= @content_for_layout %> + + + diff --git a/app/views/layouts/location.rhtml b/app/views/layouts/location.rhtml new file mode 100644 index 0000000..a3fb66d --- /dev/null +++ b/app/views/layouts/location.rhtml @@ -0,0 +1,13 @@ + + + Location: <%= controller.action_name %> + <%= stylesheet_link_tag 'scaffold' %> + + + +

<%= flash[:notice] %>

+ +<%= yield %> + + + diff --git a/app/views/layouts/nettype.rhtml b/app/views/layouts/nettype.rhtml new file mode 100644 index 0000000..46e2cf5 --- /dev/null +++ b/app/views/layouts/nettype.rhtml @@ -0,0 +1,13 @@ + + + Nettype: <%= controller.action_name %> + <%= stylesheet_link_tag 'scaffold' %> + + + +

<%= flash[:notice] %>

+ +<%= @content_for_layout %> + + + diff --git a/app/views/layouts/node.rhtml b/app/views/layouts/node.rhtml new file mode 100644 index 0000000..1a9af20 --- /dev/null +++ b/app/views/layouts/node.rhtml @@ -0,0 +1,13 @@ + + + Node: <%= controller.action_name %> + <%= stylesheet_link_tag 'scaffold' %> + + + +

<%= flash[:notice] %>

+ +<%= @content_for_layout %> + + + diff --git a/app/views/layouts/person.rhtml b/app/views/layouts/person.rhtml new file mode 100644 index 0000000..0e7102e --- /dev/null +++ b/app/views/layouts/person.rhtml @@ -0,0 +1,13 @@ + + + Person: <%= controller.action_name %> + <%= stylesheet_link_tag 'scaffold' %> + + + +

<%= flash[:notice] %>

+ +<%= yield %> + + + diff --git a/app/views/layouts/wlparm.rhtml b/app/views/layouts/wlparm.rhtml new file mode 100644 index 0000000..9dfd37a --- /dev/null +++ b/app/views/layouts/wlparm.rhtml @@ -0,0 +1,13 @@ + + + Wlparm: <%= controller.action_name %> + <%= stylesheet_link_tag 'scaffold' %> + + + +

<%= flash[:notice] %>

+ +<%= @content_for_layout %> + + + diff --git a/app/views/location/_form.rhtml b/app/views/location/_form.rhtml new file mode 100644 index 0000000..c391f62 --- /dev/null +++ b/app/views/location/_form.rhtml @@ -0,0 +1,34 @@ +<%= error_messages_for 'location' %> + + +


+<%= text_field 'location', 'pixel_x' %>

+ +


+<%= text_field 'location', 'pixel_y' %>

+ +


+<%= text_field 'location', 'gps_lon' %>

+ +


+<%= text_field 'location', 'gps_lat' %>

+ +


+<%= text_field 'location', 'name' %>

+ +


+<%= text_field 'location', 'street' %>

+ +


+<%= text_field 'location', 'number' %>

+ +


+<%= text_field 'location', 'creator_ip' %>

+ +


+<%= datetime_select 'location', 'time' %>

+ +


+<%= text_field 'location', 'comment' %>

+ + diff --git a/app/views/location/_plist.rhtml b/app/views/location/_plist.rhtml new file mode 100644 index 0000000..be4d644 --- /dev/null +++ b/app/views/location/_plist.rhtml @@ -0,0 +1,19 @@ + + + + + + +<% @locations.each do |location| %> + + + + + + + + + +<% end %> +
NameStrasseHausnr.Kommentar
<%= location.name %><%= location.street %><%= location.streetnr %><%= location.comment %><%= link_to 'Show', :action => 'show', :controller => 'location', :id => location %><%= link_to 'Edit', :action => 'edit', :controller => 'location', :id => location %><%= link_to 'Destroy', { :action => 'destroy', :controller => 'location', :id => location }, :confirm => 'Are you sure?', :post => true %>
+ diff --git a/app/views/location/_pshow.rhtml b/app/views/location/_pshow.rhtml new file mode 100644 index 0000000..b1b042a --- /dev/null +++ b/app/views/location/_pshow.rhtml @@ -0,0 +1,29 @@ + +<% if @location != nil %> + + + + + + + + + + + + + + + + + + + +
Name:<%= @location.name %>
Strasse:<%= @location.street %>
Hausnr.:<%= @location.streetnr %>
Kommentar:<%= @location.comment %>
changed:<%= @location.time %>
Links: + <%= link_to('Smokeping','http://stats.ffgraz.net/smokeping/index.cgi?target=Funkfeuer.' + @location.name) %>
+ <% if @location.gallery_link != nil %> + <%= link_to 'Gallery', @location.gallery_link %>
+ <% end %> + <%= link_to 'google maps', @googlemap %>
+

<%= link_to 'Edit', { :action => 'edit', :id => @location.id } %> +<% end %> diff --git a/app/views/location/edit.rhtml b/app/views/location/edit.rhtml new file mode 100644 index 0000000..20796b7 --- /dev/null +++ b/app/views/location/edit.rhtml @@ -0,0 +1,40 @@ +<%= render :partial => "person/nav" %> + +

Location

+<%= form_tag :action => 'update', :id => @location %> + + + + + + + + + + + + + + + + + + + +
Name<%= text_field 'location', 'name' %>
Strasse<%= text_field 'location', 'street' %>
Hausnummer<%= text_field 'location', 'streetnr' %>
Kommentar<%= text_field 'location', 'comment' %>
Administrator + +
Gallery<%= text_field 'location', 'gallery_link' %>
+ <%= submit_tag 'Edit' %> +<%= end_form_tag %> + +<%= link_to 'Show', :action => 'show', :id => @location %> | +<%= link_to 'Back', :action => 'list' %> + diff --git a/app/views/location/list.rhtml b/app/views/location/list.rhtml new file mode 100644 index 0000000..1307dfa --- /dev/null +++ b/app/views/location/list.rhtml @@ -0,0 +1,4 @@ +<%= render :partial => "person/nav" %> +

Locations

+<%= render :partial => "plist", :object => @locations %> + diff --git a/app/views/location/new.rhtml b/app/views/location/new.rhtml new file mode 100644 index 0000000..60b5d2a --- /dev/null +++ b/app/views/location/new.rhtml @@ -0,0 +1,25 @@ +<%= render :partial => "person/nav" %> + +

New Location

+ +<%= start_form_tag :action => 'create', :id => @location %> + + + + + + + + + + + + <%= hidden_field 'location', 'pixel_x' %> + <%= hidden_field 'location', 'pixel_y' %> + +
Name<%= text_field 'location', 'name' %>*
Strasse<%= text_field 'location', 'street' %>
Hausnr.<%= text_field 'location', 'streetnr' %>
Kommentar<%= text_area 'location', 'comment' %>
+ <%= submit_tag 'Create' %> +<%= end_form_tag %> + +

Bitte Felder mit * eintragen

+

Unter Name bitte nur Kleinbuchstaben und Ziffern ohne Leerzeichen eintragen

diff --git a/app/views/location/show.rhtml b/app/views/location/show.rhtml new file mode 100644 index 0000000..2666ff0 --- /dev/null +++ b/app/views/location/show.rhtml @@ -0,0 +1,21 @@ +<%= render :partial => "person/nav" %> + +

Location

+<%= render :partial => "location/pshow", :object => { @location, @mappe } %> + +
+

Nodes

+<%= render :partial => "node/pshow", :object => @nodes %> +<%= link_to 'New Node', :controller => 'node', :action => 'new', :location => @location.id %> + +
+

IP Netze

+<%= render :partial => "net/plist", :object => @nets %> + +
+

Administrator

+<% if @person != nil %> + <%= render :partial => "person/pshow", :object => @person %> +<% end %> +
+edit location in DBMS diff --git a/app/views/net/_plist.rhtml b/app/views/net/_plist.rhtml new file mode 100644 index 0000000..11bb8f4 --- /dev/null +++ b/app/views/net/_plist.rhtml @@ -0,0 +1,16 @@ + + + + + + + + <% @nets.each do |net| %> + + + + + + <% end %> +
Netz IPNetmaskKommentar
<%= net.netip %><%= net.netmask %><%= net.comment %>
+

diff --git a/app/views/node/_plist.rhtml b/app/views/node/_plist.rhtml new file mode 100644 index 0000000..c329d4c --- /dev/null +++ b/app/views/node/_plist.rhtml @@ -0,0 +1,17 @@ + + + + + +<% @nodes.each do |node| %> + + + + + + + + +<% end %> +
NameLocationKommentar
<%= node.name %><%= node.location.name %><%= node.comment %><%= link_to 'Show', :action => 'show', :controller => 'node', :id => node %><%= link_to 'Edit', :action => 'edit', :controller => 'node', :id => node %><%= link_to 'Destroy', { :action => 'destroy', :controller => 'node', :id => node }, :confirm => 'Are you sure?', :post => true %>
+ diff --git a/app/views/node/_pshow.rhtml b/app/views/node/_pshow.rhtml new file mode 100644 index 0000000..df7b132 --- /dev/null +++ b/app/views/node/_pshow.rhtml @@ -0,0 +1,54 @@ + +<% @nodes.each do |node| %> + + + + + + + + + + + <% if node.person %> + + + <% end %> + + + + + + + <% node.ip.each do |ip| %> + + + + <% if ip.nets != nil %> + <% if ip.nets.netmask != '255.255.255.255' %> + + <% else %> + + <% end %> + <% else %> + + <% end %> + + + <% end %> + + + + <% if node.smokeping %> + + <% else %> + + <% end %> + +
Name<%= node.name %>
Kommentar<%= node.comment %>
Administrator<%= node.person.email %>
InterfacesNameIPNetmaskLink
<%= ip.name %><%= link_to ip.ip, "http://#{ip.ip}" %><%= ip.nets.netmask %><%= '255.255.0.0' %><%= ip.net_id %><%= link_to "intern", "http://#{ip.name}.#{node.name}.#{node.location.name}.graz.funkfeuer.at" %> | <%= link_to "extern", "http://#{ip.name}.#{node.name}.#{node.location.name}.ext.graz.funkfeuer.at" %>
Smokepingenableddisabled
+

+ <%= link_to 'Edit', { :controller =>'node', :action => 'edit' , :id => node.id } %> | + <%= link_to 'Destroy', { :controller => 'node', :action => 'destroy', :id => node.id } %> +

+

+<% end %> diff --git a/app/views/node/edit.rhtml b/app/views/node/edit.rhtml new file mode 100644 index 0000000..3686853 --- /dev/null +++ b/app/views/node/edit.rhtml @@ -0,0 +1,34 @@ +<%= render :partial => "person/nav" %> + +

Node

+<%= start_form_tag :action => 'update', :id => @node %> + + + + + + + + + + + + + + + +
Name<%= text_field 'node', 'name' %>
Kommentar<%= text_area('node', 'comment', :cols => 40, :rows => 5) %>
Administrator + +
Smokeping<%= check_box "node", "smokeping" %>
+ <%= submit_tag 'Edit' %> +<%= end_form_tag %> +
+<%= link_to 'Back', { :controller => 'location', :action => 'show', :id => @node.location.id } %> diff --git a/app/views/node/edit.rhtml.bak b/app/views/node/edit.rhtml.bak new file mode 100644 index 0000000..c14bd94 --- /dev/null +++ b/app/views/node/edit.rhtml.bak @@ -0,0 +1,25 @@ +

Node

+<%= start_form_tag :action => 'update', :id => @node %> + + + + + + + + + + +
Name<%= text_field 'node', 'name' %>
Kommentar<%= text_field 'location', 'comment' %>
Administrator + +
+ <%= submit_tag 'Edit' %> +<%= end_form_tag %> diff --git a/app/views/node/list.rhtml b/app/views/node/list.rhtml new file mode 100644 index 0000000..a6f4ed4 --- /dev/null +++ b/app/views/node/list.rhtml @@ -0,0 +1,2 @@ +

Nodes

+<%= render :partial => "plist", :object => @nodes %> diff --git a/app/views/node/new.rhtml b/app/views/node/new.rhtml new file mode 100644 index 0000000..a1585fc --- /dev/null +++ b/app/views/node/new.rhtml @@ -0,0 +1,44 @@ +<%= render :partial => "person/nav" %> + +

Neuer Router

+ +<%= start_form_tag :action => 'do_new' %> + + + + + + + + + + + + + + + + + + + +
Location: + <%= @node.location.name %> +
Name:<%= text_field 'node', 'name' %>
Kommentar:<%= text_area 'node', 'comment', 'rows' => 4 %>
Administrator + +
Smokeping<%= check_box "node", "smokeping" %>
+ <%= hidden_field 'node', 'location_id' %> + <%= submit_tag "Create" %> +<%= end_form_tag %> + + +

Hinweise

+

Als Name bitte z.B 'omni' oder einen anden anderen, die Abstrahlcharakteristik bezeichenden Namen.

diff --git a/app/views/password_mailer/password.rhtml b/app/views/password_mailer/password.rhtml new file mode 100644 index 0000000..44a43c4 --- /dev/null +++ b/app/views/password_mailer/password.rhtml @@ -0,0 +1,14 @@ +Neues Passwort: +--------------- + +Person: <%= @person.firstname + ' ' + @person.lastname %> +Email: <%= @person.email %> +neues Passwort: <%= @password %> + +mfg +Funkfeuer Graz Admin + +-- +admin@graz.funkfeuer.at +http://graz.funkfeuer.at + diff --git a/app/views/person/_form.rhtml b/app/views/person/_form.rhtml new file mode 100644 index 0000000..a640109 --- /dev/null +++ b/app/views/person/_form.rhtml @@ -0,0 +1,25 @@ +<%= error_messages_for 'person' %> + + +


+<%= text_field 'person', 'name' %>

+ +


+<%= text_field 'person', 'nick' %>

+ +


+<%= text_field 'person', 'firstname' %>

+ +


+<%= text_field 'person', 'lastname' %>

+ +


+<%= text_field 'person', 'email' %>

+ +


+<%= text_field 'person', 'tel' %>

+ +


+<%= password_field 'person', 'password' %>

+ + diff --git a/app/views/person/_nav.rhtml b/app/views/person/_nav.rhtml new file mode 100644 index 0000000..bcde756 --- /dev/null +++ b/app/views/person/_nav.rhtml @@ -0,0 +1,11 @@ +
+

+ Navigation: + <%= link_to "Locations", :action => "list", :controller => "location" %> | + <%= link_to "Persons", :action => 'list', :controller => 'person' %>
+ Benutzer: + <%= link_to session[:person].email , :action => 'show', :controller => 'person', :id => session[:person].id %> | + <%= link_to 'Logout', :action => 'logout', :controller => 'person' %> +

+
+
diff --git a/app/views/person/_pshow.rhtml b/app/views/person/_pshow.rhtml new file mode 100644 index 0000000..61a1f32 --- /dev/null +++ b/app/views/person/_pshow.rhtml @@ -0,0 +1,20 @@ +<% if @person != nil %> + + + + + + + + + + +
Nick:<%= @person.nick %>
Email:<%= mail_to @person.email, @person.email, :encode => 'hex' %>
Tel:<%= @person.tel %>
+

+ <%= link_to 'Show', { :action => 'show', :controller => 'person', :id => @person.id } %> | + <%= link_to 'Edit', { :action => 'edit', :controller => 'person', :id => @person.id } %> | + <%= link_to 'Change Password', { :action => 'change_pass', + :controller => 'person', + :id => @person.id } %> +

+<% end %> diff --git a/app/views/person/change_pass.rhtml b/app/views/person/change_pass.rhtml new file mode 100644 index 0000000..f1d62fa --- /dev/null +++ b/app/views/person/change_pass.rhtml @@ -0,0 +1,22 @@ +<%= render :partial => "person/nav" %> +

Passwort aendern

+ +<%= form_tag :action => "do_change_pass", :id => @person.id %> + + + + + + + + + + + + + +
altes Passwort:<%= password_field_tag 'oldpassword' %>
neues Passwort:<%= password_field_tag 'password' %>
nochmals:<%= password_field_tag 'password2' %>
+ +<%= submit_tag 'Change' %> +<%= end_form_tag %> + diff --git a/app/views/person/edit.rhtml b/app/views/person/edit.rhtml new file mode 100644 index 0000000..7c0f1da --- /dev/null +++ b/app/views/person/edit.rhtml @@ -0,0 +1,26 @@ +<%= render :partial => "person/nav" %> +

Person

+<%= start_form_tag :action => 'update', :id => @person %> + + + + + + + + + + + + + + + + +
nick<%= text_field 'person', 'nick' %>
Vorname<%= text_field 'person', 'firstname' %>
Nachname<%= text_field 'person', 'lastname' %>
Email:<%= text_field 'person', 'email' %>
Tel:<%= text_field 'person', 'tel' %>
+ <%= submit_tag 'Edit' %> +<%= end_form_tag %> + +<%= link_to 'Show', :action => 'show', :id => @person %> | +<%= link_to 'Back', :action => 'list' %> + diff --git a/app/views/person/list.rhtml b/app/views/person/list.rhtml new file mode 100644 index 0000000..37b8128 --- /dev/null +++ b/app/views/person/list.rhtml @@ -0,0 +1,20 @@ + +<%= render :partial => "person/nav" %> +

Personen

+ + + + + +<% @persons.each do |person| %> + + + + + + + + +<% end %> +
NicknameEmailTel.
<%= person.nick %><%= mail_to person.email, person.email, :encode => "hex" %><%= person.tel %><%= link_to 'Show', :action => 'show', :id => person %><%= link_to 'Edit', :action => 'edit', :id => person %><%= link_to 'Destroy', { :action => 'destroy', :id => person }, :confirm => 'Are you sure?', :post => true %>
+ diff --git a/app/views/person/login.rhtml b/app/views/person/login.rhtml new file mode 100644 index 0000000..a8d8fc3 --- /dev/null +++ b/app/views/person/login.rhtml @@ -0,0 +1,19 @@ +<% %> +

Login

+<%= form_tag :action => "sign_on" %> + + + + + + + + +
Email:<%= text_field 'person', 'email' %> +
Passwort:<%= password_field 'person', 'password' %>
+ +<%= submit_tag 'Login' %> +<%= end_form_tag %> +
+<%= link_to 'Passwort vergessen', :action => 'revoke_pass' %> | +<%= link_to 'Registrieren', :action => 'register' %> diff --git a/app/views/person/new.rhtml b/app/views/person/new.rhtml new file mode 100644 index 0000000..0e79d24 --- /dev/null +++ b/app/views/person/new.rhtml @@ -0,0 +1,8 @@ +

New person

+ +<%= start_form_tag :action => 'create' %> + <%= render :partial => 'form' %> + <%= submit_tag "Create" %> +<%= end_form_tag %> + +<%= link_to 'Back', :action => 'list' %> diff --git a/app/views/person/register.rhtml b/app/views/person/register.rhtml new file mode 100644 index 0000000..4c670a4 --- /dev/null +++ b/app/views/person/register.rhtml @@ -0,0 +1,35 @@ +

register Person

+

Hier kannst du dich fuer FunkFeuer Graz registrieren damit wir dir IP Adressen und + Locations zuordnen koennen. +

+<%= start_form_tag :action => 'create', :id => @person %> + + + + + + + + + + + + + + + + + + + + + + + +
Nickname<%= text_field 'person', 'nick' %>
Vorname<%= text_field 'person', 'firstname' %>*
Nachname<%= text_field 'person', 'lastname' %>*
Email:<%= text_field 'person', 'email' %>*
Tel:<%= text_field 'person', 'tel' %>
Passwort<%= password_field_tag 'password' %>*
Passwort<%= password_field_tag 'password2' %>*
+ <%= submit_tag 'Create' %> +<%= end_form_tag %> + +

Bitte mindestens Felder mit * eintragen

+

Die Felder Nickname, Email und Tel + koennen von allen angemeldeten Benutzern eingesehen werden.

diff --git a/app/views/person/revoke_pass.rhtml b/app/views/person/revoke_pass.rhtml new file mode 100644 index 0000000..99c3a27 --- /dev/null +++ b/app/views/person/revoke_pass.rhtml @@ -0,0 +1,15 @@ +

Revoke Passwort

+

Bitte geben Sie Ihre email Adresse ein.
+Ein neues Passwort wird Ihnen dann zugesendet.

+ +<%= form_tag :action => "do_revoke" %> + + + + +
Email:<%= text_field 'person', 'email' %> +
+ +<%= submit_tag 'Revoke' %> +<%= end_form_tag %> + diff --git a/app/views/person/show.rhtml b/app/views/person/show.rhtml new file mode 100644 index 0000000..be5541f --- /dev/null +++ b/app/views/person/show.rhtml @@ -0,0 +1,8 @@ +<%= render :partial => "person/nav" %> +

Person

+<%= render :partial => "person/pshow", :object => @person %> +
+

Locations

+<%= render :partial => "location/plist", + :object => @locations %> + -- cgit v1.2.1