diff -upN authorship.5x-1.2/authorship.info authorship.6.x-dev/authorship.info --- authorship.5x-1.2/authorship.info 2007-10-06 16:00:03.000000000 +0100 +++ authorship.6.x-dev/authorship.info 2008-07-15 06:09:26.000000000 +0100 @@ -2,7 +2,6 @@ name = Authorship description = Allows for site admins to alter the submitted by field of a node ; Information added by drupal.org packaging script on 2007-10-06 -version = "5.x-1.2" +version = "6.x-dev" project = "authorship" -datestamp = "1191682803" - +core = "6.x" diff -upN authorship.5x-1.2/authorship.install authorship.6.x-dev/authorship.install --- authorship.5x-1.2/authorship.install 2007-07-12 23:05:55.000000000 +0100 +++ authorship.6.x-dev/authorship.install 2008-07-17 21:26:16.000000000 +0100 @@ -10,53 +10,27 @@ * AjK, June 2006 */ -if (!function_exists('authorship_install')) { - function authorship_install() { - $created = FALSE; - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - $query1 = db_query("CREATE TABLE IF NOT EXISTS {node_authorship} (". - "nid INT(10) NOT NULL DEFAULT 0,". - "cid INT(10) NOT NULL DEFAULT 0,". - "authorship VARCHAR(255) NOT NULL DEFAULT '',". - "profile_real_name INT(2) DEFAULT 0, ". - "PRIMARY KEY (nid, cid),". - "INDEX(authorship(8))". - ") /*!40100 DEFAULT CHARACTER SET utf8 */"); - if($query1) { - $created = TRUE; - } - break; - - case 'pgsql': - $query1 = db_query("CREATE TABLE {node_authorship} (". - "nid INT NOT NULL DEFAULT 0,". - "cid INT NOT NULL DEFAULT 0,". - "authorship VARCHAR(255) NOT NULL DEFAULT '',". - "profile_real_name SMALLINT DEFAULT 0, ". - "PRIMARY KEY (nid, cid)"); - $query2 = db_query("CREATE INDEX node_authorship_idx ON {node_authorship} (authorship);"); - if($query1 && $query2) { - $created = TRUE; - } - break; - } // end switch - - // sink module's weight to the deepest depths of the module_list() - db_query("UPDATE {system} SET weight = %d WHERE name = '%s'", - 1001, 'node_authorship'); - - // provide the user with some install feedback - if ($created) { - drupal_set_message(t('Authorship database tables installed')); - } - else { - drupal_set_message(t('Table install for Authorship was unsuccessful.')); - } - } // end function -} // end !function_exists() +/** + * v6.x-dev written by matt_b + */ +function authorship_schema() { + $schema['node_authorship'] = array( + 'fields' => array( + 'nid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'), + 'cid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'), + 'authorship' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''), + 'profile_real_name' => array('type' => 'int', 'not null' => FALSE, 'default' => 0, 'disp-width' => '2')), + 'primary key' => array('nid', 'cid'), + 'indexes' => array( + 'authorship' => array(array('authorship', 8))), + ); + + return $schema; +} + +/* +This need to be converted. For the moment, this module assumes that the latest 5.x version was used function authorship_update_1() { $items = array(); @@ -78,20 +52,15 @@ function authorship_update_2() { $items[] = update_sql("ALTER TABLE {node_authorship} ADD PRIMARY KEY (nid, cid)"); return $items; } - -/** -* Implementation of hook_uninstall(). */ + +function authorship_install() { + // Create my tables. + drupal_install_schema('authorship'); +} + function authorship_uninstall() { - if(db_table_exists('{node_authorship}')) { - db_query('DROP TABLE {node_authorship}'); - } - // delete variables - $node_types = node_get_types('names'); - $node_types = array_keys($node_types); - $node_types[] = 'comment'; - foreach($node_types as $node_type) { - variable_del('authorship_real_name_' . $node_type); - variable_del('authorship_' . $node_type); - } + // Drop my tables. + drupal_uninstall_schema('authorship'); } +?> \ No newline at end of file diff -upN authorship.5x-1.2/authorship.module authorship.6.x-dev/authorship.module --- authorship.5x-1.2/authorship.module 2007-07-12 23:09:08.000000000 +0100 +++ authorship.6.x-dev/authorship.module 2008-07-18 06:16:36.000000000 +0100 @@ -9,6 +9,8 @@ * brashquido (http://drupal.org/user/49838) * by AjK (http://drupal.org/user/39030) * June 2006 + * + * v6.x-dev written by matt_b */ if(!defined("_AUTHORSHIP_DEBUG")) { @@ -19,8 +21,8 @@ if(!defined("_AUTHORSHIP_DEBUG")) { /** * Implementation of hook_help(). */ -function authorship_help($section) { - switch ($section) { +function authorship_help($path, $arg) { + switch ($path) { case 'admin/modules#description': return t('Node authorship extention module.'); } @@ -43,7 +45,7 @@ function authorship_perm() { /** * Implementation of hook_form_alter() */ -function authorship_form_alter($form_id, &$form) { +function authorship_form_alter(&$form, &$form_state, $form_id) { global $user; _authorship_debug("authorship_form_alter(" . $form['#node']->nid . ")"); @@ -78,7 +80,7 @@ function authorship_form_alter($form_id, '#title' => t('Authorship display setting'), '#default_value' => $form['#node']->authorship, '#weight' => 9, - '#description' => t('The name to display as the submitter. '. + '#description' => t('The name to display as the author. '. 'Leave blank for normal operation') ); } @@ -102,7 +104,7 @@ function authorship_form_alter($form_id, '#type' => 'textfield', '#title' => t('Authorship display setting'), '#default_value' => $authorship, - '#description' => t('The name to display as the submitter. '. + '#description' => t('The name to display as the author. '. 'Leave blank for normal operation') ); } @@ -254,43 +256,4 @@ function _authorship_debug($s) { } /* }}} */ -/** - * Implementation of hook_views_tables() - * (see Views module) - */ -function authorship_views_tables() { - $tables['node_authorship'] = array( - 'join' => array( - 'left' => array( - 'table' => 'node', - 'field' => 'nid', - ), - 'right' => array( - 'field' => 'nid', - ), - ), - 'fields' => array( - 'authorship' => array( - 'name' => t('Node: Authorship'), - 'sortable' => true, - 'help' => t('Display the authorship display setting for the node.'), - ), - ), - 'sorts' => array( - 'authorship' => array( - 'name' => t('Node: Authorship'), - 'help' => t('Sort by the node authorship, alphabetically'), - ), - ), - 'filters' => array( - 'authorship' => array( - 'name' => t('Node: Authorship'), - 'operator' => 'views_handler_operator_like', - 'handler' => 'views_handler_filter_like', - 'help' => t('Sort by the node authorship, alphabetically'), - ), - ), - ); - return $tables; -} diff -upN authorship.5x-1.2/authorship.views.inc authorship.6.x-dev/authorship.views.inc --- authorship.5x-1.2/authorship.views.inc 1970-01-01 01:00:00.000000000 +0100 +++ authorship.6.x-dev/authorship.views.inc 2008-07-18 20:37:40.000000000 +0100 @@ -0,0 +1,49 @@ + 'authorship', + 'title' => t('Authorship'), + 'help' => t("Display the authorship setting for the node."), + ); + + //joins + $data['node_authorship']['table']['join'] = array( + //...to the node table + 'node' => array( + 'left_field' => 'nid', + 'field' => 'nid', + ), + ); + + // ---------------------------------------------------------------- + // Fields + + // subject + $data['node_authorship']['authorship'] = array( + 'title' => t('Authorship'), + 'help' => t('Display the author setting for the node.'), + 'field' => array( + 'handler' => 'views_handler_field', + 'click sortable' => TRUE, + ), + 'filter' => array( + 'handler' => 'views_handler_filter_string', + ), + 'sort' => array( + 'handler' => 'views_handler_sort', + ), + 'argument' => array( + 'handler' => 'views_handler_argument_string', + ), + ); + return $data; +} +?> \ No newline at end of file Common subdirectories: authorship.5x-1.2/po and authorship.6.x-dev/po