<?php
/****************************************************************************************
 * SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV
 *
 * Version 1.0.4
 *
 * Copyright (C) 2006-2016  Sylvain FATOME
 * This program 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.
 *
 * This program 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 this program
 * (in the directory docs);
 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 *
 * Contact : galawa@free.fr
 *
 * Web : http://smi.no-ip.org
 ****************************************************************************************/


// vérification des tentatives de hack
$pos = strpos($_SERVER['PHP_SELF'], 'inc.php');
if ($pos !== FALSE) {
    header('Location: ../index.php');
}

include_once('../inc/func.inc.php');
include_once('../inc/fic_droits.inc.php');
include_once('../inc/fic_fici.inc.php');
include_once('../classes/ezSQL/shared/ez_sql_core.php');
include_once('../classes/ezSQL/mysqli/ez_sql_mysqli.php');
include_once('../inc/func_sql.inc.php');
Archivelog(valsession('code_log'));
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>SMI - <?php echo _('ESPACE PRIVE'); ?> : <?php echo _('Création répertoire'); ?></title>

    <?php include_once('../inc/header.inc.php'); ?>
    <script language="javascript">
        <!--
        var tab1_champ = ["nom:ndir ; format:txt ; req:Y ; txt:<?php echo _('Répertoire à créer'); ?> ; lmx:20 ; stok:frmok ; stbad:frmbad",
            "nom:desc ; format:txt ; req:Y ; txt:<?php echo _('Nom complet'); ?> ; lmx:100 ; stok:frmok ; stbad:frmbad",
            "nom:detail ; format:txt ; req:N ; txt:<?php echo _('Libellé'); ?> ; stok:frmok ; stbad:frmbad"];
        //-->
    </script>

    <script type="text/javascript">
        <!--
        $(function () {
            $("#ndir").Setcase({caseValue: 'lower', changeonFocusout: true});
        });

        function init_all() {
            init_Body();
            init_valid_form('enr', 'mkdir', '<?php echo valsession('date_fmtshort'); ?>', tab1_champ, '', '');
            add_func_click('annul', 'sclose', '');
            Focus_first();
        }

        $(document).ready(function () {
            init_all();
        });
        //-->
    </script>

</head>

<body>
<?php
cre_ent_form(_('CREATION REPERTOIRE'), '', '', '', FALSE);
?>
<!--- Formulaire de création des répertoires -->
<form action="mdir_enr.php" method="POST" enctype="multipart/form-data" name="mkdir" id="mkdir">
    <input name="dir" type="hidden" id="dir" value="<?php echo valget('dir') ?>">
    <input name="nbutton" type="hidden" id="nbutton" value="">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
        <tr>
            <td nowrap class="rubfrm" align="right" class="annot_std_gras" valign="middle" id="f_ndir">
                <?php echo _('Nom du répertoire à créer :'); ?>
            </td>
            <td nowrap valign="middle">
                <input style="margin-left:5px;" type="text" id="ndir" name="ndir" size="20">
                <br/>
                <span
                    class="annot_petit_it">(<?php echo _("Sera converti en minuscules, espaces remplacés par des '_'"); ?></span>
            </td>
        </tr>
        <tr>
            <td nowrap class="rubfrm" align="right" valign="middle" id="f_desc">
                <?php echo _('Nom complet :'); ?>
            </td>
            <td nowrap valign="middle">
                <input style="margin-left:5px;" type="text" name="desc" size="50">
            </td>
        </tr>
        <tr>
            <td nowrap class="rubfrm" align="right" valign="top" id="f_detail"><?php echo _('Descriptif :'); ?></td>
            <td nowrap align="left">
                <textarea style="margin-left:5px;" name="detail" rows="10"
                          id="detail"><?php echo $fic_detail; ?></textarea>
            </td>
        </tr>
        <tr>
            <td nowrap class="rubfrm" align="right" valign="top" id="f_prive"><?php echo _('Privé ? :'); ?></td>
            <td nowrap align="left">
                <?php
                // On ne peut pas modifier un type privé si le dossier contenant est lui-même privé
                $racine = $url_gfc . '/' . valget('dir');
                if (is_prive($racine)) {
                    echo '<input type="checkbox" name="prive2" value="y" style="background : #FFFFFF;" checked="checked" disabled>';
                    echo '<input type="hidden" name="prive" value="y">';

                    echo '<span class="annot_petit_it" style="margin-left:5px;">';
                    echo ' ' . _('(Impossible de modifier le mode privé car le dossier racine est déjà privé)');
                    echo '</span>';
                } else {
                    echo '<input type="checkbox" name="prive" value="y" style="background : #FFFFFF;" >';
                }
                ?>
            </td>
        </tr>
    </table>
    <p align="center">
        <?php
        echo '<input name="enr" type="button" class="bton_std" id="enr" value="' . _('Valider') . '">';
        echo '<input name="RAZ" type="reset" class="bton_std" id="RAZ" value="' . _('Réinitialiser') . '">';
        echo '<input name="annul" type="button" class="bton_std" id="annul" value="' . _('Quitter') . '">';
        ?>
    </p>
</form>
<!--- Fin du Formulaire de création de répertoire -->
</body>
</html>
