- •Утвержден
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •Исходный код шаблонов видов
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
- •02070743.00569-01 12 01
1802070743.00569-01 12 01
if @user.type_id == 1 # make sure
they're а user
#Proceed, render controller
else #they're not а user... kick em out!
flash[:message]= "<font color=red><image src=\"/images/icon_failure.png\"> You are not logged in as а user!</font>"
redirect_to :action => "index"
end
end
end
def index
end
def collapse_ticket
render :layout => false
end
def create_new_user
if request.post?
@msg = Array.new
if(params[:user][:password]!= params[:user][:password_confirmation])
@msg << "<font color=red>Your Passwords Do NOT match!</font>"
else
@user = User.new(params[:user])
@user.type_id = 1
if @user.save
@msg << 'User was successfully created!'
#redirect_to :action => 'index'
else #save failed
@msg << "<font color=red>There was а problem creating your account!<br>Details:<br>"
@user.errors.each do |key,value|
@msg << "<font color=red><image src=\"/images/icon_failure.png\">Error: (#{key})....#{value}</font><br>"#print out any errors!
end
@msg << "</font><br><a href=\"./\" class=\"right_link\"><< Back</a>"
end
end
end
end
def create_ticket
if request.post?
@user = User.find(:first :conditions => {:id => session[:user][:id]})
if params[:ticket][:category]== "none"#category is blank
flash[:message]= "Please Specify а category.<br>"
else#everything's cool so far...
#Create Ticket object and populate---------------------
@ticket = Ticket.new(params[:ticket])
@ticket.ticketstatus_id = 1 #Create it as status type=1(new)
@ticket.user_id = session[:user][:id]
107
1902070743.00569-01 12 01
flash[:message]= "<font
color=green><image src=\"/images/icon_success.png\"> Your
ticket was successfully created!</font><br>"
#Create Tickettext object and populate-----------------
@ticket_text = Tickettext.new()
@ticket_text.text_content = params[:ticket][:text_content]
@ticket_text.user_id = session[:user][:id]
@ticket_text.post_type = "user-post"
@ticket_text.ticket_id = @ticket.id
if @ticket_text.save#Add the text to the ticket
flash[:message] << "<font color=green><image src=\"/images/icon_success.png\"> Your post was added to the ticket successfully!</font><br>"
flash[:message] << "<font color=green><image src=\"/images/icon_info.png\"> <b>Your new ticket number is: #{@ticket.id}</font>"
redirect_to :action => 'view_tickets'
else #tickettext save failed
flash[:message]= "There was an error when adding your post to the ticket!"
end
else #save failed
flash[:message]= "There was an error when entering your ticket into the database!"
redirect_to :action => 'create_ticket'
end
end
end
end
def edit_account
@user = User.find(:first :conditions => {:id => session[:user][:id]})
end
def expand_ticket
render :layout => false
end
def login
if request.post?
if session[:user]= User.authenticate(params[:user][:email], Digest::SHA256.hexdigest(params[:user][:password]))
if(session[:user][:type_id]!= 1) #that user is not а normal customer! they might be trying to log in as а tech, etc..
reset_session
flash[:message]= "<font color=red><image src=\"/images/icon_failure.png\"> You're Logged into the wrong area!</font><br>"
redirect_to :action => "index"
else#they are in the right place
flash[:message]= "<font color=green><image src=\"/images/icon_success.png\"> Login Successful!</font><br>"
#redirect_to_stored
session[:logged_in]= "y"
108