Minor fixes to payment, host manage and plesk

This commit is contained in:
Deon George
2012-04-17 20:50:06 +10:00
parent d2bc1bd451
commit 01d7f09a68
13 changed files with 360 additions and 108 deletions

View File

@@ -14,6 +14,9 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin {
protected $_table_name = 'service__hosting';
protected $_created_column = FALSE;
protected $_updated_column = FALSE;
protected $_serialize_column = array(
'server_data_date',
);
// Relationships
protected $_has_one = array(
@@ -33,6 +36,14 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin {
),
);
public function rules() {
return array_merge(parent::rules(),array(
'server_data_date'=>array(
array('ORMOSB::serialize_array',array(':model',':field',':value')),
),
));
}
// Required abstract functions
public function admin_update() {
return '';
@@ -52,11 +63,26 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin {
* to manage the domain.
*/
public function manage_button() {
$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() {
if (x++) { alert("Please refresh the page"); return false; }
$.getJSON("'.URL::site('user/service/ajaxmanage/'.$this->service_id).'", { k: "'.$k.'" }, function(data) {
$.each(data, function(key, val) { $("#"+key).val(val); });
}).error(function() { alert("There was a problem with the request"); return false; }).success(function() { $("#manage").submit(); });
});
});'
));
// @todo Convert this to a Static_List display
if ($this->service->queue == 'PROVISION')
return _('To Be Provisioned');
return ($this->host_username AND $this->host_password) ? $this->host_server->manage_button($this->host_username,$this->host_password,$this->name()) : '';
return ($this->host_username AND $this->host_password) ? $this->host_server->manage_button($this->host_username,substr(md5($this->host_password),0,8),$this->name()) : '';
}
}
?>