Subversion Repositories Applications.papyrus

Rev

Rev 1688 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1688 Rev 1828
Line 17... Line 17...
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: pap_script.fonct.php,v 1.4 2007-09-06 14:45:06 neiluj Exp $
22
// CVS : $Id: pap_script.fonct.php,v 1.4.2.1 2008-04-16 12:46:38 alexandre_tb Exp $
23
/**
23
/**
24
* Les fonctions permettant d'inclure des scripts.
24
* Les fonctions permettant d'inclure des scripts.
25
*
25
*
26
* Ces fonctions permettent d'inclure des scripts, éxécuté côté client, directement dans les pages
26
* Ces fonctions permettent d'inclure des scripts, éxécuté côté client, directement dans les pages
27
* des applications. Elles peuvent donc être appelées par les applications 
27
* des applications. Elles peuvent donc être appelées par les applications 
Line 33... Line 33...
33
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
33
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
34
//Autres auteurs :
34
//Autres auteurs :
35
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
35
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
36
*@author        Laurent COUDOUNEAU <lc@gsite.org>
36
*@author        Laurent COUDOUNEAU <lc@gsite.org>
37
*@copyright     Tela-Botanica 2000-2004
37
*@copyright     Tela-Botanica 2000-2004
38
*@version       $Revision: 1.4 $ $Date: 2007-09-06 14:45:06 $
38
*@version       $Revision: 1.4.2.1 $ $Date: 2008-04-16 12:46:38 $
39
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
40
*/
40
*/
Line 41... Line 41...
41
 
41
 
42
// +------------------------------------------------------------------------------------------------------+
42
// +------------------------------------------------------------------------------------------------------+
Line 126... Line 126...
126
* @param    string  la clé du tableau de fichiers, par exemple le nom du fichier à insérer.
126
* @param    string  la clé du tableau de fichiers, par exemple le nom du fichier à insérer.
127
* @param    string  le chemin complet du fichier à insérer.
127
* @param    string  le chemin complet du fichier à insérer.
128
* @param    string  le type MIME du langage de script utilisé dans le fichier à insérer.
128
* @param    string  le type MIME du langage de script utilisé dans le fichier à insérer.
129
* @return   void    le chemin du fichier est stocké dans une variable (tableau associatif) globale.
129
* @return   void    le chemin du fichier est stocké dans une variable (tableau associatif) globale.
130
*/
130
*/
131
function GEN_stockerFichierScript($id_fichier, $chemin_fichier, $type_fichier = 'text/javascript')
131
function GEN_stockerFichierScript($id_fichier, $chemin_fichier, $type_fichier = 'text/javascript', $attributs = array())
132
{
132
{
133
    global $_GEN_commun;
133
    global $_GEN_commun;
Line 134... Line 134...
134
    
134
    
135
    if (empty($_GEN_commun['script_fichier'][$id_fichier])) {
135
    if (empty($_GEN_commun['script_fichier'][$id_fichier])) {
136
        $_GEN_commun['script_fichier'][$id_fichier]['type']   = $type_fichier;
136
        $_GEN_commun['script_fichier'][$id_fichier]['type']   = $type_fichier;
-
 
137
        $_GEN_commun['script_fichier'][$id_fichier]['chemin'] = $chemin_fichier;
137
        $_GEN_commun['script_fichier'][$id_fichier]['chemin'] = $chemin_fichier;
138
        $_GEN_commun['script_fichier'][$id_fichier]['attributs'] = $attributs;
138
    } else {
139
    } else {
139
        if (GEN_DEBOGAGE) {
140
        if (GEN_DEBOGAGE) {
140
            $_GEN_commun['debogage_info'] .=
141
            $_GEN_commun['debogage_info'] .=
141
                    'ERREUR Papyrus : cet identifiant de fichier à déjà été enregistré par GEN_stockerFichierJavascript(). <br />'.
142
                    'ERREUR Papyrus : cet identifiant de fichier à déjà été enregistré par GEN_stockerFichierJavascript(). <br />'.
Line 164... Line 165...
164
    $sortie = '';
165
    $sortie = '';
Line 165... Line 166...
165
    
166
    
166
    $fichiers = '';
167
    $fichiers = '';
167
    if (isset($_GEN_commun['script_fichier'])) {
168
    if (isset($_GEN_commun['script_fichier'])) {
168
        while (list($cle, $valeur) = each($_GEN_commun['script_fichier'])) {
169
        while (list($cle, $valeur) = each($_GEN_commun['script_fichier'])) {
-
 
170
            $fichiers .= str_repeat(' ', 8).'<script type="'.$valeur['type'].'" src="'.$valeur['chemin'].'"';
-
 
171
            if (is_array ($valeur['attributs'])) foreach ($valeur['attributs'] as $attr => $val) $fichiers .= ' '.$attr.'="'.$val.'"';
169
            $fichiers .= str_repeat(' ', 8).'<script type="'.$valeur['type'].'" src="'.$valeur['chemin'].'" ></script>'."\n";
172
            $fichiers .=  '></script>'."\n"; 
170
        }
173
        } 
171
        $sortie .= $fichiers;
174
        $sortie .= $fichiers;
172
    } else {
175
    } else {
173
        $sortie .= '<!-- Aucun script externe -->'."\n";
176
        $sortie .= '<!-- Aucun script externe -->'."\n";
Line 215... Line 218...
215
}
218
}
Line 216... Line 219...
216
 
219
 
217
/* +--Fin du code ----------------------------------------------------------------------------------------+
220
/* +--Fin du code ----------------------------------------------------------------------------------------+
218
*
221
*
-
 
222
* $Log: not supported by cvs2svn $
-
 
223
* Revision 1.4  2007-09-06 14:45:06  neiluj
-
 
224
* ajout de la balise PAPYRUS_BODY_ATTRIBUTS
219
* $Log: not supported by cvs2svn $
225
*
220
* Revision 1.3  2005/02/28 11:12:03  jpm
226
* Revision 1.3  2005/02/28 11:12:03  jpm
221
* Modification des auteurs.
227
* Modification des auteurs.
222
*
228
*
223
* Revision 1.2  2004/09/10 16:40:41  jpm
229
* Revision 1.2  2004/09/10 16:40:41  jpm