Commit 31ee168e authored by Mindiell's avatar Mindiell
Browse files

First commit

parents
Ce module est là pour fournir une page d'administration assez simple avec certains liens.
Le module est composé de 4 fichiers :
-- lqdn_ia.css
CSS de la page. Rien de particulier
-- lqdn_ia.install
Un grand classique des modules Drupal. Il est vide.
-- lqdn_ia.info
Un grand classique des modules Drupal. Il contient le strict nécessaire. Voici la doc des .info :
http://drupal.org/node/171205
-- lqdn_ia.module
C'est le fichier principal. Il utilise deux hook :
-- hook_perm
http://api.drupal.org/api/function/hook_perm/6
Permet de définir des permissions.
La permission est la suivante : "Accès à la page d'admin de lqdn"
Une nouvelle permission apparait dans la page : admin/user/permissions
et il faut la donner à certains rôles (dev, ...).
-- hook_menu
http://api.drupal.org/api/function/hook_menu/6
Permet de définir une page (et en option, de mettre un lien dans le menu).
La page est la suivante : admin/lqdn
La fonction appelée est la suivante : _lqdn_ia_page
Toutes les autres fonctions sont appelées par la fonction _lqdn_ia_page
Le reste, c'est du HTML, sprintf, et des requetes SQL pour trouver des nombres. Rien de particulier.
1- Il faut extraire le module dans ./sites/all/modules/
2- Il faut activer le module
3- Il faut s'assurer que le bloc avec un lien vers la page d'admin s'affiche uniquement pour les rôles concernés
4- Il faut donner l'accès à la page d'admin aux rôles concernés.
#lqdn_ia h1, #lqdn_ia h2{
text-align:center;
color:white;
background-color:#487ED6;
}
#lqdn_ia .w33, #lqdn_ia .w50, #lqdn_ia .w100{
float:left;
border:0px solid black;
}
#lqdn_ia .w50{
width:50%;
}
#lqdn_ia .w100{
width:100%;
}
#lqdn_ia .nouveau-contenu{
margin:0 auto;
width:330px;
clear:both;
}
#lqdn_ia .nouveau-contenu a, #lqdn_ia .brouillons a{
display:block;
float:left;
margin:2px;
width:100px;
border:1px solid #487ED6;
text-align:center;
padding:15px 2px;
-moz-border-radius:15px;
color:#487ED6;
}
#lqdn_ia a{
color:#487ED6;
}
#lqdn_ia .brouillons a{
margin:2px 0;
width:100%;
padding:15px 0px;
}
#lqdn_ia .important a{
font-weight:bolder;
padding-top:25px;
padding-bottom:25px;
}
#lqdn_ia .nouveau-contenu a:hover, #lqdn_ia .brouillons a:hover{
color:white;
background-color:#487ED6;
}
#lqdn_ia .lien-final {
clear:both;
}
\ No newline at end of file
; $Id$
name = "Administration Interface"
description = Provides an administrative interface for simplified neurons of La Quadrature.
core = 6.x
package = "La Quadrature"
<?php
// $Id$
<?php
// $Id$
/**
* Hook perm
*/
function lqdn_ia_perm() {
return array("Access to LQDN administration page"); //Access to LQDN administration page
// Accéder à la page d'administration LQDN
}
/**
* Hook menu
*/
function lqdn_ia_menu() {
$items['admin/lqdn'] = array(
'title' => t('La Quadrature'),
'page callback' => 'lqdn_ia_page',
'access arguments' => array("Access to LQDN administration page"),
'type' => MENU_NORMAL_ITEM,
'weight' => -50,
);
return $items;
}
/**
* Hook block
*/
function lqdn_ia_block($op = 'list', $delta = 0, $edit = array()) {
if ($op == 'list') {
$blocks = array();
$blocks[0] = array(
'info' => t('Link to administration page'), //Lien vers la page d'administration
'cache' => BLOCK_CACHE_GLOBAL,
'weight' => 0,
'status' => 1,
'region' => 'content_top',
);
return $blocks;
}
elseif ($op == 'view' AND $delta==0) {
$block = array(
'subject' => '',
'content' => '<p style="text-align:center;"><strong>' . l(t('Site Administration'), 'admin/lqdn') . '</strong></p>', //Administration du site
);
return $block;
}
}
function lqdn_ia_page() {
global $user; // For "My drafts"
drupal_add_css(drupal_get_path('module', 'lqdn_ia') . '/lqdn_ia.css');
$html_block = <<<EOF
<div class="w50">
<h2>%s</h2>
%s
</div>
EOF;
//--
//-- Premier bloc, « Adding content » / « Ajout de contenu »
//--
$content = '';
$news = l(t("Quad'news"), 'node/add/actualite');
$page = l(t('Page'), 'node/add/page');
$quote = l(t('Quote'), 'node/add/citations');
$content .= '<div class="nouveau-contenu important">' . $news . $page . $quote . '</div>';
$rp = l(t('Press review'), 'node/add/revue-de-presse');
$position = l(t('Soutien'), 'node/add/soutien');
$important = l(t('Important'), 'node/add/important');
$content .= '<div class="nouveau-contenu">' . $rp . $position . $important . '</div>';
$add_personality = l(t('Add personality'), 'admin/content/taxonomy/5/add/term'); //Ajouter une personnalité
$themes = l(t('Themes list'), 'admin/content/taxonomy/2'); //Liste des thèmes
$add_theme = l(t('Add theme'), 'admin/content/taxonomy/2/add/term'); //Ajouter un thème
$content .= '<p class="lien-final">→ ' . $add_personality . '<br >→ ' . $themes . '<br >→ ' . $add_theme . '</p>';
$block[0] = sprintf($html_block, t('Adding content'), '<div>' . $content . '</div>');
//--
//-- Second bloc, « Drafts » / « Les brouillons »
//--
$content = '';
$data = db_fetch_object(db_query("SELECT COUNT(*) as 'nb' FROM `node` WHERE status='0'"));
$nb_drafts = $data->nb;
$data = db_fetch_object(db_query("SELECT COUNT(*) as 'nb' FROM `node` WHERE status='0' AND uid='%d'", $user->uid));
$nb_my_drafts = $data->nb;
$drafts = l(t('Drafts') . ' ('.$nb_drafts.')', 'brouillons');
$my_drafts = l(t('My drafts') . ' ('.$nb_my_drafts.')', 'brouillons/liste/all/' . $user->name);
$content_administration = l(t('Content administration'), 'admin/content/node');
$recent_posts = l(t('Recent posts'), 'tracker');
$content = '<div class="brouillons">' .
$drafts . '</div><div class="brouillons important">' .
$my_drafts . '</div><p class="lien-final">→ ' .
$content_administration . '<br />→ ' .
$recent_posts . '</p>';
$block[1] = sprintf($html_block, t('Drafts'), '<div>' . $content . '</div>');
//--
//-- Troisième bloc, « Advanced administration » / « Administration avancée »
//--
$content = '';
$list = array();
$list[] = l(t('Views'), 'admin/build/views');
$list[] = l(t('Menus'), 'admin/build/menu');
$list[] = l(t('Blocks'), 'admin/build/block');
$list[] = l(t('Translate interface'), 'admin/build/translate/search');
$list[] = l(t('Modules'), 'admin/build/modules');
$list[] = l(t('Panels'), 'admin/build/panels');
$list[] = l(t('Reports'), 'admin/reports');
foreach ($list as $link)
$content .= '<li>' . $link . '</li>';
$block[2] = sprintf($html_block, t('Advanced administration'), '<ul>' . $content . '</ul>');
//--
//-- Quatrième bloc, « Panels » / « Panneaux »
//--
$content = '';
$list = array();
$list[] = '<strong>' . l(t('Panels'), 'admin/build/panels') . '</strong>';
$list[] = l('Accueil', 'admin/build/pages/edit/page-accueil');
$list[] = l('Soutien', 'admin/build/pages/edit/page-soutien2011');
$list[] = l('HADOPI', 'admin/build/pages/edit/page-HADOPI');
$list[] = l('Telecoms Package', 'admin/build/pages/edit/page-Telecoms_Package');
$list[] = l('Filtrage du Net (anc. LOPPSI)', 'admin/build/pages/edit/page-LOPPSI');
$list[] = l('Net Neutrality', 'admin/build/pages/edit/page-Net_neutrality');
$list[] = l('ACTA', 'admin/build/pages/edit/page-ACTA');
$list[] = l('Directive anti-partage IPRED (anc. Rapport Gallo)', 'admin/build/pages/edit/page-Gallo_Report');
$list[] = l('Information Society Services Directive', 'admin/build/pages/edit/page-internet_directive');
$list[] = l('Propositions (anc. Financement mutualisé)', 'admin/build/pages/edit/page-financement_mutualise');
$list[] = '<em>→ ' . l('Liste des panneaux', 'admin/build/pages') . '</em>';
foreach ($list as $link)
$content .= '<li>' . $link . '</li>';
$block[3] = sprintf($html_block, t('Panels'), '<ul>' . $content . '</ul>');
return '<div id="lqdn_ia">' . $block[0] . $block[1] . '<div style="clear:both;"></div>' . $block[2] . $block[3] . '</div>';
}
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2010-07-01 19:20+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: lqdn_ia.module:17
msgid "Administration (LQDN)"
msgstr "Administration (LQDN)"
#: lqdn_ia.module:33
msgid "Link to administration page"
msgstr "Lien vers la page d'administration"
#: lqdn_ia.module:44
msgid "Site Administration"
msgstr "Administration du site"
#: lqdn_ia.module:67
msgid "News"
msgstr "Actualité"
#: lqdn_ia.module:68
msgid "Page"
msgstr "Page"
#: lqdn_ia.module:69
msgid "Quote"
msgstr "Citation"
#: lqdn_ia.module:72
msgid "Press Review"
msgstr "Revue de presse"
#: lqdn_ia.module:73
msgid "Soutien"
msgstr "Soutien"
#: lqdn_ia.module:74
msgid "Important"
msgstr "Important"
#: lqdn_ia.module:77
msgid "Add personality"
msgstr "Ajouter une personnalité"
#: lqdn_ia.module:78;79
msgid "Themes list"
msgstr "Liste des thèmes"
#: lqdn_ia.module:82
msgid "Adding content"
msgstr "Ajout de contenu"
#: lqdn_ia.module:95;105
msgid "Drafts"
msgstr "Brouillons"
#: lqdn_ia.module:96
msgid "My drafts"
msgstr "Mes brouillons"
#: lqdn_ia.module:98
msgid "Content administration"
msgstr "Administration du contenu"
#: lqdn_ia.module:112
msgid "Modules"
msgstr "Modules"
#: lqdn_ia.module:113
msgid "Blocks"
msgstr "Blocs"
#: lqdn_ia.module:114
msgid "Views"
msgstr "Views"
#: lqdn_ia.module:115;135
msgid "Panels"
msgstr "Panneaux"
#: lqdn_ia.module:116
msgid "Reports"
msgstr "Rapports"
#: lqdn_ia.module:117
msgid "Menus"
msgstr "Menus"
#: lqdn_ia.module:120
msgid "Advanced administration"
msgstr "Administration avancée"
#: lqdn_ia.module:8
msgid "Access to LQDN administration page"
msgstr "Accéder à la page d'administration LQDN"
#: lqdn_ia.info:0
msgid "Administration Interface"
msgstr "Interface d'Administration"
#: lqdn_ia.info:0
msgid "Provides an administrative interface for simplified neurons of La Quadrature."
msgstr "Fourni une interface d'administration simplifiée pour les neurones de La Quadrature."
#: lqdn_ia.info:0
msgid "La Quadrature"
msgstr "La Quadrature"
# $Id$
#
# LANGUAGE translation of Drupal (general)
# Copyright YEAR NAME <EMAIL@ADDRESS>
# Generated from files:
# lqdn_ia.module: n/a
# lqdn_ia.info: n/a
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2010-07-01 19:20+0200\n"
"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
"Last-Translator: NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
#: lqdn_ia.module:17
msgid "Administration (LQDN)"
msgstr ""
#: lqdn_ia.module:33
msgid "Link to administration page"
msgstr ""
#: lqdn_ia.module:44
msgid "Site Administration"
msgstr ""
#: lqdn_ia.module:67
msgid "News"
msgstr ""
#: lqdn_ia.module:68
msgid "Page"
msgstr ""
#: lqdn_ia.module:69
msgid "Quote"
msgstr ""
#: lqdn_ia.module:72
msgid "Press Review"
msgstr ""
#: lqdn_ia.module:73
msgid "Soutien"
msgstr ""
#: lqdn_ia.module:74
msgid "Important"
msgstr ""
#: lqdn_ia.module:77
msgid "Add personality"
msgstr ""
#: lqdn_ia.module:78;79
msgid "Themes list"
msgstr ""
#: lqdn_ia.module:82
msgid "Adding content"
msgstr ""
#: lqdn_ia.module:95;105
msgid "Drafts"
msgstr ""
#: lqdn_ia.module:96
msgid "My drafts"
msgstr ""
#: lqdn_ia.module:98
msgid "Content administration"
msgstr ""
#: lqdn_ia.module:112
msgid "Modules"
msgstr ""
#: lqdn_ia.module:113
msgid "Blocks"
msgstr ""
#: lqdn_ia.module:114
msgid "Views"
msgstr ""
#: lqdn_ia.module:115;135
msgid "Panels"
msgstr ""
#: lqdn_ia.module:116
msgid "Reports"
msgstr ""
#: lqdn_ia.module:117
msgid "Menus"
msgstr ""
#: lqdn_ia.module:120
msgid "Advanced administration"
msgstr ""
#: lqdn_ia.module:8
msgid "Access to LQDN administration page"
msgstr ""
#: lqdn_ia.info:0
msgid "Administration Interface"
msgstr ""
#: lqdn_ia.info:0
msgid "Provides an administrative interface for simplified neurons of La Quadrature."
msgstr ""
#: lqdn_ia.info:0
msgid "La Quadrature"
msgstr ""
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment