コード例 #1
0
ファイル: import.php プロジェクト: rhertzog/lcs
function affiche_progression_javascript($abs_pos,$size, $table="", $retour='') {

	include_spip('inc/charsets');
	echo "\n<script type='text/javascript'><!--\n";

	if ($abs_pos == '100 %') {

		echo "document.progression.taille.value='$abs_pos';\n";
		if ($x = $GLOBALS['erreur_restauration']) {
			echo "document.progression.recharge.value='".str_replace("'", "\\'", unicode_to_javascript(html2unicode(_T('avis_erreur').": $x")))." ';\n";
		}
		else {
			if (!$retour) $retour = self();
			echo "document.progression.recharge.value='".str_replace("'", "\\'", unicode_to_javascript(html2unicode(_T('info_fini'))))."';\n";
			echo "window.setTimeout('location.href=\"$retour\";',0);";
		}
	}
	else {
		if (trim($table))
			echo "document.progression.recharge.value='$table';\n";
		if (!$size)
			$taille = preg_replace("/&nbsp;/", " ", taille_en_octets($abs_pos));
		else
			$taille = floor(100 * $abs_pos / $size)." %";
		echo "document.progression.taille.value='$taille';\n";
	}
	echo "\n--></script>\n";
	if (function_exists('ob_flush')) @ob_flush();
	flush();
}
コード例 #2
0
ファイル: cout_fonctions.php プロジェクト: rhertzog/lcs
function cs_javascript($chaine) { return unicode_to_javascript(addslashes(html2unicode($chaine))); }
コード例 #3
0
ファイル: presentation.php プロジェクト: rhertzog/lcs
function debut_javascript($fin='')
{
	global $spip_lang_left, $browser_name, $browser_version;
	include_spip('inc/charsets');

	// tester les capacites JS :

	// On envoie un script ajah ; si le script reussit le cookie passera a +1
	// on installe egalement un <noscript></noscript> qui charge une image qui
	// pose un cookie valant -1

	$testeur = str_replace('&amp;', '\\x26', generer_url_ecrire('test_ajax', 'js=1'));

	if (_SPIP_AJAX AND !defined('_TESTER_NOSCRIPT')) {
	  // pour le pied de page (deja defini si on est validation XML)
		define('_TESTER_NOSCRIPT',
			"<noscript>\n<div style='display:none;'><img src='"
		        . generer_url_ecrire('test_ajax', 'js=-1')
		        . "' width='1' height='1' alt='' /></div></noscript>\n");
	}

	if (!defined('_LARGEUR_ICONES_BANDEAU'))
		include_spip('inc/bandeau');

	$inline =  ((isset($_COOKIE['spip_accepte_ajax']) && $_COOKIE['spip_accepte_ajax'] >= 1)
			? ''
			: "jQuery.ajax({'url':'$testeur'});") .
			(_OUTILS_DEVELOPPEURS ?"var _OUTILS_DEVELOPPEURS=true;":"") .
			"\nvar ajax_image_searching = \n'<img src=\"".url_absolue(chemin_image("searching.gif"))."\" alt=\"\" />';" .
			"\nvar stat = " . (($GLOBALS['meta']["activer_statistiques"] != 'non') ? 1 : 0) .
			"\nvar largeur_icone = " .
			intval(_LARGEUR_ICONES_BANDEAU) .
			"\nvar  bug_offsetwidth = " .
// uniquement affichage ltr: bug Mozilla dans offsetWidth quand ecran inverse!
			((($spip_lang_left == "left") &&
			  (($browser_name != "MSIE") ||
			   ($browser_version >= 6))) ? 1 : 0) .
			"\nvar confirm_changer_statut = '" .
			unicode_to_javascript(addslashes(html2unicode(_T("confirm_changer_statut")))) .
			"';\n";
	return
	  // envoi le fichier JS de config si browser ok.
	  $GLOBALS['browser_layer'] .
	  //plugin needed to fix the select showing through the submenus o IE6
	  (($browser_name == "MSIE" && $browser_version <= 6) ? http_script('', 'bgiframe.js'):'' ) .
	  http_script('', 'presentation.js') . 
	  http_script('', 'gadgets.js') .
	  http_script($inline . $fin);
}
コード例 #4
0
ファイル: tourner.php プロジェクト: rhertzog/lcs
function bouton_copier_local($document, $type, $id, $id_document, $script) {
	global $spip_lang_right;

	// pour etre sur qu'il s'agit bien d'un doc distant
	// et qu'il existe
	$bouton_copier = '';
	if ($document['distant'] == 'oui' /* on pourrait verifier l'existence du
	 	// fichier ici, mais ne risque pas-t-on de degrader les performances ?
	 	// il sera toujours temps de le verifier lorsque l'utilisateur cliquera
	 	// sur le bouton. */) {
		$bouton_copier = ajax_action_auteur("copier_local",
			    "$id_document",
			    $script,
			    "show_docs=$id_document&id_$type=$id#tourner-$id_document",
			    array(http_img_pack('telecharger.gif', _T('copier_en_local'), ''),
				  " class='bouton_rotation'"),
				  // on aurait pu faire un nouveau style 'bouton-telecharger',
				  // mais pour l'instant on se contente de reutiliser celui-ci
				  // afin de garder une homogeneite entre les differents boutons.
			    "&id_document=$id_document&id=$id&type=$type");
			    

		// Hack ?
		// demander confirmation javascript
		$u = str_replace("'", "\\'", unicode_to_javascript(html2unicode(_T('copier_en_local') . ' ' . $document['fichier'])));
		$bouton_copier = str_replace('return AjaxSqueeze',
			"return (!confirm('$u'))?false:AjaxSqueeze", $bouton_copier);
	}

	return $bouton_copier;
}