Exemplo n.º 1
0
function affiche_block_initiale($initiale, $block, $block_actif)
{
    if (strlen($block)) {
        return "<li class='item'>" . bouton_block_depliable($initiale, $block_actif ? true : false) . debut_block_depliable($block_actif) . "<ul>{$block}</ul>" . fin_block() . "</li>";
    }
    return "";
}
Exemplo n.º 2
0
function inc_iconifier_dist($id_objet, $id,  $script, $visible=false, $flag_modif=true) {
	if ($GLOBALS['spip_display'] == 4) return "";
	$texteon = $GLOBALS['logo_libelles'][($id OR $id_objet != 'id_rubrique') ? $id_objet : 'id_racine'];

	$chercher_logo = charger_fonction('chercher_logo', 'inc');
	
	// Add the redirect url when uploading via iframe
	$iframe_script = generer_url_ecrire('iconifier',"type=$id_objet&$id_objet=$id&script=$script",true);
	$iframe = "<input type='hidden' name='iframe_redirect' value='".rawurlencode($iframe_script)."' />\n";

	$logo = $chercher_logo($id, $id_objet, 'on');
	$logo_s = $chercher_logo($id, $id_objet, 'off');
	if (!$logo) {
		if ($flag_modif AND $GLOBALS['meta']['activer_logos'] != 'non') {
			$masque = indiquer_logo($texteon, $id_objet, 'on', $id, $script, $iframe);
			$masque = "<div class='cadre_padding'>$masque</div>";
			$bouton = bouton_block_depliable($texteon, $visible, "on-$id_objet-$id");
			$res = debut_block_depliable($visible,"on-$id_objet-$id") . $masque . fin_block();
		}
	} else {
		list($img, $clic) = decrire_logo($id_objet,'on',$id, 170, 170, $logo, $texteon, $script, $flag_modif AND !$logo_s);

		$bouton = bouton_block_depliable($texteon, $visible, "on-$id_objet-$id");

		$survol = '';
		$texteoff = _T('logo_survol');
		if (!$logo = $logo_s) {
			if ($flag_modif AND $GLOBALS['meta']['activer_logos_survol'] == 'oui') {
				$masque = "<br />".indiquer_logo($texteoff, $id_objet, 'off', $id, $script, $iframe);
				$survol .= "<br />".block_parfois_visible("off-$id_objet-$id", $texteoff, $masque, null, $visible);
			}
			$masque = debut_block_depliable($visible,"on-$id_objet-$id") 
				. "<div class='cadre_padding'>"
				. $clic . $survol . "</div>" . fin_block();
		} else {
			list($imgoff, $clicoff) = decrire_logo($id_objet, 'off', $id, 170, 170, $logo, $texteoff, $script, $flag_modif);
			$masque = debut_block_depliable($visible, "off-$id_objet-$id") .  $clicoff . fin_block();
			$survol .= "<br />".bouton_block_depliable($texteoff, $visible, "off-$id_objet-$id")
			. "<div class='cadre_padding'>".$imgoff.$masque."</div>";
			$masque = debut_block_depliable($visible,"on-$id_objet-$id") . $clic . fin_block() . $survol;
		}

		$res = "$img$masque";
	}

	if ($res) {
		$res = debut_cadre('r', 'image-24.gif', '', $bouton, '', '', false)
			. $res
			. fin_cadre_relief(true);

		if(_request("exec")!="iconifier") {
		  $js = http_script('',  'async_upload.js')
		    . http_script('$("form.form_upload_icon").async_upload(async_upload_icon)');

		} else $js = "";
		return ajax_action_greffe("iconifier", $id, $res).$js;
	}
	else return '';

}
Exemplo n.º 3
0
function block_parfois_visible($nom, $invite, $masque, $style='', $visible=false){
	if (!$GLOBALS['browser_layer']) return '';

	return "\n"
	. bouton_block_depliable($invite,$visible,$nom)
	. debut_block_depliable($visible,$nom)
	. $masque
	. fin_block();
}
Exemplo n.º 4
0
function inc_editer_mots_dist($objet, $id_objet, $cherche_mot, $select_groupe, $flag, $visible = false, $url_base='') {
	if ($GLOBALS['meta']["articles_mots"] == 'non')	return '';
	if (!preg_match('/^[0-9, ]*$/', $select_groupe)) return '';
	$trouver_table = charger_fonction('trouver_table', 'base');
	$nom = table_objet($objet);
	$desc = $trouver_table($nom);
	$table_id =  @$desc['key']["PRIMARY KEY"];

	$reponse = ($flag AND $cherche_mot)
		? chercher_inserer_mot($cherche_mot, $select_groupe, $objet, $id_objet, $nom, $table_id, $url_base)
		: '';

	list($liste, $mots) = afficher_mots_cles($flag, $objet, $id_objet, $nom, $table_id, $url_base);

	$aff =false;
	$bouton = _T('titre_mots_cles').aide ("artmots");

	if ($liste)
		$aff = true;

	if ($flag) { 	// si droit de modif donner le formulaire
		$visible = ($visible OR $cherche_mot OR ($flag === 'ajax'));
		list($visible, $res) = formulaire_mots_cles($id_objet, $mots, $nom, $table_id, $url_base, $visible, $objet);

		if ($res) {
			$liste .= debut_block_depliable($visible,"lesmots")
				. $res
				. creer_mot($nom, $id_objet, $table_id, $url_base, $cherche_mot, $select_groupe)
				. fin_block();
			$bouton = bouton_block_depliable($bouton, $visible,"lesmots");
			$aff = true;
		}
	}

	if (!$aff)
		return '';

	$res = debut_cadre_enfonce("mot-cle-24.gif", true, "", $bouton)
	  . $reponse
	  . $liste
	  . fin_cadre_enfonce(true);

	return ajax_action_greffe("editer_mots", $id_objet, $res);
}
Exemplo n.º 5
0
function documenter_bloc($id, $res, $s, $script, $ancre, $tous, $type)
{
	// seulement s'il y a au moins un document dedans
	if (!$res) return "";

	if ($tous) {
		$tous = "<div class='lien_tout_supprimer'>"
			. ajax_action_auteur('documenter', "$s$id/$type", $appelant ? $appelant : _request('exec'), "id_$type=$id&s=$s&type=$type",array(_T('lien_tout_supprimer')))
			. "</div>\n";
	} else $tous = '';

	$bouton = bouton_block_depliable(majuscules(_T("info_$ancre")),true,"portfolio_$ancre");

	return debut_cadre("$ancre","","",$bouton)
		. debut_block_depliable(true,"portfolio_$ancre")
		. $tous
		. $res
		. fin_block()
		. fin_cadre();
}
Exemplo n.º 6
0
function block_parfois_visible($nom, $invite, $masque, $style = '', $visible = false)
{
    return "\n" . bouton_block_depliable($invite, $visible, $nom) . debut_block_depliable($visible, $nom) . $masque . fin_block();
}
Exemplo n.º 7
0
function skeleditor_tree_open_close_dir(&$current,$target,$current_file){
	if ($current == $target) return "";
	$tcur = explode("/",$current);
	$ttarg = explode("/",$target);
	$tcom = array();
	$output = "";
	// la partie commune
	while (reset($tcur)==reset($ttarg)){
		$tcom[] = array_shift($tcur);
		array_shift($ttarg);
	}
	// fermer les repertoires courant jusqu'au point de fork
	while($close = array_pop($tcur)){
		$output .= fin_block();
	}
	$chemin = implode("/",$tcom)."/";
	// ouvrir les repertoires jusqu'a la cible
	while($open = array_shift($ttarg)){
		$chemin .= $open . "/";
		$closed = ((strncmp($current_file, ltrim($chemin,'/'), strlen(ltrim($chemin,'/')))==0)?"":" closed");

		$output .= bouton_block_depliable("<img src='"._DIR_PLUGIN_SKELEDITOR."images/se-folder-16.png' alt='directory'/> $open",!$closed,md5($chemin));
		$output .= "<div class='dir$closed' id='".md5($chemin)."'>\n";
	}
	$current = $target;
	return $output;
}
Exemplo n.º 8
0
function skel_parser($skel_str) {
  include_spip("public/interfaces");
  include_spip("public/phraser_html"); 
  //include_spip("public/debug"); 

  //$output .= _T('skeleditor:parseur_titre'); 
  $output .= "<div style='background: #eef; border:1px solid #eee;padding:10px;font-size:0.82em;font-family:Verdana'>";
  
  $boucles = array(); 
  $b = public_phraser_html($skel_str, 0, $boucles, 'skel_editor'); 
  $boucles = array_reverse($boucles,TRUE);
  
  /* parse outside boucles */
  //$output .= bouton_block_invisible("hors_boucle")._T("skeleditor:parseur_horsboucle");  
  //$output .= debut_block_invisible("hors_boucle");
  $output .= "<div style='background: #fff;padding:10px;'>"; 
  foreach($b as $k=>$val) { 
     if ($val->type == "champ") $output .= "<span style='color:#c30;background:#eee'>#".$val->nom_champ."</span>";
         else if ($val->type == "texte") $output .="<pre style='background:#ddd;margin:0;display:inline;'>&nbsp;".htmlspecialchars($val->texte)."</pre>";
         else if ($val->type == "include") $output .= "<span style='color:#30c;background:#cff;'>(INCLURE)</span>"; 
  }
  $output .= "</div>\n";
  $output .= fin_block()."<br />";
  
  /* parse boucles */
  foreach($boucles as $k=>$val) {
     /* version gentle */ 
     //$output .= bouton_block_invisible("skel_parser_$k")." BOUCLE$k";
     $output .= " <span style='color:#888'>(".strtoupper($val->type_requete).")</span>";
     //$output .= debut_block_invisible("skel_parser_$k");
     $output .= "<div style='background: #fff;padding:10px;'>";  
        if ($val->id_parent) $output .= "<strong>id_parent:</strong> BOUCLE$val->id_parent<br />";      
        if ($val->param) $output .= "<strong>"._T('skeleditor:parseur_param')."</strong>".skel_parser_param($val->param)."<br />";       
        $output .= "<strong>"._T('skeleditor:parseur_contenu')."</strong><br />"; 
        $output .= skel_parser_affiche( _T('skeleditor:parseur_avant'),$val->avant, '#cc9');       
        $output .= skel_parser_affiche( _T('skeleditor:parseur_milieu'),$val->milieu, '#fc6');
        $output .= skel_parser_affiche( _T('skeleditor:parseur_apres'),$val->apres, '#fcc');
        $output .= skel_parser_affiche( _T('skeleditor:parseur_altern'),$val->altern, '#cfc'); 
     $output .= "</div>\n";
     $output .= fin_block()."<br />";
      
     /* version brute */ 
     /*    	           
     $output .= "<strong>BOUCLE$k</strong><br />\n";
     foreach (get_object_vars($val) as $prop => $val2) {
          $output .= "\t<br />$prop = $val2\n";
          if (is_array($val2)) {
              foreach($val2 as $k3=>$val3) {
                  $output .= "\t\t<br>........................$k3 = $val3\n";
                  if (is_object($val3)) {
                      foreach (get_object_vars($val3) as $prop4 => $val4) {
                          $output .= "\t\t<br>+++........................( $prop4 = $val4 )\n"; 
                          if (is_array($val4 )) {
                               foreach($val4 as $k5=>$val5) {
                                  $output .= "\t\t<br>++++++...............$k5 = $val5 )\n";
                                  foreach($val5 as $k6=>$val6) {
                                    $output .= "\t\t<br>+++++++++++.........$k6 = $val6 )\n";
                                  } 
                               }
                          }
                      }
                  }
              }
        }
    }*/
    
 }       	         
                                   	        
  $output .= "</div>";
  return $output;
}
Exemplo n.º 9
0
function enfants_aff($id_parent,$decalage, $critere, $gauche=0) {

	global $niveau;
	global $nombre_vis;
	global $nombre_abs;
	global $spip_lang_right, $spip_lang_left;
	global $abs_total;
	global $taille;
	$visites_abs = 0;

	$result = sql_select("id_rubrique, titre, descriptif", "spip_rubriques", "id_parent=$id_parent",'', '0+titre,titre');

	while($row = sql_fetch($result)){
		$id_rubrique = $row['id_rubrique'];
		$titre = typo($row['titre']);
		$descriptif = attribut_html(couper(typo($row['descriptif']),80));

		if ($nombre_vis[$id_rubrique]>0 OR $nombre_abs[$id_rubrique]>0){
			$largeur_rouge = floor(($nombre_vis[$id_rubrique] - $nombre_abs[$id_rubrique]) * $taille / $abs_total);
			$largeur_vert = floor($nombre_abs[$id_rubrique] * $taille / $abs_total);
			
			if ($largeur_rouge+$largeur_vert>0){
					
				if ($niveau == 0) {
					$couleur="#cccccc";
				}

				else if ($niveau == 1) {
					$couleur="#eeeeee";
				}
				else {
					$couleur="white";
				}
				echo "<table cellpadding='2' cellspacing='0' border='0' width='100%'>";
				echo "\n<tr style='background-color: $couleur'>";
				echo "\n<td style='border-bottom: 1px solid #aaaaaa; padding-$spip_lang_left: ".($niveau*20+5)."px;'>";

				
				if ( $largeur_rouge > 2) 
					echo bouton_block_depliable("<a href='" . generer_url_ecrire("naviguer","id_rubrique=$id_rubrique") . "' style='color: black;' title=\"$descriptif\">$titre</a>","incertain", "stats$id_rubrique");
				else
					echo 	"<div class='verdana1' style='padding-left: 18px; padding-top: 4px; padding-bottom: 3px;'>",
					  "<a href='" . generer_url_ecrire("naviguer","id_rubrique=$id_rubrique") . "' style='color: black;' title=\"$descriptif\">$titre</a>",
					  "</div>";
				echo "</td>";
				
				
				if ($niveau==0 OR 1==1){
					$pourcent = round($nombre_vis[$id_rubrique]/$abs_total*1000)/10;
					echo "\n<td class='verdana1' style='text-align: $spip_lang_right; width: 40px; border-bottom: 1px solid #aaaaaa;'>$pourcent%</td>";
				}
				else { echo "<td style='width: 10px; border-bottom: 1px solid #aaaaaa;'></td>"; }
				
				
				echo "\n<td align='right' style='border-bottom: 1px solid #aaaaaa; width:" . ($taille+5) ."px'>";
				
				
				echo "\n<table cellpadding='0' cellspacing='0' border='0' width='".($decalage+1+$gauche)."'>";
				echo "\n<tr>";
				if ($gauche > 0) echo "<td style='width: " .$gauche."px'></td>";
				echo "\n<td style='border: 0px; white-space: nowrap;'>";
				echo "<div style='border: 1px solid #999999; background-color: #dddddd; height: 12px; padding: 0px; margin: 0px;'>";
				if ($visites_abs > 0) echo "<img src='" . chemin_image('rien.gif') . "' style='vertical-align: top; height: 12px; border: 0px; width: ".$visites_abs."px;' alt= ' '/>";
				if ($largeur_rouge>0) echo "<img src='" . chemin_image('rien.gif') . "' class='couleur_cumul' style='vertical-align: top; height: 12px; border: 0px; width: " . $largeur_rouge . "px;' alt=' ' />";
				if ($largeur_vert>0) echo "<img src='" . chemin_image('rien.gif') . "' class='couleur_nombre' style='vertical-align: top; width: " . $largeur_vert ."px; height: 12px; border: 0px' alt=' ' />";
				echo "</div>";
				echo "</td></tr></table>\n";
				echo "</td></tr></table>";
			}	
		}
		
		if (isset($largeur_rouge) && ($largeur_rouge > 0)) {
			$niveau++;
			echo debut_block_depliable(false,"stats$id_rubrique");
			enfants_aff($id_rubrique,$largeur_rouge, $critere, $visites_abs+$gauche);
			echo fin_block();
			$niveau--;
		}
		$visites_abs = $visites_abs + round($nombre_vis[$id_rubrique]/$abs_total*$taille);
	}
}
Exemplo n.º 10
0
function spiplistes_boite_patron ($flag_editable, $id_liste
	, $exec_retour, $nom_bouton_valider, $chemin_patrons, $titre_boite = ""
	, $msg_patron = false, $patron = "") {
	// bloc selection patron
	$result = ""
		. debut_cadre_relief(_DIR_PLUGIN_SPIPLISTES_IMG_PACK."patron-24.png", true)
		. "<div class='verdana1' style='text-align: center;'>\n"
		;
	$titre_boite = "<strong>$titre_boite</strong>\n";
	
	if($flag_editable) {
	// inclusion du script de gestion des layers de SPIP
		if(($patron === true) || (is_string($patron) && empty($patron))) {
			$result  .= ""
				. spiplistes_bouton_block_depliable ($titre_boite, true, md5($nom_bouton_valider))
				. (spiplistes_spip_est_inferieur_193() ? $titre_boite : "")
				. spiplistes_debut_block_visible(md5($nom_bouton_valider))
				;
		}
		else {
			$result  .= ""
				. spiplistes_bouton_block_depliable ($titre_boite, false, md5($nom_bouton_valider))
				. (spiplistes_spip_est_inferieur_193() ? $titre_boite : "")
				. spiplistes_debut_block_invisible(md5($nom_bouton_valider))
				;
		}
	}
	else {
		$result  .= $titre_boite;
	}
	if($flag_editable) {
		$result .= "\n"
			. "<form action='".generer_url_ecrire($exec_retour, "id_liste=$id_liste")."' method='post' style='margin:1ex;'>\n"
			. spiplistes_boite_selection_patrons ($patron, true, $chemin_patrons)
			. "<div style='margin-top:1em;text-align:right;'><input type='submit' name='$nom_bouton_valider' value='"._T('bouton_valider')."' class='fondo' /></div>\n"
			. "</form>\n"
			. fin_block()
			;
	}
	else {
	}
	$result .= "\n"
		. "<div style='text-align:center'>\n"
		. ($msg_patron ? $msg_patron : "<span style='color:gray;'>&lt;"._T('spiplistes:aucun')."&gt;</span>\n")
		. "</div>\n"
		. "</div>\n"
		. fin_cadre_relief(true);
		;

	return($result);
}
Exemplo n.º 11
0
function inc_presenter_liste_dist($requete, $fonc, &$prims, $own, $force, $styles, $idom='', $title='', $icone='', $url='', $cpt=NULL)
{
	global $spip_display, $spip_lang_left;

	// $requete est passe par reference, pour modifier l'index LIMIT
	if ($idom AND $spip_display != 4)
		$tranches = affiche_tranche_bandeau($requete, $idom, $url, $cpt, _TRANCHES);
	else $tranches = '';

	$prim = $prims;
	$prims = array();
	$result = sql_allfetsel((isset($requete["SELECT"]) ? $requete["SELECT"] : "*"), $requete['FROM'], $requete['WHERE'], $requete['GROUP BY'], $requete['ORDER BY'], $requete['LIMIT']);

	if (!count($result)) {
		if (!$force) return '';
	} else {
	if ($spip_display != 4) {
		$evt = !preg_match(",msie,i", $GLOBALS['browser_name']) ? ''
		: "
			onmouseover=\"changeclass(this,'tr_liste_over');\"
			onmouseout=\"changeclass(this,'tr_liste');\"" ;

		$table = $head = '';
		$th = 0;
		foreach ($result as $r) {
		  if ($prim) $prims[]= $r[$prim];
		  if ($vals = $fonc($r, $own)) {
			reset($styles);
			$res = '';
			foreach ($vals as $t) {
				$style = $largeur = $nom = "";
				list(,$s) = each($styles);
				if (count($s)) $style = array_shift($s);
				if (count($s)) $largeur = array_shift($s);
				if (count($s)) $nom = array_shift($s);
				if ($largeur) $largeur = " style='width: $largeur" ."px;'";
				if ($style) $style = " class=\"$style\"";
				$t = !trim($t) ? "&nbsp;" : lignes_longues($t);
				$res .= "\n<td$style$largeur>$t</td>";
				if (!$table) {
				  $th |= $nom ? 1 : 0;
				  $head .= "\n<th style='text-align:center'>$nom</th>";
				}
			}
			$table .= "\n<tr class='tr_liste'$evt>$res</tr>";
		  }
		}
		if (!$th) $head= '';
		$tranches .= "<table width='100%' cellpadding='2' cellspacing='0' border='0'>$head$table</table>";
	} else {
		foreach ($result as $r) {
			if ($prim) $prims[]= $r[$prim];
			if ($t = $fonc($r, $own)) {
			  	$tranches = '<li>' . join('</li><li>', $t) . '</li>';
		$tranches = "\n<ul style='text-align: $spip_lang_left; background-color: white;'>"
		. $tranches
		. "</ul>";
			}
		}
	}
	}

	$id = 't'.substr(md5(join('',$requete)),0,8);
	$bouton = !$icone ? '' : bouton_block_depliable($title, true, $id);

	return debut_cadre('liste', $icone, "", $bouton, "", "", false)
	  . debut_block_depliable(true,  $id)
	  . $tranches
	  . fin_block()
	  . fin_cadre('liste');
}
Exemplo n.º 12
0
function choix_rubriques_admin_restreint($auteur, $modif=true) {
	global $spip_lang;

	$id_auteur = intval($auteur['id_auteur']);
	$res = afficher_rubriques_admin_restreintes($auteur, $modif);

	// Ajouter une rubrique a un administrateur restreint
	if ($modif
	AND autoriser('modifier', 'auteur', $id_auteur, NULL, array('restreintes' => true))
	AND $chercher_rubrique = charger_fonction('chercher_rubrique', 'inc')
	AND $a = $chercher_rubrique(0, 'auteur', false)) {

		$label = $restreint
			? _T('info_ajouter_rubrique')
			: _T('info_restreindre_rubrique');

		$res .= debut_block_depliable(true,"statut$id_auteur")
		. "\n<div id='ajax_rubrique' class='arial1'>\n"
		. "<b>"
		. $label 
		. "</b>"
		. "\n<input name='id_auteur' value='"
		. $id_auteur
		. "' type='hidden' />"
		. $a
		. "</div>\n"

		// onchange = pour le menu
		// l'evenement doit etre provoque a la main par le selecteur ajax
		. "<script type='text/javascript'><!--
		jQuery('#id_parent')
		.bind('change', function(){
			var id_parent = this.value;
			var titre = jQuery('#titreparent').attr('value') || this.options[this.selectedIndex].text;
			// Ajouter la rubrique selectionnee au formulaire,
			// sous la forme d'un input name='rubriques[]'
			var el = '<input type=\'checkbox\' checked=\'checked\' name=\'restreintes[]\' value=\''+id_parent+'\' /> ' + '<a href=\'?exec=naviguer&amp;id_rubrique='+id_parent+'\'>'+titre+'</a>';
			if (jQuery('#rubrest_'+id_parent).size() == 0) {
				jQuery('#liste_rubriques_restreintes')
				.append('<li id=\'rubrest_'+id_parent+'\'>'+el+'</li>');
			}
		}); //--></script>\n"

		. fin_block();
	}

	return $res;
}
/**
 * Affiche les enfants d'une sous rubrique dans un bloc dépliable
 * (Utilisé dans les pages du privé)
 *
 * @param int $collection2
 *  L'identifiant numérique de la rubrique parente
 * @return string
 *  Le contenu du bloc dépliable
 */
function sous_enfant_rub($collection2)
{
    $nb = sql_countsel('spip_rubriques', "id_parent={$collection2}");
    $retour = '';
    $pagination = '';
    $debut = 0;
    $limite = 500;
    /**
     * On ne va afficher que 500 résultats max
     * Si > 500 on affiche une pagination
     */
    if ($nb > $limite) {
        $debut = _request('debut_rubrique' . $collection2) ? _request('debut_rubrique' . $collection2) : $debut;
        $pagination = chercher_filtre('pagination');
        $pagination = '<p class="pagination">' . $pagination($nb, '_rubrique' . $collection2, $debut, $limite, true, 'prive') . '</p>';
        $limite = $debut + $limite;
    }
    $result = sql_select("id_rubrique, id_parent, titre, lang", "spip_rubriques", "id_parent={$collection2}", '', '0+titre,titre', "{$debut},{$limite}");
    while ($row = sql_fetch($result)) {
        $id_rubrique2 = $row['id_rubrique'];
        $id_parent2 = $row['id_parent'];
        $titre2 = generer_info_entite($id_rubrique2, 'rubrique', 'titre');
        // pour etre sur de passer par tous les traitements
        if ('' !== ($rang2 = recuperer_numero($row['titre']))) {
            $rang2 = "{$rang2}. ";
        }
        changer_typo($row['lang']);
        $lang_dir = lang_dir($row['lang']);
        if (autoriser('voir', 'rubrique', $id_rubrique2)) {
            $retour .= "\n<li class='item' dir='{$lang_dir}'><a href='" . generer_url_entite($id_rubrique2, 'rubrique') . "'>" . $rang2 . $titre2 . "</a></li>\n";
        }
    }
    $retour = $pagination . $retour . $pagination;
    if (!$retour) {
        return '';
    }
    return debut_block_depliable($debut > 0 ? true : false, "enfants{$collection2}") . "\n<ul class='liste-items sous-sous-rub'>\n" . $retour . "</ul>\n" . fin_block() . "\n\n";
}
Exemplo n.º 14
0
function sous_enfant_rub($collection2){
	global $spip_lang_left;

	$result3 =  sql_select("id_rubrique, id_parent, titre, lang", "spip_rubriques", "id_parent=$collection2",'', '0+titre,titre');

	$retour = '';
	while($row=sql_fetch($result3)){
		$id_rubrique2=$row['id_rubrique'];
		$id_parent2=$row['id_parent'];
		$titre2=$row['titre'];
		changer_typo($row['lang']);
		$lang_dir = lang_dir($row['lang']);
		if (autoriser('voir','rubrique',$id_rubrique2))
			$retour.="\n<li class='arial11 rubrique_12' dir='$lang_dir'><a href='" . generer_url_ecrire("naviguer","id_rubrique=$id_rubrique2") . "'>".typo($titre2)."</a></li>\n";
	}

	if (!$retour) return '';

	return debut_block_depliable(false,"enfants$collection2")
	."\n<ul style='margin: 0px; padding: 0px; padding-top: 3px;'>\n"
	. $retour
	. "</ul>\n\n".fin_block()."\n\n";
}
Exemplo n.º 15
0
function cs_formatspip($id_article){
	include_spip('public/assembler');
	if(!$txt = recuperer_fond('fonds/format_spip', array('id_article'=>$id_article))) return '';
	$txt = explode('@TITRE@=', $txt, 2);
	// compatibilite SPIP < 2.0
	$compat = function_exists('bouton_block_depliable');
	$bouton = $compat?bouton_block_depliable(cs_div_configuration().$txt[1], 'invisible', "formatspip")
		:bouton_block_invisible("formatspip").cs_div_configuration().$txt[1];
	$bloc = $compat?debut_block_depliable(false, "formatspip")
		:debut_block_invisible("formatspip");
	return debut_cadre_enfonce(find_in_path('/img/formatspip-24.png'), true, '', $bouton)
		. $bloc	. $txt[0] . fin_block()
		. fin_cadre_enfonce(true);
}
Exemplo n.º 16
0
function inc_meme_rubrique_dist($id_rubrique, $id, $type, $order='', $limit=NULL, $ajax=false)
{
	global $spip_lang_right, $spip_lang_left;
	include_spip('inc/presentation');
	include_spip('inc/afficher_objets');

	$table = table_objet_sql($type);
	if (!id_table_objet($table)) {
		spip_log("meme_rubrique: $type table inconnue");
		$type = 'article';
		$table = 'spip_articles';
	}
	$prim = 'id_' . $type;
	if (!$limit)
		$limit = defined('_MAX_ART_AFFICHES') ? _MAX_ART_AFFICHES : 10;

	$titre = ($type!='syndic'?'titre':'nom_site');
	$exec = array('article'=>'articles','breve'=>'breves_voir','syndic'=>'sites');

	$where = (($GLOBALS['visiteur_session']['statut'] == '0minirezo')
		  ? ''
		  :  "(statut = 'publie' OR statut = 'prop') AND ") 
	. "id_rubrique=$id_rubrique AND ($prim != $id)";

	$select = "$prim AS id, $titre AS titre, statut";

	$n = sql_countsel($table, $where);

	if (!$n) return '';

	if (!defined('_TRI_ARTICLES_RUBRIQUE')) define('_TRI_ARTICLES_RUBRIQUE', 'date DESC'); // surcharge possible dans mes_options.php
	$order = ($order == '') ? _TRI_ARTICLES_RUBRIQUE : "$order DESC";
	$voss = sql_select($select, $table, $where, '', "$order", $limit);

	$limit = $n - $limit;
	$retour = '';
	$puce_statut = charger_fonction('puce_statut', 'inc');
	$idom = 'rubrique_' . $type;

	while($row = sql_fetch($voss)) {
		$id = $row['id'];
		$num = afficher_numero_edit($id, $prim, $type);
		$statut = $row['statut'];
		
		// Exception pour les meme-rubrique de sites
		if ($type == "syndic") $type_statut = "site";
		else $type_statut = $type;
		
		$statut = $puce_statut($id, $statut, $id_rubrique, $type_statut);
		$href = "<a class='verdana1' href='"
		. generer_url_ecrire($exec[$type],"$prim=$id")
		. "'>"
		. sinon(typo($row['titre']), _T('info_sans_titre'))
		. "</a>";

		// Todo: refaire en css plus sains
		$retour .= "\n<div>"
				. "\n<div style='float:$spip_lang_right;width: 32%'>"
				. $num . "</div>"
				. "<div style='float:$spip_lang_left; padding-top:1px; width:18px;'>".$statut ."</div>"
				. "<div style='padding-$spip_lang_left:18px;'>".$href."</div>"
				. "<div style='clear:both; height: 3px;'></div>"
				. "</div>";
	}

	$icone =  '<b>' . _T('info_meme_rubrique')  . '</b>';
	$bouton = bouton_block_depliable(_T('info_meme_rubrique'),true,'memerub');

	$retour = 
		debut_cadre('meme-rubriques',"article-24.gif",'',$bouton)
		. debut_block_depliable(true,'memerub')
		. $retour;
	

	//	$retour .= (($limit <= 0) ? '' : "<tr><td colspan='3' style='text-align: center'>+ $limit</td></tr>");

	$retour .= fin_block()
		. fin_cadre('meme-rubriques');

	if ($ajax) return $retour;

	// id utilise dans puce_statut_article
	return "\n<div id='imgstatut$idom$id_rubrique'>$retour</div>";
}
Exemplo n.º 17
0
function joindre_formulaire(&$v) {
	global $spip_lang_right;
	$depliable = false;

	$mode = $v['mode'];
	$vignette_de_doc = ($mode == 'vignette' AND $v['id_document']>0);
	$distant = (($mode == 'document' OR $mode == 'choix') AND $v['type']);

	# indiquer un choix d'upload FTP
	$dir_ftp = '';
	if (test_espace_prive()
	AND ($mode == 'document' OR $mode == 'choix') # si c'est pour un document
	AND !$vignette_de_doc		# pas pour une vignette (NB: la ligne precedente suffit, mais si on la supprime il faut conserver ce test-ci)
	AND $GLOBALS['flag_upload']) {
		if ($dir = determine_upload('documents')) {
			// quels sont les docs accessibles en ftp ?
			$l = texte_upload_manuel($dir, $mode);
			// s'il n'y en a pas, on affiche un message d'aide
			// en mode document, mais pas en mode image
			if ($l OR ($mode == 'document' OR $mode=='choix'))
				$dir_ftp = afficher_transferer_upload($l, $dir);
		}
	}
  
  // Add the redirect url when uploading via iframe

  $iframe = "";
  if($v['iframe_script'])
    $iframe = "<input type='hidden' name='iframe_redirect' value='".rawurlencode($v['iframe_script'])."' />\n";

	// Un menu depliant si on a une possibilite supplementaire

	if ($dir_ftp OR $distant OR $vignette_de_doc) {
		$bloc = "ftp_". $mode .'_'. intval($v['id_document']);

		if ($vignette_de_doc)
			$debut = bouton_block_depliable($v['intitule'],false,$bloc);
		else
			$debut = $v['intitule'];

		$milieu = debut_block_depliable(false,$bloc);
		$fin = "\n\t" . fin_block();
		$v['titre'] = bouton_block_depliable($v['titre'],false,$bloc);

	} else
		$debut = $milieu = $fin = '';

	// Lien document distant, jamais en mode image
	if ($distant) {
		$distant = "<br />\n<div style='border: 1px #303030 solid; padding: 4px; color: #505050;'>" .
			"\n\t<img src='". chemin_image('attachment.gif') .
			"' style='float: $spip_lang_right;' alt=\"\" />\n" .
			"<label for='url'>" .
			_T('info_referencer_doc_distant') .
			"</label><br />\n\t<input name='url' id='url' value='http://' />" .
			"\n\t<div style='text-align: $spip_lang_right'><input name='sousaction2' type='submit' value='".
			_T('bouton_choisir').
			"' /></div>" .
			"\n</div>";
	}

	$res = "<input name='fichier' id='fichier_$mode" .'_'. strval($v['id_document']) . "' type='file' class='forml spip_xx-small' size='15' />"
	. ($v['ancre']
		? "\n\t\t<input type='hidden' name='ancre' value='".$v['ancre']."' />"
		: ''
	)
	. "\n\t\t<div style='text-align: $spip_lang_right'><input name='sousaction1' type='submit' value='"
	. _T('bouton_telecharger')
	. "' /></div>";

	if ($vignette_de_doc)
		$res = $milieu . $res;
	else
		$res = $res . $milieu;

	return "$iframe$debut$res$dir_ftp$distant$fin";
}
function spiplistes_auteur_abonnement_details ($id_auteur, $auteur_statut, $email) {
	
	include_spip("inc/spiplistes_api");
	include_spip("inc/spiplistes_api_presentation");

	global $connect_statut
		, $connect_toutes_rubriques
		, $connect_id_auteur
		;

	$result = "";

	$flag_editable = (
		(($connect_statut == '0minirezo') && $connect_toutes_rubriques)
		|| ($connect_id_auteur == $id_auteur)
		);

	if($flag_editable) {
		
		// recupere la liste des abonnements disponibles
		$sql_where = spiplistes_listes_sql_where_or(_SPIPLISTES_LISTES_STATUTS_PERIODIQUES)
			. " OR statut=".sql_quote(_SPIPLISTES_LIST_PUBLIC);
			
		// les auteurs ont droit aux listes privees (internes)
		if(($auteur_statut == '1comite') || ($auteur_statut == '0minirezo')) {
			$sql_where .= " OR statut=".sql_quote(_SPIPLISTES_LIST_PRIVATE);
		}

		$sql_result = sql_select(
			array('id_liste','titre','texte','date','statut')
			, "spip_listes"
			, $sql_where
			, ''
			, array("titre ASC")
			);

		$nb_listes_dispo = sql_count($sql_result);
//spiplistes_log(gettype($nb_listes_dispo).":".$nb_listes_dispo);

		// si liste disponible, affiche formulaire
		if($sql_result && $nb_listes_dispo) {
			
			// recupere la liste des listes
			$listes = array();
			while($row = sql_fetch($sql_result)) {
				$texte = propre($row['texte']);
				if(strlen($legend = textebrut($texte)) > 40) {
					$texte = couper($texte, 40);
				}
				$texte = strip_tags($texte, '<strong>');
				$listes[] = array(
					'id_liste' => intval($row['id_liste'])
					, 'titre' => $row['titre']
					, 'texte' => $texte
					, 'date' => $row['date']
					, 'statut' => $row['statut']
					, 'legend' => $legend
				);
			} // end while
			
			// si retour de formulaire, ajoute/retire les abonnements
			if(_request('btn_abonnements_valider')) {
				$abos_set = _request('abos_set');
				$abo_ajoute = array();
				// liste des abonnements de id_auteur
				$auteur_abos_current_list = spiplistes_abonnements_listes_auteur($id_auteur);
				// ajoute/retire les abonnements desires
				if(count($abos_set)) {
					// Abonnements ?
					foreach($abos_set as $value) {
						if(!in_array($value, $auteur_abos_current_list)) {
							$abo_ajoute[] = $value;
						}
					}
					if(count($abo_ajoute)) {
						spiplistes_abonnements_ajouter($id_auteur, $abo_ajoute);
					}
					// Desabonnements ?
					foreach($auteur_abos_current_list as $value) {
						if(!in_array($value, $abos_set)) {
							spiplistes_abonnements_auteur_desabonner($id_auteur, $value);
						}
					}
				}
				// desabonne de tout
				else {
					if(spiplistes_abonnements_auteur_desabonner($id_auteur, "toutes") === false) {
						$result .= spiplistes_boite_alerte(_T('spiplistes:Erreur_sur_la_base'), true);
					}
				}
			} // end if
			
			// si retour de formulaire, modifie le format de reception
			if($abo_format = _request('abo_format')) {
				spiplistes_format_abo_modifier($id_auteur, $abo_format);
			}
			
			// recupere le format d'abonnement de id_auteur
			$abo_format = spiplistes_format_abo_demande($id_auteur);		
		
			// recupere la liste ou auteur est abonne
			$auteur_abos_current_list = spiplistes_abonnements_listes_auteur($id_auteur);
			
			$bloc_visible = _request('btn_abonnements_valider');
			
			$debut_block = ($bloc_visible ? "spiplistes_debut_block_visible" : "spiplistes_debut_block_invisible");
			
			$result .= ""
				. "<!-- formulaire abonnement spiplistes -->\n" 
				. "<a name='abonnement'></a>\n"
				. debut_cadre_enfonce(_DIR_PLUGIN_SPIPLISTES_IMG_PACK."courriers_listes-24.png"
					, true, '', _T('spiplistes:listes_de_diffusion_'))
				. spiplistes_bouton_block_depliable(
					_T('spiplistes:abonnements_aux_courriers')
					, $bloc_visible
					, "abos_block")
				. "<div class='verdana2'>"
				;
			if($n = count($auteur_abos_current_list)) {
				$result .= $n."/"
					. spiplistes_nb_listes_str_get ($nb_listes_dispo)
					. ". "
					. _T('spiplistes:format_de_reception')." : "
						.	(
							(in_array($abo_format, array('html', 'texte')))
							? _T('spiplistes:'.$abo_format)
							: "&lt;"._T('spiplistes:aucun')."&gt;"
							)
					;
			} else {
				$result .= _T('spiplistes:Sans_abonnement');
			}
			$result .= ""
				. "</div>\n"
				. $debut_block("abos_block")
				. "<form action='".generer_url_ecrire("auteur_infos", "id_auteur=$id_auteur")."' method='post' style='margin-bottom:0;' name='abos_formulaire'>\n"
				. debut_cadre_formulaire("", true)
				. "\n<p class='verdana2' style='margin-top:0;margin-bottom:0;'>"
				.	(
						($abo_format!='html' && $abo_format!='texte')
						? _T('spiplistes:Alert_abonnement_sans_format')
						: _T('spiplistes:vous_etes_abonne_aux_listes_selectionnees_').":"
					)
				. "</p>\n"
				//
				. "<!-- liste des abonnements -->\n"
				. "<ul class='liste-listes'>\n"
				;
			foreach($listes as $key=>$value) {
				$id_liste = $value['id_liste'];
				$auteur_est_abonne = in_array($id_liste, $auteur_abos_current_list);
				$checked = $auteur_est_abonne ? "checked='checked'" : "";
				$label = $auteur_est_abonne ? "Arreter_abonnement_a" : "Abonner_a";
				$label = _T("spiplistes:".$label)." ".$value['titre'];
				$prochain_envoi = 
					($value['date'] > 0)
					? _T('spiplistes:Prochain_envoi_').": <span style='font-weight:bold;'>".affdate_heure($value['date'])."</span>"
					: _T('spiplistes:envoi_non_programme')
					;
				$result .= ""
					. "<li>\n"
					. "<label>\n"
					. "<input name='abos_set[]' type='checkbox' value='$id_liste' title=\"$label\" $checked />\n"
					. spiplistes_bullet_titre_liste('puce', $value['statut'], '', true)
					. "<span title=\"".$value['legend']."\">\n"
					. "<span class='titre'>".typo($value['titre'])."</span> \n"
					. "<span class='description'>".typo($value['texte'])." </span>\n"
					. "<span class='periodicite'>($prochain_envoi)</span>\n"
					. "</span>\n"
					. "</label></li>\n"
					;
			}
			$result .= ""
				. "</ul>\n"
				. "<!-- fin liste des abonnements -->\n"
				. fin_cadre_formulaire(true)
				//
				// selection du format de reception
				. debut_cadre_formulaire("margin-top:1ex", true)
				. ((empty($abo_format) || ($abo_format=="non")) 
					? "<p>"._T('spiplistes:Format_obligatoire_pour_diffusion')."</p>" : "" )
				. _T('spiplistes:format_de_reception')
				. "<ul class='liste-format'>\n"
				;
			$checked = ($abo_format=="html" ? "checked='checked'" : "");
			$result .= ""
				. "<li style='width:50%;float:left;'>\n"
				. " <input type='radio' name='abo_format' value='html' id='format_rcpt_html' title='"._T('spiplistes:html')."' $checked />"
				. " <label for='format_rcpt_html'>"._T('spiplistes:version_html')."</label></li>\n"
				;
			$checked = ($abo_format=="texte" ? "checked='checked'" : "");
			$result .= ""
				. "<li>\n"
				. " <input type='radio' name='abo_format' value='texte' id='format_rcpt_texte' title='"._T('spiplistes:texte')."' $checked />"
				. " <label for='format_rcpt_texte'>"._T('spiplistes:version_texte')."</label></li>\n"
				. "</ul>\n"
				. fin_cadre_formulaire(true)
				;
			if(spiplistes_format_valide($abo_format) && ($abo_format!="non")) {
				$result .= ""
					. debut_cadre_formulaire("margin-top:1ex", true)
					. "<ul class='liste-format-desabo'>\n"
					. "<li>\n"
					. spiplistes_form_input_radio('abo_format', 'non', _T('spiplistes:Suspendre_abonnements')
						, false, true, false)
					. "</li>\n"
					. "</ul>\n"
					. fin_cadre_formulaire(true)
					;
			}
			$result .= ""
				//
				. "<div style='text-align:right;margin-top:1ex;'><input type='submit' name='btn_abonnements_valider' "
					. " value='"._T('spiplistes:Valider_abonnement')."' class='fondo' /></div>\n"
				. "</form>\n"
				. fin_block()
				. fin_cadre_enfonce(true)
				;
		}
	}
	
	return($result);
}
Exemplo n.º 19
0
function editer_auteurs_objet($type, $id, $flag, $cherche_auteur, $ids, $les_auteurs, $futurs, $statut, $titre_boite,$script_edit_objet, $arg_ajax)
{
	global $spip_lang_left, $spip_lang_right;

	$bouton_creer_auteur =  $GLOBALS['connect_toutes_rubriques'];
	$clic = _T('icone_creer_auteur');

//
// complement de action/editer_auteurs.php pour notifier la recherche d'auteur
//
	if ($cherche_auteur) {

		$reponse ="<div style='text-align: $spip_lang_left'>"
		. debut_boite_info(true)
		. rechercher_auteurs_objet($cherche_auteur, $ids, $type, $id,$script_edit_objet, $arg_ajax);

		if ($type=='article' && $bouton_creer_auteur) { // pas generique pour le moment

			$legende = generer_url_ecrire("auteur_infos", "new=oui&lier_id_article=$id");
			if (isset($cherche_auteur))
				$legende = parametre_url($legende, 'nom', $cherche_auteur);
			$legende = parametre_url($legende, 'redirect',
				generer_url_ecrire('articles', "id_article=$id", '&'));

			$reponse .="<div style='width: 200px;'>"
			. icone_horizontale($clic, $legende, "redacteurs-24.gif", "creer.gif", false)
			. "</div> ";

			$bouton_creer_auteur = false;
		}

		$reponse .= fin_boite_info(true)
		. '</div>';
	} else $reponse ='';

	$reponse .= $les_auteurs;

//
// Ajouter un auteur
//

	$res = '';
	if ($flag) {

		if ($type=='article' && $bouton_creer_auteur) { // pas generique pour le moment

			$legende = generer_url_ecrire("auteur_infos", "new=oui&lier_id_article=$id");
			if (isset($cherche_auteur))
				$legende = parametre_url($legende, 'nom', $cherche_auteur);
			$legende = parametre_url($legende, 'redirect',
				generer_url_ecrire('articles', "id_article=$id", '&'));

			$clic = "<span class='verdana1'><b>$clic</b></span>";
			$res = icone_horizontale_display($clic, $legende, "redacteurs-24.gif", "creer.gif", false);
		}

		$res = "<div style='float:$spip_lang_right; width:280px;position:relative;display:inline;'>"
		. $futurs
		."</div>\n"
		. $res;
	}

	$idom = "auteurs_$type" . "_$id";
	$bouton = bouton_block_depliable($titre_boite,$flag ?($flag === 'ajax'):-1,$idom);
	$res = debut_cadre_enfonce("auteur-24.gif", true, "", $bouton)
	. $reponse
	. debut_block_depliable($flag === 'ajax',$idom)
	. $res
	. fin_block()
	. fin_cadre_enfonce(true);

	return ajax_action_greffe("editer_auteurs", $id, $res);
}
Exemplo n.º 20
0
function adhclub_imp_show_erreurs($erreur)
{
    $output = "";
    if (count($erreur) > 0) {
        $bouton = bouton_block_depliable(_T('adhintg:adh_erreurs'), false, "adh_erreurs");
        $output .= debut_cadre_enfonce("mot-cle-24.gif", true, "", $bouton);
        $output .= debut_block_depliable(false, "adh_erreurs");
        foreach ($erreur as $key => $val) {
            $output .= "<dl>";
            $output .= "<dt>" . _T('adhclub:champ_err', array('cher' => $key));
            $output .= "<dd>" . _T('adhintg:' . $key) . " : {$val}<dd>";
            $output .= "</dl>";
        }
        $output .= fin_block();
        $output .= fin_cadre_enfonce(true);
    }
    return $output;
}
Exemplo n.º 21
0
function http_message_avec_participants($id_message, $statut, $forcer_dest, $cherche_auteur, $expediteur='')
{
	global $connect_id_auteur ;

	if ($cherche_auteur) {
		echo "\n<div style='text-align: left' class='cadre-info'>"
		. http_auteurs_ressemblants($cherche_auteur , $id_message)
		. "\n</div>";
	  }
	$bouton = bouton_block_depliable(_T('info_nombre_partcipants'),true,"auteurs,ajouter_auteur");
	echo debut_cadre_enfonce("redacteurs-24.gif", true, '', $bouton, 'participants');

	//
	// Liste des participants
	//

	$result = sql_allfetsel("*", "spip_auteurs AS auteurs, spip_auteurs_messages AS lien", "lien.id_message=$id_message AND lien.id_auteur=auteurs.id_auteur");

	$total_dest = count($result);

	if ($total_dest > 0) {
		$ifond = 0;
		$res = '';
		$formater_auteur = charger_fonction('formater_auteur', 'inc');
		$t = _T('lien_retrait_particpant');
		foreach($result as $k => $row) {
			$id_auteur = $row["id_auteur"];
			list($status, $mail, $nom, $site,) = $formater_auteur($id_auteur, $row);
			if ($id_auteur == $expediteur) {

				$nom = "<span class='arial0' style='margin-left: 10px'>"
				.  _T('info_auteur_message')
				. "</span> $nom";
			}
			$class = alterner (++$ifond,'row_even','row_odd');
			$res .= "<tr class='$class'>\n<td class='nom'>$status $mail $nom $site$exp</td>"
			  . "\n<td align='right' class='lien'>"
			  . (($id_auteur == $connect_id_auteur) ?  "&nbsp;" : ("[<a href='" . redirige_action_auteur("editer_message","$id_message/-$id_auteur", 'message', "id_message=$id_message") . "'>$t</a>]")) .  "</td></tr>\n";
			$result[$k] = $id_auteur;
		
		}
		echo
			debut_block_depliable(true,"auteurs"),
			"\n<table class='spip' width='100%'>",
			$res,
			  "</table>\n",
			fin_block();
	}

	if ($statut == 'redac' OR $forcer_dest)
		echo http_ajouter_participants($result, $id_message);
	else {
		echo
		  debut_block_depliable(true,"ajouter_auteur"),
		  "<br />\n<div style='text-align: right' class='verdana1 spip_small'><a href='" . generer_url_ecrire("message","id_message=$id_message&forcer_dest=oui") . "'>"._T('lien_ajouter_participant')."</a></div>",
		  fin_block();
	}
	echo fin_cadre_enfonce(true);
	return $total_dest;
}
Exemplo n.º 22
0
function galettonuts_formulaire_synchro()
{
    global $spip_lang_left, $spip_lang_right;
    include_spip('inc/config');
    // Détermine si on dépli le cadre
    if ('oui' == _request('galettonuts_synchro_ok')) {
        $visibilite = 'visible';
    } else {
        $visibilite = 'invisible';
    }
    $return = debut_cadre_couleur('synchro-24.gif', true, '', call_user_func('bouton_block_' . $visibilite, 'galettonuts_synchro') . _T('galettonuts:titre_formulaire_synchro'));
    $return .= call_user_func('debut_block_' . $visibilite, 'galettonuts_synchro');
    // Le plugin n'a pas encore été configuré
    if (!class_exists('L2_Spip_Plugin_Metas')) {
        include_spip('lib/L2/Spip/Plugin/Metas.class');
    }
    $config = new L2_Spip_Plugin_Metas('galettonuts_config');
    if (!$config || !$config->lire('db_ok')) {
        $return .= debut_cadre_relief('', true);
        $return .= http_img_pack('warning.gif', _T('info_avertissement'), 'style="width:48px;height:48px;float:right;margin:5px;"');
        $return .= '<p class="verdana2"><strong>';
        $return .= _T('galettonuts:configuration_manquante');
        $return .= '</strong><br />';
        $return .= _T('galettonuts:configuration_lien', array('url' => generer_url_ecrire('admin_galettonuts')));
        $return .= '</p>';
        $return .= fin_cadre_relief(true);
        $return .= fin_block();
        $return .= fin_cadre_couleur(true);
        return $return;
    }
    unset($config);
    // Affichage des erreurs
    if ($statut = (int) _request('code_retour')) {
        switch ($statut) {
            // Une erreur inconnue est survenue.
            case 0:
                $msg = '<p class="verdana2"><strong>' . _T('info_avertissement') . '</strong><br />';
                $msg .= _T('galettonuts:etat_synchro_erreur') . '</p>';
                $alt = _T('info_avertissement');
                $img = _DIR_PLUGIN_GALETTONUTS . 'img_pack/error-48.png';
                break;
                // Des erreurs sont survenues lors de la connexion à la BDD.
            // Des erreurs sont survenues lors de la connexion à la BDD.
            case -2:
                $msg = '<p class="verdana2"><strong>' . _T('info_avertissement') . '</strong><br />';
                $msg .= _T('galettonuts:etat_synchro_erreur_bdd') . '</p>';
                $alt = _T('info_avertissement');
                $img = _DIR_PLUGIN_GALETTONUTS . 'img_pack/error-48.png';
                break;
                // La synchronisation a échouée.
            // La synchronisation a échouée.
            case -1:
                $msg = '<p class="verdana2"><strong>' . _T('info_avertissement') . '</strong><br />';
                $msg .= _T('galettonuts:etat_synchro_echec') . '</p>';
                $alt = _T('info_avertissement');
                $img = _DIR_PLUGIN_GALETTONUTS . 'img_pack/error-48.png';
                break;
                // La synchronisation est inutile.
            // La synchronisation est inutile.
            case -10:
                $msg = '<p class="verdana2"><strong>' . _T('galettonuts:info_information') . '</strong><br />';
                $msg .= _T('galettonuts:etat_synchro_inutile') . '</p>';
                $alt = _T('galettonuts:info_information');
                $img = _DIR_PLUGIN_GALETTONUTS . 'img_pack/information-48.png';
                break;
                // La synchronisation s'est déroulée correctement
            // La synchronisation s'est déroulée correctement
            default:
                $msg = '<p class="verdana2"><strong>' . _T('galettonuts:info_information') . '</strong><br />';
                $msg .= _T('galettonuts:etat_synchro_ok', array('nb' => $statut)) . '</p>';
                $alt = _T('galettonuts:info_information');
                $img = _DIR_PLUGIN_GALETTONUTS . 'img_pack/information-48.png';
                break;
        }
        $return .= debut_cadre_relief('', true);
        $return .= http_img_pack($img, $alt, 'style="width:48px;height:48px;float:right;margin:5px;"');
        $return .= $msg;
        $return .= fin_cadre_relief(true);
    }
    $voir_statut = _request('statut');
    if ($voir_statut) {
        $voir_statut = '&statut=' . $voir_statut;
    }
    $action = generer_action_auteur('galettonuts_cron_manuel', 'galettonuts-0.1&' . $voir_statut, 'auteurs');
    $return .= '<p class="verdana2">' . _T('galettonuts:texte_synchro_manuelle') . '</p>';
    $return .= '<form action="' . $action . '" method="post>"';
    $return .= form_hidden($action);
    // Dernière mise à jour
    $synchro = new L2_Spip_Plugin_Metas('galettonuts_synchro');
    if ('' != ($maj = $synchro->lire('maj'))) {
        $return .= '<p class="verdana2">' . _T('galettonuts:derniere_maj', array('annee' => date('Y', $maj), 'mois' => date('m', $maj), 'jour' => date('d', $maj), 'heures' => date('G', $maj), 'minutes' => date('i', $maj), 'secondes' => date('s', $maj)));
        $return .= '</p>';
    }
    // Bouton de validation
    $return .= '<div style="text-align:right;padding:0 2px;margin-top:.5em" id="buttons">';
    $return .= '<input type="submit" name="_galettonuts_ok" value="' . _T('galettonuts:entree_synchroniser') . '" class="fondo" style="cursor:pointer"/></div>';
    $return .= '</form>';
    $return .= fin_block();
    $return .= fin_cadre_couleur(true);
    return $return;
}
Exemplo n.º 23
0
function exec_spiplistes_courrier_edit(){

	include_spip('inc/barre');
	include_spip('inc/documents');
	include_spip('base/spiplistes_tables');
	include_spip('inc/spiplistes_api');
	include_spip('inc/spiplistes_api_presentation');
	include_spip('inc/spiplistes_dater_envoi');
	include_spip('inc/spiplistes_api_courrier');
	include_spip('public/assembler');
	include_spip('inc/spiplistes_naviguer_paniers');

	global $connect_statut
		, $connect_toutes_rubriques
		, $connect_id_auteur
		, $spip_ecran
		, $compteur_block
		;
	
	$eol = "\n";
	$id_temp = false;
	
	$type = _request('type');
	$id_courrier = intval(_request('id_courrier'));

	foreach(array('btn_courrier_apercu') as $key) {
		$$key = _request($key);
	}

	if($id_courrier > 0) {
	///////////////////////////
	// Edition /modification d'un courrier
		$sql_select_array = array('titre','texte','message_texte','type','statut','id_auteur');
		if($row = spiplistes_courriers_premier($id_courrier, $sql_select_array)) {
			foreach($sql_select_array as $key) {
				$$key = $row[$key];
			}
			$titre = entites_html($titre);
			$texte = entites_html($texte);
		}
		else {
			$id_courrier = false;
		}
	}
	// n'existe pas encore ?
	// placer un marqueur pour les documents joints
	else {
		$id_temp = 0-intval(substr(creer_uniqid(),0,5));
	}

	// l'edition du courrier est reservee aux super-admins 
	// ou aux admin createur du courrier
	$flag_editable = (($connect_statut == "0minirezo") 
		&& ($connect_toutes_rubriques || ($connect_id_auteur == $id_auteur) || !$id_courrier));

	if($flag_editable) {
		if(!$id_courrier) {
		// si pas de ID courrier, c'est une creation
			$statut = _SPIPLISTES_COURRIER_STATUT_REDAC; 
			$type = _SPIPLISTES_COURRIER_TYPE_NEWSLETTER;
			$new = 'oui';
			$titre = _T('spiplistes:Nouveau_courrier');
			$clearonfocus = " onfocus=\"if(!antifocus){this.value='';antifocus=true;}\"";
		}
		else {
			$clearonfocus = "";
		}
	
		$gros_bouton_retour =
			($id_courrier)
			? icone(
				_T('spiplistes:retour_link')
				, generer_url_ecrire(_SPIPLISTES_EXEC_COURRIER_GERER, "id_courrier=$id_courrier")
				, spiplistes_items_get_item('icon', $statut)
				, "rien.gif"
				, ""
				, false
				)
			: ""
			;
		$boite_documents = afficher_documents_colonne(
							  ($id_courrier ? $id_courrier : $id_temp )
							  , 'courrier');
	}
	
////////////////////////////////////
// PAGE CONTENU
////////////////////////////////////

	$titre_page = _T('spiplistes:edition_du_courrier');
	// Permet entre autres d'ajouter les classes a' la page : <body class='$rubrique $sous_rubrique'>
	$rubrique = _SPIPLISTES_PREFIX;
	$sous_rubrique = "courrier_edit";

	$commencer_page = charger_fonction('commencer_page', 'inc');
	echo($commencer_page(_T('spiplistes:spiplistes') . " - " . $titre_page, $rubrique, $sous_rubrique));

	if(!$flag_editable) {
		die (spiplistes_terminer_page_non_autorisee() . fin_page());
	}
	
	$page_result = ""
		. "<br /><br /><br />\n"
		. spiplistes_gros_titre($titre_page, '', true)
		. barre_onglets($rubrique, $sous_rubrique)
		. debut_gauche($rubrique, true)
		. spiplistes_boite_info_id(_T('spiplistes:Courrier_numero_'), $id_courrier, true)
		. spiplistes_naviguer_paniers_courriers(_T('spiplistes:aller_au_panier_'), true)
		. $boite_documents
		. pipeline('affiche_gauche', array('args'=>array('exec'=>$sous_rubrique),'data'=>''))
		//. creer_colonne_droite($rubrique, true)  // spiplistes_boite_raccourcis() s'en occupe
		. spiplistes_boite_raccourcis(true)
		//. spiplistes_boite_autocron() // ne pas gener l'edition
		. pipeline('affiche_droite', array('args'=>array('exec'=>$sous_rubrique),'data'=>''))
		. debut_droite($rubrique, true)
		;

	$page_result .= ""
		// le bloc pour apercu (retour ajax)
		. "<div id='apercu-courrier' style='clear:both;tex-align:center'></div>\n"
		//
		. debut_cadre_formulaire('', true)
		. "<a name='haut-block' id='haut-block'></a>\n"
		// 
		//
		// bloc titre
		. "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>\n"
		. "<tr width='100%'>"
		. "<td>"
		. $gros_bouton_retour
		. "</td>"
		. "<td><img src='"._DIR_IMG_PACK."/rien.gif' width='10'></td>\n"
		. "<td width='100%'>"
		. ($id_courrier ? _T('spiplistes:Modifier_un_courrier__') : _T('spiplistes:Creer_un_courrier_') )."<br />\n"
		. spiplistes_gros_titre($titre, '', true)
		. "</td>\n"
		. "</tr></table>\n"
		. "<hr />\n"
		;
		//
		// debut formulaire
	
	$page_result .= ""
		. "<form action='".generer_url_ecrire(_SPIPLISTES_EXEC_COURRIER_GERER
											  , ($id_courrier ? "id_courrier=$id_courrier" : "")
											  )
			."' method='post' name='formulaire_courrier_edit' id='formulaire_courrier_edit'>\n"
		. "<input type='hidden' name='modifier_message' value=\"oui\" />\n"
		. "<input type='hidden' name='id_courrier' value='$id_courrier' />\n"
		//
		// bloc sujet du courrier
		. "<label for='sujet_courrier'>"._T('spiplistes:sujet_courrier').":</label>\n"
		. "<input id='sujet_courrier' type='text' class='formo' name='titre' value=\"$titre\" size='40' $clearonfocus />\n"
		. "<p style='margin-bottom:1.75em;'>"._T('spiplistes:Courrier_edit_desc')."</p>\n"
		;
		
	$titre_block_depliable = _T('spiplistes:Generer_le_contenu');
	$page_result .= ''
		//
		// generer le contenu
		// Reprise du Formulaire adapte de abomailman () // MaZiaR - NetAktiv	// tech@netaktiv.com
		. debut_cadre_relief(_DIR_PLUGIN_SPIPLISTES_IMG_PACK.'stock_insert-slide.gif', true)
		//. bouton_block_invisible(md5(_T('spiplistes:charger_patron')))
		. spiplistes_bouton_block_depliable($titre_block_depliable, false, md5(_T('spiplistes:charger_patron')))
		. "<span class='verdana2 triangle_label' onclick=\"javascript:$('#triangle".$compteur_block."').click();\">"
			. (spiplistes_spip_est_inferieur_193() ? $titre_block_depliable : "")
			. "</span>\n"
		. spiplistes_debut_block_invisible(md5(_T('spiplistes:charger_patron')))
		// 
		. '<div id="ajax-loader" align="right">'
			. '<script type="text/javascript">'.$eol
			. 'document.write(\'<img src="' . _DIR_PLUGIN_SPIPLISTES_IMG_PACK . 'ajax_indicator.gif" alt="" />\');'	
			. '</script>'.$eol
			. '<noscript>'.$eol
			. spiplistes_boite_alerte (_T('spiplistes:javascript_inactif'), true)
			. $eol
			. '</noscript>'.$eol
			//. '<img src="' . _DIR_PLUGIN_SPIPLISTES_IMG_PACK . 'ajax_indicator.gif" alt="" />'
			. '</div>'.$eol
		;
	
	if(strpos($GLOBALS['meta']['langues_multilingue'], ",") !== false) {
		$page_result .= "" 
			// selecteur de langues
			. "<div class='boite-generer-option'>\n"
			. "<label class='verdana2'>"._T('spiplistes:Langue_du_courrier_')
			. "<select name='lang' class='fondo'>\n"
			. liste_options_langues('changer_lang')
			. "</select></label>\n"
			. "</div>\n"
			;
	}
	
	$page_result .= ""
		// Prendre en compte a partir de quelle date ?
		. spiplistes_dater_envoi(
			'courrier', $id_courrier, $statut
			, $flag_editable
			, _T('spiplistes:Contenu_a_partir_de_date_')
			, normaliser_date(time()), 'btn_changer_date'
			, false
			)
		;
		
	$page_result .= ""
		// texte introduction a placer avant le patron et sommaire 
		. '<div class="boite-generer-option">'.$eol
		. '<label class="verdana2">'
		. '<input type="checkbox" id="avec_intro" name="avec_intro" value="non" />'
		. _T('spiplistes:avec_introduction')
		. '</label>'.$eol
		. '<div id="choisir_intro" class="option">'.$eol
		. '<label class="verdana2" style="display:block;" for="message_intro">'
		. _T('spiplistes:introduction_du_courrier_').':</label>'.$eol
		. afficher_barre('document.formulaire_courrier_edit.message_intro')
		. '<textarea id="message_intro" name="message_intro" '.$GLOBALS['browser_caret'].' rows="5" cols="40" wrap="soft" style="width:100%">'.$eol
		. '</textarea>'
		. '</div>'.$eol
		. '</div>'.$eol
		;
		
	// selection du patron
	$page_result .= ''
		. "<div class='boite-generer-option'>\n"
		. "<label class='verdana2'>"
		. "<input type='checkbox' id='avec_patron' name='avec_patron' value='non' />"
		. _T('spiplistes:a_partir_de_patron')
		. "</label>\n"
		. "<div id='choisir_patron' class='option'>"
		. "<label class='verdana2'>"
		. _T('spiplistes:choisir_un_patron_').":</label>\n"
		. spiplistes_boite_selection_patrons ("", true, _SPIPLISTES_PATRONS_DIR, "patron", 1)
		. "<div id='patron_pos' style='display:none'>\n"
		. "<span class='verdana2'>" . _T('spiplistes:generer_patron_'). "</span>\n"
		. spiplistes_form_input_radio ('patron_pos', 'avant', _T('spiplistes:generer_patron_avant'), true, true, false)
		. spiplistes_form_input_radio ('patron_pos', 'apres', _T('spiplistes:generer_patron_apres'), false, true, false)
		. "</div>\n"
		. "</div>\n"
		. "</div>\n"
		;
	
	// Generer un sommaire
	$page_result .= ""
		. "<div class='boite-generer-option'>\n"
		. "<label class='verdana2'>"
		. "<input type='checkbox' id='avec_sommaire' name='avec_sommaire' value='non' />"
		. _T('spiplistes:generer_un_sommaire')
		. "</label>\n"
		. "<div id='choisir_sommaire' class='option'>";		
	$page_result .= ""
		//
		// selecteur de rubriques
		. "<label class='verdana2' for='ajouter_rubrique'>"._T('spiplistes:Lister_articles_de_rubrique').":</label>\n"
		. "<select name='id_rubrique' id='ajouter_rubrique' class='formo'>\n"
		. "<option value=''></option>\n"
		. spiplistes_arbo_rubriques()
		. "</select>\n"
		. "<br />\n"
		//
		// selecteur des mots-cles
		. "<label class='verdana2' for='ajouter_motcle'>"._T('spiplistes:Lister_articles_mot_cle').":</label>\n"
		. "<select name='id_mot' id='ajouter_motcle' class='formo'>\n"
		. "<option value=''></option>\n"
		;
	
	if (version_compare($GLOBALS['spip_version_code'], '1.9300', '<')){
		$rqt_gmc = sql_select (array('id_groupe','titre'), 'spip_groupes_mots', "articles=".sql_quote('oui'));
	}else{
		$rqt_gmc = sql_select (array('id_groupe','titre'), 'spip_groupes_mots', "tables_liees LIKE '%articles%'");		
	}
	
	while ($row = sql_fetch($rqt_gmc)) {
		$id_groupe = intval($row['id_groupe']);
		$titre = $row['titre'];
		$page_result .= "<option value='' disabled='disabled'>". supprimer_numero (typo($titre)) . "</option>\n";
		$rqt_mc = sql_select (array('id_mot','titre'), 'spip_mots', "id_groupe=".sql_quote($id_groupe));
		while ($row = sql_fetch($rqt_mc)) {
			$id_mot = intval($row['id_mot']);
			$titre = supprimer_numero (typo($row['titre']));
			$page_result .= "<option value='$id_mot'>--&nbsp;$titre</option>\n";
		}
	}
	$page_result .= ""
		. "</select><br />\n"
		//
		// a partir de la date selectionnee plus haut
		. spiplistes_form_input_item ('checkbox', 'date_sommaire', 'oui'
			, _T('spiplistes:sommaire_date_debut'), $sommaire_date == 'oui', true, false)
		. "</div>\n"
		. "</div>\n"
		; // fin generer le sommaire
		
		// choisir son patron de pied
	$page_result .= ""
		. "<div class='boite-generer-option'>\n"
			. "<label class='verdana2'>"
		. _T('spiplistes:avec_patron_pied__')
		. spiplistes_boite_selection_patrons (_SPIPLISTES_PATRONS_PIED_DEFAUT, true, _SPIPLISTES_PATRONS_PIED_DIR, "pied_patron", 1)
		. "</label>\n"
		. "</div>\n"
		; 
		
	$page_result .= ""
		. "<p class='verdana2'>\n"
			. _T('spiplistes:Cliquez_Generer_desc'
				, array('titre_bouton'=>_T('spiplistes:generer_Apercu'), 'titre_champ_texte'=>_T('spiplistes:texte_courrier'))
				)
			. "</p>\n"
		. "<p class='verdana2'>\n" ._T('spiplistes:calcul_patron_attention') .  "</p>\n"
		. spiplistes_form_bouton_valider ('Valider', _T('spiplistes:generer_Apercu'))
		. fin_block() // fin_block_invisible
		. fin_cadre_relief(true)
		. "<br />\n"
		;
		
	//
	// bloc du courrier (titre, texte), toujours visible
	$page_result .= ''
		. '<label for="texte_courrier">'._T('spiplistes:texte_courrier').'</label>'
		. afficher_barre('document.formulaire_courrier_edit.message')
		. '<textarea id="texte_courrier" name="message" '.$GLOBALS['browser_caret'].' class="porte_plume_partout barre_inserer formo" rows="20" cols="40" wrap=soft>'.$eol
		. $texte
		. '</textarea>'.$eol
		. (!$id_courrier ? '<input type="hidden" name="new" value="oui" />'.$eol : '')
		//
		. '<p style="text-align:right;">'.$eol
		. '<input type="submit" onclick="this.value=\'oui\';" id="btn_courrier_edit" '
			. ' name="btn_courrier_valider" value="'._T('bouton_valider').'" class="fondo" /></p>'.$eol
		// le marqueur pour les documents joints
		. (($id_temp!==false) ? '<input type="hidden" name="id_temp" value="' . $id_temp . '" />'.$eol : '')
		//
		// fin formulaire
		. '</form>'.$eol
		. fin_cadre_formulaire(true)
		;
	
	echo($page_result);

	// COURRIER EDIT FIN ---------------------------------------------------------------

	echo pipeline('affiche_milieu',array('args'=>array('exec'=>$sous_rubrique),'data'=>''))
		, spiplistes_html_signature(_SPIPLISTES_PREFIX)
		, fin_gauche(), fin_page();
	
}
Exemplo n.º 24
0
function liste_archive_jointe($valables, $zip, $type, $id, $mode, $id_document, $hash, $redirect, $iframe_redirect)
{
	include_spip('inc/layer');

	$arg = (intval($id) .'/' .intval($id_document) . "/$mode/$type");

	$texte = "<div style='text-align: left'>
<input type='hidden' name='redirect' value='$redirect' />
<input type='hidden' name='iframe_redirect' value='$iframe_redirect' />
<input type='hidden' name='hash' value='$hash' />
<input type='hidden' name='chemin' value='$zip' />
<input type='hidden' name='arg' value='$arg' />
<input type='radio' checked='checked' name='sousaction5' id='sousaction5_5' value='5' onchange='jQuery(\"#options_deballe_zip\").slideUp();' />" .
	  "<label for='sousaction5_5'>" . _T('upload_zip_telquel'). "</label>" .
		"<br />".
		"<input type='radio' name='sousaction5' id='sousaction5_6' value='6' onchange='jQuery(\"#options_deballe_zip\").slideDown();' />".
		"<label for='sousaction5_6'>" . _T('upload_zip_decompacter') . "</label>" .
		"<ol>" .
		liste_archive_taille($valables) .
		"</ol>"

		. debut_block_depliable(false,'options_deballe_zip') 
		. "<input type='checkbox' name='sousaction4' id='sousaction4_4' value='4' />".
			"<label for='sousaction4_4'>" . _T('upload_zip_conserver') . "</label>" .
			"<br /><input type='checkbox' name='titrer' id='titrer' />"
			. "<label for='titrer'>" . _T('upload_zip_titrer') .
			"</label>".
			"</div></div>"
		. fin_block()


		. "<div style='text-align: right;'><input type='submit' value='".
		_T('bouton_valider').
		  "' />";

	$texte = "<p>" .
		_T('upload_fichier_zip_texte') .
		"</p><p>" .
		_T('upload_fichier_zip_texte2') .
		 "</p>" .
		generer_form_action('joindre', $texte,' method="post"');

	if(_request("iframe")=="iframe") {
		return "<p>build form $iframe_redirect</p>" .
		  "<div class='upload_answer upload_zip_list'>" .
		  $texte .
		  "</div>";
	} else { return minipres(_T('upload_fichier_zip'), $texte); }
}
Exemplo n.º 25
0
function afficher_suivi_versions ($debut = 0, $id_secteur = 0, $uniq_auteur = false, $lang = "", $court = false) {
	
	changer_typo($lang);
	$lang_dir = lang_dir($lang);
	$nb_aff = 10;
	$champs = array('surtitre', 'titre', 'soustitre', 'descriptif', 'nom_site', 'url_site', 'chapo', 'texte', 'ps');

	if ($uniq_auteur) {
		$req_where = " AND articles.statut IN ('prepa','prop','publie')"; 
		$req_where .= " AND versions.id_auteur = $uniq_auteur";
	} else {
		$req_where = " AND articles.statut IN ('prop','publie')";
	}
	
	if (strlen($lang) > 0)
		$req_where .= " AND articles.lang=" . sql_quote($lang);

	if ($id_secteur > 0)
		$req_where .= " AND articles.id_secteur = ".intval($id_secteur);

	$req_where = "versions.id_version > 1 $req_where";

	$req_sel = "versions.id_version, versions.id_auteur, versions.date, versions.id_article, articles.statut, articles.titre";

	$req_from = 'spip_versions AS versions LEFT JOIN spip_articles AS articles ON versions.id_article = articles.id_article';

	$revisions = '';
	$items = array();
	$result = sql_select($req_sel, $req_from, $req_where, '', 'versions.date DESC', "$debut, $nb_aff");
	while ($row = sql_fetch($result)) {
			$id_article = $row['id_article'];
			if (autoriser('voir','article',$id_article)){
				$statut = $row['statut'];
				$id_version = $row['id_version'];
				$id_auteur = $row['id_auteur'];
				$date = $row['date'];
				$titre = typo(supprime_img($row['titre'],''));
				
				// l'id_auteur peut etre un numero IP (edition anonyme)
				if ($id_auteur == intval($id_auteur)
				AND $row_auteur = sql_fetsel('nom,email', 'spip_auteurs', "id_auteur = ".sql_quote($id_auteur))) {
					$nom = typo($row_auteur["nom"]);
					$email = $row_auteur['email'];
				} else {
					$nom = $id_auteur;
					$email = '';
				}

				$aff = revisions_bouton($id_article, $id_auteur, $id_version, $titre, $statut, $date, $lang_dir, $nom);
				if (!$court) {
						$bouton_id = "b$id_version-$id_article-$id_auteur";
						$aff = bouton_block_depliable($aff,false,$bouton_id)
						  . debut_block_depliable(false,$bouton_id)
						  . safehtml(revisions_diff ($id_article, $id_version, $court))
						  . fin_block();
				}
				$revisions .= "\n<div class='tr_liste' style='padding: 5px; border-top: 1px solid #aaaaaa;'>$aff</div>";
			}
	}
	if (!$revisions) return '';
	else return 
	  revisions_entete_boite($court, $debut, $id_secteur, $lang, $nb_aff, $req_from, $req_where, $uniq_auteur)
	  . $revisions
	  . fin_block()
	  . fin_cadre();
}
Exemplo n.º 26
0
function referers_group($nbvisites, $id_article, $lesliensracine, $lesreferermd5, $lesreferers, $lesurls)
{
	global $spip_lang_right, $source_vignettes;
	$vign = ((strlen($source_vignettes) > 0) && 
		 $GLOBALS['meta']["activer_captures_referers"]!='non');
	$aff = array();
	foreach($nbvisites as $numero => $visites) {
		if (!$numero) next;
		$referermd5 = $lesreferermd5[$numero];
		$bouton = $ret = "";

		if ($vign)
			$ret = "\n<a href=\"http://".$lesurls[$numero]."\"><img src=\"$source_vignettes".rawurlencode($lesurls[$numero])."\"\nstyle=\"float: $spip_lang_right; margin-bottom: 3px; margin-left: 3px;\" alt='' /></a>";

		if ($visites > 5) $bouton .= "<span class='visites visites3'>$visites "._T('info_visites')."</span> ";
		else if ($visites > 1) $bouton .= "<span class='visites visites2'>$visites "._T('info_visites')."</span> ";
		else $bouton .= "<span class='visites visites1'>$visites "._T('info_visite')."</span> ";

		if ($numero == "(email)") {
			$ret .=  $bouton . "<b>".$numero."</b>";
		} else {
			$n = count($lesreferers[$numero]);
			if (($n > 1) || ($n > 0 && substr(supprimer_tags($lesreferers[$numero][0]),0,1) != '/')) {
				$rac = $lesliensracine[$numero];
				$bouton .= "<a href=\"http://".attribut_html($lesurls[$numero])."\" style='font-weight: bold;'>".$numero."</a>"
				  . (!$rac ? '': (" <span class='spip_x-small'>(" . $rac .")</span>"));
				 $ret .= bouton_block_depliable($bouton,false)
				  . debut_block_depliable(false)
				  . "\n<ul><li>"
				  . join ("</li><li>",$lesreferers[$numero])
				  . "</li></ul>"
				  . fin_block();
			} else {
				$ret .= $bouton;
				$lien = $n ? $lesreferers[$numero][0] : '';
				if (preg_match(",^(<a [^>]+>)([^ ]*)( \([0-9]+\))?,i", $lien, $regs)) {
					$lien = quote_amp($regs[1]).$numero.$regs[2];
					if (!strpos($lien, '</a>')) $lien .= '</a>';
				} else
					$lien = "<a href=\"http://".attribut_html($numero)."\">".$numero."</a>";
				$ret .= "<b>".quote_amp($lien)."</b>"
				  . ($id_article ? '' : referes($referermd5));
			}
		}
		$aff[]= $ret;
	}
	return $aff;
}
Exemplo n.º 27
0
function tree_open_close_dir(&$current, $target, $deplie = array())
{
    if ($current == $target) {
        return "";
    }
    $tcur = explode("/", $current);
    $ttarg = explode("/", $target);
    $tcom = array();
    $output = "";
    // la partie commune
    while (reset($tcur) == reset($ttarg)) {
        $tcom[] = array_shift($tcur);
        array_shift($ttarg);
    }
    // fermer les repertoires courant jusqu'au point de fork
    while ($close = array_pop($tcur)) {
        $output .= "</ul>\n";
        $output .= fin_block();
        $output .= "</li>\n";
    }
    $chemin = "";
    if (count($tcom)) {
        $chemin .= implode("/", $tcom) . "/";
    }
    // ouvrir les repertoires jusqu'a la cible
    while ($open = array_shift($ttarg)) {
        $visible = @isset($deplie[$chemin . $open]);
        $chemin .= $open . "/";
        $output .= "<li>";
        $output .= bouton_block_depliable($chemin, $visible);
        $output .= debut_block_depliable($visible);
        $output .= "<ul>\n";
    }
    $current = $target;
    return $output;
}
function enfants_aff($id_parent, $decalage, $taille, $critere, $gauche = 0)
{
    global $spip_lang_right, $spip_lang_left;
    static $total_site = null;
    static $niveau = 0;
    static $nombre_branche;
    static $nombre_rub;
    if (is_null($total_site)) {
        $nombre_branche = array();
        $nombre_rub = array();
        $total_site = enfants(0, $critere, $nombre_branche, $nombre_rub);
        if ($total_site < 1) {
            $total_site = 1;
        }
    }
    $visites_abs = 0;
    $out = "";
    $width = intval(floor($nombre_branche[$id_parent] / $total_site * $taille));
    $width = "width:{$width}px;float:{$spip_lang_left};";
    $result = sql_select("id_rubrique, titre, descriptif", "spip_rubriques", "id_parent={$id_parent}", '', '0+titre,titre');
    while ($row = sql_fetch($result)) {
        $id_rubrique = $row['id_rubrique'];
        $titre = typo($row['titre']);
        $descriptif = attribut_html(couper(typo($row['descriptif']), 80));
        if ($nombre_branche[$id_rubrique] > 0 or $nombre_rub[$id_rubrique] > 0) {
            $largeur_branche = floor(($nombre_branche[$id_rubrique] - $nombre_rub[$id_rubrique]) * $taille / $total_site);
            $largeur_rub = floor($nombre_rub[$id_rubrique] * $taille / $total_site);
            if ($largeur_branche + $largeur_rub > 0) {
                if ($niveau == 0) {
                    $couleur = "#cccccc";
                } else {
                    if ($niveau == 1) {
                        $couleur = "#eeeeee";
                    } else {
                        $couleur = "white";
                    }
                }
                $out .= "<table cellpadding='2' cellspacing='0' border='0' width='100%'>";
                $out .= "\n<tr style='background-color: {$couleur}'>";
                $out .= "\n<td style='border-bottom: 1px solid #aaaaaa; padding-{$spip_lang_left}: " . ($niveau * 20 + 5) . "px;'>";
                if ($largeur_branche > 2) {
                    $out .= bouton_block_depliable("<a href='" . generer_url_entite($id_rubrique, 'rubrique') . "' style='color: black;' title=\"{$descriptif}\">{$titre}</a>", "incertain", "stats{$id_rubrique}");
                } else {
                    $out .= "<div class='rubsimple' style='padding-left: 18px;'>" . "<a href='" . generer_url_entite($id_rubrique, 'rubrique') . "' style='color: black;' title=\"{$descriptif}\">{$titre}</a>" . "</div>";
                }
                $out .= "</td>";
                // pourcentage de visites dans la branche par rapport au total du site
                $pourcent = round($nombre_branche[$id_rubrique] / $total_site * 1000) / 10;
                $out .= "\n<td class='verdana1' style='text-align: {$spip_lang_right}; width: 40px; border-bottom: 1px solid #aaaaaa;'>{$pourcent}%</td>";
                $out .= "\n<td align='right' style='border-bottom: 1px solid #aaaaaa; width:" . ($taille + 5) . "px'>";
                $out .= "\n<table cellpadding='0' cellspacing='0' border='0' width='" . ($decalage + 1 + $gauche) . "'>";
                $out .= "\n<tr>";
                if ($gauche > 0) {
                    $out .= "<td style='width: " . $gauche . "px'></td>";
                }
                $out .= "\n<td style='border: 0px; white-space: nowrap;'>";
                $out .= "<div style='border: 1px solid #999999; background-color: #dddddd; height: 1em; padding: 0px; margin: 0px;{$width}'>";
                if ($visites_abs > 0) {
                    $out .= "<img src='" . chemin_image('rien.gif') . "' style='vertical-align: top; height: 1em; border: 0px; width: " . $visites_abs . "px;' alt= ' '/>";
                }
                if ($largeur_branche > 0) {
                    $out .= "<img src='" . chemin_image('rien.gif') . "' class='couleur_cumul' style='vertical-align: top; height: 1em; border: 0px; width: " . $largeur_branche . "px;' alt=' ' />";
                }
                if ($largeur_rub > 0) {
                    $out .= "<img src='" . chemin_image('rien.gif') . "' class='couleur_nombre' style='vertical-align: top; width: " . $largeur_rub . "px; height: 1em; border: 0px' alt=' ' />";
                }
                $out .= "</div>";
                $out .= "</td></tr></table>\n";
                $out .= "</td></tr></table>";
            }
        }
        if (isset($largeur_branche) && $largeur_branche > 0) {
            $niveau++;
            $out .= debut_block_depliable(false, "stats{$id_rubrique}");
            $out .= enfants_aff($id_rubrique, $largeur_branche, $taille, $critere, $visites_abs + $gauche);
            $out .= fin_block();
            $niveau--;
        }
        $visites_abs = $visites_abs + round($nombre_branche[$id_rubrique] / $total_site * $taille);
    }
    return $out;
}
Exemplo n.º 29
0
function exec_messagerie_dist()
{

global $connect_id_auteur, $connect_statut, $spip_lang_rtl;


$commencer_page = charger_fonction('commencer_page', 'inc');
echo $commencer_page(_T('titre_page_messagerie'), "accueil", "messagerie");

echo debut_gauche("messagerie",true);


echo debut_boite_info(true);

echo _T('info_gauche_messagerie');

echo "<p>".http_img_pack("m_envoi$spip_lang_rtl.gif", 'V', "style='width: 14px; height: 7px; border: 0px'") .' ' . _T('info_symbole_vert'), '</p>';

 echo aide ("messut");

echo "<p>".http_img_pack("m_envoi_bleu$spip_lang_rtl.gif", 'B', "style='width: 14px; height: 7px; border: 0px'") .' ' . _T('info_symbole_bleu'), '</p>';

echo aide ("messpense");

echo "<p>".http_img_pack("m_envoi_jaune$spip_lang_rtl.gif", 'J', "style='width: 14px; height: 7px; border: 0px'") .' ' . _T('info_symbole_jaune'), '</p>';

echo fin_boite_info(true);

echo creer_colonne_droite('', true);

echo debut_cadre_relief("messagerie-24.gif", true);
echo icone_horizontale(_T('lien_nouvea_pense_bete'),generer_action_auteur("editer_message","pb"), "pense-bete.gif", "", false);
echo icone_horizontale(_T('lien_nouveau_message'),generer_action_auteur("editer_message","normal"), "message.gif", "", false);
		
		if ($connect_statut == "0minirezo") {
			echo icone_horizontale(_T('lien_nouvelle_annonce'),generer_action_auteur("editer_message","affich"), "annonce.gif", "", false);
		}
echo fin_cadre_relief(true);


# Affiche l'encadre "lien iCal"

 echo
    debut_cadre_enfonce('',true) .
    "<div class='verdana1'>"._T("calendrier_synchro") .
    "<table  class='cellule-h-table' cellpadding='0'><tr>\n" .
    "<td><a href='" . generer_url_ecrire("synchro") . "' class='ical'>&nbsp;</a></td>\n"
    . "<td class='cellule-h-lien'><br /><a href='" . generer_url_ecrire("synchro") . "' class='cellule-h'>" 
    . _T("icone_suivi_activite")
    . "</a></td>\n</tr></table>\n" ."</div>" .
    fin_cadre_enfonce(true);


 echo debut_droite("messagerie", true);

 $messages_vus = array();

 echo afficher_ses_messages('<b>' . _T('infos_vos_pense_bete') . '</b>', '', "id_auteur=$connect_id_auteur AND statut='publie' AND type='pb' AND (date_fin > DATE_SUB(".sql_quote(date('Y-m-d H:i:s')).", INTERVAL 1 DAY) OR rv != 'oui')", $messages_vus, false, true);


 echo afficher_ses_messages('<b>' . _T('info_nouveaux_message') . '</b>', ", spip_auteurs_messages AS lien", "lien.id_auteur=$connect_id_auteur AND vu='non' AND statut='publie' AND lien.id_message=messages.id_message", $messages_vus,  true, true);


 echo afficher_ses_messages('<b>' . _T('info_discussion_cours') . '</b>', ", spip_auteurs_messages AS lien", "lien.id_auteur=$connect_id_auteur AND statut='publie' AND type='normal' AND lien.id_message=messages.id_message AND (date_fin > DATE_SUB(".sql_quote(date('Y-m-d H:i:s')).", INTERVAL 1 DAY) OR rv != 'oui')",  $messages_vus, true, false);


// Afficher le lien RSS

echo bouton_spip_rss('messagerie', array('id_auteur' => $connect_id_auteur));



 echo afficher_ses_messages('<b>' . _T('info_message_en_redaction') . '</b>', '', "id_auteur=$connect_id_auteur AND statut='redac'",  $messages_vus, true, false);


 $result = sql_select('auteurs.id_auteur, auteurs.nom, COUNT(*) AS total', 'spip_auteurs AS auteurs,  spip_auteurs_messages AS lien2, spip_messages AS messages, spip_auteurs_messages AS lien', "(lien.id_auteur = $connect_id_auteur AND lien.id_message = messages.id_message AND messages.statut = 'publie' AND (messages.rv != 'oui' OR messages.date_fin > ".sql_quote(date('Y-m-d H:i:s'))." )) AND (lien2.id_auteur = lien2.id_auteur AND lien2.id_message = messages.id_message AND lien2.id_auteur != $connect_id_auteur AND auteurs.id_auteur = lien2.id_auteur)", "auteurs.id_auteur", 'total DESC', 10);

 $cor = array();
 while($row = sql_fetch($result)) {
		$id_auteur = $row['id_auteur'];
		$nom = typo($row["nom"]);
		$total = $row["total"];
		$cor[]= "<div class='tr_liste'\nonmouseover=\"changeclass(this,'tr_liste_over');\"\nonmouseout=\"changeclass(this,'tr_liste');\"\nstyle='padding: 2px; padding-left: 10px; border-bottom: 1px solid #cccccc;'><div class='verdana1'><img src='" . chemin_image('redac-12.gif') . "'\nstyle='border: 0px' alt=' ' /> <a href='" . generer_url_ecrire("auteur_infos","id_auteur=$id_auteur") . "'>$nom,</a> ($total)</div></div>";
 }

 if ($cor) {

	echo "<div style='height: 12px;'></div>";
	$bouton = bouton_block_depliable(_T('info_principaux_correspondants'),true,'principaux');
	echo debut_cadre('liste',"redacteurs-24.gif",'',$bouton);
	echo debut_block_depliable(true,'principaux');
	echo "<table width='100%' cellpadding='0' cellspacing='0'>";
	echo "<tr><td valign='top' style='width: 50%'>";
	$count = ceil(count($cor)/2);
	echo join("\n",array_slice($cor, 0, $count));
	echo "</td><td valign='top' style='width: 50%'>";
	echo join("\n",array_slice($cor, $count));
	echo "</td></tr></table>";
	echo fin_block();
	echo fin_cadre('liste');
 }

 echo afficher_ses_messages('<b>' . _T('info_pense_bete_ancien') . '</b>', '', "id_auteur=$connect_id_auteur AND statut='publie' AND type='pb' AND rv!='oui'",  $messages_vus, false, false);

 echo afficher_ses_messages('<b>' . _T('info_tous_redacteurs') . '</b>', '', "statut='publie' AND type='affich' AND (date_fin > DATE_SUB(".sql_quote(date('Y-m-d H:i:s')).", INTERVAL 1 DAY) OR rv != 'oui')",  $messages_vus, false, false);

echo fin_gauche(), fin_page();

}
Exemplo n.º 30
0
function inc_referencer_traduction_dist($id_article, $flag, $id_rubrique, $id_trad, $trad_err='')
{
	global $spip_display;

	if (! (($GLOBALS['meta']['multi_articles'] == 'oui')
		OR (($GLOBALS['meta']['multi_rubriques'] == 'oui') 
			AND ($GLOBALS['meta']['gerer_trad'] == 'oui'))) )
		return '';

	$langue_article = sql_fetsel("lang", "spip_articles", "id_article=$id_article");

	$langue_article = $langue_article['lang'];

	$reponse = '';
	// Choix langue article
	if ($GLOBALS['meta']['multi_articles'] == 'oui' AND $flag) {

		$row = sql_fetsel("lang", "spip_rubriques", "id_rubrique=$id_rubrique");
		$langue_parent = $row['lang'];

		if (!$langue_parent)
			$langue_parent = $GLOBALS['meta']['langue_site'];
		if (!$langue_article)
			$langue_article = $langue_parent;

		if ($menu = liste_options_langues('changer_lang', $langue_article, $langue_parent)) {
// attention ce onchange doit etre suivi de <span><input type='submit'
			$lien = "\nonchange=\"this.nextSibling.firstChild.style.visibility='visible';\"";
			$menu =  select_langues('changer_lang', $lien, $menu, _T('info_multi_cet_article'));
			
			$menu = ajax_action_post('referencer_traduction', "$id_article,$id_rubrique","articles","id_article=$id_article", $menu, _T('bouton_changer'), " class='visible_au_chargement'");

			$reponse .= debut_cadre_couleur('',true)
			. "\n<div style='text-align: center;'>"
			. $menu
			. "</div>\n"
			. fin_cadre_couleur(true);
		}
	}

	if ($trad_err)
		$reponse .= "<div><span style='color: red' size='2' face='Verdana, Geneva, helvetica, sans-serif'>"._T('trad_deja_traduit'). "</span></div>";

	// Afficher la liste des traductions

	if ($id_trad) {
		$requete = array('SELECT' => "id_article, id_rubrique, titre, lang, statut, id_trad", 'FROM' => "spip_articles", 'WHERE' => "id_trad = $id_trad");
		$styles = array(array('',7), array('', 12), array('arial2'), array('arial2', 100));
		$presenter_liste = charger_fonction('presenter_liste', 'inc');
		$tableau = array();
		$liste = $presenter_liste($requete, 'articles_traduction', $tableau,  $id_article, false, $styles, '',_T('trad_article_traduction'));
	} else $liste = '';

	// changer les globales de direction de langue
	changer_typo($langue_article);

	// Participation aux Traductions pas pour Mal-voyant. A completer
	if ($spip_display == 4) $form =''; else {
	$form = "<table width='100%'><tr>";

	if ($flag  AND !$liste) {
			// Formulaire pour lier a un article
		$form .= "<td style='width: 60%' class='arial2'>"
		. ajax_action_post("referencer_traduction",
				$id_article,
				'articles',
				"id_article=$id_article",
				("<label for='lier_trad'>" . _T('trad_lier') . "</label>" .
				 "\n<input type='text' name='lier_trad' id='lier_trad' size='5' />\n"),
				_T('bouton_valider'),
				"")
		. "</td>\n"
		. "<td style='width: 10px'> &nbsp; </td>"
		. "<td style='width: 2px; background: url(" . chemin_image("tirets-separation.gif") . ")'>". http_img_pack('rien.gif', " ", "width='2' height='2'") . "</td>"
		. "<td style='width: 10px'> &nbsp; </td>";
	}

	$form .= "<td>"
	. icone_horizontale(_T('trad_new'), generer_url_ecrire("articles_edit","new=oui&lier_trad=$id_article&id_rubrique=$id_rubrique"), "traductions-24.gif", "creer.gif", false)
	. "</td>";

	if ($flag AND $liste) {
		$clic = _T('trad_delier');
		$form .= "<td style='width: 10px'> &nbsp; </td>"
		. "<td style='width: 2px; background: url(" . chemin_image("tirets-separation.gif") . ")'>". http_img_pack('rien.gif', " ", "width='2' height='2'") . "</td>"
		. "<td style='width: 10px'> &nbsp; </td>"
		. "<td>"
		  // la 1ere occurrence de clic ne sert pas en Ajax
		. icone_horizontale($clic, ajax_action_auteur("referencer_traduction","$id_article,-$id_trad",'articles', "id_article=$id_article",array($clic)), "traductions-24.gif", "supprimer.gif", false)
		. "</td>\n";
	}

	$form .= "</tr></table>";
	}
	if ($GLOBALS['meta']['gerer_trad'] == 'oui')
		$bouton = _T('titre_langue_trad_article');
	else
		$bouton = _T('titre_langue_article');

	if ($langue_article)
		$bouton .= "&nbsp; (".traduire_nom_langue($langue_article).")";

	$res = debut_cadre_enfonce('langues-24.gif', true, "", 
			bouton_block_depliable($bouton,$flag === 'ajax','languearticle,lier_traductions'))
		. debut_block_depliable($flag === 'ajax','languearticle')
		. $reponse
		. fin_block()
		. $liste
		. debut_block_depliable($flag === 'ajax','lier_traductions')
		. $form
		. fin_block()
		. fin_cadre_enfonce(true);
	return ajax_action_greffe("referencer_traduction", $id_article, $res);
}