17 private $windowType =
'popup';
18 private $windowWidth =
'';
19 private $windowHeight =
'';
20 private $windowTop =
'';
21 private $windowLeft =
'';
29 $page->AddScript(
'm_lookup.js');
39 $this->related = implode(
',',
$related);
44 $this->
event = $event ?
$event :
'filler';
46 $module = $this->manager->GetConf(
"mad.module");
49 $form = ($this->form == NULL) ?
$page->name : $this->form->name;
51 $this->lookup_name =
"lookup_{$form}_{$this->name}";
52 $this->lookup_name = str_replace(
'.',
'_', $this->lookup_name);
70 $this->windowWidth = $width;
71 $this->windowHeight = $height;
74 function setWindowType( $windowType=
'iframe', $width=
'', $height=
'', $top=
'', $left=
'')
76 $this->windowType = $windowType;
77 $this->windowTop = $top;
78 $this->windowLeft = $left;
87 $this->showButton = $show;
92 $this->label = $this->label ?
' ' :
'';
96 $filter = is_array($this->filter) ? $this->filter : array($this->filter);
99 $attr = $this->GetAttributes();
101 if ($this->showButton )
103 $content[] =
new MSpan(
'',
' ');
104 $button =
new MButtonFind(
"javascript:MIOLO_Lookup($this->lookup_name,'$base', event);");
105 $content[] = $button->Generate();
108 $html = $this->painter->GenerateToString($content);
109 $html .=
"<script language=\"JavaScript\">\n";
110 $html .=
" var $this->lookup_name = new LookupContext();\n";
111 $html .=
" $lookup_name.name = '{$lookup_name}';\n";
112 $html .=
" $lookup_name.module = '{$this->module}';\n";
113 $html .=
" $lookup_name.item = '{$this->item}';\n";
114 $html .=
" $lookup_name.related = '{$this->related}';\n";
115 $html .=
" $lookup_name.filter = '" . implode(
',',
$filter) .
"';\n";
116 $html .=
" $lookup_name.idxFilter = '" . implode(
',',array_keys(
$filter)) .
"';\n";
117 $html .=
" $lookup_name.form = document.{$this->form->name};\n";
118 $html .=
" $lookup_name.field = '{$this->name}';\n";
119 $html .=
" $lookup_name.function = '{$this->function}';\n";
120 $html .=
" $lookup_name.event = '{$this->event}';\n";
121 $html .=
" $lookup_name.wType = '{$this->windowType}';\n";
122 $html .=
" $lookup_name.wWidth = '{$this->windowWidth}';\n";
123 $html .=
" $lookup_name.wHeight = '{$this->windowHeight}';\n";
124 $html .=
" $lookup_name.wTop = '{$this->windowTop}';\n";
125 $html .=
" $lookup_name.wLeft = '{$this->windowLeft}';\n";
126 $html .=
" $lookup_name.autoPost = '{$this->autoPostBack}';\n";
127 $html .=
" document.lookup = $lookup_name;\n";
128 $html .=
"</script>\n";
129 $this->inner = $this->GenerateLabel() . $html;
149 private $windowType =
'popup';
150 private $windowWidth =
'';
151 private $windowHeight =
'';
152 private $windowTop =
'';
153 private $windowLeft =
'';
161 $page->AddScript(
'm_lookup_ajax.js');
171 $this->related = implode(
',',
$related);
176 $this->
event = $event ?
$event :
'filler';
178 $module = $this->manager->GetConf(
"mad.module");
181 $form = ($this->form == NULL) ?
$page->name : $this->form->name;
183 $this->lookup_name =
"lookup_{$form}_{$this->name}";
184 $this->lookup_name = str_replace(
'.',
'_', $this->lookup_name);
203 $this->windowWidth = $width;
204 $this->windowHeight = $height;
207 function setWindowType( $windowType=
'iframe', $width=
'', $height=
'', $top=
'', $left=
'')
209 $this->windowType = $windowType;
210 $this->windowTop = $top;
211 $this->windowLeft = $left;
220 $this->showButton = $show;
225 $this->label = $this->label ?
' ' :
'';
229 $filter = is_array($this->filter) ? $this->filter : array($this->filter);
232 $attr = $this->GetAttributes();
234 if ($this->showButton )
239 $content[] =
new MSpan(
'',
' ');
241 $button =
new MButtonFind(
"javascript:MIOLO_Lookup($this->lookup_name,'$base', event);");
242 $button->addAttribute(
'data-toggle',
'modal');
243 $button->addAttribute(
'data-target',
'#lookupModal_' . $this->name);
244 $button->addAttribute(
'data-bs-toggle',
'modal');
245 $button->addAttribute(
'data-bs-target',
'#lookupModal_' . $this->name);
246 $content[] = $button->Generate();
249 $html = $this->painter->GenerateToString($content);
250 $html .=
"<script language=\"JavaScript\">\n";
251 $html .=
" var $this->lookup_name = new LookupContext();\n";
252 $html .=
" $lookup_name.name = '{$lookup_name}';\n";
253 $html .=
" $lookup_name.module = '{$this->module}';\n";
254 $html .=
" $lookup_name.item = '{$this->item}';\n";
255 $html .=
" $lookup_name.related = '{$this->related}';\n";
256 $html .=
" $lookup_name.filter = '" . implode(
',',
$filter) .
"';\n";
257 $html .=
" $lookup_name.idxFilter = '" . implode(
',',array_keys(
$filter)) .
"';\n";
258 $html .=
" $lookup_name.form = document.forms[0];\n";
259 $html .=
" $lookup_name.field = '{$this->name}';\n";
260 $html .=
" $lookup_name.function = '{$this->function}';\n";
261 $html .=
" $lookup_name.event = '{$this->event}';\n";
262 $html .=
" $lookup_name.wType = '{$this->windowType}';\n";
263 $html .=
" $lookup_name.wWidth = '{$this->windowWidth}';\n";
264 $html .=
" $lookup_name.wHeight = '{$this->windowHeight}';\n";
265 $html .=
" $lookup_name.wTop = '{$this->windowTop}';\n";
266 $html .=
" $lookup_name.wLeft = '{$this->windowLeft}';\n";
267 $html .=
" $lookup_name.autoPost = '{$this->autoPostBack}';\n";
268 $html .=
" document.lookup = $lookup_name;\n";
269 $html .=
"</script>\n";
274 '<div class="modal fade" id="lookupModal_'.$this->name.
'" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
275 <div class="modal-dialog modal-lg">
276 <div class="modal-content">
277 <div class="modal-header">
278 <h4 class="modal-title" id="lookupTitle_'.$this->name.
'">Modal title</h4>
279 <button id="lookupCloseButton_'.$this->name.
'" type="button" class="close btn-close" data-dismiss="modal" data-bs-dismiss="modal" aria-label="Fechar" title="Fechar"><span aria-hidden="true">×</span></button>
281 <div class="modal-body">
282 <iframe class="m-lookup-iframe" id="lookupIframe_'.$this->name.
'" frameborder="0"></iframe>
289 $this->inner = $this->GenerateLabel() . $html;
321 $field =
new MTextField($this->name,$this->value,$this->label,$this->size,$this->hint, $this->validator);
323 if ( $this->autocomplete )
325 $field->setAttribute(
'onChange',
"MIOLO_AutoComplete({$this->lookup_name},'$this->baseModule')");
330 if($this->value && $this->autocomplete)
334 $info = $this->getAutoCompleteData();
337 foreach(
$info as $i )
341 $info_ = substr($info_, 0, -1);
345 $msg = _M(
'[autocomplete]: Field @1 not found!', $this->baseModule) .
'<br/>';
347 $this->page->addJSCode(
"MIOLO_AutoCompleteDeliver(document, {$this->lookup_name}.form, '$msg', '$this->related', new Array($info_) );");
350 $field->SetClass(
'm-text-field');
353 $field->AddBoxStyle(
'float',
'left');
354 if ( $this->readonly )
356 $field->SetClass(
'm-readonly');
357 $field->AddAttribute(
'readonly');
359 $html = $field->Generate();
360 parent::GenerateInner();
361 $htmlInner = $this->GetInner();
362 $this->inner = $html . ( $this->readonly ?
'' : $htmlInner) ;
382 parent::GenerateInner();
383 $htmlInner = $this->GetInner();
384 $field =
new MTextField($this->name,$this->value,$this->label,$this->size,$this->hint, $this->validator);
386 $field->SetClass(
'm-text-field');
390 $field->SetClass(
'm-readonly');
391 $field->AddAttribute(
'readonly');
392 $html = $field->Generate();
393 $this->inner = ( $this->readonly ?
'' : $htmlInner) . $html;
423 $field =
new MTextField($this->name, $this->value, $this->label, $this->size,
'', $this->validator);
425 if ( $this->autocomplete )
427 if (count($this->customAttribute) > 0)
430 foreach ($this->customAttribute as $key =>
$value)
432 $field->setAttribute(
'onChange',
"MIOLO_AutoComplete_Ajax({$this->lookup_name},'$this->baseModule');" .
$value);
436 $field->setAttribute($key,
$value);
444 $field->setAttribute(
'onChange',
"MIOLO_AutoComplete_Ajax({$this->lookup_name},'$this->baseModule')");
448 elseif (count($this->customAttribute) > 0)
450 foreach ($this->customAttribute as $key =>
$value)
452 $field->setAttribute($key,
$value);
459 if ( $this->value && $this->autocomplete )
463 $info = $this->getAutoCompleteData();
472 $info_ .=
"'$value',";
475 $info_ = substr($info_, 0, -1);
479 $msg = _M(
'[autocomplete]: Field @1 not found!', $this->baseModule) .
'<br/>';
483 if ( $this->page->request(
'cpaint_function') !=
"" )
485 $this->page->addAJAXJsCode(
"setTimeout(\"MIOLO_AutoCompleteDeliver_Ajax(document, {$this->lookup_name}.form, '$msg', '$this->related', new Array($info_) );\", 0);");
489 $this->page->addJSCode(
"MIOLO_AutoCompleteDeliver_Ajax(document, {$this->lookup_name}.form, '$msg', '$this->related', new Array($info_) );");
493 $field->SetClass(
'm-text-field');
496 $field->AddBoxStyle(
'float',
'left');
497 if ( $this->readonly )
499 $field->SetClass(
'm-readonly');
500 $field->AddAttribute(
'readonly');
502 $html = $field->Generate();
503 parent::GenerateInner();
504 $htmlInner = $this->GetInner();
505 $this->inner = $html . $htmlInner;
529 parent::__construct(
$name,
$value,
$label,
$size,
$hint,
$validator,
$related,
$module,
$item,
$event,
$filter,
$autocomplete);
530 $this->page->AddScript(
'x/x_core.js');
531 $this->page->AddScript(
'm_lookup_ajax.js');
532 $this->page->AddScript(
'm_popup.js');
538 $this->showLabel = ($this->formMode == 2);
540 $label = $this->painter->span($span) . $this->painter->BR;
541 $form = ($this->form == NULL) ?
$page->name : $this->form->name;
545 $filter = is_array($this->filter) ? $this->filter : array($this->filter);
546 $attr = $this->GetAttributes();
547 $content[] =
new MSpan(
'',
' ');
549 $w = ($this->lwidth !=
'') ? $this->lwidth : 400;
550 $h = ($this->lheight !=
'') ? $this->lheight : 250;
553 "lmodule" => $this->module,
554 "event" => $this->event,
555 "related" => $this->related,
556 "lheight" => $this->lheight,
557 "lwidth" => $this->lwidth
561 $params[
"filter$k"] = $f;
564 $url = $this->manager->GetActionURL($this->baseModule,
'activelookup',
$item, $params);
565 $button =
new MButtonFind(
"javascript:MIOLO_ActiveLookup('$lookup_name',200,200,$w,$h, '{$url}','','{$this->name}',1);");
566 $content[] = $button->Generate();
567 if ( $this->readonly )
569 $ro =
new MSpan($this->name,$this->value,
'm-readonly');
570 $this->inner = (($this->showLabel && ($this->label !=
'')) ?
$label :
'') . $this->painter->span($ro);
573 $field =
new MTextField($this->name,$this->value,$this->label,$this->size,$this->hint, $this->validator);
575 $field->SetClass(
'm-text-field');
576 $html = $field->GetRender(
'inputtext') . $this->painter->GenerateToString($content);
577 $this->inner = $html;
__construct($name='', $value='', $label='', $size=10, $hint='', $validator=null, $related='', $module='', $item='', $event='', $filter='', $autocomplete=false)
static _REQUEST( $vars, $from='ALL')
SetModuleItem($module, $item)
__construct($name='', $value='', $label='', $hint='', $related='', $module='', $item='', $event='filler', $filter='')
setWindowSize( $width, $height)
setShowButton( $show=true)
setWindowType( $windowType='iframe', $width='', $height='', $top='', $left='')
SetModuleItem($module, $item)
__construct($name='', $value='', $label='', $hint='', $related='', $module='', $item='', $event='filler', $filter='')
setWindowSize( $width, $height)
setShowButton( $show=true)
setWindowType( $windowType='iframe', $width='', $height='', $top='', $left='')
__construct($name='', $value='', $label='', $size=10, $hint='', $validator=null, $related='', $module='', $item='', $event='', $filter='', $autocomplete=false)
__construct($name='', $value='', $label='', $size=10, $hint='', $validator=null, $related='', $module='', $item='', $event='filler', $filter='', $autocomplete=true)
setCustomAttribute($customAttribute)
__construct($name='', $value='', $label='', $size=10, $hint='', $validator=null, $related='', $module='', $item='', $event='filler', $filter='', $autocomplete=true)
static getBooleanValue($value)