Internal rework pending editframe

This commit is contained in:
Deon George
2019-07-12 10:42:01 +07:00
parent 4f79a1a997
commit 264747e2f3
14 changed files with 611 additions and 428 deletions

View File

@@ -24,7 +24,7 @@ class Login extends Action
$this->mode = 2; // MODE_FIELD
// $this->action = 2; // ACTION_GOTO
$this->so->sendBaseline($this->so->client(),RED.'INVALID DETAILS, TRY AGAIN *00');
$this->so->sendBaseline($this->so->co,RED.'INVALID DETAILS, TRY AGAIN *00');
return FALSE;
}
@@ -33,7 +33,7 @@ class Login extends Action
$this->uo = User::where('login',array_get($fielddata,0))->firstOrFail();
} catch (ModelNotFoundException $e) {
$this->so->sendBaseline($this->so->client(),RED.'USER NOT FOUND, TRY AGAIN *00');
$this->so->sendBaseline($this->so->co,RED.'USER NOT FOUND, TRY AGAIN *00');
return FALSE;
}
@@ -41,7 +41,7 @@ class Login extends Action
if ($this->uo->password != array_get($fielddata,1))
{
$this->uo = new User;
$this->so->sendBaseline($this->so->client(),RED.'INVALID PASSWORD, TRY AGAIN *00');
$this->so->sendBaseline($this->so->co,RED.'INVALID PASSWORD, TRY AGAIN *00');
return FALSE;
}

View File

@@ -2,12 +2,14 @@
namespace App\Classes\Frame;
use App\Classes\Parser;
use Illuminate\Support\Facades\Log;
use App\Classes\Frame as AbstractFrame;
use App\Classes\Frame;
use App\Classes\Parser\Ansi as AnsiParser;
use App\Models\Frame as FrameModel;
class Ansi extends AbstractFrame
class Ansi extends Frame
{
public static $frame_length = 22;
public static $frame_width = 80;
@@ -19,7 +21,7 @@ class Ansi extends AbstractFrame
public static $if_filler = '.';
public function __construct(\App\Models\Frame $o,string $msg='')
public function __construct(FrameModel $o,string $msg='')
{
parent::__construct($o);
@@ -28,15 +30,12 @@ class Ansi extends AbstractFrame
$this->output .= ESC.'[24;0f'.$msg.HOME;
}
public function fields($startline=1)
protected function parser(int $startline): Parser
{
$o = new AnsiParser($this->frame->content,$startline);
$this->output .= (string)$o;
$this->fields = $o->fields;
return new AnsiParser($this->fo->content,self::$frame_width,$startline);
}
public function strlenv($text):int {
public static function strlenv($text):int {
return strlen($text ? preg_replace('/'.ESC.'\[[0-9;?]+[a-zA-Z]/','',$text) : $text);
}
}

View File

@@ -4,10 +4,12 @@ namespace App\Classes\Frame;
use Illuminate\Support\Facades\Log;
use App\Classes\Frame as AbstractFrame;
use App\Classes\Frame;
use App\Classes\Parser;
use App\Classes\Parser\Videotex as VideotexParser;
use App\Models\Frame as FrameModel;
class Videotex extends AbstractFrame
class Videotex extends Frame
{
public static $frame_length = 22;
public static $frame_width = 40;
@@ -19,7 +21,7 @@ class Videotex extends AbstractFrame
public static $if_filler = '.';
public function __construct(\App\Models\Frame $o,string $msg='')
public function __construct(FrameModel $o,string $msg='')
{
parent::__construct($o);
@@ -28,17 +30,12 @@ class Videotex extends AbstractFrame
$this->output .= HOME.UP.$msg.HOME;
}
// @todo Change to use a Parser, like we do for ANSI
public function fields($startline=1)
protected function parser(int $startline): Parser
{
$o = new VideotexParser($this->frame->content,$startline);
$this->output .= (string)$o;
$this->fields = $o->fields;
return new VideotexParser($this->fo->content,self::$frame_width,$startline);
}
public function strlenv($text):int {
public static function strlenv($text):int {
return strlen($text)-substr_count($text,ESC);
}
}