Changeset 623 for trunk


Ignore:
Timestamp:
Nov 26, 2004, 5:10:17 PM (20 years ago)
Author:
gweltas
Message:

New template for group management
French translation for synchronization
Minor update of the css file

Location:
trunk
Files:
1 added
3 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/cat_modify.php

    r622 r623  
    171171}
    172172
    173 /*
    174 // can the parent category be changed ? (is the category virtual ?)
    175 if ( $row['dir'] == '' )
    176 {
    177   $vtp->addSession( $sub, 'parent' );
    178   // We only show a List Of Values if the number of categories is less than
    179   // $conf['max_LOV_categories']
    180   $query = 'SELECT COUNT(id) AS nb_total_categories';
    181   $query.= ' FROM '.CATEGORIES_TABLE;
    182   $query.= ';';
    183   $countrow = mysql_fetch_array( pwg_query( $query ) );
    184   if ( $countrow['nb_total_categories'] < $conf['max_LOV_categories'] )
    185   {
    186     $vtp->addSession( $sub, 'associate_LOV' );
    187     $vtp->addSession( $sub, 'associate_cat' );
    188     $vtp->setVar( $sub, 'associate_cat.value', '-1' );
    189     $vtp->setVar( $sub, 'associate_cat.content', '' );
    190     $vtp->closeSession( $sub, 'associate_cat' );
    191     $page['plain_structure'] = get_plain_structure( true );
    192     $structure = create_structure( '', array() );
    193     display_categories( $structure, '&nbsp;', $row['id_uppercat'],$row['id'] );
    194     $vtp->closeSession( $sub, 'associate_LOV' );
    195   }
    196   // else, we only display a small text field, we suppose the administrator
    197   // knows the id of its category
    198   else
    199   {
    200     $vtp->addSession( $sub, 'associate_text' );
    201     $vtp->setVar( $sub, 'associate_text.value', $row['id_uppercat'] );
    202     $vtp->closeSession( $sub, 'associate_text' );
    203   }
    204   $vtp->closeSession( $sub, 'parent' );
    205 }
    206 */
    207173//----------------------------------------------------------- sending html code
    208174$template->assign_var_from_handle('ADMIN_CONTENT', 'categories');
  • trunk/admin/group_list.php

    r593 r623  
    2525// | USA.                                                                  |
    2626// +-----------------------------------------------------------------------+
    27 include_once( './admin/include/isadmin.inc.php' );
    28 //----------------------------------------------------- template initialization
    29 $sub = $vtp->Open( './template/'.$user['template'].'/admin/group_list.vtp' );
    30 $tpl = array( 'group_add','add','listuser_permission','delete',
    31               'group_confirm','yes','no','group_list_title' );
    32 templatize_array( $tpl, 'lang', $sub );
    33 $vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
     27if( !defined("PHPWG_ROOT_PATH") )
     28{
     29        die ("Hacking attempt!");
     30}
     31include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
     32
    3433//-------------------------------------------------------------- delete a group
    3534$error = array();
    36 if ( isset ( $_GET['delete'] ) and is_numeric( $_GET['delete'] ) )
     35if ( isset( $_POST['delete'] ) && isset( $_POST['confirm_delete'] ) )
    3736{
    38   $query = 'SELECT name';
    39   $query.= ' FROM '.PREFIX_TABLE.'groups';
    40   $query.= ' WHERE id = '.$_GET['delete'];
    41   $query.= ';';
    42   $row = mysql_fetch_array( pwg_query( $query ) );
    43   // confirm group deletion ?
    44   if ( !isset( $_GET['confirm'] ) or $_GET['confirm'] != 1 )
    45   {
    46     $vtp->addSession( $sub, 'deletion' );
    47     $vtp->setVar( $sub, 'deletion.name', $row['name'] );
    48     $yes_url = './admin.php?page=group_list&amp;delete='.$_GET['delete'];
    49     $yes_url.= '&amp;confirm=1';
    50     $vtp->setVar( $sub, 'deletion.yes_url', add_session_id( $yes_url ) );
    51     $no_url = './admin.php?page=group_list';
    52     $vtp->setVar( $sub, 'deletion.no_url', add_session_id( $no_url ) );
    53     $vtp->closeSession( $sub, 'deletion' );
    54   }
    55   // group deletion confirmed
    56   else
    57   {
    58     $vtp->addSession( $sub, 'confirmation' );
    59     $query = 'SELECT COUNT(*) AS nb_result';
    60     $query.= ' FROM '.PREFIX_TABLE.'groups';
    61     $query.= ' WHERE id = '.$_GET['delete'];
    62     $query.= ';';
    63     $row2 = mysql_fetch_array( pwg_query( $query ) );
    64     if ( $row2['nb_result'] > 0 )
    65     {
    66       delete_group( $_GET['delete'] );
    67       $vtp->setVar( $sub, 'confirmation.class', 'info' );
    68       $info = '"'.$row['name'].'" '.$lang['listuser_info_deletion'];
    69       $vtp->setVar( $sub, 'confirmation.info', $info );
    70     }
    71     else
    72     {
    73       $vtp->setVar( $sub, 'confirmation.class', 'erreur' );
    74       $vtp->setVar( $sub, 'confirmation.info', $lang['group_err_unknown'] );
    75     }
    76     $vtp->closeSession( $sub, 'confirmation' );
    77   }
     37  $query = 'DELETE FROM ' . USER_GROUP_TABLE;
     38  $query.= ' WHERE group_id = '.$_POST['group_id'];
     39        pwg_query( $query );
     40       
     41        $query = 'DELETE FROM ' . GROUPS_TABLE;
     42  $query.= ' WHERE id = '.$_POST['group_id'];
     43        $query.= ';';
     44        pwg_query( $query );
    7845}
    7946//----------------------------------------------------------------- add a group
    80 if ( isset( $_POST['submit'] ) )
     47elseif ( isset( $_POST['new'] ) )
    8148{
    82   if ( preg_match( "/'/", $_POST['name'] )
    83        or preg_match( '/"/', $_POST['name'] ) )
     49  if ( empty($_POST['newgroup']) || preg_match( "/'/", $_POST['newgroup'] )
     50       or preg_match( '/"/', $_POST['newgroup'] ) )
    8451  {
    8552    array_push( $error, $lang['group_add_error1'] );
     
    8855  {
    8956    // is the group not already existing ?
    90     $query = 'SELECT id';
    91     $query.= ' FROM '.PREFIX_TABLE.'groups';
    92     $query.= " WHERE name = '".$_POST['name']."'";
     57    $query = 'SELECT id FROM '.GROUPS_TABLE;
     58    $query.= " WHERE name = '".$_POST['newgroup']."'";
    9359    $query.= ';';
    9460    $result = pwg_query( $query );
     
    10167  {
    10268    // creating the group
    103     $query = ' INSERT INTO '.PREFIX_TABLE.'groups';
    104     $query.= " (name) VALUES ('".$_POST['name']."')";
     69    $query = ' INSERT INTO '.GROUPS_TABLE;
     70    $query.= " (name) VALUES ('".$_POST['newgroup']."')";
    10571    $query.= ';';
    10672    pwg_query( $query );
    10773  }
    10874}
     75//--------------------------------------------------------------- user management
     76elseif ( isset( $_POST['add'] ) )
     77{
     78  $userdata = getuserdata($_POST['username']);
     79  if (!$userdata) echo "Utilisateur inexistant";
     80       
     81        // create a new association between the user and a group
     82  $query = 'INSERT INTO '.USER_GROUP_TABLE;
     83  $query.= ' (user_id,group_id) VALUES';
     84  $query.= ' ('.$userdata['id'].','.$_POST['edit_group_id'].')';
     85  $query.= ';';
     86  pwg_query( $query );
     87}
     88elseif (isset( $_POST['deny_user'] ))
     89{
     90  $sql_in = '';
     91        $members = $_POST['members'];
     92        for($i = 0; $i < count($members); $i++)
     93  {
     94    $sql_in .= ( ( $sql_in != '' ) ? ', ' : '' ) . intval($members[$i]);
     95  }
     96  $query = 'DELETE FROM ' . USER_GROUP_TABLE;
     97  $query.= ' WHERE user_id IN ('.$sql_in;
     98        $query.= ') AND group_id = '.$_POST['edit_group_id'];
     99        pwg_query( $query );
     100}
    109101//-------------------------------------------------------------- errors display
    110102if ( sizeof( $error ) != 0 )
    111103{
    112   $vtp->addSession( $sub, 'errors' );
     104  $template->assign_block_vars('errors',array());
    113105  for ( $i = 0; $i < sizeof( $error ); $i++ )
    114106  {
    115     $vtp->addSession( $sub, 'li' );
    116     $vtp->setVar( $sub, 'li.li', $error[$i] );
    117     $vtp->closeSession( $sub, 'li' );
     107    $template->assign_block_vars('errors.error',array('ERROR'=>$error[$i]));
    118108  }
    119   $vtp->closeSession( $sub, 'errors' );
    120109}
    121110//----------------------------------------------------------------- groups list
    122 $vtp->addSession( $sub, 'groups' );
    123111
    124 $query = 'SELECT id,name';
    125 $query.= ' FROM '.PREFIX_TABLE.'groups';
    126 $query.= ' ORDER BY id ASC';
    127 $query.= ';';
     112$query = 'SELECT id,name FROM '.GROUPS_TABLE;
     113$query.= ' ORDER BY id ASC;';
    128114$result = pwg_query( $query );
     115$groups_display = '<select name="group_id">';
     116$groups_nb=0;
    129117while ( $row = mysql_fetch_array( $result ) )
    130118{
    131   $vtp->addSession( $sub, 'group' );
    132   $vtp->setVar( $sub, 'group.name', $row['name'] );
    133   $url = './admin.php?page=group_perm&amp;group_id='.$row['id'];
    134   $vtp->setVar( $sub, 'group.permission_url', add_session_id( $url ) );
    135   $url = './admin.php?page=group_list&amp;delete='.$row['id'];
    136   $vtp->setVar( $sub, 'group.deletion_url', add_session_id( $url ) );
    137   $vtp->closeSession( $sub, 'group' );
     119  $groups_nb++;
     120        $selected = '';
     121        if (isset($_POST['group_id']) && $_POST['group_id']==$row['id'])
     122                $selected = 'selected';
     123  $groups_display .= '<option value="' . $row['id'] . '" '.$selected.'>' . $row['name']  . '</option>';
     124}
     125$groups_display .= '</select>';
     126
     127$action = PHPWG_ROOT_PATH.'admin.php?page=group_list';
     128//----------------------------------------------------- template initialization
     129$template->set_filenames( array('groups'=>'admin/group_list.tpl') );
     130$tpl = array( 'group_add','add','listuser_permission','delete',
     131              'group_confirm','yes','no','group_list_title' );
     132
     133$template->assign_vars(array(
     134  'S_GROUP_SELECT'=>$groups_display,
     135       
     136  'L_GROUP_SELECT'=>$lang['group_list_title'],
     137        'L_GROUP_CONFIRM'=>$lang['group_confirm_delete'],
     138        'L_LOOK_UP'=>$lang['edit'],
     139        'L_GROUP_DELETE'=>$lang['delete'],
     140  'L_CREATE_NEW_GROUP'=>$lang['group_add'],
     141  'L_GROUP_EDIT'=>$lang['group_edit'],
     142        'L_USER_NAME'=>$lang['login'],
     143        'L_USER_EMAIL'=>$lang['mail_address'],
     144        'L_USER_SELECT'=>$lang['Select'],
     145        'L_DENY_SELECTED'=>$lang['group_deny_user'],
     146        'L_ADD_MEMBER'=>$lang['group_add_user'],
     147  'L_FIND_USERNAME'=>$lang['Find_username'],
     148       
     149        'S_GROUP_ACTION'=>add_session_id($action),
     150        'U_SEARCH_USER' => add_session_id(PHPWG_ROOT_PATH.'admin/search.php')
     151        ));
     152
     153if ($groups_nb)
     154{
     155  $template->assign_block_vars('select_box',array());
    138156}
    139157
    140 $vtp->closeSession( $sub, 'groups' );
    141 //------------------------------------------------------- create new group form
    142 $action = './admin.php?'.$_SERVER['QUERY_STRING'];
    143 $vtp->setVar( $sub, 'form_action', $action );
     158//----------------------------------------------------------------- add a group
     159if ( isset( $_POST['edit']) || isset( $_POST['add']) || isset( $_POST['deny_user'] ))
     160{
     161  // Retrieving the group name
     162        $query = 'SELECT id, name FROM '.GROUPS_TABLE;
     163  $query.= " WHERE id = '".$_POST['group_id']."'";
     164  $query.= ';';
     165  $result = mysql_fetch_array(pwg_query( $query ));
     166  $template->assign_block_vars('edit_group',array(
     167          'GROUP_NAME'=>$result['name'],
     168                'GROUP_ID'=>$result['id']
     169                ));
     170               
     171  // Retrieving all the users
     172        $query = 'SELECT id, username, mail_address';
     173        $query.= ' FROM ('.USERS_TABLE.' as u';
     174        $query.= ' LEFT JOIN '.USER_GROUP_TABLE.' as ug ON ug.user_id=u.id)';
     175  $query.= " WHERE ug.group_id = '".$_POST['group_id']."';";
     176        $result = pwg_query( $query );
     177        $i=0;
     178        while ( $row = mysql_fetch_array( $result ) )
     179        {
     180          $class = ($i % 2)? 'row1':'row2'; $i++;
     181          $template->assign_block_vars('edit_group.user',array(
     182                  'ID'=>$row['id'],
     183                        'NAME'=>$row['username'],
     184                        'EMAIL'=>$row['mail_address'],
     185                        'T_CLASS'=>$class
     186                ));
     187        }
     188}
     189
    144190//----------------------------------------------------------- sending html code
    145 $vtp->Parse( $handle , 'sub', $sub );
     191$template->assign_var_from_handle('ADMIN_CONTENT', 'groups');
    146192?>
  • trunk/language/en_UK.iso-8859-1/admin.lang.php

    r622 r623  
    120120$lang['title_waiting'] = 'Pictures waiting for validation';
    121121$lang['title_cat_options'] = 'Categories options';
     122$lang['title_groups'] = 'Groups management';
    122123
    123124//Error messages
     
    239240$lang['stats_global_graph_title'] = 'Pages seen by month';
    240241$lang['stats_visitors_graph_title'] = 'Nombre de visiteurs par jour';
     242
     243// Users
     244
     245// Groups
     246$lang['group_confirm_delete']= 'Confirm group deletion';
     247$lang['group_add'] = 'Add a group';
     248$lang['group_add_error1'] = 'The name of a group must not contain " or \' or be empty.';
     249$lang['group_add_error2'] = 'This name is already used by another group.';
     250$lang['group_list_title'] = 'List of existing groups';
     251$lang['group_edit'] = 'Manage users of the group';
     252$lang['group_deny_user'] = 'Deny selected';
     253$lang['group_add_user']= 'Add user';
    241254
    242255$lang['menu_add_user'] = 'add';
     
    303316$lang['title_add'] = 'Add a user';
    304317$lang['title_modify'] = 'Modify a user';
    305 $lang['title_groups'] = 'Groups management';
    306318$lang['title_user_perm'] = 'Modify permission for user';
    307319$lang['title_cat_perm'] = 'Modify permissions for category';
    308320$lang['title_group_perm'] = 'Modify permissions for group';
    309321$lang['title_picmod'] = 'Modify informations about a picture';
    310 $lang['adduser_associate'] = 'Associate to group';
    311 $lang['group_add'] = 'Add a group';
    312 $lang['group_add_error1'] = 'The name of a group must not contain " or \'';
    313 $lang['group_add_error2'] = 'This name is already used by another group';
    314 $lang['group_confirm'] = 'Are you sure you want to remove this group ?';
    315 $lang['group_list_title'] = 'List of existing groups';
    316 $lang['group_err_unknown'] = 'This group doesn\'t exist in the database';
     322
    317323$lang['stats_pages_seen'] = 'pages seen';
    318324$lang['stats_visitors'] = 'guests';
  • trunk/language/fr_FR.iso-8859-1/admin.lang.php

    r622 r623  
    122122$lang['title_upload'] = 'Sélectionner les catégories pour lesquelles l\'ajout d\'image est autorisé';
    123123$lang['title_cat_options'] = 'Options relatives aux catégories';
     124$lang['title_groups'] = 'Gestion des groupes';
    124125
    125126//Error messages
     
    214215//Update
    215216$lang['update_missing_tn'] = 'Il manque la miniature pour';
    216 $lang['update_disappeared_tn'] = 'La miniature a disparu';
    217 $lang['update_disappeared'] = 'a disparu';
     217$lang['update_disappeared_tn'] = 'La miniature n\'existe pas';
     218$lang['update_disappeared'] = 'n\'existe pas';
    218219$lang['update_part_deletion'] = 'Suppression des images de la base qui n\'ont pas de thumbnail ou qui n\'existent pas';
    219 $lang['update_deletion_conclusion'] = 'images supprimées de la base de données';
    220220$lang['update_part_research'] = 'Recherche des nouvelles images dans les répertoires';
    221221$lang['update_research_added'] = 'ajouté';
    222222$lang['update_research_tn_ext'] = 'miniature en';
    223 $lang['update_research_conclusion'] = 'images ajoutées à la base de données';
    224 $lang['update_default_title'] = 'Choisir une option';
    225 $lang['update_only_cat'] = 'mettre à jour les catégories, mais pas les images';
    226 $lang['update_all'] = 'mettre tout à jour';
    227 $lang['update_sync_metadata_question'] = 'Utiliser les métadonnées des images pour la mise à jour';
     223$lang['update_default_title'] = 'Type de mise à jour';
    228224$lang['update_nb_new_elements'] = 'élément(s) ajouté(s)';
    229225$lang['update_nb_del_elements'] = 'élément(s) effacé(s)';
    230226$lang['update_nb_new_categories'] = 'catégorie(s) ajoutée(s)';
    231227$lang['update_nb_del_categories'] = 'catégorie(s) effacée(s)';
     228$lang['update_sync_files'] = 'Synchroniser la structure';
     229$lang['update_sync_dirs'] = 'Seulement les catégories';
     230$lang['update_sync_all'] = 'Catégories et fichiers';
     231$lang['update_sync_metadata'] = 'Synchroniser les méta-donnnées';
     232$lang['update_sync_metadata_new'] = 'Seulement sur les nouveaux éléments';
     233$lang['update_sync_metadata_all'] = 'Sur tous les éléments';
     234$lang['update_cats_subset'] = 'Limiter la synchronisation aux catégories suivantes';
    232235
    233236// History
     
    239242$lang['stats_visitors_graph_title'] = 'Nombre de visiteurs par jour';
    240243
    241 //Users
     244// Users
     245
     246
     247// Groups
     248$lang['group_list_title'] = 'Liste des groupes existants';
     249$lang['group_confirm_delete']= 'Confirmer la destruction du groupe';
     250$lang['group_add'] = 'Ajouter un groupe';
     251$lang['group_add_error1'] = 'Le nom du groupe ne doit pas comporter de " ou de \' et ne pas être vide.';
     252$lang['group_add_error2'] = 'Ce nom de groupe est déjà utilisé.';
     253$lang['group_edit'] = 'Edition des utilisateurs appartenant au groupe';
     254$lang['group_deny_user'] = 'Supprimer la sélection';
     255$lang['group_add_user']= 'Ajouter le membre';
    242256
    243257
     
    306320$lang['title_add'] = 'Ajouter un utilisateur';
    307321$lang['title_modify'] = 'Modifier un utilisateur';
    308 $lang['title_groups'] = 'Gestion des groupes';
     322
    309323$lang['title_user_perm'] = 'Modifier les permissions pour l\'utilisateur';
    310324$lang['title_cat_perm'] = 'Modifier les permissions pour la catégorie';
     
    312326$lang['title_picmod'] = 'Modifier les informations d\'une image';
    313327$lang['waiting_update'] = 'Les images validées ne seront visibles qu\'après mise à jour de la base d\'images.';
    314 $lang['adduser_associate'] = 'Associer au groupe';
    315 $lang['group_add'] = 'Ajouter un groupe';
    316 $lang['group_add_error1'] = 'Le nom du groupe ne doit pas comporter de " ou de \'';
    317 $lang['group_add_error2'] = 'Ce nom de groupe est déjà utilisé';
    318 $lang['group_confirm'] = 'Etes-vous sûr de vouloir supprimer le groupe';
    319 $lang['group_list_title'] = 'Liste des groupes existants';
    320 $lang['group_err_unknown'] = 'Ce groupe n\'existe pas dans la base de données';
    321328$lang['permuser_only_private'] = 'Seules les catégories privées sont représentées';
    322329
  • trunk/language/fr_FR.iso-8859-1/common.lang.php

    r621 r623  
    136136$lang['create_cookie'] = 'Créer un cookie';
    137137$lang['theme'] = 'Thème de l\'interface';
     138$lang['mail_address'] = 'Adresse mail';
    138139$lang['periods_error'] = 'La période doit être entière.';
    139140$lang['maxwidth_error'] = 'La largeur maximum des images doit être un entier supérieur à 50';
     
    252253
    253254$lang['guest'] = 'visiteur';
    254 $lang['mail_address'] = 'adresse mail';
    255255$lang['add'] = 'ajouter';
    256256$lang['dissociate'] = 'dissocier';
  • trunk/template/default/default.css

    r622 r623  
    11/* BACKGROUND */
     2
    23body { background-color:#000000;}
    34.main, .throw, .admin { background-color:#3F3F3F;}
     
    910.bouton, .imgMenu a, #imgBarMenu { background-image: url(theme/button_bg.gif);}
    1011
     12/* FONT COLORS */
     13
     14.titreMenu, .titreMenu a, .info, .admin{ color:#FFF48E;}
     15.titrePage, .titreMenu a:hover { color:#E0E0E0;}
     16.comment{ color:#C6B78E;}
     17.commentDate { color:#999999;}
     18input,select,textarea { color:#FFFFCC;}
     19
     20/* ANCHORS */
     21
     22a { text-decoration:none; color:#FFFFFF;}
     23a:hover { text-decoration:none; color:#FFF48E;}
     24a.none:hover { text-decoration:none;}
     25a.image:hover { text-decoration:none;}
     26a.thumbLink:hover { text-decoration:none;}
     27
    1128/* POSITION */
    1229#gauche,#droite
     
    2441}
    2542
    26 #droite
    27 {
    28   text-align:right;
    29 }
    30 
    31 #left
    32 {
    33   float:left;
    34 }
    35 
    36 #right
    37 {
    38   float:right;
    39 }
     43#droite{text-align:right;}
     44#left {float:left; }
     45#right{float:right; }
    4046
    4147/* MAIN STYLES */
     
    6066}
    6167
    62 /* ANCHORS */
    63 
    64 a { text-decoration:none; color:#FFFFFF;}
    65 a:hover { text-decoration:none; color:#FFF48E;}
    66 a.none:hover { text-decoration:none;}
    67 a.image:hover { text-decoration:none;}
    68 a.thumbLink:hover { text-decoration:none;}
     68
    6969
    7070/* LAYOUT STYLE */
     
    9393  line-height: 25px;
    9494  font-size:12px;
    95   color:#E0E0E0;
    9695  font-weight:600;
    9796  text-align:center;
     
    266265  font-weight:lighter;
    267266  text-align:right;
    268   color:#999999;
    269267  border-top: 1px solid #000000;
    270268  border-bottom: 1px solid #000000;
    271269}
    272270
    273 .comment{
    274   color:#C6B78E;
    275 }
    276271/* Form styles */
    277272
     
    295290 border: 1px solid #797979;
    296291 padding: 0;
    297  color:#FFFFCC;
    298292}
    299293
     
    317311text-align: center;
    318312padding:0px;
    319 color : #FFF48E;
    320313}
    321314
    322315/* Other styles */
    323316.info {
    324   color:#FFF48E;
    325317  margin:5px 0px 5px 0px;
    326318  white-space:nowrap;
Note: See TracChangeset for help on using the changeset viewer.