| 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.5 2008-08-26 15:32:57 alexandre_tb Exp $
|
22 |
// CVS : $Id: pap_script.fonct.php,v 1.6 2008-10-01 08:25:00 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.5 $ $Date: 2008-08-26 15:32:57 $
|
38 |
*@version $Revision: 1.6 $ $Date: 2008-10-01 08:25:00 $
|
| 39 |
// +------------------------------------------------------------------------------------------------------+
|
39 |
// +------------------------------------------------------------------------------------------------------+
|
| 40 |
*/
|
40 |
*/
|
| Line 41... |
Line 41... |
| 41 |
|
41 |
|
| 42 |
// +------------------------------------------------------------------------------------------------------+
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 127... |
Line 127... |
| 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', $attributs = array())
|
131 |
function GEN_stockerFichierScript($id_fichier, $chemin_fichier, $type_fichier = 'text/javascript', $attributs = array())
|
| 132 |
{
|
132 |
{
|
| 133 |
global $_GEN_commun;
|
- |
|
| 134 |
|
- |
|
| 135 |
if (empty($_GEN_commun['script_fichier'][$id_fichier])) {
|
133 |
if (empty($GLOBALS['_GEN_commun']['script_fichier'][$id_fichier])) {
|
| 136 |
$_GEN_commun['script_fichier'][$id_fichier]['type'] = $type_fichier;
|
134 |
$GLOBALS['_GEN_commun']['script_fichier'][$id_fichier]['type'] = $type_fichier;
|
| 137 |
$_GEN_commun['script_fichier'][$id_fichier]['chemin'] = $chemin_fichier;
|
135 |
$GLOBALS['_GEN_commun']['script_fichier'][$id_fichier]['chemin'] = $chemin_fichier;
|
| 138 |
$_GEN_commun['script_fichier'][$id_fichier]['attributs'] = $attributs;
|
136 |
$GLOBALS['_GEN_commun']['script_fichier'][$id_fichier]['attributs'] = $attributs;
|
| 139 |
} else {
|
137 |
} else {
|
| 140 |
if (GEN_DEBOGAGE) {
|
138 |
if (GEN_DEBOGAGE) {
|
| 141 |
$_GEN_commun['debogage_info'] .=
|
139 |
$GLOBALS['_GEN_commun']['debogage_info'] .=
|
| 142 |
'ERREUR Papyrus : cet identifiant de fichier à déjà été enregistré par GEN_stockerFichierJavascript(). <br />'.
|
140 |
'ERREUR Papyrus : cet identifiant de fichier à déjà été enregistré par GEN_stockerFichierJavascript(). <br />'.
|
| 143 |
'Identifiant : '. $id_fichier .'<br />'.
|
141 |
'Identifiant : '. $id_fichier .'<br />'.
|
| 144 |
'Ligne n° : '. __LINE__ .'<br />'.
|
142 |
'Ligne n° : '. __LINE__ .'<br />'.
|
| 145 |
'Fichier : '. __FILE__;
|
143 |
'Fichier : '. __FILE__;
|
| 146 |
}
|
144 |
}
|
| Line 159... |
Line 157... |
| 159 |
* utilisé pour stocker le code des script.
|
157 |
* utilisé pour stocker le code des script.
|
| 160 |
* @return string le code XHTML contenant les scripts à insérer dans l'entête.
|
158 |
* @return string le code XHTML contenant les scripts à insérer dans l'entête.
|
| 161 |
*/
|
159 |
*/
|
| 162 |
function GEN_afficherScript()
|
160 |
function GEN_afficherScript()
|
| 163 |
{
|
161 |
{
|
| 164 |
global $_GEN_commun;
|
- |
|
| - |
|
162 |
|
| 165 |
$sortie = '';
|
163 |
$sortie = '';
|
| Line 166... |
Line 164... |
| 166 |
|
164 |
|
| 167 |
$fichiers = '';
|
165 |
$fichiers = '';
|
| 168 |
if (isset($_GEN_commun['script_fichier'])) {
|
166 |
if (isset($GLOBALS['_GEN_commun']['script_fichier'])) {
|
| 169 |
while (list($cle, $valeur) = each($_GEN_commun['script_fichier'])) {
|
167 |
while (list($cle, $valeur) = each($GLOBALS['_GEN_commun']['script_fichier'])) {
|
| 170 |
$fichiers .= str_repeat(' ', 8).'<script type="'.$valeur['type'].'" src="'.$valeur['chemin'].'"';
|
168 |
$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 |
if (is_array ($valeur['attributs'])) foreach ($valeur['attributs'] as $attr => $val) $fichiers .= ' '.$attr.'="'.$val.'"';
|
| 172 |
$fichiers .= '></script>'."\n";
|
170 |
$fichiers .= '></script>'."\n";
|
| 173 |
}
|
171 |
}
|
| Line 176... |
Line 174... |
| 176 |
$sortie .= '<!-- Aucun script externe -->'."\n";
|
174 |
$sortie .= '<!-- Aucun script externe -->'."\n";
|
| 177 |
}
|
175 |
}
|
| Line 178... |
Line 176... |
| 178 |
|
176 |
|
| 179 |
|
177 |
|
| 180 |
$fonctions = '';
|
178 |
$fonctions = '';
|
| 181 |
while (list($cle, $valeur) = each($_GEN_commun['script_fonction'])) {
|
179 |
while (list($cle, $valeur) = each($GLOBALS['_GEN_commun']['script_fonction'])) {
|
| Line 182... |
Line 180... |
| 182 |
$fonctions .= $valeur;
|
180 |
$fonctions .= $valeur;
|
| 183 |
}
|
181 |
}
|
| Line 184... |
Line 182... |
| 184 |
|
182 |
|
| 185 |
$code = '';
|
183 |
$code = '';
|
| 186 |
$code = $_GEN_commun['script_code'];
|
184 |
$code = $GLOBALS['_GEN_commun']['script_code'];
|
| 187 |
|
185 |
|
| 188 |
if ($fonctions != '' || $code != '') {
|
186 |
if ($fonctions != '' || $code != '') {
|
| 189 |
$sortie .= "\n";
|
187 |
$sortie .= "\n";
|
| 190 |
$sortie .= str_repeat(' ', 8).'<script type="'.$_GEN_commun['script_type'].'">'."\n";
|
188 |
$sortie .= str_repeat(' ', 8).'<script type="'.$GLOBALS['_GEN_commun']['script_type'].'">'."\n";
|
| 191 |
$sortie .= str_repeat(' ', 12).'<!--/*--><![CDATA[//><!--'."\n";
|
189 |
$sortie .= str_repeat(' ', 12).'<!--/*--><![CDATA[//><!--'."\n";
|
| Line 218... |
Line 216... |
| 218 |
}
|
216 |
}
|
| Line 219... |
Line 217... |
| 219 |
|
217 |
|
| 220 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
218 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
| 221 |
*
|
219 |
*
|
| - |
|
220 |
* $Log: not supported by cvs2svn $
|
| - |
|
221 |
* Revision 1.5 2008-08-26 15:32:57 alexandre_tb
|
| - |
|
222 |
* ajout du parametre $attributs dans la fonction GEN_stockerFichierScript
|
| 222 |
* $Log: not supported by cvs2svn $
|
223 |
*
|
| 223 |
* Revision 1.4 2007-09-06 14:45:06 neiluj
|
224 |
* Revision 1.4 2007-09-06 14:45:06 neiluj
|
| 224 |
* ajout de la balise PAPYRUS_BODY_ATTRIBUTS
|
225 |
* ajout de la balise PAPYRUS_BODY_ATTRIBUTS
|
| 225 |
*
|
226 |
*
|
| 226 |
* Revision 1.3 2005/02/28 11:12:03 jpm
|
227 |
* Revision 1.3 2005/02/28 11:12:03 jpm
|