From b47765f72175185abaa72b1f7e000444477347a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Apr 2013 22:26:41 +0200 Subject: [PATCH] Optimize for smartphones --- htdocs/comm/action/fiche.php | 6 +-- htdocs/core/class/doleditor.class.php | 8 ++- htdocs/core/class/html.form.class.php | 72 +++++++-------------------- 3 files changed, 25 insertions(+), 61 deletions(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 7eb136047db..b4b91a56836 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -869,7 +869,7 @@ if ($id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendar').' '; + print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' '; print ''."\n"; print '
'; print ''; @@ -878,7 +878,7 @@ if ($id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarweek').' '; + print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' '; print '
'."\n"; print '
'; print ''; @@ -887,7 +887,7 @@ if ($id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarday').' '; + print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' '; print '
'."\n"; print ''; print ''; diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 55cc984c12f..f608d293ee2 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -65,7 +65,7 @@ class DolEditor { global $conf,$langs; - dol_syslog(get_class($this)."::DolEditor htmlname=".$htmlname." toolbarname=".$toolbarname); + dol_syslog(get_class($this)."::DolEditor htmlname=".$htmlname." width=".$width." height=".$height." toolbarname=".$toolbarname); if (! $rows) $rows=round($height/20); if (! $cols) $cols=($width?round($width/6):80); @@ -77,10 +77,8 @@ class DolEditor $this->uselocalbrowser=$uselocalbrowser; // Check if extended editor is ok. If not we force textarea - if (empty($conf->fckeditor->enabled) || ! $okforextendededitor) - { - $this->tool = 'textarea'; - } + if (empty($conf->fckeditor->enabled) || ! $okforextendededitor) $this->tool = 'textarea'; + if ($conf->browser->phone) $this->tool = 'textarea'; // Define content and some properties if ($this->tool == 'ckeditor') diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f251df08cb7..3004e8c6398 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3321,8 +3321,12 @@ class Form if ($d) { + $usecalendar='combo'; + if (! empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) $usecalendar=empty($conf->global->MAIN_POPUP_CALENDAR)?'eldy':$conf->global->MAIN_POPUP_CALENDAR; + if ($conf->browser->phone) $usecalendar='combo'; + // Show date with popup - if (! empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) + if ($usecalendar != 'combo') { $formated_date=''; //print "e".$set_time." t ".$conf->format_date_short; @@ -3333,7 +3337,7 @@ class Form } // Calendrier popup version eldy - if (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR == "eldy") + if ($usecalendar == "eldy") { // Zone de saisie manuelle de la date $retstring.=''."\n"; } else - { - print "Bad value of calendar"; + { + print "Bad value of MAIN_POPUP_CALENDAR"; } } - // Show date with combo selects - if (empty($conf->use_javascript_ajax) || $conf->global->MAIN_POPUP_CALENDAR == "none") - { + else + { // Day $retstring.=''; @@ -3373,15 +3376,7 @@ class Form for ($day = 1 ; $day <= 31; $day++) { - if ($day == $sday) - { - $retstring.=""; + $retstring.=''; } $retstring.=""; @@ -3412,15 +3407,7 @@ class Form for ($year = $syear - 5; $year < $syear + 10 ; $year++) { - if ($year == $syear) - { - $retstring.=""; + $retstring.=''; } $retstring.="\n"; } @@ -3436,21 +3423,11 @@ class Form if ($empty) $retstring.=''; for ($hour = 0; $hour < 24; $hour++) { - if (dol_strlen($hour) < 2) - { - $hour = "0" . $hour; - } - if ($hour == $shour) - { - $retstring.=""; - } - else - { - $retstring.=""; - } + if (strlen($hour) < 2) $hour = "0" . $hour; + $retstring.=''; } - $retstring.=""; - $retstring.="H\n"; + $retstring.=''; + if (empty($conf->dol_optimize_smallscreen)) $retstring.=":"; } if ($m) @@ -3460,21 +3437,10 @@ class Form if ($empty) $retstring.=''; for ($min = 0; $min < 60 ; $min++) { - if (dol_strlen($min) < 2) - { - $min = "0" . $min; - } - if ($min == $smin) - { - $retstring.=""; - } - else - { - $retstring.=""; - } + if (strlen($min) < 2) $min = "0" . $min; + $retstring.=''; } - $retstring.=""; - $retstring.="M\n"; + $retstring.=''; } // Add a "Now" button