--- workspace.dist/workspace.module	Thu Feb 22 11:40:50 2007
+++ workspace/workspace.module	Thu Feb 22 11:34:06 2007
@@ -70,15 +70,15 @@
 
 function workspace_admin() {
   global $user;
-  if (isset($_POST['edit']['content_type'])) {
-    $node_type = $_POST['edit']['content_type'];
+  if (isset($_POST['content_type'])) {
+    $node_type = $_POST['content_type'];
     if ($node_type == t('Select...')) {
       drupal_goto('node/add');
     }
     
-    foreach (node_get_types() as $type => $name) {
+    foreach (node_get_types() as $type => $typeobject) {
       if (node_access('create', $type, $user->uid)) {
-        $options[$type] = $name;
+        $options[$type] = $typeobject->name;
       }
       if (isset($options[$node_type])) {
         drupal_goto('node/add/' . $node_type);
@@ -95,7 +95,7 @@
 /**
 * The configuration page.
 */
-function workspace_configure() {
+function workspace_configure_form() {
   global $user;
   $form = array();
   $form['maxnodes'] = array(
@@ -116,12 +116,16 @@
     '#type' => 'submit',
     '#value' => t('Save configuration')
   );
-  $output = drupal_get_form('workspace_configure', $form);
+  return $form;
+}
+
+function workspace_configure() {
+  $output = drupal_get_form('workspace_configure_form');
   drupal_set_title(t('workspace : %username', array('%username' => $user->name)));
   return $output;
 }
 
-function workspace_configure_validate($form_id, $edit) {
+function workspace_configure_form_validate($form_id, $edit) {
   if (!is_numeric($edit['maxnodes'])) {
     form_set_error('maxnodes', t('Please enter a numeric value.'));
   }
@@ -130,7 +134,7 @@
   }
 }
 
-function workspace_configure_submit($form_id, $edit) {
+function workspace_configure_form_submit($form_id, $edit) {
   global $user;
   if (!isset($user->workspaces)) {
     $user->workspaces = array();
@@ -156,10 +160,10 @@
   if (!is_numeric($maxnodes)) {$maxnodes = 50;}
   if (!is_numeric($maxfilenames)) {$maxfilenames = 50;}
 
-  $comments_enabled = module_exist('comment');
-  $nodeperm_role_enabled = module_exist('nodeperm_role');
-  $flexinode_enabled = module_exist('flexinode');
-  $cck_enabled = module_exist('content');
+  $comments_enabled = module_exists('comment');
+  $nodeperm_role_enabled = module_exists('nodeperm_role');
+  $flexinode_enabled = module_exists('flexinode');
+  $cck_enabled = module_exists('content');
   $output = _workspace_addform();
   
   $node_select = array('n.nid', 'n.uid', 'n.type', '0 AS cid', 'n.title', 'n.status', 'n.changed', 's.comment_count', '1 AS node');
@@ -218,6 +222,8 @@
       }
       elseif ($cck_enabled && strstr($function, 'content_')) {
         $function = 'content_access';
+      } else {
+        $function = 'node_access';
       }
 
       if (function_exists($function)) {
@@ -232,7 +238,7 @@
       // the name of the owner of this node
       $name = ($user->uid == $row->uid) ? $user->name : db_result(db_query('SELECT name FROM {users} WHERE uid = %d', $row->uid));
       $rows[] = array(
-        node_get_name($row->type), 
+        node_get_types('name', $row->type),
         l($row->title, "node/$row->nid"), 
         $name, 
         $row->status ? $yes : $no, 
@@ -251,15 +257,10 @@
       // delegate access permission checks and link generation to comments.module
       $com_links = comment_links($comment, 0);
       $link = l(t('edit'), "comment/edit/$comment->cid");
-      $edit_link = in_array($link, $com_links) ? $link : '';
-      
-      if (!$edit_link) {
-    	  $admin_edit_link = l(t('edit'), "admin/comment/edit/$comment->cid");
-    	  $edit_link = in_array($admin_edit_link, $com_links) ? $admin_edit_link : '';
-      }
+      $edit_link = $com_links['comment_edit'] ? $link : '';
       
-      $link = l(t('delete'), "admin/comment/$comment->cid/delete");
-      $delete_link = in_array($link, $com_links) ? $link : '';
+      $link = l(t('delete'), "comment/delete/$comment->cid");
+      $delete_link = $com_links['comment_delete'] ? $link : '';
     
       $rows[] = array(t('comment'), l($row->title, "node/$row->nid#comment-$row->cid"), $user->name, $row->status ? $no : $yes, format_date($row->changed, 'small'), array('data' => $num_replies, 'align' => 'right'), $edit_link, $delete_link);
     }
@@ -304,8 +305,8 @@
 }
 
 /**
- * The deletion menu callback
- */
+* The deletion menu callback
+*/
 function workspace_delete() {
   $nid = intval(arg(2));
   if (is_numeric($nid)) {
@@ -317,14 +318,15 @@
 * Module Functions :: Private
 ********************************************************************/
 
-function _workspace_addform() {
+function _workspace_addform_form() {
   global $user;
-  $description = t('Choose what kind of content you would like to add.');
+  $description = t('Choose what kind of content you would like to add.')
+               . ' [' . l(t('help'), 'node/add') . ']';
   $select = t('Select...');
   $options = array($select => $select);
-  foreach (node_get_types() as $type => $name) {
-    if (module_invoke(node_get_base($type), 'access', 'create', $type)) {
-      $options[$type] = $name;
+  foreach (node_get_types() as $type => $typeobject) {
+    if (module_invoke(node_get_types('module', $type), 'access', 'create', $type)) {
+      $options[$type] = $typeobject->name;
     }
   }
   $form = array();
@@ -338,9 +340,14 @@
     '#type' => 'submit',
     '#value' => t('Add new item')
   );
+  return $form;
+}
   
-  $submit = form_render($form['submit']);
-  $output = drupal_get_form('workspace_addform', $form);
+function _workspace_addform() {
+  $output = drupal_get_form('_workspace_addform_form');
+  $form = _workspace_addform_form();
+  $submit = drupal_render($form['submit']);
+  $output = preg_replace("/<input.*type=\"submit\".*>/U", '', $output);
   $output = str_replace('</select>', '</select>&nbsp;' . $submit, $output);
   return $output;
 }
\ No newline at end of file
