
- •Утвержден
- •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
1402070743.00569-01 12 01
flash[:message] << "<font
color=green><image
src=\"/images/icon_success.png\"> #{@user.email}
saved successfully!!</font><br>"
else
flash[:message] << "<font color=red><image src=\"/images/icon_failure.png\"> Failed Saving!</font><br>"
end
#redirect_to :login
end
def expand_ticket
render :layout => false
end
def index
render :layout => false
end
def login
if request.post?
if session[:user]= User.authenticate(params[:user][:email], Digest::SHA256.hexdigest(params[:user][:password]))
flash[:message]= "<font color=green><image src=\"/images/icon_success.png\"> Login Successful!</font><br>"
#redirect_to_stored
session[:logged_in]= "y"
@msg = "#{params[:user][:email]} logged in successfully!<br>"
redirect_to :action => "view_tickets"
else #login failed
flash[:message]= "<font color=red><image src=\"/images/icon_failure.png\"> Login Failed!</font><br>"
redirect_to :controller => "admin" :action => "index"
end
end
end
def lookup_ticket
#render :text => params.inspect
@ticket = Ticket.find(params[:ticket][:id] :limit => 1) #look up the ticket to make sure it exists
rescue ActiveRecord::RecordNotFound # If the ticket doesn't exist...
flash[:message]= "<font color=red><image src=\"/images/icon_failure.png\"> I couldn't find ticket: #{params[:ticket][:id]}</font><br>"
redirect_to :action => "view_tickets"
end
def open_ticket
@user = User.find(session[:user][:id])
@categories = Category.find(:all :limit => 100)
@statuses = Ticketstatus.find(:all)
end
def save_post
103
1502070743.00569-01 12 01
flash[:message]= ""
#----------Check and Updated Status-----------------
if(params[:ticket][:status]== "none") #make sure they set а status
flash[:message] << "<font color=red><image src=\"/images/icon_failure.png\"> Please choose а status other than #{params[:ticket][:status]}!</font><br>"
else
@ticket = Ticket.find(params[:ticket][:ticket_id])#test to see if the status has changed
if(params[:ticket][:ticketstatus_id]!= @ticket.ticketstatus_id) #if the ticket status has been changed
if @ticket.update_attribute(:ticketstatus_id, params[:ticket][:ticketstatus_id])#save the status
flash[:message] << "<font color=green><image src=\"/images/icon_success.png\"> The status of your ticket was changed successfully!</font><br>"
else
flash[:message] << "<font color=red><image src=\"/images/icon_failure.png\"> There was а problem changing your ticket status! #{params[:ticket][:status]}!</font><br>"
end
else #the ticket status is the same
flash[:message] << "<font color=green><image src=\"/images/icon_warning.png\"> Your Ticket Status will stay the same.</font><br>"
end
#--------------------------------------------------
#----------Add Post to Ticket----------------------
#add the ticket text to the tick
@ticket_text = Tickettext.new()
@ticket_text.text_content = params[:ticket][:text_content]
@ticket_text.user_id = session[:user][:id]
@ticket_text.ticket_id = params[:ticket][:ticket_id]
@ticket_text.post_type = params[:ticket][:post_type]
if @ticket_text.save#save the text
flash[:message] << "<font color=green><image src=\"/images/icon_success.png\"> Your post was added successfully!</font><br>"
else
flash[:message] << "<font color=red><image src=\"/images/icon_failure.png\"> There was а problem saving your post!</font><br>"
end
#--------------------------------------------------
#flash[:message] << "#{params.inspect} <br><br><br> #{@ticket.inspect} <br><br>@ticket.id: #{@ticket.id}<br>params[:ticket][:ticket_id]: #{params[:ticket][:ticket_id]}<br>params[:ticket][:status]: #{params[:ticket][:status]} "#for debugging
redirect_to :action => "view_tickets"
end
end
end
def update_ticket_status
@ticket = Ticket.find(params[:ticket][:ticket_id])
104