service->product->title(),$this->name()); } /** * View details of the service */ abstract public function service_view(); /** * The table attributes that provide username/password values */ abstract public function username_value(); abstract public function password_value(); public function manage_button() { if (! $this->service->status) return FALSE; static $k = ''; // If $k is already set, we've rendered this JS if ($k) return TRUE; $k = Random::char(); Session::instance()->set('manage_button',$k); Script::add(array('type'=>'stdin','data'=>' $(document).ready(function() { var x=0; $("button[name=submit]").click(function() { var t=$(this).val().split(":"); if (x++) { alert("Session expired, please refresh the page!"); return false; } $.getJSON("'.URL::link('user','service/ajaxmanage/'.$this->service_id,TRUE).'", { k: "'.$k.'",t: t[1] }, function(data) { $.each(data, function(key, val) { $("#"+key+"_"+t[0]+"_"+t[1]).val(val); }); }).error(function() { alert("There was a problem with the request"); return false; }).success( function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); }); }); });' )); return TRUE; } /** * Get specific service details for use in other modules * For Example: Invoice * * @todo Make the rendered items configurable * @todo Change this method name, now that it is public */ public function _details($type) { switch ($type) { // Nothing to add for invoices case 'invoice_detail_items': return array(); default: throw new Kohana_Exception('Unkown detail request :type',array(':type'=>$type)); } } } ?>