1: | <?php
|
2: | |
3: | |
4: | |
5: | |
6: |
|
7: | include_once("$libpath/tools/Control.php");
|
8: | include_once("$comppath/jquery.php");
|
9: |
|
10: | class Dialog extends Control{
|
11: | public function oncreate($element){
|
12: | $this->setHTMLName("");
|
13: | }
|
14: |
|
15: | public function onjsrender(){
|
16: | global $jquerypath;
|
17: |
|
18: |
|
19: | if($this->getAttribute('parameter')!=''){
|
20: | $this->parameterA['parameter'] = ", ".$this->parameterA['parameter'];
|
21: | }
|
22: | if($this->getAttribute('opener')==''){
|
23: | $this->parameterA['opener'] = "#opener";
|
24: | }
|
25: |
|
26: | if($this->getAttribute('modal')!=''){
|
27: | $this->parameterA['modal'] = ", modal: ".$this->parameterA['modal'];
|
28: | }
|
29: | if($this->getAttribute('buttons')!=''){
|
30: | $ft = explode(',', $this->parameterA['buttons']);
|
31: | $tu = '';
|
32: | foreach($ft as $key=>$val){
|
33: | if($tu!=''){
|
34: | $tu .= ",";
|
35: | }
|
36: | switch(strtolower($val)){
|
37: | case 'ok':{
|
38: | $tu .= "Ok: function() { $(this).dialog('close'); ".$this->getAttribute('onok')." }";
|
39: | break;
|
40: | }
|
41: | case 'cancel':{
|
42: | $tu .= "Cancel: function() { $(this).dialog('close'); ".$this->getAttribute('oncancel')." }";
|
43: | break;
|
44: | }
|
45: | default:{
|
46: | $tu .= "'$val': function() {".$this->parameterA['on'.strtolower($val)]." }";
|
47: | break;
|
48: | }
|
49: | }
|
50: | }
|
51: | $this->parameterA['buttons'] = ", buttons: {
|
52: | $tu
|
53: | }
|
54: | ";
|
55: |
|
56: | }
|
57: | |
58: | |
59: | |
60: | |
61: | |
62: | |
63: | |
64: | |
65: | |
66: | |
67: | |
68: | |
69: | |
70: | |
71: | |
72: |
|
73: | if($this->HTMLID==''){
|
74: | $this->HTMLID = $this->name;
|
75: | }
|
76: | addHeaderJSFunctionCode('ready',$this->HTMLID,'
|
77: | $("#'.$this->HTMLID.'").dialog({
|
78: | autoOpen: false,
|
79: | width: "auto",
|
80: | height: "auto",
|
81: | show: {
|
82: | effect: "blind",
|
83: | duration: 1000
|
84: | },
|
85: | hide: {
|
86: | effect: "explode",
|
87: | duration: 1000
|
88: | },
|
89: | title: "'.$this->getAttribute('title').'"
|
90: | '.$this->getAttribute('modal').'
|
91: | '.$this->getAttribute('buttons').'
|
92: | '.$this->getAttribute('parameter').'
|
93: | });
|
94: | $( "'.$this->getAttribute('opener').'" ).click(function() {
|
95: | $( "#'.$this->HTMLID.'" ).dialog( "open" );
|
96: | return false;
|
97: | });
|
98: |
|
99: | ');
|
100: | if($this->getAttribute('class') == ''){
|
101: | addHeaderCSS('dragdrop', '
|
102: | .dragdrop
|
103: | {
|
104: | position: relative;
|
105: | cursor: auto;
|
106: | }
|
107: | ');
|
108: | $this->parameterA['class'] = 'dragdrop';
|
109: | }
|
110: |
|
111: | }
|
112: |
|
113: |
|
114: | }
|
115: | ?> |