diff --git a/base/blocks.php b/base/blocks.php index ac1da53e3f6e7525ebc0f8c43c7e8a799ec62b72..19fa5959fd3c766dbfb01e0ef27e0c56fc867c27 100644 --- a/base/blocks.php +++ b/base/blocks.php @@ -44,16 +44,16 @@ function blocks_declarer_tables_objets_sql($tables) { 'type' => 'block', 'principale' => 'oui', 'field' => [ - 'id_block' => 'bigint(21) NOT NULL', - 'blocktype' => 'varchar(255) DEFAULT "" NOT NULL', - 'objet' => 'varchar(25) DEFAULT "" NOT NULL', - 'id_objet' => 'bigint(21) DEFAULT "0" NOT NULL', - 'rang_lien' => 'int(4) DEFAULT "0" NOT NULL', - 'ancre' => 'varchar(20) NOT NULL DEFAULT ""', - 'valeurs' => 'text NOT NULL DEFAULT ""', - 'date' => 'datetime NOT NULL DEFAULT "0000-00-00 00:00:00"', - 'statut' => 'varchar(20) DEFAULT "0" NOT NULL', - 'maj' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', + 'id_block' => 'bigint(21) NOT NULL', + 'blocktype' => 'varchar(255) DEFAULT "" NOT NULL', + 'objet' => 'varchar(25) DEFAULT "" NOT NULL', + 'id_objet' => 'bigint(21) DEFAULT "0" NOT NULL', + 'rang_lien' => 'int(4) DEFAULT "0" NOT NULL', + 'ancre' => 'varchar(20) NOT NULL DEFAULT ""', + 'valeurs' => 'text NOT NULL DEFAULT ""', + 'date' => 'datetime NOT NULL DEFAULT "0000-00-00 00:00:00"', + 'statut' => 'varchar(20) DEFAULT "0" NOT NULL', + 'maj' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', ], 'key' => [ 'PRIMARY KEY' => 'id_block', @@ -67,11 +67,9 @@ function blocks_declarer_tables_objets_sql($tables) { 'champs_editables' => ['blocktype', 'id_objet', 'objet', 'ancre'], 'champs_versionnes' => ['blocktype', 'id_objet', 'objet', 'ancre', 'valeurs'], 'statut_textes_instituer' => [ - 'prepa' => 'texte_statut_en_cours_redaction', - 'prop' => 'texte_statut_propose_evaluation', - 'publie' => 'texte_statut_publie', - // 'refuse' => 'texte_statut_refuse', - // 'poubelle' => 'texte_statut_poubelle', + 'prepa' => 'block:texte_statut_masque', + 'publie' => 'block:texte_statut_affiche', + 'poubelle' => 'texte_statut_poubelle', ], 'statut' => [ [ diff --git a/blocks_administrations.php b/blocks_administrations.php index 385095d36ede22e9d237143539c72d740e17fc0e..773bab856eb711312ffd931a105831eec1ecb839 100644 --- a/blocks_administrations.php +++ b/blocks_administrations.php @@ -115,6 +115,8 @@ function blocks_update_1_3_0() { 'id_block = ' . $blocks_lien['id_block'] ); } + // Le statut prop disparait au profit de prepa + sql_updateq('spip_blocks',['statut' => 'prepa'],'statut = "prop"'); } function blocks_update_2_0_0() { diff --git a/blocks_pipelines.php b/blocks_pipelines.php index 374a1d12223f58d3d378ad39eda18404abd7f347..b76f944cf528a8c59e3ce25a8ed0922336b5b40a 100644 --- a/blocks_pipelines.php +++ b/blocks_pipelines.php @@ -68,3 +68,18 @@ function blocks_optimiser_base_disparus($flux) { sql_delete('spip_blocks', "statut='poubelle' AND maj < " . $flux['args']['date']); return $flux; } + +/** + * Pipeline de la corbeille, permet de définir les objets à supprimer + * + * @param array $param Tableau d'objets + * @return array Tableau d'objets complété + */ +function blocks_corbeille_table_infos($param) { + $param['blocks'] = [ + 'statut' => 'poubelle', + 'table' => 'spip_blocks', + ]; + + return $param; +} diff --git a/lang/block_fr.php b/lang/block_fr.php index 0f484372ad1ebedc4c91076d38a23f58fcfd21e0..f226321c89dbffec1ee9b5c6732b129d502475fb 100644 --- a/lang/block_fr.php +++ b/lang/block_fr.php @@ -23,6 +23,8 @@ return [ 'champ_blocktype_label' => 'Type de bloc', 'champ_valeurs_label' => 'Valeurs', 'confirmer_supprimer_block' => 'Confirmez-vous la suppression de ce bloc ?', + 'corbeille_blocks_un' => 'Un block dans la corbeille', + 'corbeille_blocks_tous' => '@nb@ blocks dans la corbeille', // I 'icone_creer_block' => 'Créer un bloc', @@ -57,4 +59,6 @@ return [ 'titre_logo_block' => 'Logo de ce bloc', 'titre_objets_lies_block' => 'Liés à ce bloc', 'titre_page_blocks' => 'Les blocs', + 'texte_statut_masque' => 'Masqué', + 'texte_statut_affiche' => 'Affiché', ]; diff --git a/paquet.xml b/paquet.xml index 5e58aaeb7161b5ed0e7bfec475c01e6cd1092632..5ee0dccf87f0c0933e34a4e98c8770ea140e669c 100644 --- a/paquet.xml +++ b/paquet.xml @@ -1,41 +1,43 @@ <paquet - prefix="blocks" - version="2.0.0" - etat="dev" - compatibilite="[4.2.0;4.*]" - logo="prive/themes/spip/images/blocks-xx.svg" - documentation="" - schema="2.0.0" + prefix="blocks" + version="2.0.0" + etat="dev" + compatibilite="[4.2.0;4.*]" + logo="prive/themes/spip/images/blocks-xx.svg" + documentation="" + schema="2.0.0" > - <nom>Blocks</nom> - <!-- Composer des pages avec des blocs --> + <nom>Blocks</nom> + <!-- Composer des pages avec des blocs --> - <auteur lien='https://contrib.spip.net/nicod_'>nicod_</auteur> + <auteur lien='https://contrib.spip.net/nicod_'>nicod_</auteur> - <licence>GNU/GPL</licence> - <necessite nom="ajaxfiltre" compatibilite="[1.0.10;]"/> - <necessite nom="saisies" compatibilite="[3.50.1;]"/> - <necessite nom="select2" compatibilite="[2.0.0;]"/> - <necessite nom="spip_bonux" compatibilite="[4.1.2;]"/> - <necessite nom="verifier" compatibilite="[3.1.0;]"/> - <necessite nom="yaml" compatibilite="[3.0.3;]"/> + <licence>GNU/GPL</licence> + <necessite nom="ajaxfiltre" compatibilite="[1.0.10;]"/> + <necessite nom="saisies" compatibilite="[3.50.1;]"/> + <necessite nom="select2" compatibilite="[2.0.0;]"/> + <necessite nom="spip_bonux" compatibilite="[4.1.2;]"/> + <necessite nom="verifier" compatibilite="[3.1.0;]"/> + <necessite nom="yaml" compatibilite="[3.0.3;]"/> + <utilise nom="corbeille"/> - <pipeline nom="autoriser" inclure="blocks_autorisations.php"/> + <pipeline nom="autoriser" inclure="blocks_autorisations.php"/> - <pipeline nom="declarer_tables_objets_sql" inclure="base/blocks.php"/> - <pipeline nom="declarer_tables_interfaces" inclure="base/blocks.php"/> - <pipeline nom="declarer_tables_auxiliaires" inclure="base/blocks.php" /> + <pipeline nom="declarer_tables_objets_sql" inclure="base/blocks.php"/> + <pipeline nom="declarer_tables_interfaces" inclure="base/blocks.php"/> + <pipeline nom="declarer_tables_auxiliaires" inclure="base/blocks.php"/> - <pipeline nom="header_prive" inclure="blocks_pipelines.php"/> - <pipeline nom="affiche_enfants" inclure="blocks_pipelines.php"/> - <pipeline nom="afficher_contenu_objet" inclure="blocks_pipelines.php"/> - <pipeline nom="optimiser_base_disparus" inclure="blocks_pipelines.php"/> + <pipeline nom="header_prive" inclure="blocks_pipelines.php"/> + <pipeline nom="affiche_enfants" inclure="blocks_pipelines.php"/> + <pipeline nom="afficher_contenu_objet" inclure="blocks_pipelines.php"/> + <pipeline nom="optimiser_base_disparus" inclure="blocks_pipelines.php"/> + <pipeline nom="corbeille_table_infos" inclure="blocks_pipelines.php"/> - <menu nom="blocks" titre="block:titre_blocks" parent="menu_squelette" icone="images/block-16.png" action="blocks"/> - <menu nom="blocktypes" titre="blocktype:titre_blocktypes" parent="menu_squelette" icone="images/blocktype-16.png" action="blocktypes"/> + <menu nom="blocks" titre="block:titre_blocks" parent="menu_squelette" icone="images/block-16.png" action="blocks"/> + <menu nom="blocktypes" titre="blocktype:titre_blocktypes" parent="menu_squelette" icone="images/blocktype-16.png" action="blocktypes"/> - <chemin path="squelettes"/> - <chemin path=""/> + <chemin path="squelettes"/> + <chemin path=""/> </paquet> diff --git a/prive/listes/corbeille_blocks.html b/prive/listes/corbeille_blocks.html new file mode 100644 index 0000000000000000000000000000000000000000..a8cb114ec9c856d25aabc6e13453e03ebd467b16 --- /dev/null +++ b/prive/listes/corbeille_blocks.html @@ -0,0 +1,18 @@ +<B_corbeille> + <div class="liste"> + [<h3 class="titrem">(#GRAND_TOTAL|singulier_ou_pluriel{block:corbeille_blocks_un,block:corbeille_blocks_tous})</h3>] + [<nav class='pagination'>(#PAGINATION)</nav>] + <ul class='liste-items checkables'> + <BOUCLE_corbeille(BLOCKS){statut='poubelle'}{pagination 5}{!par date}{recherche ?}> + <li class='item'> + <label for='block-#ID_BLOCK'><:corbeille:selectionner:></label> + <input type='checkbox' name='elements[]' id="block-#ID_BLOCK" value='#ID_BLOCK'[ (#ID_BLOCK|in_any{#ENV{elements}}|oui)checked='checked']/> + <h4>[(#INFO_TITRE{block,#ID_BLOCK}|concat{' (',#OBJET,' n° ',#ID_OBJET,')'}|sinon{<:info_sans_titre:>})]</h4> + <small>[(#DATE|affdate)][ (#DATE|heures)]:[(#DATE|minutes)]</small> + <p class='actions'><a href='#URL_ECRIRE{block,id_block=#ID_BLOCK}'><:corbeille:voir_detail:></a></p> + </li> + </BOUCLE_corbeille> + </ul> + [<p class='pagination'>(#PAGINATION{prive})</p>] + </div> +</B_corbeille> diff --git a/prive/objets/liste/blocks.html b/prive/objets/liste/blocks.html index 48d023e0aa185bee63d37db6231d7bfe5805dd31..c4efd9d7c1bb6cc80a37439937b248eb7ad925d5 100644 --- a/prive/objets/liste/blocks.html +++ b/prive/objets/liste/blocks.html @@ -1,3 +1,6 @@ +[(#ENV{statut}|=={poubelle}|non) + #SET{where,'statut <> "poubelle"'} +] [(#SET{defaut_tri,#ARRAY{ date,-1, id_block,1, @@ -20,7 +23,8 @@ </tr> </thead> <tbody> - <BOUCLE_liste_blocks(BLOCKS) {id_?} {objet?}{ where?} {statut?} {blocktype?} {recherche?} + <BOUCLE_liste_blocks(BLOCKS) {id_?} {objet?} {statut?} {blocktype?} {recherche?} + {where #GET{where}} {tri #ENV{par,date},#GET{defaut_tri}} {!par date} {pagination #ENV{nb,10}}> <tr class="[(#COMPTEUR_BOUCLE|alterner{row_odd,row_even})]"> <td class="picto">[(#CHEMIN_IMAGE{block-16.png}|balise_img)]</td>