markets: allow to change base coin (experimental)

This commit is contained in:
Tanguy Pruvot 2016-05-24 23:42:07 +02:00
parent 53b1e06b63
commit e3a485179b
2 changed files with 11 additions and 0 deletions

View file

@ -33,6 +33,11 @@ class db_markets extends CActiveRecord
public function save($runValidation=true,$attributes=null) public function save($runValidation=true,$attributes=null)
{ {
if (empty($this->base_coin)) $this->base_coin = null; if (empty($this->base_coin)) $this->base_coin = null;
else if ($this->base_coin == 'BTC') $this->base_coin = null;
else if (strpos($this->name, $this->base_coin) === false) {
$parts = explode(' ', $this->name);
$this->name = trim($parts[0].' '.$this->base_coin);
}
if (empty($this->message)) $this->message = null; if (empty($this->message)) $this->message = null;
return parent::save($runValidation, $attributes); return parent::save($runValidation, $attributes);

View file

@ -15,6 +15,12 @@ echo CUFHtml::activeTextField($market, 'deposit_address', array('maxlength'=>200
echo "<p class='formHint2'>.</p>"; echo "<p class='formHint2'>.</p>";
echo CUFHtml::closeCtrlHolder(); echo CUFHtml::closeCtrlHolder();
echo CUFHtml::openActiveCtrlHolder($market, 'base_coin');
echo CUFHtml::activeLabelEx($market, 'base_coin');
echo CUFHtml::activeTextField($market, 'base_coin', array('maxlength'=>16,'style'=>'width: 40px;'));
echo "<p class='formHint2'>Default (empty) is BTC</p>";
echo CUFHtml::closeCtrlHolder();
echo CUFHtml::closeTag('fieldset'); echo CUFHtml::closeTag('fieldset');
showSubmitButton('Save'); showSubmitButton('Save');
echo CUFHtml::endForm(); echo CUFHtml::endForm();