Sha256: c5ebea36c982b61be0699b015a83d0945a5d925c923de6c6b89beee99e7f745a
Contents?: true
Size: 1.98 KB
Versions: 1
Compression:
Stored size: 1.98 KB
Contents
<% if !_site.has_rank?("admin") _hb.alert(_("You are not an administrator and cannot view this page.")).back end if _get["choice"] == "dosave" save_hash = { :name => _post["texname"] } end if _get["customer_id"].to_i > 0 customer = _ob.get(:Customer, _get["customer_id"]) title = sprintf(_("Edit customer: %s"), customer.name.html) if _get["choice"] == "dosave" customer.update(save_hash) _hb.redirect("?show=customer_edit&customer_id#{customer.id}") end if _get["choice"] == "dodelete" _hb.on_error_go_back do _ob.delete(customer) _hb.redirect("?show=customer_search") end end else title = _("Add new customer") if _get["choice"] == "dosave" _hb.on_error_go_back do customer = _ob.add(:Customer, save_hash) _hb.redirect("?show=customer_edit&customer_id=#{customer.id}") end end end print _site.header(title) %> <form method="post" action="?show=customer_edit&choice=dosave<%if customer; print "&customer_id=#{customer.id}"; end%>"> <%=_site.boxt(_("Enter details"), "350px")%> <table class="form"> <% print Knj::Web.inputs([{ :title => _("Name"), :name => :texname, :value => [customer, :name], :descr => _("The name of the customer as it should appear in the system.") }]) %> <tr> <td colspan="2" class="buttons"> <%if customer%> <input type="button" value="<%=_("Show")%>" onclick="location.href='?show=customer_show&customer_id=<%=customer.id%>';" /> <input type="button" value="<%=_("Delete")%>" onclick="if (confirm('<%=_("Do you want to delete this customer?")%>')){location.href='?show=customer_edit&customer_id=<%=customer.id%>&choice=dodelete';}" /> <%end%> <input type="submit" value="<%=_("Save")%>" /> </td> </tr> </table> <%=_site.boxb%> </form> <script type="text/javascript"> $("#texname").focus(); </script>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
knjtasks-0.0.3 | pages/customer_edit.rhtml |