1: <?php
2: /**
3: * Description of DragAble
4: *
5: * @author SARTAJ
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: //$this->parameterA['type'] = ", modal: true '".$this->parameterA['axis']. "'";
56: }
57: /*
58: addFileLink($jquerypath.'themes/base/jquery.ui.all.css');
59: addFileLink($jquerypath.'themes/base/jquery.ui.dialog.css');
60: addFileLink($jquerypath.'ui/jquery.ui.core.min.js');
61: addFileLink("{$jquerypath}/ui/jquery.ui.widget.min.js");
62: addFileLink("{$jquerypath}/ui/jquery.ui.mouse.min.js");
63: addFileLink($jquerypath.'ui/jquery.ui.draggable.min.js');
64: addFileLink("{$jquerypath}/ui/jquery.ui.position.min.js");
65: addFileLink($jquerypath.'ui/jquery.ui.resizable.min.js');
66: addFileLink($jquerypath.'ui/jquery.ui.button.min.js');
67: addFileLink($jquerypath.'ui/jquery.ui.dialog.min.js');
68: addFileLink($jquerypath.'ui/jquery.ui.effect.min.js');
69: addFileLink($jquerypath.'ui/jquery.ui.effect-blind.min.js');
70: addFileLink($jquerypath.'ui/jquery.ui.effect-explode.min.js');
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: ?>