Optimize for smartphones

This commit is contained in:
Laurent Destailleur 2013-04-05 22:26:41 +02:00
parent 1fb3159045
commit b47765f721
3 changed files with 25 additions and 61 deletions

View File

@ -869,7 +869,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar').' <input type="submit" style="width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -878,7 +878,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek').' <input type="submit" style="width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -887,7 +887,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday').' <input type="submit" style="width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n";
print '</td>';
print '</tr>';

View File

@ -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')

View File

@ -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.='<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="9" maxlength="11" value="'.$formated_date.'"';
@ -3355,14 +3359,13 @@ class Form
$retstring.='<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\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.='<select'.($disabled?' disabled="disabled"':'').' class="flat" name="'.$prefix.'day">';
@ -3373,15 +3376,7 @@ class Form
for ($day = 1 ; $day <= 31; $day++)
{
if ($day == $sday)
{
$retstring.="<option value=\"$day\" selected=\"selected\">$day";
}
else
{
$retstring.="<option value=\"$day\">$day";
}
$retstring.="</option>";
$retstring.='<option value="'.$day.'"'.($day == $sday ? ' selected="selected"':'').'>'.$day.'</option>';
}
$retstring.="</select>";
@ -3412,15 +3407,7 @@ class Form
for ($year = $syear - 5; $year < $syear + 10 ; $year++)
{
if ($year == $syear)
{
$retstring.="<option value=\"$year\" selected=\"true\">".$year;
}
else
{
$retstring.="<option value=\"$year\">".$year;
}
$retstring.="</option>";
$retstring.='<option value="'.$year.'"'.($year == $syear ? ' selected="true"':'').'>'.$year.'</option>';
}
$retstring.="</select>\n";
}
@ -3436,21 +3423,11 @@ class Form
if ($empty) $retstring.='<option value="-1">&nbsp;</option>';
for ($hour = 0; $hour < 24; $hour++)
{
if (dol_strlen($hour) < 2)
{
$hour = "0" . $hour;
}
if ($hour == $shour)
{
$retstring.="<option value=\"$hour\" selected=\"true\">$hour</option>";
}
else
{
$retstring.="<option value=\"$hour\">$hour</option>";
}
if (strlen($hour) < 2) $hour = "0" . $hour;
$retstring.='<option value="'.$hour.'"'.(($hour == $shour)?' selected="true"':'').'>'.$hour.(empty($conf->dol_optimize_smallscreen)?'':'H').'</option>';
}
$retstring.="</select>";
$retstring.="H\n";
$retstring.='</select>';
if (empty($conf->dol_optimize_smallscreen)) $retstring.=":";
}
if ($m)
@ -3460,21 +3437,10 @@ class Form
if ($empty) $retstring.='<option value="-1">&nbsp;</option>';
for ($min = 0; $min < 60 ; $min++)
{
if (dol_strlen($min) < 2)
{
$min = "0" . $min;
}
if ($min == $smin)
{
$retstring.="<option value=\"$min\" selected=\"true\">$min</option>";
}
else
{
$retstring.="<option value=\"$min\">$min</option>";
}
if (strlen($min) < 2) $min = "0" . $min;
$retstring.='<option value="'.$min.'"'.(($min == $smin)?' selected="true"':'').'>'.$min.(empty($conf->dol_optimize_smallscreen)?'':'').'</option>';
}
$retstring.="</select>";
$retstring.="M\n";
$retstring.='</select>';
}
// Add a "Now" button