Example #1
0
function formulaire_discuter($script, $args, $debut, $pas, $ancre, $total, $objet)
{
	$nav = '';
	$e = (_SPIP_AJAX === 1);
	for ($tranche = 0; $tranche < $total; $tranche += $pas){
		$y = $tranche + $pas - 1;
		if ($tranche == $debut)
			$nav .= "<span class='spip_medium'><b>[$tranche-$y]</b></span> ";
		else {
			$h = "$args&debut=$tranche";
			if (!$e) {
				$h = generer_url_ecrire($script, $h);
			} else {
				$h .= "&script=$script";
				if ($objet) $h .= "&objet=$objet";
				$h = generer_url_ecrire('discuter', $h);
				$e = "\nonclick=" . ajax_action_declencheur($h,$ancre);
			}
			$nav .= "[<a href='$h#$ancre'$e>$tranche-$y</a>] ";
		}
	}
	return "<div class='serif2 centered'>$nav</div>";
}
Example #2
0
function repondre_forum($row, $titre, $statut, $retour, $clic)
{
	$id_forum = $row['id_forum'];
	$id_thread = $row['id_thread'];
	$ancre = "poster_forum_prive-$id_thread";

	$lien = generer_url_ecrire("poster_forum_prive", "statut=$statut&id_parent=$id_forum&titre_message=" . rawurlencode($titre) . "&script=" . urlencode($retour)) . '#formulaire';

	return "<div style='text-align: right' class='verdana1'><b><a onclick="
	. ajax_action_declencheur($lien, $ancre)
	. "\nhref='"
	. $lien
	. "'>"
	. $clic
	. "</a></b></div>\n";
}
Example #3
0
function calendrier_href($script, $annee, $mois, $jour, $type, $fin, $ancre, $img, $titre, $class='', $alt='', $clic='', $style='', $evt='')
{
	static $moi = NULL;
	// pas d'Ajax pour l'espace public pour le moment ou si indispo
	// sinon preparer la RegExp qui l'empeche aussi pour la page elle-meme
	if ($moi === NULL)  {
		$moi = (test_espace_prive() AND (_SPIP_AJAX === 1 ))
		? ("/exec=" . _request('exec') .'$/')
		: '';
	}
	$d = mktime (1,1,1, $mois, $jour, $annee);
	$url = calendrier_args_time($d, $script, $type, $fin) . ($ancre ? "#$ancre" : '');
	$c = ($class ? " class=\"$class\"" : '');
	
	if ($img) $clic =  http_img_pack($img, ($alt ? $alt : $titre), $c);

	if ($moi AND preg_match($moi, $script))
		$evt .= "\nonclick=" . ajax_action_declencheur($h,$ancre);
	return http_href($url, PtoBR($clic), attribut_html($titre), $style, $class, $evt);
}
Example #4
0
function auteurs_href($clic, $args='', $att='')
{
	$h = generer_url_ecrire('auteurs', $args);
	$a = 'auteurs';

	if (_SPIP_AJAX === 1 )
		$att .= ("\nonclick=" . ajax_action_declencheur($h,$a));

	return "<a href='$h#$a'$att>$clic</a>";
}
Example #5
0
function icone_inline($texte, $lien, $fond, $fonction="", $align="", $ajax=false, $javascript=''){
	global $spip_display;

	if ($fonction == "supprimer.gif") {
		$style = 'icone36 danger';
	} else {
		$style = 'icone36';
		if (strlen($fonction) < 3) $fonction = "rien.gif";
	}
	$style .= " " . substr(basename($fond),0,-4);

	if ($spip_display == 1){
		$hauteur = 20;
		$largeur = 100;
		$title = $alt = "";
	}
	else if ($spip_display == 3){
		$hauteur = 30;
		$largeur = 30;
		$title = "\ntitle=\"$texte\"";
		$alt = $texte;
	}
	else {
		$hauteur = 70;
		$largeur = 100;
		$title = '';
		$alt = $texte;
	}

	$size = 24;
	if (preg_match("/-([0-9]{1,3})[.](gif|png)$/i",$fond,$match))
		$size = $match[1];
	if ($spip_display != 1 AND $spip_display != 4){
		if ($fonction != "rien.gif"){
		  $icone = http_img_pack($fonction, $alt, "$title width='$size' height='$size'\n" .
					  http_style_background($fond, "no-repeat center center"));
		}
		else {
			$icone = http_img_pack($fond, $alt, "$title width='$size' height='$size'");
		}
	} else $icone = '';

	// cas d'ajax_action_auteur: faut defaire le boulot
	// (il faudrait fusionner avec le cas $javascript)
	if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i",$lien,$r))
		list($x,$lien,$atts,$texte)= $r;
	else $atts = '';

	if ($align && $align!='center') $align = "float: $align; ";

	$icone = "<a style='$align' class='$style'"
	. $atts
	. (!$ajax ? '' : (' onclick=' . ajax_action_declencheur($lien,$ajax)))
	. $javascript
	. "\nhref='"
	. $lien
	. "'>"
	. $icone
	. (($spip_display == 3)	? '' : "<span>$texte</span>")
	  . "</a>\n";

	if ($align <> 'center') return $icone;
	$style = " style='text-align:center;'";
	return "<div$style>$icone</div>";
}
Example #6
0
function ajax_action_post($action, $arg, $retour, $gra, $corps, $clic='', $atts_i='', $atts_span = "", $args_ajax='', $fct_ajax='')
{
	global $spip_lang_right;

	if (strpos($gra,"#")===FALSE) {
	  // A etudier: prendre systematiquement arg en trancodant les \W
		$n = intval($arg);
		$ancre = "$action-" . ($n ? $n : $arg);
	} else {
		$ancre = explode("#",$gra);
		$args = $ancre[0];
		$ancre = $ancre[1];
	}

	if (!$atts_i) 
		$atts_i = " style='float: $spip_lang_right'";

	if (is_array($clic)) {
		$submit = "";
		$atts_i .= "\nonclick='AjaxNamedSubmit(this)'";
		foreach($clic as $n => $c)
		  $submit .= "\n<input type='submit' name='$n' value='$c' $atts_i />";
	} else {
		if (!$clic)  $clic =  _T('bouton_valider');
		$submit = "<input type='submit' value='$clic' $atts_i />";
	}
	$corps = "<div>"
	  . $corps 
	  . "<span"
	  . $atts_span
	  . ">"
	  . $submit
	  . "</span></div>";

	if (_SPIP_AJAX !== 1) {
		return redirige_action_post($action, $arg, $retour,
					($gra . '#' . $ancre),
				        $corps);
	} else { 

		if ($gra AND !$args_ajax) $args_ajax = "&$gra";
		if (isset($GLOBALS['var_profile']))
			$args_ajax .= '&var_profile=1';

		$js = ajax_action_declencheur('this', $ancre, $fct_ajax);
		return redirige_action_post($action,
			$arg,
			$action,
			"script=$retour$args_ajax",
			$corps,
			" onsubmit=$js");
	}
}