- •Утвержден
- •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
1002070743.00569-01 12 01
else
flash[:message]= "<font color=red><image src=\"/images/icon_failure.png\"> You are not logged in as а admin!</font>"
redirect_to :action => "index"
end
end
end
def collapse_ticket
render :layout => false
end
def create_new_category
@category = Category.new(params[:category])
@category.id = params[:category][:id] #set the id of the record manually
flash[:message]= ""
if @category.save
flash[:message] << "<font color=green><image src=\"/images/icon_success.png\"> The Category was successfully created!</font>"
else #save failed
flash[:message] << "<font color=red><image src=\"/images/icon_failure.png\"> There was а problem creating the category!</font><br>"
@category.errors.each do |key,value|
flash[:message] << "<font color=red><image src=\"/images/icon_failure.png\">Error: (#{key})....#{value}</font><br>"#print errors
end
end
redirect_to :action => 'edit_ticket_categories'
end
def create_new_status
@status = Ticketstatus.new(params[:status])
@status.status_type = "general" # for now...
@status.id = params[:status][:id] #set the id of the record manually
flash[:message]= ""
if @status.save
flash[:message] << '<font color=green><image src=\"/images/icon_success.png\"> The Status was successfully created!</font>'
else #save failed
flash[:message] << "<font color=red><image src=\"/images/icon_failure.png\"> There was а problem creating the status!</font><br>"
@status.errors.each do |key,value|
flash[:message] << "<font color=red><image src=\"/images/icon_failure.png\">Error: (#{key})....#{value}</font><br>"#print errors
end
end
redirect_to :action => 'edit_ticket_statuses'
end
99
1102070743.00569-01 12 01
@user = User.new(params[:user])
# render :text => @user.inspect
flash[:message]= ""
if params[:user][:password]!= params[:user][:password_confirmation] #password doesn't match!
flash[:message] << "<font color=red><image src=\"/images/icon_failure.png\"> Passwords do not match!</font><br>"
else
if @user.save
flash[:message] << '<font color=green><image src=\"/images/icon_success.png\"> User was successfully created!</font>'
else #save failed
flash[:message] << "<font color=red><image src=\"/images/icon_failure.png\"> There was а problem creating your account! Below are details. </font><br>"
@user.errors.each do |key,value|
flash[:message] << "<font color=red><image src=\"/images/icon_failure.png\">Error: (#{key})....#{value}</font><br>"#print out any erro$
end
end
end
redirect_to :action => 'add_user'
end
def create_ticket
if request.post?
@user = User.find(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
@ticket.user_id = session[:user][:id]
if @ticket.save#save ticket & text in db.
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
100