### Eclipse Workspace Patch 1.0
#P contemplate6
Index: contemplate.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/contemplate/contemplate.module,v
retrieving revision 1.8.2.3
diff -u -r1.8.2.3 contemplate.module
--- contemplate.module	12 Aug 2007 21:32:41 -0000	1.8.2.3
+++ contemplate.module	22 Feb 2008 03:23:47 -0000
@@ -45,39 +45,48 @@
   }
 }
 
+/**
+* Menu callback; loads a flexifilter object
+*/
+function contemplate_load($type) {
+  $sql ="
+  	SELECT
+  		*
+  	FROM
+  		{node_type}
+  	WHERE
+  		`type`='%s'
+  ";
+  $result = db_query($sql, $type);
+  if($result){
+    return $type;
+  }else{
+    return FALSE;
+  }
+}
 
 /**
  * Implementation of hook_menu().
  */
-function contemplate_menu($may_cache) {
+function contemplate_menu() {
   $items = array();
-
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/content/templates',
-      'title' => t('Content templates'),
-      'description' => t('Create templates to customize output of teaser and body content.'),
-      'access' => user_access('administer templates'),
-      'callback' => 'contemplate_edit_type'
-    );
-  }
-  else {
-
-    if (arg(0) == 'admin' && arg(1) == 'content' && arg(2) == 'types' && arg(3)) {
-      $access = user_access('administer templates');
-
-      $items[] = array(
-        'path' => 'admin/content/types/'. arg(3) .'/template',
-        'title' => t('Template'),
-        'callback' => 'contemplate_edit_type',
-        'access' => $access,
-        'callback arguments' => array(arg(3)),
-        'type' => MENU_LOCAL_TASK,
-        'weight' => 7,
-      );
-    }
-  }
-
+  $items['admin/content/templates'] = array(
+    'title' => t('Content templates'),
+    'description' => t('Create templates to customize output of teaser and body content.'),
+    'access callback' => 'user_access',
+    'access arguments' => 'administer templates',
+    'page callback' => 'contemplate_edit_type',
+    'page arguments' => array(3),
+  );
+  $items['admin/content/types/%contemplate/template'] = array(
+    'title' => t('Template'),
+    'page callback' => 'contemplate_edit_type',
+    'access callback' => 'user_access',
+    'access arguments' => 'administer templates',
+    'page arguments' => array(3),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 7,
+  );
   return $items;
 }
 
@@ -165,8 +174,7 @@
  *
  * @param string $type
  */
-function contemplate_edit_type_form($type = NULL) {
-
+function contemplate_edit_type_form(&$form_state, $type = NULL) {
   $example = contemplate_examples($type);
 
   $template = contemplate_get_template($type);
@@ -354,12 +362,10 @@
     '#type' => 'submit',
     '#value' => t('Submit'),
   );
-
   return $form;
 }
 
 function contemplate_edit_type($type = NULL) {
-
   $types = node_get_types();
 
   if (!$types[$type]) { // if the argument isn't a valid node type, output admin page
@@ -426,14 +432,14 @@
   return $templates;
 }
 
-function contemplate_edit_type_form_submit($form_id, $form_values) {
+function contemplate_edit_type_form_submit($form, &$form_state) {
   $op = isset($_POST['op']) ? $_POST['op'] : '';
   if ($op == t('Reset')) {
-    contemplate_delete($form_values['type']);
+    contemplate_delete($form['type']['#value']);
     drupal_set_message(t('%type template has been reset.', array("%type" => $form_values['type'])));
   }
   else {
-    contemplate_save($form_values);
+    contemplate_save($form);
     drupal_set_message(t('%type template saved.', array('%type' => $form_values['type'])));
     if (arg(0) == 'admin' && arg(1) == 'node' && arg(2) == 'template') {
       drupal_goto('admin/content/templates');
@@ -442,11 +448,12 @@
 }
 
 function contemplate_save($edit) {
-  contemplate_delete($edit['type']);
-  $flags |= $edit['teaser-enable'] ? CONTEMPLATE_TEASER_ENABLED : 0;
-  $flags |= $edit['body-enable'] ? CONTEMPLATE_BODY_ENABLED : 0;
-  $flags |= $edit['rss-enable'] ? CONTEMPLATE_RSS_ENABLED : 0;
-  return db_query("INSERT INTO {contemplate} (type, teaser, body, rss, enclosure, flags) VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $edit['type'], $edit['teaserfield'], $edit['bodyfield'], $edit['rss'], $edit['enclosure'], $flags);
+  contemplate_delete($edit['type']['#value']);
+  $flags |= $edit['#post']['teaser-enable'] ? CONTEMPLATE_TEASER_ENABLED : 0;
+  $flags |= $edit['#post']['body-enable'] ? CONTEMPLATE_BODY_ENABLED : 0;
+  $flags |= $edit['#post']['rss-enable'] ? CONTEMPLATE_RSS_ENABLED : 0;
+  $sql = "INSERT INTO {contemplate} (type, teaser, body, rss, enclosure, flags) VALUES ('%s', '%s', '%s', '%s', '%s', %d)";
+  return db_query($sql, $edit['#post']['type'], $edit['#post']['teaserfield'], $edit['#post']['bodyfield'], $edit['#post']['rss'], $edit['#post']['enclosure'], $flags);
 
 }
 
Index: contemplate.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/contemplate/contemplate.info,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 contemplate.info
--- contemplate.info	25 Mar 2007 19:23:09 -0000	1.2.2.1
+++ contemplate.info	22 Feb 2008 03:23:46 -0000
@@ -1,4 +1,5 @@
 ; $Id: contemplate.info,v 1.2.2.1 2007/03/25 19:23:09 jjeff Exp $
 name = Content Templates
 description = Create templates to customize output of teaser and body content.
-package = CCK
\ No newline at end of file
+package = CCK
+core = 6.x
\ No newline at end of file
