Page 1 of 1

add drop-down lists

PostPosted: Mon Mar 11, 2013 6:31 am
by gattaba
hello,
I want to add drop-down lists on the interface VICIDIAL agent.
when I apply the code nothing appears someone could help me


Goautodial 2.0
Vicidial
VERSION: 2.6-392a svn
BUILD: 130102-1135
Asterisk-1.4.27.1-1
Vtiger version 5.1.0
Centos 6.3
digium card : TE122

Re: add drop-down lists

PostPosted: Mon Mar 11, 2013 6:37 am
by bbakirtas
do you have any examples?

add drop-down lists

PostPosted: Mon Mar 11, 2013 10:00 am
by gattaba
Code: Select all
<?php
/* Requête SQL de récupération des données */
$sql = "SELECT id_departement AS idd, departement AS dept, region.id_region AS idr, region ".
"FROM departement, region ".
"WHERE departement.id_region = region.id_region ".
"ORDER BY region.id_region;";
/* Connexion et exécution de la requête */
$connexion = mysql_pconnect($serveur, $admin, $mdp);
if($connexion != false)
{
    $choixbase = mysql_select_db($base, $connexion);
    $recherche = mysql_query($sql, $connexion);
    /* Pour ne pas écraser mes tableaux, je crée un témoin */
    $temoin_r = 0;
    /* Création du tableau PHP des valeurs récupérées */
    $regions = array();
    /* Index du département par tableau régional */
    $id = 0;
    while($ligne = mysql_fetch_assoc($recherche))
    {
        $r = $ligne['idr'];
        $d = $ligne['idd'];
        /* Je vérifie si je suis toujours dans la même région, sinon je crée les tableaux nécessaires */
        if($temoin_r != $r)
        {
            $regions[$r] = array();
            /* J'ajoute laa région */
            $regions[$r][0] = $ligne['region'];
            $regions[$r][1] = array();
            $regions[$r][2] = array();
            $temoin_r = $r;
            $id = 0;
        }
        /* J'ajoute les départements */
        $regions[$r][1][$id] = $d;
        $regions[$r][2][$id] = $ligne['dept'];
        $id++;
    }
    /* On sérialise le tableau obtenu pour traitement par JavaScript */
    $chaine = htmlspecialchars(serialize($regions), ENT_QUOTES);
?>
<script type="text/javascript">
/* <![CDATA[ */
<!--
/*
* Ici, on transmets la chaîne sérialisée à JavaScript
* pour la transformer en tableau indexé JavaScript
*/
var tableau = new PhpArray2Js('<?php echo $chaine; ?>');
var tab = tableau.retour();
// -->
/* ]]> */
</script>
</head>
<body style="font-family: verdana, helvetica, sans-serif; font-size: 85%">
<h3>Version Utilisant JavaScript</h3>
<p>Vous constaterez que le délai de latence entre la sélection et la mise à jour est quasiment inexistant.</p>
<?php
if(isset($_POST['ok']) && isset($_POST['departement']) && $_POST['departement'] != "")
{
    $region_selectionnee = $_POST['region'];
    $dept_selectionne = $_POST['departement'];
?>
<p>Vous avez sélectionné le département <?php echo($dept_selectionne); ?> dans la région <?php echo($region_selectionnee); ?></p>
<?php
}
?>
<form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="post" id="chgdept">
  <fieldset style="border: 3px double #333399">
  <legend>Sélectionnez une région</legend>
    <select name="region" id="region" onchange="changeDept(tab,this.value);">
      <option value="vide">- - - Choisissez une région - - -</option>
    <?php
    /* Construction de la première liste : on se sert du tableau PHP */
    $nbr = count($regions);
    foreach($regions as $nr => $nom)
    {
        ?>
    <option value="<?php echo($nr); ?>"><?php echo($nom[0]); ?></option>
<?php
    }
    ?>
    </select>
    <!-- ICI, le secret : on met un bloc avec un id ou va s'insérer le code de
         la seconde liste déroulande -->
  <span id="blocDepartements"></span><br />
  <input type="submit" name="ok" id="ok" value="Envoyer" />
  </fieldset>
</form>
<?php

Re: add drop-down lists

PostPosted: Mon Mar 11, 2013 10:02 am
by gattaba
I want that as soon as the call is hung like this that dropdowns are automatically recorded

Re: add drop-down lists

PostPosted: Mon Mar 11, 2013 5:20 pm
by williamconley
use custom fields which must first be activated and then applied to the List (or all lists, copying from the original). This will allow addition of many field types including dropdown. But this will only be available during the call. Alternately, you could use a Web Form to have the agent use "Web Form Submit" instead of "Submit" and any changes you want could be made in the web form.

Re: add drop-down lists

PostPosted: Tue Mar 12, 2013 7:23 am
by gattaba
thank you
but can you explain a little more about how to implement it.
I really do not know where to start

Re: add drop-down lists

PostPosted: Tue Mar 12, 2013 8:41 am
by gattaba
in the administration page I just see a way to change the field names but not to add drop-down list

Re: add drop-down lists

PostPosted: Wed Mar 13, 2013 12:29 pm
by williamconley
use custom fields. not mofidication of the existing fields. do you have a copy of the manager's manual?

in system settings you must first activate custom fields. then you will have to modify a list to add those custom feilds. this is where you will be able to create a dropdown or checkbox or any other type of field.

Re: add drop-down lists

PostPosted: Sat Mar 16, 2013 9:25 am
by gattaba
thanks William
but when i click custom field in list i have this message "You are not authorized to view this section "
But I put 1 "Enable Custom Fields List" in setting system

Re: add drop-down lists

PostPosted: Sat Mar 16, 2013 9:43 am
by williamconley
modify your user to have permission to modify fields (you set the system, but not your user yet ... because the custom fields option was invisible in the user settings until now)

Re: add drop-down lists

PostPosted: Sat Mar 16, 2013 10:03 am
by gattaba
this is good must be enabled for the admin too.
I am trying to build lists

Re: add drop-down lists

PostPosted: Sat Mar 16, 2013 10:36 am
by gattaba
is that I have linked lists in the configuration.
for example I chose a list and change the following value