Index: flag.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/flag/Attic/flag.module,v
retrieving revision 1.11.2.63
diff -u -r1.11.2.63 flag.module
--- flag.module	15 Feb 2009 06:10:13 -0000	1.11.2.63
+++ flag.module	20 Feb 2009 21:53:52 -0000
@@ -399,7 +399,7 @@
  * Theme the output for the main flag administration page.
  */
 function theme_flag_admin_page($flags, $default_flags) {
-  $output = '<p>' . t('This page lists all the <em>flags</em> that are currently defined on this system. You may <a href="@add-url">add</a> new flags.', array('@add-url' => url('admin/build/flags/add'))) . '</p>';
+  $output = '<p>' . t('This page lists all the <em>flags</em> that are currently defined on this system. You may <a href="@add-url">add new flags</a>.', array('@add-url' => url('admin/build/flags/add'))) . '</p>';
 
   // Build out the list of normal, database flags.
   foreach ($flags as $flag) {
@@ -454,7 +454,13 @@
     $output .= '<p>' . t('The <a href="@views-url">Views</a> module is not installed, or not enabled. It is recommended that you install the Views module to be able to easily produce lists of flagged content.', array('@views-url' => url('http://drupal.org/project/views'))) . '</p>';
   }
   else {
-    $output .= '<p>' . t('Once a flag is defined, a new menu item will appear leading to a page showing for each user the items she has flagged by it. In case of <em>global</em> flags, the items flagged are shared by all users. These lists of flagged items <a href="@views-url">are views</a>, and <a href="@customize-url">are customizable</a>.', array('@views-url' => url('admin/build/views'), '@customize-url' => 'http://drupal.org/node/296954')) . '</p>';
+    $output .= '<p>';
+    $output .= t('Lists of flagged content can be displayed using views. You can configure these in the <a href="@views-url">Views administration section</a>.', array('@views-url' => url('admin/build/views')));
+    if (flag_get_flag('bookmarks')) {
+      $output .= ' ' . t('Flag module automatically provides a few <a href="@views-url">default views for the <em>bookmarks</em> flag</a>. You can use these as templates by cloning these views and then customizing as desired.', array('@views-url' => url('admin/build/views', array('query' => 'tag=flag'))));
+    }
+    $output .= ' ' . t('The <a href="@flag-handbook-url">Flag module handbook</a> contains extensive <a href="@customize-url">documentation on creating customized views</a> using flags.', array('@flag-handbook-url' => 'http://drupal.org/handbook/modules/flag', '@customize-url' => 'http://drupal.org/node/296954'));
+    $output .= '</p>';
   }
 
   if (!module_exists('flag_actions')) {
@@ -464,7 +470,7 @@
     $output .= '<p>' . t('Flagging an item may trigger <a href="@actions-url">actions</a>.', array('@actions-url' => url('admin/build/flags/actions'))) . '</p>';
   }
 
-  $output .= '<p>' . t('To learn about the various ways to use flags, please check out <a href="@handbook-url">the handbook</a>.', array('@handbook-url' => 'http://drupal.org/handbook/modules/flag')) . '</p>';
+  $output .= '<p>' . t('To learn about the various ways to use flags, please check out the <a href="@handbook-url">Flag module handbook</a>.', array('@handbook-url' => 'http://drupal.org/handbook/modules/flag')) . '</p>';
 
   return $output;
 }
Index: flag.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/flag/Attic/flag.install,v
retrieving revision 1.2.2.27
diff -u -r1.2.2.27 flag.install
--- flag.install	8 Dec 2008 16:23:11 -0000	1.2.2.27
+++ flag.install	20 Feb 2009 21:53:42 -0000
@@ -408,6 +408,27 @@
   return $ret;
 }
 
+/**
+ * Remove the previous default views that are no longer bundled with Flag.
+ *
+ * These views are saved to the database so that they are preserved.
+ */
+function flag_update_6003() {
+  $ret = array();
+
+  $flags = flag_get_flags();
+  foreach ($flags as $name => $flag) {
+    if ($view = views_get_view('flags_'. $name)) {
+      if (!$view->disabled && $view->type == t('Default')) {
+        $view->save();
+        $ret[] = array('success' => TRUE, 'query' => t('The view %name as been saved to the database. Flag no longer provides this view by default.', array('%name' => $view->name)));
+      }
+    }
+  }
+
+  return $ret;
+}
+
 // This is a replacement for update_sql(). The latter doesn't support placeholders.
 function _flag_update_sql($sql) {
   $args = func_get_args();
Index: includes/flag.views_default.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/flag/includes/Attic/flag.views_default.inc,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 flag.views_default.inc
--- includes/flag.views_default.inc	26 Nov 2008 22:51:39 -0000	1.1.2.3
+++ includes/flag.views_default.inc	20 Feb 2009 21:53:55 -0000
@@ -10,270 +10,270 @@
  * Implementation of hook_views_default_views().
  */
 function flag_views_default_views() {
-  $views = array();
-  _flag_views_node_default_views($views);
-  _flag_views_user_default_views($views);
-  return $views;
-}
-
-function _flag_views_node_default_views(&$views) {
-  $flags = flag_get_flags('node');
-
-  foreach ($flags as $flag) {
-    $menu_title = $flag->global ? drupal_ucfirst($flag->get_title()) : t('My !flag-title', array('!flag-title' => drupal_strtolower($flag->get_title())));
-
-    $view = new view;
-    $view->name = 'flag_'. $flag->name;
-    $view->description = t('View for flag: !flag-title', array('!flag-title' => $flag->get_title()));
-    $view->tag = 'flag';
-    $view->view_php = '';
-    $view->base_table = 'node';
-    $view->is_cacheable = '0';
-    $view->api_version = 2;
-    $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
-    $handler = $view->new_display('default', 'Defaults', 'default');
-    $handler->override_option('relationships', array(
-      'flag_content_rel' => array(
-        'label' => $flag->name,
-        'required' => 1,
-        'flag' => $flag->name,
-        'user_scope' => 'current',
-        'id' => 'flag_content_rel',
-        'table' => 'node',
-        'field' => 'flag_content_rel',
-        'relationship' => 'none',
-      ),
-      'uid' => array(
-        'label' => 'user',
-        'required' => 0,
-        'id' => 'uid',
-        'table' => 'flag_content',
-        'field' => 'uid',
-        'relationship' => 'flag_content_rel',
-      ),
-    ));
+  // Only setup views for the "bookmarks" flag.
+  // If it's been deleted, don't create any views.
+  $flag = flag_get_flag('bookmarks');
+  if (!$flag) {
+    return;
+  }
 
-    $fields = array(
+  // Set up properties that are used for both views.
+  $fields = array(
+    'type' => array(
+      'id' => 'type',
+      'table' => 'node',
+      'field' => 'type',
+      'label' => 'Type',
+    ),
+    'title' => array(
+      'id' => 'title',
+      'table' => 'node',
+      'field' => 'title',
+      'label' => 'Title',
+      'link_to_node' => 1,
+    ),
+    'name' => array(
+      'label' => 'Author',
+      'link_to_user' => 1,
+      'id' => 'name',
+      'table' => 'users',
+      'field' => 'name',
+    ),
+  );
+
+  $style_options = array(
+    'grouping' => '',
+    'override' => 0,
+    'sticky' => 1,
+    'columns' => array(),
+    'default' => 'title',
+    'order' => 'asc',
+    'columns' => array(
+      'type' => 'type',
+      'title' => 'title',
+      'name' => 'name',
+    ),
+    'info' => array(
       'type' => array(
-        'id' => 'type',
-        'table' => 'node',
-        'field' => 'type',
-        'label' => 'Type',
+        'sortable' => TRUE,
       ),
       'title' => array(
-        'id' => 'title',
-        'table' => 'node',
-        'field' => 'title',
-        'label' => 'Title',
-        'link_to_node' => 1,
+        'sortable' => TRUE,
       ),
       'name' => array(
-        'label' => 'Author',
-        'link_to_user' => 1,
-        'id' => 'name',
-        'table' => 'users',
-        'field' => 'name',
+        'sortable' => TRUE,
       ),
-    );
-
-    if (module_exists('comment')) {
-      $fields += array(
-        'comment_count' => array(
-          'id' => 'comment_count',
-          'table' => 'node_comment_statistics',
-          'field' => 'comment_count',
-          'label' => 'Replies',
-        ),
-        'last_comment_timestamp' => array(
-          'id' => 'last_comment_timestamp',
-          'table' => 'node_comment_statistics',
-          'field' => 'last_comment_timestamp',
-          'label' => 'Last Post',
-        ),
-      );
-    }
+    ),
+    'override' => FALSE,
+    'order' => 'asc',
+  );
+
+  $filters = array(
+    'status' => array(
+      'operator' => '=',
+      'value' => 1,
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'status',
+      'table' => 'node',
+      'field' => 'status',
+      'relationship' => 'none',
+    ),
+  );
+
+  $relationships = array(
+    'flag_content_rel' => array(
+      'label' => 'bookmarks',
+      'required' => 1,
+      'flag' => 'bookmarks',
+      'user_scope' => 'current',
+      'id' => 'flag_content_rel',
+      'table' => 'node',
+      'field' => 'flag_content_rel',
+      'relationship' => 'none',
+      'override' => array(
+        'button' => 'Override',
+      ),
+    ),
+  );
+
+  $access = array(
+    'type' => 'role',
+    'role' => drupal_map_assoc($flag->roles),
+    'perm' => '',
+  );
 
+  // Additional fields and style options if comment exists.
+  if (module_exists('comment')) {
     $fields += array(
-      'ops' => array(
-        'label' => 'Ops',
-        'id' => 'ops',
-        'table' => 'flag_content',
-        'field' => 'ops',
-        'relationship' => 'flag_content_rel',
+      'comment_count' => array(
+        'id' => 'comment_count',
+        'table' => 'node_comment_statistics',
+        'field' => 'comment_count',
+        'label' => 'Replies',
+      ),
+      'last_comment_timestamp' => array(
+        'id' => 'last_comment_timestamp',
+        'table' => 'node_comment_statistics',
+        'field' => 'last_comment_timestamp',
+        'label' => 'Last Post',
       ),
     );
 
-    $handler->override_option('fields', $fields);
-    $handler->override_option('filters', array(
-      'status' => array(
-        'operator' => '=',
-        'value' => 1,
-        'group' => '0',
-        'exposed' => FALSE,
-        'expose' => array(
-          'operator' => FALSE,
-          'label' => '',
-        ),
-        'id' => 'status',
-        'table' => 'node',
-        'field' => 'status',
-        'relationship' => 'none',
+    $style_options['default'] = 'last_comment_timestamp';
+    $style_options['order'] = 'desc';
+    $style_options['info'] += array(
+      'comment_count' => array(
+        'sortable' => TRUE,
       ),
-    ));
-    $handler->override_option('access', array(
-      'type' => 'role',
-      'role' => drupal_map_assoc($flag->roles),
-      'perm' => '',
-    ));
-
-    $style_options = array(
-      'columns' => array(),
-      'default' => module_exists('comment') ? 'last_comment_timestamp' : 'title',
-      'info' => array(
-        'type' => array(
-          'sortable' => TRUE,
-        ),
-        'title' => array(
-          'sortable' => TRUE,
-        ),
-        'name' => array(
-          'sortable' => TRUE,
-        ),
+      'last_comment_timestamp' => array(
+        'sortable' => TRUE,
       ),
-      'override' => FALSE,
-      'order' => 'asc',
     );
-
-    if (module_exists('comment')) {
-      $style_options['info'] += array(
-        'comment_count' => array(
-          'sortable' => TRUE,
-        ),
-        'last_comment_timestamp' => array(
-          'sortable' => TRUE,
-        ),
-      );
-    }
-
-    $handler->override_option('title', $menu_title);
-    $handler->override_option('items_per_page', '25');
-    $handler->override_option('use_pager', TRUE);
-    $handler->override_option('style_plugin', 'table');
-    $handler->override_option('style_options', $style_options);
-    $handler = $view->new_display('page', 'Page', 'page_1');
-    $handler->override_option('path', 'flags/'. $flag->name);
-    $handler->override_option('menu', array(
-      'type' => 'normal',
-      'title' => $menu_title,
-      'weight' => '0',
-    ));
-    $handler->override_option('tab_options', array(
-      'type' => 'none',
-      'title' => NULL,
-      'weight' => NULL,
-    ));
-
-    $views[$view->name] = $view;
+    $style_options['columns'] += array(
+      'comment_count' => 'comment_count',
+      'last_comment_timestamp' => 'last_comment_timestamp',
+    );
   }
-}
 
-function _flag_views_user_default_views(&$views) {
-  $flags = flag_get_flags('user');
+  $views = array();
 
-  foreach ($flags as $flag) {
-    $menu_title = $flag->global ? drupal_ucfirst($flag->get_title()) : t('My !flag-title', array('!flag-title' => drupal_strtolower($flag->get_title())));
+  /* Individual users user/%/bookmarks tab. */
 
-    $view = new view;
-    $view->name = 'flag_' . $flag->name;
-    $view->description = t('View for flag: !flag-title', array('!flag-title' => $flag->get_title()));
-    $view->tag = 'flag';
-    $view->view_php = '';
-    $view->base_table = 'users';
-    $view->is_cacheable = FALSE;
-    $view->api_version = 2;
-    $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
-    $handler = $view->new_display('default', 'Defaults', 'default');
-
-    $handler->override_option('relationships', array(
-      'flag_content_rel' => array(
-        'label' => $flag->name,
-        'required' => 1,
-        'flag' => $flag->name,
-        'user_scope' => 'current',
-        'id' => 'flag_content_rel',
-        'table' => 'users',
-        'field' => 'flag_content_rel',
-        'relationship' => 'none',
-      ),
-    ));
+  // Additional relationship for this view.
+  $relationships['flag_content_rel']['user_scope'] = 'all';
+  $relationships_tab = $relationships + array(
+    'uid' => array(
+      'label' => 'bookmarks_user',
+      'required' => 1,
+      'id' => 'uid',
+      'table' => 'flag_content',
+      'field' => 'uid',
+      'relationship' => 'flag_content_rel',
+    ),
+  );
+
+  // Additional argument for this view.
+  $arguments_tab = array(
+    'uid' => array(
+      'default_action' => 'empty',
+      'style_plugin' => 'default_summary',
+      'style_options' => array(),
+      'wildcard' => 'all',
+      'wildcard_substitution' => 'All',
+      'title' => '%1\'s bookmarks',
+      'default_argument_type' => 'fixed',
+      'default_argument' => '',
+      'validate_type' => 'none',
+      'validate_fail' => 'not found',
+      'break_phrase' => 0,
+      'not' => 0,
+      'id' => 'uid',
+      'table' => 'users',
+      'field' => 'uid',
+      'override' => array(
+        'button' => 'Override',
+      ),
+      'relationship' => 'uid',
+      'default_options_div_prefix' => '',
+      'default_argument_user' => 0,
+      'default_argument_fixed' => '',
+      'default_argument_php' => '',
+    ),
+  );
+
+  $view = new view;
+  $view->name = 'flag_bookmarks_tab';
+  $view->description = 'Provides a tab on all user\'s profile pages containing bookmarks for that user.';
+  $view->tag = 'flag';
+  $view->view_php = '';
+  $view->base_table = 'node';
+  $view->is_cacheable = FALSE;
+  $view->api_version = 2;
+  $view->disabled = FALSE;
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('relationships', $relationships_tab);
+  $handler->override_option('fields', $fields);
+  $handler->override_option('arguments', $arguments_tab);
+  $handler->override_option('filters', $filters);
+  $handler->override_option('access', $access);
+  $handler->override_option('title', 'User bookmarks');
+  $handler->override_option('empty', 'This user has not yet bookmarked any content.');
+  $handler->override_option('empty_format', '1');
+  $handler->override_option('items_per_page', '25');
+  $handler->override_option('use_pager', TRUE);
+  $handler->override_option('style_plugin', 'table');
+  $handler->override_option('style_options', $style_options);
+
+  $handler = $view->new_display('page', 'Page', 'page');
+  $handler->override_option('path', 'user/%/bookmarks');
+  $handler->override_option('menu', array(
+    'type' => 'tab',
+    'title' => 'Bookmarks',
+    'weight' => '0',
+    'name' => 'navigation',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => NULL,
+    'weight' => NULL,
+  ));
+
+  $views[$view->name] = $view;
+
+  /* User bookmarks page with Ops. */
+
+  // Add some unique options for this view.
+  $style_options['columns'] += array('ops' => 'ops');
+  $fields += array(
+    'ops' => array(
+      'label' => 'Ops',
+      'id' => 'ops',
+      'table' => 'flag_content',
+      'field' => 'ops',
+      'relationship' => 'flag_content_rel',
+    ),
+  );
+
+  $view = new view;
+  $view->name = 'flag_'. $flag->name;
+  $view->description = 'A page listing the current user\'s bookmarks at /bookmarks.';
+  $view->tag = 'flag';
+  $view->view_php = '';
+  $view->base_table = 'node';
+  $view->is_cacheable = '0';
+  $view->api_version = 2;
+  $view->disabled = FALSE;
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('relationships', $relationships);
+  $handler->override_option('fields', $fields);
+  $handler->override_option('filters', $filters);
+  $handler->override_option('access', $access);
+  $handler->override_option('title', t('My bookmarks'));
+  $handler->override_option('items_per_page', '25');
+  $handler->override_option('use_pager', TRUE);
+  $handler->override_option('empty', 'You have not yet bookmarked any content. Click the "'. $flag->flag_short .'" link when viewing a piece of content to add it to this list.');
+  $handler->override_option('empty_format', FILTER_FORMAT_DEFAULT);
+  $handler->override_option('style_plugin', 'table');
+  $handler->override_option('style_options', $style_options);
+  $handler = $view->new_display('page', 'Page', 'page');
+  $handler->override_option('path', 'bookmarks');
+  $handler->override_option('menu', array(
+    'type' => 'normal',
+    'title' => t('My bookmarks'),
+    'weight' => '0',
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => NULL,
+    'weight' => NULL,
+  ));
 
-    $handler->override_option('fields', array(
-      'name' => array(
-        'label' => 'Name',
-        'link_to_user' => 1,
-        'exclude' => 0,
-        'id' => 'name',
-        'table' => 'users',
-        'field' => 'name',
-        'relationship' => 'none',
-      ),
-      'ops' => array(
-        'label' => 'Ops',
-        'exclude' => 0,
-        'id' => 'ops',
-        'table' => 'flag_content',
-        'field' => 'ops',
-        'relationship' => 'flag_content_rel',
-      ),
-    ));
+  $views[$view->name] = $view;
 
-    $handler->override_option('style_plugin', 'table');
-    $handler->override_option('style_options', array(
-      'grouping' => '',
-      'override' => 1,
-      'sticky' => 0,
-      'order' => 'asc',
-      'columns' => array(
-        'name' => 'name',
-        'ops' => 'ops',
-      ),
-      'info' => array(
-        'name' => array(
-          'sortable' => 1,
-          'separator' => '',
-        ),
-        'ops' => array(
-          'separator' => '',
-        ),
-      ),
-      'default' => 'name',
-    ));
-
-    $handler->override_option('access', array(
-      'type' => 'role',
-      'role' => drupal_map_assoc($flag->roles),
-      'perm' => '',
-    ));
-
-    $handler->override_option('title', $menu_title);
-    $handler->override_option('items_per_page', 30);
-    $handler->override_option('use_pager', TRUE);
-    $handler->override_option('empty', 'No users are flagged.');
-    $handler->override_option('empty_format', '1');
-
-    $handler = $view->new_display('page', 'Page', 'page_1');
-    $handler->override_option('path', 'flags/' . $flag->name);
-    $handler->override_option('menu', array(
-      'type' => 'normal',
-      'title' => $menu_title,
-      'weight' => '0',
-    ));
-    $handler->override_option('tab_options', array(
-      'type' => 'none',
-      'title' => NULL,
-      'weight' => 0,
-    ));
-
-    $views[$view->name] = $view;
-  }
+  return $views;
 }
