? easylink_6.patch
Index: easylink.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/easylink/easylink.info,v
retrieving revision 1.4
diff -u -p -r1.4 easylink.info
--- easylink.info	29 Aug 2007 21:20:43 -0000	1.4
+++ easylink.info	21 Sep 2008 00:24:27 -0000
@@ -1,6 +1,7 @@
 ; $Id: easylink.info,v 1.4 2007/08/29 21:20:43 linuxbox Exp $
 name = EasyLink
 description = Allows non-technical users to insert links via TinyMCE.
+core = 6.x
 
-dependencies = views tinymce
-
+dependencies[] = tinymce
+dependencies[] = views
Index: easylink.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/easylink/easylink.module,v
retrieving revision 1.5
diff -u -p -r1.5 easylink.module
--- easylink.module	29 Aug 2007 21:20:43 -0000	1.5
+++ easylink.module	21 Sep 2008 00:24:27 -0000
@@ -14,37 +14,41 @@ function easylink_help($section) {
   }
 }
 
-function easylink_menu($may_cache) {
-  $items = array();
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'easylink/load',
-      'title' => t('EasyLink'),
-      'callback' => 'easylink_loader',
-      'access' => user_access('use easylink'),
-      'type' => MENU_CALLBACK);
-
-    $items[] = array(
-      'path' => 'admin/settings/easylink',
-      'title' => t('EasyLink'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('easylink_admin_settings'),
-      'access' => user_access('administer easylink'),
-      'type' => MENU_NORMAL_ITEM);
-  } else {
-    $path = drupal_get_path('module', 'easylink');
-
-    // the base url here is used for popup windows
-    $js_base_url  = "\n<script type=\"text/javascript\"><!--\n";
-    $js_base_url .= "  var BASE_URL = \"" . base_path() . "\";\n";
-    $js_base_url .= "--></script>\n";
-    drupal_set_html_head($js_base_url);
+/**
+ * Implementation of hook_menu().
+ */
+function easylink_menu() {
+  $items['easylink/load'] = array(
+    'title' => t('EasyLink'),
+    'page callback' => 'easylink_loader',
+    'access arguments' => array('use easylink'),
+    'type' => MENU_CALLBACK
+  );
+
+  $items['admin/settings/easylink'] = array(
+    'title' => t('EasyLink'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('easylink_admin_settings'),
+    'access arguments' => array('administer easylink'),
+    'type' => MENU_NORMAL_ITEM
+  );
 
-  }
   return $items;
 }
 
 /**
+ * Implementation of hook_init().
+ * @see hook_init
+ */ 
+function easylink_init(){
+  $path = drupal_get_path('module', 'easylink');
+
+  // the base url here is used for popup windows
+
+  drupal_add_js("var BASE_URL = \"". base_path() ."\";\n", 'inline'); 
+}
+
+/**
  * Implementation of hook_perm().
  */
 function easylink_perm() {
@@ -129,61 +133,104 @@ function easylink_admin_settings() {
 }
 
 function easylink_views_default_views(){
-  $view = new stdClass();
-  $view->name = 'easylink';
-  $view->url = 'easylink';
-  $view->description = 'The basic easylink view shows all pages belonging to the current user';
-  $view->access = array (
-  0 => '2',
-);
-  $view->view_args_php = '';
-  $view->page = TRUE;
-  $view->page_title = 'EasyLink';
-  $view->page_header = '';
-  $view->page_header_format = '3';  $view->page_footer = '';
-  $view->page_footer_format = '3';
-  $view->page_empty = '';
-  $view->page_empty_format = '3';
-  $view->page_type = 'table';
-  $view->url = 'easylink';
-  $view->use_pager = TRUE;
-  $view->nodes_per_page = '50';
-  $view->sort = array (
-  );
-  $view->argument = array (
-  );
-  $view->field = array (
-    array (
-      'tablename' => 'node',
+  $view = new view;
+  $view->name = 'Easylink';
+  $view->description = 'easylink view';
+  $view->tag = 'node, link';
+  $view->view_php = '';
+  $view->base_table = 'node';
+  $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('fields', array(
+    'title' => array(
+      'label' => 'Titel',
+      'link_to_node' => 1,
+      'exclude' => 0,
+      'id' => 'title',
+      'table' => 'node',
       'field' => 'title',
-      'label' => 'Page Title',
-      'handler' => 'views_handler_field_nodelink_with_mark',
-      'sortable' => '1',
-      'defaultsort' => 'ASC',
-      'options' => 'link',
+      'relationship' => 'none',
     ),
-  );
-  $view->filter = array (
-    array (
-      'tablename' => 'node',
+  ));
+  $handler->override_option('filters', array(
+    'type' => array(
+      'operator' => 'in',
+      'value' => array(
+        'page' => 'page',
+      ),
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'type',
+      'table' => 'node',
       'field' => 'type',
-      'operator' => 'OR',
-      'options' => '',
-      'value' => array (
-  0 => 'page',
-),
+      'relationship' => 'none',
     ),
-    array (
-      'tablename' => 'node',
-      'field' => 'currentuid',
+    'uid_current' => array(
       'operator' => '=',
-      'options' => '',
-      'value' => '***CURRENT_USER***',
+      'value' => 1,
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'uid_current',
+      'table' => 'users',
+      'field' => 'uid_current',
+      'relationship' => 'none',
     ),
-  );
-  $view->exposed_filter = array (
-  );
-  $view->requires = array(node);
+  ));
+  $handler->override_option('access', array(
+    'type' => 'none',
+    'role' => array(),
+    'perm' => '',
+  ));
+  $handler->override_option('title', 'Easylink');
+  $handler->override_option('use_ajax', TRUE);
+  $handler->override_option('use_pager', '1');
+  $handler->override_option('style_plugin', 'table');
+  $handler->override_option('style_options', array(
+    'grouping' => '',
+    'override' => 1,
+    'sticky' => 1,
+    'order' => 'asc',
+    'columns' => array(
+      'title' => 'title',
+    ),
+    'info' => array(
+      'title' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+    ),
+    'default' => 'title',
+  ));
+  $handler = $view->new_display('page', 'Seite', 'page_1');
+  $handler->override_option('items_per_page', 50);
+  $handler->override_option('use_pager', '1');
+  $handler->override_option('path', 'easylink');
+  $handler->override_option('menu', array(
+    'type' => 'none',
+    'title' => '',
+    'weight' => 0,
+  ));
+  $handler->override_option('tab_options', array(
+    'type' => 'none',
+    'title' => '',
+    'weight' => 0,
+  ));
+  
+  // Add view to list of views to provide.
   $views[$view->name] = $view;
+
+  // ...Repeat all of the above for each view the module should provide.
+
+  // At the end, return array of default views.
   return $views;
 }
