using egw.LAB.wait for jscalendar

This commit is contained in:
Ralf Becker 2013-04-03 07:49:04 +00:00
parent b9a43091dc
commit da32eb81fb

View File

@ -130,30 +130,23 @@ class jscalendar
" onBlur=\"self.status=''; return true;\""; " onBlur=\"self.status=''; return true;\"";
} }
if ($jsreturn) $html = '<input type="text" id="'.$name.'" name="'.$name.'" size="10" value="'.htmlspecialchars($date).'"'.$options.'/>
{ '.($useicon ? '<img id="'.$name.'-trigger" src="'.common::find_image('phpgwapi','datepopup').'" title="'.lang('Select date').'" style="cursor:pointer; cursor:hand;">' : '');
$return_array = array(
'html' => '<input type="text" id="'.$name.'" name="'.$name.'" size="10" value="'.htmlspecialchars($date).'"'.$options.'/>'.
($useicon ? '<img id="'.$name.'-trigger" src="'.common::find_image('phpgwpai','datepopup').'" title="'.lang('Select date').'" style="cursor:pointer; cursor:hand;"/>' : ''),
'js' => 'Calendar.setup({inputField : "'.$name.'"'.($useicon ? ',button: "'.$name.'-trigger"' : '').' });'
);
return $return_array; $js = '<script type="text/javascript">
} '.(!$useicon ? ' document.getElementById("'.$name.'").readOnly=true;' : '').
return ' egw.LAB.wait(function() {
'<input type="text" id="'.$name.'" name="'.$name.'" size="10" value="'.htmlspecialchars($date).'"'.$options.'/> Calendar.setup({
'.($useicon ? '<img id="'.$name.'-trigger" src="'.common::find_image('phpgwapi','datepopup').'" title="'.lang('Select date').'" style="cursor:pointer; cursor:hand;">' : '').
'<script type="text/javascript">
'.(!$useicon ? 'document.getElementById("'.$name.'").readOnly=true;' : '').
'Calendar.setup(
{
inputField : "'.$name.'",'.(!$useicon ? '' : ' inputField : "'.$name.'",'.(!$useicon ? '' : '
button : "'.$name.'-trigger"').', button : "'.$name.'-trigger"').',
onUpdate : function(){var input = document.getElementById("'.$name.'"); $j(input).change(); } onUpdate : function(){var input = document.getElementById("'.$name.'"); $j(input).change(); }
} })
); });
</script> </script>
'; ';
if ($jsreturn) return array('html' => $html, 'js' => $js);
return $html."\n".$js;
} }
/** /**
@ -234,8 +227,8 @@ function monthClicked(calendar,monthstart) {
} }
' : '').' ' : '').'
Calendar.setup( egw.LAB.wait(function() {
{ Calendar.setup({
flat : "'.$id.'", flat : "'.$id.'",
flatCallback : dateChanged'.($weekUrl ? ', flatCallback : dateChanged'.($weekUrl ? ',
flatWeekCallback : weekClicked' : '').($weekTTip ? ', flatWeekCallback : weekClicked' : '').($weekTTip ? ',
@ -245,9 +238,8 @@ function monthClicked(calendar,monthstart) {
flatTodayCallback : todayClicked, flatTodayCallback : todayClicked,
date : "'.$date.'" date : "'.$date.'"
' : '').' ' : '').'
} });
); });
</script>'; </script>';
} }