Task #0002050: Mobile : menu différent

This commit is contained in:
sparkyx 2021-07-29 18:04:25 +02:00
parent 9b5ece1cb7
commit b974417084
22 changed files with 2240 additions and 1285 deletions

View file

@ -309,7 +309,9 @@ $path = array(
// report definition // report definition
"report_definition"=>"ajax_report_definition", "report_definition"=>"ajax_report_definition",
// search all card , analytic or accounting // search all card , analytic or accounting
"search_account_card"=>"ajax_search_account_card" "search_account_card"=>"ajax_search_account_card",
// Mobile device menu from mobile_device_mtable
"mobile_device_menu"=>"ajax_mobile_device_menu"
) ; ) ;
if (array_key_exists($op, $path)) { if (array_key_exists($op, $path)) {

View file

@ -563,23 +563,53 @@ select {
padding: 3px; padding: 3px;
} }
.infobulle { .infobulle {
position:absolute; position:absolute;
border:1px solid #000000; border:1px solid #000000;
background-color:#FCFFCC; background-color:#FCFFCC;
padding-bottom: 10px; padding-bottom: 10px;
padding-top: 10px; padding-top: 10px;
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
color:#000000; color:#000000;
top:0px;left:0px; top:0px;left:0px;
visibility:hidden; visibility:hidden;
width:400px; width:80%;
width:25rem; z-index:20;
z-index:20; }
/* SM */
@media (min-width: 576px) {
.infobulle {
position:absolute;
border:1px solid #000000;
background-color:#FCFFCC;
padding-bottom: 10px;
padding-top: 10px;
padding-left: 10px;
padding-right: 10px;
color:#000000;
top:0px;left:0px;
visibility:hidden;
width:400px;
width:25rem;
z-index:20;
}
} }
/* MD */
@media (min-width: 768px) {
}
/* LG */
@media (min-width: 992px) {
}
/* XL */
@media (min-width: 1200px) {
}
/**========*/
span.action { span.action {
height:48px; height:48px;
@ -1593,7 +1623,21 @@ div#bookmark_div {
left:30%; left:30%;
width:40%; width:40%;
} }
#error_div{
position:absolute;
border:1px solid #000000;
background-color:#DDE6FF;
padding-bottom: 2px;
padding-top: 2px;
padding-left: 2px;
padding-right: 2px;
color:#FF0000;
top:14%;left:2%;
visibility:hidden;
z-index:20;
}
/* SM */
@media (min-width: 576px) {
#error_div{ #error_div{
position:absolute; position:absolute;
border:1px solid #000000; border:1px solid #000000;
@ -1609,6 +1653,36 @@ div#bookmark_div {
width:40rem; width:40rem;
z-index:20; z-index:20;
} }
}
/* MD */
@media (min-width: 768px) {
}
/* LG */
@media (min-width: 992px) {
#error_div{
position:absolute;
border:1px solid #000000;
background-color:#DDE6FF;
padding-bottom: 2px;
padding-top: 2px;
padding-left: 2px;
padding-right: 2px;
color:#FF0000;
top:40%;left:25%;
visibility:hidden;
width:640px;
width:40rem;
z-index:20;
}
}
/* XL */
@media (min-width: 1200px) {
}
/**========*/
#error_div h2 { #error_div h2 {
background: #FF0000; background: #FF0000;
} }
@ -2960,7 +3034,7 @@ span.tagcell {
color:white; color:white;
} }
.nav-pills .nav-link.active { .nav-pills .nav-link.active {
background-color: #70829d !important; background-color: hsl(224, 42%, 51.7%) !important;
border-radius: 0px; border-radius: 0px;
} }
.nav-pills .nav-link { .nav-pills .nav-link {
@ -2972,7 +3046,7 @@ li.li-active {
} }
.nav-level2 { .nav-level2 {
background-color: #0b2d99; background-color: hsl(240, 39%, 41.2%);
} }
.nav-level2>li { .nav-level2>li {
border-right: 1px #9fbcd6 ridge; border-right: 1px #9fbcd6 ridge;
@ -3027,3 +3101,22 @@ li.li-active {
color:white !important; color:white !important;
border: 0px solid black; border: 0px solid black;
} }
/**
* Module for smartphone menu
*/
#mobile_module .nav-pills a.nav-link {
background-color:transparent !important;
color:navy !important;
border:1px solid blue;
margin:0px;
border-radius: 0px;
}
#mobile_module .nav-pills a.nav-link:hover {
background-color: navy !important;
color:white !important;
border-radius: 0px;
}
#mobile_module h1 {
text-align: center;
font-weight: 700;
}

View file

@ -312,7 +312,6 @@ function action_add(p_dossier) {
if (p_xml.responseText === 'NOCONX') { reconnect();return;} if (p_xml.responseText === 'NOCONX') { reconnect();return;}
remove_waiting_box(); remove_waiting_box();
add_div({id: 'action_add_div', add_div({id: 'action_add_div',
style:"top:1%;width:80%;left:10%" ,
cssclass: 'inner_box'}); cssclass: 'inner_box'});
$('action_add_div').innerHTML=p_xml.responseText; $('action_add_div').innerHTML=p_xml.responseText;
p_xml.responseText.evalScripts(); p_xml.responseText.evalScripts();

View file

@ -2034,7 +2034,7 @@ function show_fin_chdate(obj_id)
function profile_show(p_div) function profile_show(p_div)
{ {
try { try {
var div = ['profile_gen_div', 'profile_menu_div', 'profile_print_div', 'profile_gestion_div', 'profile_repo_div']; var div = ['profile_gen_div', 'profile_menu_div', 'profile_print_div', 'profile_gestion_div', 'profile_repo_div','profile_menu_mobile_div'];
for (var r = 0; r < div.length; r++) { for (var r = 0; r < div.length; r++) {
$(div[r]).hide(); $(div[r]).hide();
} }

View file

@ -25,7 +25,7 @@ include_once NOALYSS_INCLUDE.'/lib/ac_common.php';
* \brief Login page * \brief Login page
*/ */
require_once NOALYSS_INCLUDE.'/class/database.class.php';
// Verif if User and Pass match DB // Verif if User and Pass match DB
// if no, then redirect to the login page // if no, then redirect to the login page
$rep=new Database(); $rep=new Database();
@ -37,11 +37,9 @@ if (defined('MULTI') && MULTI == 0)
if ( isset ($_POST["p_user"] ) ) if ( isset ($_POST["p_user"] ) )
{ {
$g_user=strtolower(sql_string($_POST["p_user"]));
$g_pass=$_POST["p_pass"];
$_SESSION[SESSION_KEY.'g_user']=$g_user;
$_SESSION[SESSION_KEY.'g_pass']=$g_pass;
$User=new User($rep);
$User->Check(false,'LOGIN');
/* /*
@ -57,9 +55,6 @@ if ( isset ($_POST["p_user"] ) )
echo "<META HTTP-EQUIV=\"REFRESH\" content=\"3;url=admin-noalyss.php??action=upgrade&sb=database\">"; echo "<META HTTP-EQUIV=\"REFRESH\" content=\"3;url=admin-noalyss.php??action=upgrade&sb=database\">";
exit(); exit();
} }
require_once NOALYSS_INCLUDE."/class/user.class.php";
$User=new User($rep);
$User->Check(false,'LOGIN');
if (defined('NOALYSS_CAPTCHA') && NOALYSS_CAPTCHA==true) if (defined('NOALYSS_CAPTCHA') && NOALYSS_CAPTCHA==true)
{ {
include("securimage/securimage.php"); include("securimage/securimage.php");
@ -70,15 +65,21 @@ if ( isset ($_POST["p_user"] ) )
echo alert(_('Code invalide')); echo alert(_('Code invalide'));
echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url=index.php\">"; echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url=index.php\">";
exit(); exit();
}
} }
if ($User->get_access_mode()=='PC')
{
// force the nocache
$backurl='user_login.php?v='.microtime(true);
if ( isset ($_POST['backurl'])) {
$backurl=urldecode($_POST['backurl']);
}
echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url={$backurl}\">";
exit();
} else {
echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url=mobile.php\">";
exit();
} }
// force the nocache
$backurl='user_login.php?v='.microtime(true);
if ( isset ($_POST['backurl'])) {
$backurl=urldecode($_POST['backurl']);
}
echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url={$backurl}\">";
exit();
} }
else else
{ {
@ -99,8 +100,6 @@ else
} }
include_once ("class/user.class.php");
$User=new User($rep); $User=new User($rep);
$User->Check(); $User->Check();

100
html/mobile.php Normal file
View file

@ -0,0 +1,100 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2021) Author Dany De Bontridder <danydb@noalyss.eu>
/**
* @file
* @brief only for mobile device
*/
require_once '../include/constant.php';
global $g_user;
$cn=new Database();
$g_user=new \User($cn);
$g_user->check();
define ('ALLOWED',true);
//-----------------------------------------------------------------
/// if $_REQUEST['gDossier'] is not set then select the folder
//-----------------------------------------------------------------
$http=new HttpInput();
$dossier_id=$http->request("gDossier","number",-1);
if ($dossier_id === -1) {
// count the available folder
$cnt_folder=$g_user->get_available_folder();
// if there is no available folder , then exit
if ($cnt_folder==0) {
echo _("Aucun dossier disponible");
redirect(NOALYSS_URL."/index.php", 3);
return;
}
if (count($cnt_folder ) == 1) {
// if only one folder available , connect to it
$dossier_id=$cnt_folder[0]['dos_id'];
put_global(array(['key'=>'gDossier',"value"=>$dossier_id]));
} else {
$mobile=new \Noalyss\Mobile();
//-----------------------------------------------------------------
// --- load the javascript and start a page ----------------------
//-----------------------------------------------------------------
$mobile->page_start();
// propose to select the available folder
echo '<ul class="nav bg-light flex-column">';
foreach ($cnt_folder as $folder)
{
echo '<li>';
echo '<a class="nav-item nav-link " href="mobile.php?gDossier='.$folder['dos_id'].'">';
echo $folder['dos_id']." ".$folder['dos_name']." ".$folder["dos_description"];
echo '</a>';
echo '</li>';
}
echo '</ul>';
return;
}
}
// we are connected to a folder
global $g_user,$cn;
$cn=Dossier::connect();
$g_user->setDb($cn);
global $g_parameter;
$g_parameter=new Noalyss_Parameter_Folder($cn);
$mobile=new \Noalyss\Mobile();
$ac=trim($http->request("ac","string",""));
//-----------------------------------------------------------------
/// If a module is selected the execute it
//-----------------------------------------------------------------
if ( $ac !== "" && $g_user->check_module($ac) == 1) {
// if $ac is in the mobile profile then execute it
$mobile->execute_menu($ac);
} else {
//-----------------------------------------------------------------
/// inside a folder , propose a menu
//-----------------------------------------------------------------
$mobile->page_start();
$mobile->display_menu();
}

View file

@ -39,18 +39,19 @@ $profile=new Profile_sql($cn,$p_id);
$gDossier=Dossier::id(); $gDossier=Dossier::id();
$add_impression=HtmlInput::button("add", _("Ajout Menu"),"onclick=\"add_menu({dossier:$gDossier,p_id:$p_id,type:'pr'})\""); $add_impression=HtmlInput::button("add", _("Ajout Menu"),"onclick=\"add_menu({dossier:$gDossier,p_id:$p_id,type:'pr'})\"");
$call_tab=$http->post('tab', "string",'profile_gen_div'); $call_tab=$http->post('tab', "string",'profile_gen_div');
$a_tab=array('profile_gen_div'=>'tabs','profile_menu_div'=>'tabs','profile_print_div'=>'tabs','profile_gestion_div'=>'tabs','profile_repo_div'=>'tabs'); $a_tab=array('profile_gen_div'=>'tabs','profile_menu_div'=>'tabs','profile_print_div'=>'tabs','profile_gestion_div'=>'tabs','profile_repo_div'=>'tabs',"profile_menu_mobile_div"=>"tabs");
$a_tab[$call_tab]='tabs_selected'; $a_tab[$call_tab]='tabs_selected';
?> ?>
<h1>Profil <?php echo $profile->p_name?></h1> <h1>Profil <?php echo $profile->p_name?></h1>
<?php <?php
echo HtmlInput::anchor(_('Retour'), "", " onclick = \" $('detail_profile').hide();$('list_profile').show(); \" ", 'class="line"'); echo HtmlInput::anchor("&#10094;"._('Retour'), "", " onclick = \" $('detail_profile').hide();$('list_profile').show(); \" ", 'class="line"');
?> ?>
<?php if ($p_id > 0 ) : ?> <?php if ($p_id > 0 ) : ?>
<ul class="tabs"> <ul class="tabs">
<li class="<?php echo $a_tab['profile_gen_div']?>"><a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_gen_div')"><?php echo _('Nom')?></a></li> <li class="<?php echo $a_tab['profile_gen_div']?>"><a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_gen_div')"><?php echo _('Nom')?></a></li>
<li class="<?php echo $a_tab['profile_menu_div']?>"><a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_menu_div')"><?php echo _('Détail Menus')?></a></li> <li class="<?php echo $a_tab['profile_menu_div']?>"><a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_menu_div')"><?php echo _('Détail Menus')?></a></li>
<li class="<?php echo $a_tab['profile_menu_mobile_div']?>"><a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_menu_mobile_div')"><?php echo _('Menu SmartPhone')?></a></li>
<li class="<?php echo $a_tab['profile_print_div']?>"><a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_print_div')"><?php echo _('Détail Impressions')?></a></li> <li class="<?php echo $a_tab['profile_print_div']?>"><a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_print_div')"><?php echo _('Détail Impressions')?></a></li>
<li class="<?php echo $a_tab['profile_gestion_div']?>"><a href="javascript:void(0)" style="" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_gestion_div')"><?php echo _('Groupe Gestion')?> </a></li> <li class="<?php echo $a_tab['profile_gestion_div']?>"><a href="javascript:void(0)" style="" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_gestion_div')"><?php echo _('Groupe Gestion')?> </a></li>
<li class="<?php echo $a_tab['profile_repo_div']?>"><a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_repo_div')"><?php echo _('Dépôts')?></a>&nbsp; <li class="<?php echo $a_tab['profile_repo_div']?>"><a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_repo_div')"><?php echo _('Dépôts')?></a>&nbsp;
@ -112,6 +113,12 @@ if ($profile->p_id > 0)
$profile_menu->p_id=$p_id; $profile_menu->p_id=$p_id;
$profile_menu->display_profile_menu_detail(); $profile_menu->display_profile_menu_detail();
echo '</div>'; echo '</div>';
echo '<div class="myfieldset" style="display:none" id="profile_menu_mobile_div">';
$profile_menu->mobile_device();
echo '</div>';
echo '<div class="myfieldset" style="display:none" id="profile_print_div">'; echo '<div class="myfieldset" style="display:none" id="profile_print_div">';
echo "<h1 class=\"legend\">"._("Impression")."</h1>"; echo "<h1 class=\"legend\">"._("Impression")."</h1>";
$profile_menu->printing(); $profile_menu->printing();

View file

@ -0,0 +1,66 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2021) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
/**
* @file
* @brief callback script for mobile_device_mtable
* @see Mobile_Device_MTable
*/
$http=new HttpInput();
try
{
$table=$http->request('table');
$action=$http->request('action');
$p_id=$http->request('p_id', "number");
$ctl_id=$http->request('ctl');
$profile_id=$http->request("profile_id","number");
}
catch (Exception $e)
{
echo $e->getMessage();
return;
}
$object= Mobile_Device_MTable::build($p_id,$profile_id);
$object->set_profile_id($profile_id);
$object->set_object_name($ctl_id);
$object->send_header();
switch ($action)
{
case "input":
echo $object->ajax_input()->saveXML();
break;
case "save":
echo $object->ajax_save()->saveXML();
break;
case "delete":
echo $object->ajax_delete()->saveXML();
break;
default:
break;
}

View file

@ -7,9 +7,9 @@
* @brief show the calendar * @brief show the calendar
*/ */
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
$http=new HttpInput();
$cal=new Calendar(); $cal=new Calendar();
$cal->default_periode=(isset ($_GET['in']))?$_GET['in']:$g_user->get_periode(); $cal->default_periode=(isset ($_GET['in']))?$http->get("in","number"):$g_user->get_periode();
?> ?>
<div id="calendar_zoom_div"> <div id="calendar_zoom_div">

View file

@ -152,7 +152,8 @@ class Calendar
} }
} }
} }
/*!\brief display a calendar after a call to Calendar::fill /*!
*\brief display a calendar after a call to Calendar::fill
*\param $p_type long or short *\param $p_type long or short
* *
*\return HTML String *\return HTML String

View file

@ -0,0 +1,239 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2021) Author Dany De Bontridder <danydb@noalyss.eu>
namespace Noalyss;
use \HtmlInput;
use \Dossier;
use \User;
/**
* @file
* @brief Main class for Mobile device
*/
/**
* @class Mobile
* @brief Main class for Mobile device
*/
class Mobile
{
/**
* @brief Load a module with all its data from database thanks the access_code
* @global \Noalyss\type $g_user
* @param type $p_access_code
* @return type
*/
function load_module($p_access_code)
{
global $g_user;
$cn=Dossier::connect();
$aModule=$cn->get_row("
select
me_file,me_parameter,me_javascript,me_type,menu_ref.me_code,
pmo_id,pmo_order,pmo_default
from menu_ref
join profile_mobile using (me_code)
where
me_code=$1 and
(me_file is not null or trim(me_file) <>'' or
me_javascript is not null or trim (me_javascript) <> '')
and profile_mobile.p_id=$2",
array($p_access_code,$g_user->get_profile()));
if (count($aModule)==0)
{
return [];
}
return $aModule;
}
/**
* @brief HTML Page
* @staticvar int $already_call
* @return type
*/
function page_start()
{
// check not called twiced
static $already_call=0;
if ($already_call==1)
return;
$already_call=1;
$style="style-classic7.css";
$title="NOALYSS";
echo '<!doctype html>';
printf("\n");
echo "<HTML>";
echo "<HEAD>";
echo '<meta charset="utf-8">';
echo "<META http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">";
echo "
<TITLE>$title</TITLE>
<link rel=\"icon\" type=\"image/ico\" href=\"favicon.ico\" />
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
<LINK id=\"bootstrap\" REL=\"stylesheet\" type=\"text/css\" href=\"css/bootstrap.min.css\" media=\"screen\"/>
<LINK id=\"fontello\" REL=\"stylesheet\" type=\"text/css\" href=\"css/font/fontello/css/fontello.css\" media=\"screen\"/>
<LINK id=\"pagestyle\" REL=\"stylesheet\" type=\"text/css\" href=\"css/".$style."?version=".SVNINFO."\" media=\"screen\"/>
<link rel=\"stylesheet\" type=\"text/css\" href=\"css/style-print.css?version=".SVNINFO."\" media=\"print\"/>";
// preload font
echo '<link rel="preload" href="./css/font/OpenSansRegular.woff" as="font" crossorigin="anonymous" />';
echo '<link rel="preload" href="./css/font/SansationLight/SansationLight.woff" as="font" crossorigin="anonymous" />';
echo '<link rel="preload" href="./css/font/fontello/fontello.woff" as="font" crossorigin="anonymous" />';
echo '<script language="javascript" src="js/calendar.js"></script>
<script type="text/javascript" src="js/lang/calendar-en.js"></script>';
if (isset($_SESSION[SESSION_KEY.'g_lang'])&&$_SESSION[SESSION_KEY.'g_lang']=='fr_FR.utf8')
{
echo '<script type="text/javascript" src="js/lang/calendar-fr.js"></script>';
}
elseif (isset($_SESSION[SESSION_KEY.'g_lang'])&&$_SESSION[SESSION_KEY.'g_lang']=='nl_NL.utf8')
{
echo '<script type="text/javascript" src="js/lang/calendar-nl.js"></script>';
}
echo '
<script language="javascript" src="js/calendar-setup.js"></script>
<LINK REL="stylesheet" type="text/css" href="css/calendar-blue.css" media="screen">
';
// language
if (isset($_SESSION[SESSION_KEY.'g_lang']))
{
set_language();
}
echo load_all_script();
echo ' </HEAD> ';
echo "<BODY>";
echo '<div id="info_div"></div>';
echo '<div id="error_div">'.
HtmlInput::title_box(_("Erreur"), 'error_div', 'hide').
'<div id="error_content_div">'.
'</div>'.
'<p style="text-align:center">'.
HtmlInput::button_action('Valider',
'$(\'error_div\').style.visibility=\'hidden\';$(\'error_content_div\').innerHTML=\'\';').
'</p>'.
'</div>';
}
/**
* @brief Display the menu available for this folder
*
*/
public function display_menu()
{
if (DEBUGNOALYSS>1)
{
echo __CLASS__."&rarr;".__FUNCTION__;
}
$cn=Dossier::connect();
$user=new User($cn);
$aModule=$cn->get_array("select *
from profile_mobile pm
join menu_ref mr on (pm.me_code=mr.me_code)
where p_id=$1 order by pmo_order", [$user->get_profile()]);
require_once NOALYSS_TEMPLATE."/mobile-display_menu.php";
}
/**
* @brief execute the menu
* @global type $g_user
* @staticvar int $level
* @param type $p_access_code
* @return type
*/
public function execute_menu($p_access_code)
{
global $g_user,$g_parameter,$cn;
$aModule=$this->load_module($p_access_code);
if ( empty($aModule)) {
return;
}
/*-- Load the standard headers if needed -- */
if ( $aModule['pmo_default'] == 1) {
$this->page_start();
}
echo HtmlInput::anchor("&#10094;"._("Retour"), "mobile.php?".http_build_query(["gDossier"=>Dossier::id()]));
if ($aModule['me_file']!="")
{
if ($aModule['me_parameter']!=="")
{
// if there are paramter put them in superglobal
$array=compute_variable($aModule['me_parameter']);
put_global($array);
}
if (DEBUGNOALYSS==2)
{
echo $aModule['me_file'], " param : ", $aModule['me_parameter'];
}
/*
* Log the file we input to put in the folder test-noalyss for replaying it
*/
if (LOGINPUT)
{
$file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php', 'a+');
fwrite($file_loginput, "include '".$aModule['me_file']."';");
fwrite($file_loginput, "\n");
fclose($file_loginput);
}
// if file is not a plugin, include the file, otherwise
// include the plugin launcher
if ($aModule['me_type']!='PL')
{
if (file_exists($aModule['me_file']))
{
require_once $aModule['me_file'];
}
elseif (file_exists(NOALYSS_INCLUDE.'/'.$aModule['me_file']))
{
require_once NOALYSS_INCLUDE.'/'.$aModule['me_file'];
}
else
{
echo echo_warning(_("Fichier non trouvé"));
}
}
else
{
require 'extension_get.inc.php';
}
exit();
}
elseif ($aModule['me_javascript']!='')
{
$js=str_replace('<DOSSIER>', dossier::id(), $aModule['me_javascript']);
echo create_script($js);
}
}
}

View file

@ -0,0 +1,153 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2021) Author Dany De Bontridder <danydb@noalyss.eu>
/**
* @file
* @brief Manage the table profile_mobile
*/
/**
* @class Mobile_Device_MTable
* @brief Manage the table profile_mobile
*/
class Mobile_Device_MTable extends Manage_Table_SQL
{
private $profile_id; //!< profile_mobile.p_id profile
function __construct(Profile_Mobile_SQL $p_table)
{
parent::__construct($p_table);
$this->set_append_row(true);
$this->set_delete_row(true);
$this->set_col_label("me_code", _("Code Menu"));
$this->set_col_label("pmo_order", _("Ordre apparition"));
$this->set_col_label("pmo_default", _("Entêtes standards"));
$this->set_col_tips("pmo_default",80 );
$this->set_property_visible("pmo_id", false);
$this->set_property_visible("p_id", false);
$this->set_col_type("pmo_default", "select",array(
["value"=>1,"label"=>_("Oui")],
["value"=>0,"label"=>_("Non")]
));
$this->set_col_type("me_code","custom");
$this->set_col_type("pmo_order","numeric");
$this->set_header_option("pmo_order",'style="text-align:right;"');
$this->set_callback("ajax_misc.php");
$this->add_json_param("op","mobile_device_menu");
$this->set_sort_column("pmo_order");
$this->set_col_sort(1);
$this->set_order(["me_code","pmo_order","pmo_default"]);
$this->set_object_name("profile_menu_mtable");
}
public function get_profile_id()
{
return $this->profile_id;
}
public function set_profile_id($profile_id)
{
$this->profile_id=$profile_id;
$this->get_table()->setp('p_id',$profile_id);
$this->add_json_param("profile_id",$profile_id);
return $this;
}
/**
* @brief
* @param number $p_id profile_mobile.pmo_id
* @param number $profile_id profile_mobile.p_id profile
* @return \Mobile_Device_MTable
*/
static function build($p_id,$profile_id)
{
$cn=Dossier::connect();
$profile_mobile=new Profile_Mobile_SQL($cn,$p_id);
if ( $p_id== -1) {
$profile_mobile->setp("pmo_order",5);
$profile_mobile->setp("pmo_default",1);
}
$mobile_device_table=new Mobile_Device_MTable($profile_mobile);
/* $mobile_device_table->set_profile_id($profile_id);
$mobile_device_table->get_table()->setp('p_id',$profile_id);*/
return $mobile_device_table;
}
function input_custom($p_key,$p_value)
{
if ( $p_key == "me_code") {
$select = new ISelect("me_code");
$cn=$this->get_table()->get_cn();
$select->value=$cn->make_array("select me_code , me_code ||' '||coalesce(me_description,'') from menu_ref
where
me_type in ('PL','ME') and trim(me_code) != 'new_line'
order by me_code");
$select->rowsize=17;
$select->selected=$p_value;
echo td($select->input());
return;
}
}
function display_row_custom($p_key, $p_value, $p_id=0)
{
if ( $p_key == 'me_code') {
echo td($p_value);
return;
}
}
/**
* @brief before inserting or updating, check that the data are correct ,
*
*/
function check()
{
// DB connection
$cn=$this->get_table()->cn;
// object to insert
$profile_mobile_sql=$this->get_table();
$profile_mobile_sql->me_code=strtoupper($profile_mobile_sql->getp('me_code'));
$me_code=$profile_mobile_sql->me_code;
$profile_id=$profile_mobile_sql->getp("p_id");
$pmo_id=$profile_mobile_sql->getp("pmo_id");
// check for duplicate
if ( $cn->get_value("select count(*) from profile_mobile where p_id = $1 and me_code=$2 and pmo_id <> $3",
array($profile_id,$me_code,$pmo_id )) > 0
) {
$this->set_error("me_code", _("Doublon"));
}
if (isNumber($profile_mobile_sql->getp("pmo_order")) != 1 ) {
$this->set_error("pmo_order", _("doit être un nombre"));
}
if ( $cn->get_value("select count(*) from menu_ref where me_code=$1",[$me_code]) == 0) {
$this->set_error ("me_code",_('Menu code invalide'));
}
if ($this->count_error() > 0) {
return false;
}
return true;
}
}

View file

@ -21,12 +21,18 @@
require_once NOALYSS_INCLUDE.'/database/profile_menu_sql.class.php'; require_once NOALYSS_INCLUDE.'/database/profile_menu_sql.class.php';
/** /**
* Manage the menu of a profile * @file
* @brief Manage the menu of a profile
* *
* @author dany * @author dany
*/ */
/**
* @class Profile_Menu
* @brief Manage the menu of a profile
*/
class Profile_Menu extends Profile_Menu_sql class Profile_Menu extends Profile_Menu_sql
{ {
function __construct($p_cn, $p_id=-1) function __construct($p_cn, $p_id=-1)
{ {
@ -35,7 +41,7 @@ class Profile_Menu extends Profile_Menu_sql
} }
/** /**
* Display the content of a profile menu for printing * @brief Display the content of a profile menu for printing
* @param type $resource * @param type $resource
* @param type $p_id * @param type $p_id
*/ */
@ -97,7 +103,7 @@ class Profile_Menu extends Profile_Menu_sql
} }
/** /**
* Show a table with all the menu and the type * @brief Show a table with all the menu and the type
* @param type $p_id profile.p_id * @param type $p_id profile.p_id
*/ */
function display_profile_menu_detail() function display_profile_menu_detail()
@ -224,7 +230,7 @@ class Profile_Menu extends Profile_Menu_sql
} }
/** /**
* Show the available profile for the profile $p_id, it concerns only the action of management (action-gestion) * @brief Show the available profile for the profile $p_id, it concerns only the action of management (action-gestion)
* @param $p_id is the profile p_id * @param $p_id is the profile p_id
*/ */
function available_profile() function available_profile()
@ -250,7 +256,7 @@ class Profile_Menu extends Profile_Menu_sql
} }
/** /**
* Show the available repository for the profile $p_id * @brief Show the available repository for the profile $p_id
* @param $p_id is the profile p_id * @param $p_id is the profile p_id
*/ */
function available_repository() function available_repository()
@ -273,6 +279,14 @@ class Profile_Menu extends Profile_Menu_sql
); );
require_once NOALYSS_TEMPLATE.'/profile_sec_repository.php'; require_once NOALYSS_TEMPLATE.'/profile_sec_repository.php';
} }
/**
* @brief menu for device
*/
function mobile_device() {
$profile_mobile=Mobile_Device_MTable::build(0,$this->p_id);
$profile_mobile->display_table("where p_id=$1 order by pmo_order",[ $this->p_id ]);
echo create_script("profile_menu_mtable.param_add({profile_id:{$this->p_id}});");
}
} }

File diff suppressed because it is too large Load diff

View file

@ -116,7 +116,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
if ( ! defined ("SYSINFO_DISPLAY")) { if ( ! defined ("SYSINFO_DISPLAY")) {
define ("SYSINFO_DISPLAY",TRUE); define ("SYSINFO_DISPLAY",TRUE);
} }
define ("DBVERSION",163); define ("DBVERSION",164);
define ("MONO_DATABASE",25); define ("MONO_DATABASE",25);
define ("DBVERSIONREPO",20); define ("DBVERSIONREPO",20);
define ('NOTFOUND','--not found--'); define ('NOTFOUND','--not found--');
@ -596,8 +596,10 @@ function noalyss_class_autoloader($class) {
"sort_table" => "lib/sort_table.class.php", "sort_table" => "lib/sort_table.class.php",
"table_data_sql" => "lib/table_data_sql.class.php", "table_data_sql" => "lib/table_data_sql.class.php",
"zip_extended" => "lib/zip_extended.class.php", "zip_extended" => "lib/zip_extended.class.php",
"document_state_mtable"=>"class/document_state_mtable.class.php" "document_state_mtable"=>"class/document_state_mtable.class.php",
"noalyss\mobile"=>"class/mobile.class.php",
"profile_mobile_sql"=>"database/profile_mobile_sql.class.php",
"mobile_device_mtable"=>"class/mobile_device_mtable.class.php"
); );
if ( isset ($aClass[$class]) ) { if ( isset ($aClass[$class]) ) {
require_once NOALYSS_INCLUDE."/".$aClass[$class]; require_once NOALYSS_INCLUDE."/".$aClass[$class];

View file

@ -36,7 +36,7 @@ require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
class Profile_Menu_sql extends Table_Data_SQL class Profile_Menu_sql extends Table_Data_SQL
{ {
function __construct(&$p_cn,$p_id=-1) function __construct(&$p_cn, $p_id=-1)
{ {
$this->table="public.profile_menu"; $this->table="public.profile_menu";
$this->primary_key="pm_id"; $this->primary_key="pm_id";
@ -48,7 +48,7 @@ class Profile_Menu_sql extends Table_Data_SQL
, "p_order"=>"p_order" , "p_order"=>"p_order"
, "p_type_display"=>"p_type_display" , "p_type_display"=>"p_type_display"
, "pm_default"=>"pm_default" , "pm_default"=>"pm_default"
,"pm_id_dep"=>"pm_id_dep" , "pm_id_dep"=>"pm_id_dep"
); );
$this->type=array( $this->type=array(

View file

@ -0,0 +1,71 @@
<?php
/**
* Autogenerated file
* This file is part of NOALYSS.
*
* NOALYSS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once NOALYSS_INCLUDE.'/lib/data_sql.class.php';
require_once NOALYSS_INCLUDE.'/class/database.class.php';
/**
* class_profile_mobile_sql.php
*
* @file
* @brief abstract of the table public.profile_mobile */
/**
* @class Profile_Mobile_SQL
* @brief ORM abstract of the table public.profile_mobile
*/
class Profile_Mobile_SQL extends \Table_Data_SQL
{
function __construct(DatabaseCore $p_cn, $p_id=-1)
{
$this->table="public.profile_mobile";
$this->primary_key="pmo_id";
/*
* List of columns
*/
$this->name=array(
"pmo_id"=>"pmo_id"
, "me_code"=>"me_code"
, "pmo_order"=>"pmo_order"
, "p_id"=>"p_id"
, "pmo_default"=>"pmo_default"
);
/*
* Type of columns
*/
$this->type=array(
"pmo_id"=>"numeric"
, "me_code"=>"text"
, "pmo_order"=>"numeric"
, "p_id"=>"numeric"
, "pmo_default"=>"text"
);
$this->default=array(
"pmo_id"=>"auto"
);
$this->date_format="DD.MM.YYYY";
parent::__construct($p_cn, $p_id);
}
}

View file

@ -113,5 +113,5 @@ content[77]="<?php echo htmlspecialchars(_("Permet de chercher dans le suivi pou
content[78]="<?php echo htmlspecialchars($file_too_large,ENT_QUOTES)?>"; content[78]="<?php echo htmlspecialchars($file_too_large,ENT_QUOTES)?>";
content[79]="<?php echo htmlspecialchars(_("Les postes comptables sont entre [] , les fiches entre {} et les postes analytiques entre {{ }}"))?>"; content[79]="<?php echo htmlspecialchars(_("Les postes comptables sont entre [] , les fiches entre {} et les postes analytiques entre {{ }}"))?>";
content[80]="<?php echo htmlspecialchars(_("Oui pour charger les fichiers javascripts et CSS standards"),ENT_QUOTES)?>";
</script> </script>

View file

@ -387,7 +387,7 @@ for ($i=0; $i<Database::num_row($ret); $i++)
$gDossier, $row->p_id); $gDossier, $row->p_id);
echo '<tr>'; echo '<tr>';
echo "<td>".$js.$row->p_name.'</a>'.'</td>'; echo "<td>".$js.$row->p_name.'</a>'.'</td>';
echo td($row->p_desc); echo td($row->p_desc);
echo td($row->with_calc); echo td($row->with_calc);
echo td($row->with_direct_form); echo td($row->with_direct_form);
echo '</tr>'; echo '</tr>';
@ -399,7 +399,8 @@ echo "<td>".$js._("Ajouter un profil")." </td>";
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';
echo '</div>'; echo '</div>';
$profile_mobile=Mobile_Device_MTable::build(0,90);
$profile_mobile->create_js_script();
//******************************************************* //*******************************************************
// Show details of the selected profile // Show details of the selected profile

View file

@ -0,0 +1,22 @@
begin;
drop table if exists profile_mobile;
create table profile_mobile (pmo_id serial primary key , me_code text not null , pmo_order int not null, p_id int not null,pmo_default char default '1');
alter table profile_mobile add constraint profile_mobile_profile_fk foreign key (p_id) references profile (p_id);
alter table profile_mobile add constraint profile_mobile_menu_ref_fk foreign key (me_code) references menu_ref (me_code);
alter table profile_mobile add constraint profile_mobile_code_uq unique (p_id,me_code);
comment on table profile_mobile is 'Menu for mobile device';
comment on column profile_mobile.pmo_id is 'primary key';
comment on column profile_mobile.me_code is 'Code of menu_ref to execute';
comment on column profile_mobile.pmo_order is 'item order in menu';
comment on column profile_mobile.p_id is 'Profile id ';
comment on column profile_mobile.pmo_default is 'possible values are 1 , the default HTML header (javascript,CSS,...) is loaded , 0 nothing is loaded from noalyss ';
insert into profile_mobile (p_id,me_code,pmo_order) select p_id , 'AGENDA',10 from profile;
insert into profile_mobile (p_id,me_code,pmo_order) select p_id , 'LOGOUT',20 from profile;
insert into version (val,v_description) values (164,'Menu for small device : mobile');
commit ;

View file

@ -23,7 +23,8 @@ $nDay=$nFirstDay;
for ($i=0;$i<=6;$i++){ for ($i=0;$i<=6;$i++){
echo "<th>"; echo "<th>";
$nDay=($nDay>6)?0:$nDay; $nDay=($nDay>6)?0:$nDay;
echo $week[$nDay]; echo '<span class="d-none d-sm-block ">'.$week[$nDay].'</span>';
echo '<span class=" d-block d-sm-none">'.substr($week[$nDay],0,2).'</span>';
$nDay++; $nDay++;
echo "</th>"; echo "</th>";
} }
@ -36,18 +37,27 @@ $nCol=0;
$today_month=date('m'); $today_month=date('m');
$today_day=date('j'); $today_day=date('j');
while ($ind <= $this->day) { while ($ind <= $this->day) {
if ( $nCol == 0 ) echo "<tr>"; if ($nCol==0)
{
echo "<tr>";
}
$class="workday"; $class="workday";
if ( $week == 0 || $week == 6) $class="weekend"; if ($week==0||$week==6)
{
$class="weekend";
}
// compute the date // compute the date
$timestamp_date=mktime(0,0,0,$this->month,$ind,$this->year); $timestamp_date=mktime(0,0,0,$this->month,$ind,$this->year);
$date_calendar=date('w',$timestamp_date); $date_calendar=date('w',$timestamp_date);
$st=""; $st="";
if ( $today_month==$this->month && $today_day==$ind) if ($today_month==$this->month&&$today_day==$ind)
$st=' style="border:1px solid red" '; {
$st=' style="border:1px solid red" ';
}
if ( $date_calendar == $week ) { if ( $date_calendar == $week ) {
echo '<td class="'.$class.'" '.$st.'>'.'<span class="day">'.$ind."</span>"; echo '<td class="'.$class.'" '.$st.'>'.'<span class="day">'.$ind."</span>";
echo $cell[$ind]; echo '<span class="d-none d-sm-block ">'.$cell[$ind].'<span>';
echo '<span class="d-block d-sm-none">'.$cell[$ind].'<span>';
echo '</td>'; echo '</td>';
$ind++;$week++;$nCol++; $ind++;$week++;$nCol++;
} else { } else {

View file

@ -0,0 +1,69 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2021) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
/**
* @file
* @brief show the mobile menu
*/
if (DEBUGNOALYSS>1)
{
echo __FILE__;
};
?>
<img src="<?=NOALYSS_URL?>/image/logo9000.png" width="100%" style="position:absolute;top:0px;left:0px;z-index:-1;opacity: 11%">
<div id="mobile_module" >
<h1>NOALYSS</h1>
<ul class="nav nav-pills nav-fill flex-column " >
<?php
foreach ($aModule as $row):
$js="";
$style="";
$style="nav-item-module";
if ($row['me_code']=='new_line')
{
continue;
}
if ($row['me_url']!='')
{
$url=$row['me_url'];
}
elseif ($row['me_javascript']!='')
{
$url="javascript:void(0)";
$js_dossier=str_replace('<DOSSIER>', Dossier::id(), $row['me_javascript']);
$js=sprintf(' onclick="%s"', $js_dossier);
}
else
{
$url="mobile.php?gDossier=".Dossier::id()."&ac=".$row['me_code'];
}
?>
<li class="<?php echo $style ?>">
<a class="nav-link border-1 border-dark rounded-2" href="<?php echo $url ?>" title="<?php echo _($row['me_description']) ?>" <?php echo $js ?> ><?php echo gettext($row['me_menu']) ?></a>
</li>
<?php
endforeach;
?>
</ul>
</div>