Fix abstract passwords in host/domain manage planel logins

This commit is contained in:
Deon George
2012-06-22 15:12:59 +10:00
parent 0eecfe8abd
commit df82268405
12 changed files with 93 additions and 42 deletions

View File

@@ -49,14 +49,16 @@ class Model_Service extends ORMOSB {
/**
* Return the object of the product plugin
*/
public function plugin() {
public function plugin($type='') {
if (! $this->product->prod_plugin_file)
return NULL;
if (! is_numeric($this->product->prod_plugin_data))
throw new Kohana_Exception('Missing plugin_id for :product (:type)',array(':product'=>$this->product->id,':type'=>$this->product->prod_plugin_file));
return ORM::factory(sprintf('service_plugin_%s',$this->product->prod_plugin_file),array('service_id'=>$this->id));
$o = ORM::factory(sprintf('service_plugin_%s',$this->product->prod_plugin_file),array('service_id'=>$this->id));
return $type ? $o->$type : $o;
}
/**

View File

@@ -36,6 +36,37 @@ abstract class Model_Service_Plugin extends ORMOSB {
*/
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() {
static $k = '';
// If $k is already set, we've rendered this JS
if ($k)
return;
$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("Please refresh the page"); return false; }
$.getJSON("'.URL::site('user/service/ajaxmanage/'.$this->service_id).'", { 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(); });
});
});'
));
}
/**
* Get specific service details for use in other modules
* For Example: Invoice