-
Notifications
You must be signed in to change notification settings - Fork 0
/
buttonfield.go
83 lines (66 loc) · 2.12 KB
/
buttonfield.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package xdommask
import "github.com/webability-go/wajaf"
type ButtonField struct {
*ControlField
Action string
}
func NewButtonField(name string, action string) *ButtonField {
bf := &ButtonField{ControlField: NewControlField(name), Action: action}
bf.Type = CONTROL
return bf
}
func (f *ButtonField) GetName() string {
return f.Type + "::" + f.Action
}
func (f *ButtonField) Compile() wajaf.NodeDef {
b := wajaf.NewButtonElement(f.ID, f.Action)
b.SetAttribute("style", f.Style)
b.SetAttribute("classname", f.ClassName)
b.AddMessage("titleinsert", f.TitleInsert)
b.AddMessage("titleupdate", f.TitleUpdate)
b.AddMessage("titledelete", f.TitleDelete)
b.AddMessage("titleview", f.TitleView)
b.SetAttribute("visible", convertModes(f.AuthModes))
return b
}
/*
class DomMaskButtonField extends DomMaskField
{
public $action = 'submit';
public $OnClick = 'reset();'; // for ButtonFields
public $ButtonFieldInsert = null; // string
public $ButtonFieldUpdate = null; // string
public $ButtonFieldDelete = null; // string
public $ButtonFieldView = null; // string
public $ButtonFieldAsImage = null; // string link of image
public $OnEvent = null;
function __construct($name = '')
{
parent::__construct($name, false);
$this->type = 'button';
}
public function getAction()
{
return $this->action;
}
public function create()
{
$title = is_string($this->title)?$this->title:'';
$f = new \wajaf\buttonElement($title, $this->name);
if (is_array($this->title))
{
if (isset($this->title[DomMask::INSERT]))
$f->setMessage('titleinsert', $this->title[DomMask::INSERT]);
if (isset($this->title[DomMask::UPDATE]))
$f->setMessage('titleupdate', $this->title[DomMask::UPDATE]);
if (isset($this->title[DomMask::DELETE]))
$f->setMessage('titledelete', $this->title[DomMask::DELETE]);
if (isset($this->title[DomMask::VIEW]))
$f->setMessage('titleview', $this->title[DomMask::VIEW]);
}
$f->setVisible($this->DomMask->createModes($this->authmodes));
$f->setAction($this->action);
return $f;
}
}
*/