- •Утвержден
- •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
2402070743.00569-01 12 01
#----------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].to_s != @ticket.ticketstatus_id.to_s) #if the ticket status has been changed
@status = Ticketstatus.find(params[:ticket][:ticketstatus_id] :limit => 1)
stat_change = " and status changed to: #{@status.name}"
if(params[:ticket][:ticketstatus_id].to_s != @ticket.ticketstatus_id.to_s)
flash[:message] << "The status is changed! #{@ticket.ticketstatus_id} #{params[:ticket][:ticketstatus_id]}<br>"
end
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>"
make_log(@ticket_text.ticket_id, "Added post(#{params[:ticket][:post_type]})" + "#{stat_change}")# log it!
else
flash[:message] << "<font color=red><image src=\"/images/icon_failure.png\"> There was а problem saving your post!</font><br>"
end
#--------------------------------------------------
113
2502070743.00569-01 12 01
redirect_to :controller => "tech"
:action => "view_tickets"
end
end
end
def update_ticket_status
@ticket = Ticket.find(params[:ticket][:ticket_id])
flash[:message]= ""
if(@ticket.ticketstatus_id == params[:ticket][:ticketstatus_id]) #they didn't actually select а new status
flash[:message] << "<font color=red><image src=\"/images/icon_failure.png\"> You must choose а NEW ticket status!</font><br>"
else #they did select а new status, proceed normally
@status = Ticketstatus.find(params[:ticket][:ticketstatus_id] :limit => 1) #look up the new status for the log msg
@stat_msg = "Changed ticket status to: #{@status.name}" # log message
if(@ticket.update_attribute(:ticketstatus_id, params[:ticket][:ticketstatus_id]))
flash[:message] << "<font color=green><image src=\"/images/icon_success.png\"> Your ticket status has been changed successfully!</font><br>"
make_log(params[:ticket][:ticket_id] @stat_msg)# Log it!
end
redirect_to :controller => "tech" :action => "view_tickets"
end
end
def view_logs
end
def view_tickets
@categories = Category.find(:all :limit => 100) # for use in select in view
@statuses = Ticketstatus.find(:all :limit => 100) # for use in select in view
@increment = 100 # show x tickets per page
if params[:offset].nil? # no offset is defined
@offset = 0 # where to start looking for tickets
else
@offset = params[:offset].to_i
end
@tick_limit = @offset.to_i + @increment.to_i #The max amount of ticks to display
if(params[:category_id]&& params[:category_id]!= "none")# if а category is selected
@category = Category.find(params[:category_id] :limit => 1)
@category_name = @category.name
if(params[:status_id]&& params[:status_id]!= "none")# if а status is selected too
@status = Ticketstatus.find(params[:status_id] :limit => 1)
114