Thanks for this module. It fills a need I didn't know I had. ;)

There's one thing that I can't figure out though and I'm coming to the conclusion that it's a feature that's not implemented yet. What I need is a path on the site that will show the workspace for the currently logged in user, without any argument for the user id. i.e. a URL I can include in an e-mail to all the users, and it will work for everyone. Additionally, this path should present something informative to unauthenticated users, telling them to authenticate to see their workspace.

Looking in workspace_menu, I thought the 'workspace/%user_uid_optional' path would do the trick since it says the user argument is optional, but when I navigate to '/workspace' or '/workspace/' in my browser, they both give page not found.

Am I just doing it wrong? If code needs to be written, I can help.

CommentFileSizeAuthor
#1 workspace-536078.patch6.59 KBturadg

Comments

turadg’s picture

StatusFileSize
new6.59 KB

Attached is a first draft implementation. Feedback welcomed.

frank ralf’s picture

Status: Active » Needs review

Hi turadg,

Thanks for your patch! It will be reviewed asap.

Please also have a look at #376080: URL to reach Workspace from non "Navigation" menu and report whether the issues are related.

tia
Frank

turadg’s picture

hi Frank,

The symptoms are different but they may have a related cause. I didn't have any problems with My Workspace showing up in the Navigation menu. So I wasn't experiencing http://drupal.org/node/376080 or http://drupal.org/node/353278 . Oddly, I was having a different problem. In that latter ticket, the submitter writes, "The module itself appears to be working as intended, since when I go to /workspace and /workspace/1 I get the expected results."

For me, /workspace/1 would work and appear in my Navigation menu, but /workspace gave page not found. That's why I hacked this new path together, /workspace/go which redirects to the current user's workspace. I didn't know about the %user_id_optional loader. I've learned a little about it now, but it doesn't appear to be working, at least on my installation.

buckley’s picture

sub

udvranto’s picture

I did this in a simpler way:

  // but since workspace_delete() simply redirects to
  // node/*/delete deletion permissions will be applied there.
  $items['workspace/delete'] = array(
    'title' => 'Delete',
    'page callback' => 'workspace_delete',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );
  $items['workspace'] = array(
    'title' => 'Go to my workspace',
    'page callback' => 'workspace_list_content',
    'access callback' => TRUE,
    'weight' => -12,
  );

  return $items;
}
 *   User object representing user whose workspace is being listed.
 */
function workspace_list_content($account=null) {
  global $user;
  if(!isset($account) || !isset($account->uid)) $account = $user;
  drupal_set_title(t('Workspace: @name', array('@name' => $account->name)));
  $max = isset($user->workspaces) ? $user->workspaces['default']['maxnodes'] : 50;
  $comments_enabled = module_exists('comment');
udvranto’s picture

  $items['workspace/content'] = array(
    'title' => 'Content',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'page callback' => 'workspace_list_content',
    'access callback' => 'workspace_access',
    'weight' => 10,
  );
  $items['workspace/comments'] = array(
    'title' => 'Comments',
    'type' => MENU_LOCAL_TASK,
    'page callback' => 'workspace_list_comments',
    'access callback' => 'workspace_access',
    'access arguments' => array(1, module_exists('comment')),
    'weight' => 20,
  );
  $items['workspace/attachments'] = array(
    'title' => 'Attachments',
    'type' => MENU_LOCAL_TASK,
    'page callback' => 'workspace_list_files',
    'access callback' => 'workspace_access',
    'access arguments' => array(1, module_exists('upload')),
    'weight' => 30,
  );
  $items['workspace/configure'] = array(
    'title' => 'Configure',
    'page callback' => 'workspace_configure',
    'access callback' => 'workspace_configure_access',
    'type' => MENU_LOCAL_TASK,
    'weight' => 50,
  );
 */
function workspace_list_comments($account=null) {
  global $user;
  if(!isset($account) || !isset($account->uid)) $account = $user;
  drupal_set_title(t('Workspace: @name', array('@name' => $account->name)));
  $max = isset($account->workspaces) ? $account->workspaces['default']['maxcomments'] : 50;
 *   User object representing user whose workspace is being listed.
 */
function workspace_build_rows($result, $account=null) {
  global $user;
  if(!isset($account) || !isset($account->uid)) $account = $user;
  $yes = t('yes');
 *   User object representing user whose workspace is being listed.
 */
function workspace_list_files($account=null) {
  global $user;
  if(!isset($account) || !isset($account->uid)) $account = $user;
  drupal_set_title(t('Workspace: @name', array('@name' => $account->name)));
 * Menu access callback.
 */
function workspace_configure_access($account=null) {
  global $user;
  if(!isset($account) || !isset($account->uid)) $account = $user;
  return ($user->uid != 0)                          // May not be anonymous user.
luthien’s picture

I used the "me" module to solve this problem. Create a menu path: workspace/me and that solved the problem without patching the code.