diff -u project.module project.module --- project.module 13 Aug 2010 06:31:37 -0000 +++ project.module 13 Aug 2010 06:45:59 -0000 @@ -858,7 +858,7 @@ // Project itself is responsible for, so we use our implementation of the // hook, instead of the global load function. $project_perms = project_project_permission_info(); - $maintainers = db_query('SELECT u.name, pm.* FROM {project_maintainer} pm INNER JOIN {users} u ON pm.uid = u.uid WHERE pm.nid = %d', $node->nid); + $maintainers = db_query('SELECT u.name, pm.* FROM {project_maintainer} pm INNER JOIN {users} u ON pm.uid = u.uid WHERE pm.nid = %d ORDER BY u.name', $node->nid); while ($maintainer = db_fetch_object($maintainers)) { $project->project['maintainers'][$maintainer->uid]['name'] = $maintainer->name; foreach ($project_perms as $perm_name => $perm_info) { diff -u includes/project_maintainers.inc includes/project_maintainers.inc --- includes/project_maintainers.inc 13 Aug 2010 06:31:37 -0000 +++ includes/project_maintainers.inc 13 Aug 2010 06:50:49 -0000 @@ -38,10 +38,12 @@ } $form['maintainers'][$uid]['operations'] = array(); if ($uid == $project->uid) { + // We special-case the project owner with disabled checkboxes. + foreach ($project_perms as $perm_name => $perm_info) { + $form['maintainers'][$uid]['permissions'][$perm_name]['#disabled'] = TRUE; + } $form['maintainers'][$uid]['operations']['delete'] = array( - '#prefix' => '', '#value' => t('locked'), - '#suffix' => '', ); } else { @@ -93,7 +95,12 @@ $row[] = drupal_render($form['maintainers'][$uid]['permissions'][$perm]); } $row[] = drupal_render($form['maintainers'][$uid]['operations']); - $rows[] = $row; + if ($form['#project']->uid == $uid) { + $owner_row = $row; + } + else { + $rows[] = $row; + } } } @@ -106,6 +113,9 @@ $row[] = ''; // Empty cell for the 'Operations' column on new maintainers. $rows[] = $row; + // Always put the owner row at the top of the table. + $rows = array_merge(array($owner_row), $rows); + // Although using named keys in the $header array makes this form easier to // alter, theme_table() freaks out if the $header array has non-numeric // keys. So we ditch the keys at this point to avoid notices. @@ -150,7 +160,14 @@ // Loop over all the maintainers and update their permissions accordingly. if (!empty($form_state['values']['maintainers'])) { foreach ($form_state['values']['maintainers'] as $uid => $maintainer) { - project_maintainer_update($project_nid, $uid, $maintainer['permissions']); + // Just to be extra safe, always give the project owner full permissions. + if ($uid == $form['#project']->uid) { + $perms = array_fill_keys(array_keys(project_permission_load()), 1); + } + else { + $perms = $maintainer['permissions']; + } + project_maintainer_update($project_nid, $uid, $perms); } }