Index: CHANGELOG.txt
===================================================================
RCS file: CHANGELOG.txt
diff -N CHANGELOG.txt
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ CHANGELOG.txt	4 Feb 2009 18:11:54 -0000
@@ -0,0 +1,42 @@
+$Id$
+
+Editview x.x-x.x, xxx-xx-xx
+---------------------------
+by Darren Oh: Updated to Drupal 6 and Views 2.
+
+
+Editview 5.x-1.x, xxxx-xx-xx
+----------------------------
+
+
+Editview 5.x-1.0, 2009-01-29
+----------------------------
+#217937 by Agileware: Fixed image uploads.
+#305350 by Agileware: Added support for jscalendar date fields.
+
+
+Editview 5.x-0.3, 2008-01-28
+----------------------------
+#119208 by Agileware: Added an install file to warn users when Drupal needs to
+be patched.
+#152819 by cnb: Module .info files should not define 'version' in CVS.
+by Agileware: File uploads now work.
+by Agileware: Updated to the latest jquery.form.js (version 2.03).
+by Agileware: Added hook_field_form_render so that other modules can define a
+  way of rendering certain fields, especially when their views fieldname doesn't
+  directly correspond to a node fieldname.
+
+
+Editview 5.x-0.1, 2007-02-20
+----------------------------
+by nterbogt: Added choice of table or compressed view.
+by nterbogt: Fixed .info file format.
+by nterbogt: Initial Drupal 5 release.
+
+
+Editview 4.7.x-1.x, 2006-11-02
+------------------------------
+#92034 by wrunt: Fixed type error.
+by wrunt: An Editview now appears even when empty, so you can add nodes to an
+  empty view.
+by wrunt: Got rid of license in favour of LICENSE.txt.
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/editview/README.txt,v
retrieving revision 1.4
diff -u -p -r1.4 README.txt
--- README.txt	27 Nov 2006 22:55:49 -0000	1.4
+++ README.txt	4 Feb 2009 18:11:54 -0000
@@ -1,163 +1,36 @@
 $Id: README.txt,v 1.4 2006/11/27 22:55:49 wrunt Exp $
 
-The Editview Drupal Module
+Editview is a Views plug-in that allows you to create views in which nodes are
+editable and new nodes can be created. Editview works with or without JavaScript
+enabled.
 
-   Editview is a plugin for the [1]Views module. It allows you to create a view
-   in which the nodes are editable, and new nodes can be created. Editview uses
-   AJAX to speed things up, but will still work on browsers with javascript
-   disabled. Editview is only known to work under drupal 4.7, and has not yet
-   been extensively tested.
 
 Installation
+------------
+
+  1. Ensure that Views is installed.
+
+  2. Unpack the editview tarball in your sites/all/modules directory.
+
+  3. Enable Editview at Administer >> Site building >> Modules.
 
-   To install Editview:
-    1. Ensure that [2]the Views module is installed and enabled.
-    2. Unpack [3]the latest editview tarball in your drupal modules directory.
-    3. Enable the editview module on your drupal admin/modules page.
 
 Usage
+-----
 
-   Editviews are created just like any other type of view, with a few caveats.
+Editviews are created just like any other type of view, with a few caveats:
 
-  Select the View Type
+  1. Add or edit a node view.
 
-   Normal views allow you to choose whether they are one of:
-     * Full Nodes
-     * Teaser List
-     * Table View
-     * List View
-
-   Installing the Editview module adds another option:
-     * Edit View
-
-   If you select that option then your view is an Editview.
-
-  Caveat 1
-
-   Editview assumes that your view is filtered to display only one node type.
-   This is so that the Editview knows what type to make any nodes it adds.
-
-  Caveat 2
-
-   You should include any 'required' fields in the view, otherwise adding new
-   nodes will be impossible, since any nodes you try to add will fail their
-   validation.
-
-Cookbook
-
-  Make a view that allows you to edit and create pages on your site
-
-   This Editview will show an editable table of page nodes. You can edit their
-   title and body fields, save your changes, delete pages (with confirmation),
-   and create new pages which are then added to the view.
-   Steps:
-    1. Create a new view, giving it a name and limiting access to roles who are
-       able to create and edit pages.
-    2. Check  the  'Provide  Page  View'  box,  and  give  your  view  an
-       easy-to-remember url.
-    3. In 'View Type', select 'Edit View'.
-    4. In the 'Fields' section, add 'Node: Title', and 'Node: Body'
-    5. In the 'Filters' section, add a 'Node: Type' filter, and select 'page'
-       as the value.
-    6. Save the view and visit its url.
-
-  View, edit, and add 'child' nodes on a 'parent' node page
-
-   This view uses cck, views, and editview to add the ability to see and edit a
-   table of 'child' nodes on a 'parent' node page. We'll relate children to
-   parents using a cck node reference field to the child node type.
-   Steps:
-    1. Create the parent and child node types. In this example we'll make
-       'organisation' the parent type, and 'employee' the child type.
-         1. Create 'organisation' as a cck node type, giving it whatever fields
-            you like.
-         2. Create 'employee' as a ckk node type. One of its fields should be a
-            node reference which you should limit to only be able to access
-            nodes of type 'organisation'. Make sure the node reference is a
-            select list, not an auto-complete text field. We'll be relying on
-            not having to enter the reference manually.
-         3. At this point you may want to create a few test organisations and
-            assign each one a few employees.
-    2. Make  a  new table view listing employees, that will appear on the
-       organisation view page:
-         1. Create the view as a block of type 'Table View'.
-         2. The view's fields should be the employee type's fields, without the
-            organisation node reference.
-         3. Add  the  organisation node reference as an argument. Put the
-            following  as  the  argument  code:
-			if  (arg(0) == 'node' && is_numeric(arg(1)))  {
-				$organisation = node_load(arg(1));
-				if ($organisation->nid) {
-					return array($organisation->nid);
-				}
-			}
-			This will  make  sure the view only shows employees of the current
-			organisation being viewed.
-         4. Save the view, and enable it as a block on the admin/block page.
-         5. Configure  the block, putting the following code in the 'Page
-            specific visibility settings':
-			<?php
-			if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == '') {
-				$node = node_load(arg(1));
-				if ($node->type == 'content_organisation') {
-					return true;
-				}
-			}
-			return false;
-			?>
-			This will make sure that the view is only displayed on the view
-			tab of organisation nodes.
-    3. Create our edit view, which will appear on the edit tab of organisation
-       nodes.
-          + Go back to the views page and clone the view you just made. Change
-            the type of the new view to 'Edit View' and save it.
-          + Go to the blocks admin page and enable the edit view as a block,
-            putting the following as its code (note the similarity (and minor
-            (but important) difference) to above):
-			<?php
-			if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'edit') {
-				$node = node_load(arg(1));
-				if ($node->type == 'content_organisation') {
-					return true;
-				}
-			}
-			return false;
-			?>
-
-   Now when you go to an organisation node, you will see a table listing all of
-   that organisation's employees, and when you click on its 'edit' tab, the
-   list of employees will become editable as well.
-
-  More Cookbook Examples?
-
-   If you find another useful way to use an Editview, write a quick description
-   and I'll add it here.
-
-Todo
-
-     * Access control - display a table view when users can't edit nodes.
-       Currently unprivileged users can't edit nodes using editview, but the
-       node editing forms are still loaded and displayed.
-     * Javascript libraries loaded alongside editview.js may be loaded more
-       than once. For instance, the jscalendar library that comes with the
-       jstools module will load a new jscalendar button every time you add or
-       edit a node, and you end up with multiple buttons per row instead of
-       just  one. The best fix would be to make sure all js libraries are
-       idempotent.
-
-Changelog
-
-   2nd November 2006
-          An Editview now appears even when empty, so you can add nodes to an
-          empty view.
+  2. If you want to be able to add new nodes in the view, set the style to
+     Editview in Basic settings. Otherwise, you can choose any style that allows
+     you to set a row style and set the row style to Editview.
 
-About Editview
+  3. Include any required fields in the view, or new nodes will fail validation.
 
-   Editview was developed  by Agileware Pty Ltd (http://www.agileware.net) and
-   co-sponsored by Xu Media Solutions (http://xumedia.org) and Agileware..
 
-References
+About Editview
+--------------
 
-   1. http://drupal.org/project/views
-   2. http://drupal.org/project/views
-   3. http://ftp.osuosl.org/pub/drupal/files/projects/editview-4.7.0.tar.gz
+Editview was developed  by Agileware Pty Ltd (http://www.agileware.net) and
+co-sponsored by Xu Media Solutions (http://xumedia.org) and Agileware.
Index: editview-view-row-node-edit.tpl.php
===================================================================
RCS file: editview-view-row-node-edit.tpl.php
diff -N editview-view-row-node-edit.tpl.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ editview-view-row-node-edit.tpl.php	4 Feb 2009 18:11:54 -0000
@@ -0,0 +1,26 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Editview row template.
+ *
+ * Available variables:
+ * - $view: View object.
+ * - $row: Row data object.
+ * - $zebra: Even or odd.
+ * - $id: Row number.
+ * - $is_admin: True if the user is a site administrator.
+ * - $is_front: True if this is the site front page.
+ * - $logged_in: True if user is logged in.
+ * - $user: Current user object.
+ * - $form: Themed node form.
+ *
+ * @see template_preprocess_editview_view_row_node_edit()
+ */
+?>
+<?php if (isset($form)): ?>
+  <div id="editview-node-form-<?php print $row->nid; ?>">
+    <?php print $form; ?>
+  </div>
+<?php endif; ?>
Index: editview.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/editview/editview.css,v
retrieving revision 1.5
diff -u -p -r1.5 editview.css
--- editview.css	16 May 2007 04:22:02 -0000	1.5
+++ editview.css	4 Feb 2009 18:11:54 -0000
@@ -1,4 +1,4 @@
-/* $Id: editview.css,v 1.5 2007/05/16 04:22:02 agileware Exp $ */
+/* $Id: editview.css,v 1.3.2.2 2008/01/29 00:21:44 agileware Exp $ */
 
 td.editview-field {
   height: 1em;
Index: editview.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/editview/editview.info,v
retrieving revision 1.3
diff -u -p -r1.3 editview.info
--- editview.info	16 May 2007 04:22:02 -0000	1.3
+++ editview.info	4 Feb 2009 18:11:54 -0000
@@ -1,5 +1,6 @@
-; $Id: editview.info,v 1.3 2007/05/16 04:22:02 agileware Exp $
+; $id$
 name = Editview
-description = "Allows you to edit multiple nodes simultaneously through a view"
-dependencies = views
+description = "Allows users to add and edit nodes in a view."
+core = 6.x
 package = Views
+dependencies[] = views
Index: editview.install
===================================================================
RCS file: editview.install
diff -N editview.install
--- editview.install	16 May 2007 04:22:02 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,8 +0,0 @@
-<?php
-// $Id $
-
-function editview_install() {
-  if (!function_exists('drupal_reset_errors')) {
-    drupal_set_message('Warning: Editview will not work until you have installed <a href="http://drupal.org/node/119208">this patch</a>', 'error');
-  }
-}
Index: editview.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/editview/editview.js,v
retrieving revision 1.4
diff -u -p -r1.4 editview.js
--- editview.js	20 Feb 2007 23:51:19 -0000	1.4
+++ editview.js	4 Feb 2009 18:11:54 -0000
@@ -1,37 +1,46 @@
-// $Id: editview.js,v 1.4 2007/02/20 23:51:19 nterbogt Exp $
+// $Id: editview.js,v 1.3.2.3 2008/11/25 00:34:07 agileware Exp $
 
-$(function(){ if (Drupal.jsEnabled) $("form").each(editviewCaptureForm); });
+Drupal.behaviors.editview = function (context) {
+  $('form', context).each(Editview.formCapture);
+};
 
-function editviewCaptureForm() {
+var Editview = Editview || {
+  formCapture: function() {
     var form_id = $('[@name=form_id]', this).val();
     var delete_form = (form_id == 'editview_delete_form');
     var node_form = form_id && form_id.match(/^editview_node_form_\d+/);
-    // This doesn't catch new node forms, we want them to submit normally
     if (node_form || delete_form) {
-        var form = this;
-        var wrapper = $(form).parent();
-        var message = $('#editview_messages');
-        var options = {
-            url: $('#editview-submit-url').html(),
-            dataType: 'json',
-            beforeSubmit: function() {
-                wrapper.slideUp('slow').empty();
-                message.fadeOut('slow').empty();
-            },
-            success: function(data, status) {
-                if (status == 0) {
-                    alert('Error submitting form');
-                }
-                if (data['message']) {
-                    message.append(data['message']).fadeIn('slow');
-                } 
-                wrapper.hide();
-                wrapper.append(data['form']).slideDown('slow');
-                $('form', wrapper).each(editviewCaptureForm);
-                $('form', wrapper).each(Drupal.textareaAttach); // TODO: generalise
+      var options = {
+        url: Drupal.settings.editview.submit_url,
+        beforeSubmit: function(form_values, form, options) {
+          var name;
+          var deleted = false;
+          for (var i = 0; i < form_values.length; i++) {
+            if (form_values[i].name == 'op' && form_values[i].value == Drupal.t('Delete')) {
+              deleted = true;
             }
-        }
-        $(form).ajaxForm(options);
+            if (form_values[i].name == 'title') {
+              name = form_values[i].value;
+            }
+          }
+          if (deleted && !confirm(Drupal.t('Are you sure you want to delete @name?', {'@name': name}) +"\n"+ Drupal.t('This action cannot be undone.'))) {
+            return false;
+          }       
+          var wrapper = $(form).parent();
+          wrapper.slideUp('slow');
+        },
+        success: function(response, status, form) {
+          var wrapper = $(form).parent();
+          $(wrapper).empty();
+          $(wrapper).append(response);
+          $(wrapper).slideDown('slow');
+          Drupal.attachBehaviors(wrapper);
+          $('.messages', wrapper).fadeOut(6000);
+        },
+        dataType: 'json',
+        type: 'POST'
+      }
+      $(this).ajaxForm(options);
     }
-}
-
+  }
+};
Index: editview.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/editview/editview.module,v
retrieving revision 1.6
diff -u -p -r1.6 editview.module
--- editview.module	20 Feb 2007 23:51:19 -0000	1.6
+++ editview.module	4 Feb 2009 18:11:54 -0000
@@ -1,376 +1,65 @@
 <?php
-// $Id: editview.module,v 1.6 2007/02/20 23:51:19 nterbogt Exp $
+// $Id$
 
-function editview_help($section = 'admin/help#editview') {
-  switch ($section) {
-    case 'admin/modules#description':
-      return t('Plugin for views to make an editable view.');
-  }
-}
-
-function editview_menu($may_cache) {
-  $items = array();
-
-  // the ajax callback is always the current path plus /editview_submit. This
-  // means the view will always have the same node/taxonomy context when it
-  // looks at the path. (a bit of a hack)
-  if (!$may_cache) {
-    $arguments = explode('/', $_GET['q']);
-    $last = array_pop($arguments);
-    if ($last == 'editview_submit') {
-      $items[] = array('path' => $_GET['q'],
-        'callback' => 'editview_render_node',
-        'type' => MENU_CALLBACK,
-      );
-    }
-  }
-  return $items;
-}
-
-function editview_render_node () {
-    $output = editview_node();
-    echo drupal_to_js(array('form' => $output, 'message' => theme('status_messages')));
-    exit;
-}
-
-/*
- * Node function to draw a row both within the page view, and as an AJAX callback.
+/**
+ * @file
+ * Plug-in to make an editable node view.
  */
-function editview_node ($node = null, $view = null) {
-  // If we didn't pass in the node, we posted to this page. Build these values from the post
-  if (is_null($node)) $node = node_load($_POST['nid']);
-  if (is_null($view)) $view = views_get_view($_POST['view_name']);
-
-  form_reset_errors();
-
-  if (isset($_POST['nid']) && $_POST['nid'] == $node->nid) {
-    switch ($_POST['op']) {
-      case t('Confirm'):
-        drupal_get_form('editview_delete_form', $node, $view);
-        $result = '';
-        break;
-      case t('Delete'):
-        $result = drupal_get_form('editview_delete_form', $node, $view);
-        break;
-      default:
-        // We cancelled the delete or submitted this node, show the normal form
-        $result = drupal_get_form('editview_node_form_'.$node->nid, $node, $view);
-        // This reloads the node after successful save, so that a new form token is created
-        // This allows the user to submit the form/node a second time without drupal throwing an error
-        if (($_POST['form_id'] != 'editview_node_form_') && count(form_get_errors()) == 0) {
-          $_POST = array();
-          $node = node_load($node->nid, null, true);
-          return editview_node($node, $view);
-        }
-        break;
-    }
-  } else {
-    $result = drupal_get_form('editview_node_form_'.$node->nid, $node, $view);
-  }
-
-  // Wrap the resulting form in a div, so we can catch it for AJAX funkyness
-  return "<div class='editview-wrapper'>".$result."</div>";
-}
-
-function editview_forms($args) {
-  $forms = array();
-  // Map all the forms with an ID to the standard editview node form
-  if (!strncmp($args[0], 'editview_node_form_', 19)) {
-    $forms[$args[0]] = array(
-      'callback' => 'editview_node_form',
-    );
-  }
-  return $forms;
-}
-
-function _editview_node_type($view) {
-  $type = false;
-  foreach ($view->filter as $filter) {
-    if ($filter['field'] == 'node.type') {
-      $type = $filter['value'][0];
-      break;
-    }
-  }
-  return $type;
-}
-
-function editview_form_alter($form_id, &$form) {
-   if ($form['#base'] == 'editview_node_form') {
-    $form['submit']['#value'] = t('Update');
-    if ($form['#node']->nid == '') {
-      $form['submit']['#value'] = t('Add');
-    }  
-   }
-}
-
-function editview_node_form($node, $view) {
-  global $user;
-
-  $form = node_form($node);
-  editview_alter_node_form($node, $form);
-
-  // DO NOT REMOVE THIS NEXT LINE, this makes it work:
-  // Base needs to be changed after we've completed building the form
-  $form['#base'] = 'editview_node_form';
-  $form['#theme'] = 'editview_node_form';
-  $form['view_name'] = array('#type' => 'hidden', '#value' => $view->name);
-  $form['nid'] = array('#name' => 'nid', '#type' => 'hidden', '#value' => $node->nid);
-
-  // Make the form unique
-  $form['#id'] .= '-' . $node->nid;
-  $form = editview_make_form_ids_unique($form, $node->nid);
-  return $form;
-}
-
-function editview_node_form_validate($form_id, $form_values, $form) {
-  return node_validate($form_values, $form);
-}
-
-function editview_node_form_submit($form_id, $form_values) {
-  if ($form_values['op'] != t('Delete')) {
-    node_form_submit($form_id, $form_values);
-  }
-
-  return false;
-}
-
-function editview_views_style_plugins() {
-  $result = array(
-    'editview_compressed' => array(
-      'name' => t('Editview - compressed'),
-      'theme' => 'views_editview',
-      //'validate' => 'views_ui_plugin_validate_table',
-      'needs_fields' => true,
-      'needs_table_header' => true,
-      'even_empty' => true,
-      ),
-    'editview_table' => array(
-      'name' => t('Editview - table'),
-      'theme' => 'views_editview',
-      //'validate' => 'views_ui_plugin_validate_table',
-      'needs_fields' => true,
-      'needs_table_header' => true,
-      'even_empty' => true,
-      ),
-    );
-
-  return $result;
-}
-
-function theme_views_editview($view, $nodes) {
-  global $user;
-
-  // add css
-  drupal_add_css(drupal_get_path('module', 'editview') . '/editview.css');
-
-  // add js
-  drupal_add_js(drupal_get_path('module', 'editview') . '/form.js'); // jquery Form plugin
-  drupal_add_js(drupal_get_path('module', 'editview') . '/editview.js');
-
-  // Get the type and print an error if one isn't set
-  $type = _editview_node_type($view);
-  if (!$type) {
-    drupal_set_message("This Editview view doesn't appear to be filtered by node type. This could cause problems.", 'error');
-  }
-
-  // Instantiate nodes, because views don't pass us all the information in one hit
-  $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type);
-  $node = (object)$node;
-
-  // Display the new node form
-  $edit_rows .= editview_node($node, $view);
-
-  // If we've created a new node, build it and rebuild the view
-  if (($_POST['form_id'] == 'editview_node_form_') && (count(form_get_errors()) == 0)) {
-    // Saved correctly, unset the form_id so we don't save it again
-    $_POST = array();
-    // TODO: One day make this rerun the query to get the nodes list, rather than rebuilding the view
-    // You end up with a view inside a view :(
-    return views_build_view($view->build_type, $view, $view->args, $view->use_pager, $view->pager_limit);
-  }
-
-  // Print the nodes to the screen
-  foreach ($nodes as $node) {
-    $node = node_load($node->nid);
-    $edit_rows .= editview_node($node, $view);
-  }
-
-  // tell the javascript where to submit nodes
-  if (!substr_count($_GET['q'], '/editview_submit')) {
-    $submit_path = $_GET['q'] . '/editview_submit';
-  } else {
-    $submit_path = $_GET['q'];
-  }
-  $submit_url = "<span style='display: none' id='editview-submit-url'>" . url($submit_path, null, null, true) . "</span>";
-  $messages = theme('status_messages');
-  if ($messages == '') {
-    $editview_messages = "<div id='editview_messages' style='display: none;'></div>\n";
-  } else {
-    $editview_messages = "<div id='editview_messages'>".$messages."</div>\n";
-  }
-
-  $output .= "<div id='editview-view-content-wrapper'>" . $submit_url . $editview_messages . $edit_rows . "</div>";
-  return  $output;
-}
-
-function editview_make_form_ids_unique($form, $nid) {
-  // much of this code is from form_builder. we set input elements' #id to a
-  // unique id by postpending -$nid.
-
-  if ((!empty($form['#type'])) && ($info = _element_info($form['#type']))) {
-    // overlay $info onto $form, retaining preexisting keys in $form
-    $form += $info;
-  }
-
-  if (isset($form['#input']) && $form['#input']) {
-    $form['#id'] = (isset($form['#id'])) ? $form['#id'] : 'edit-' . implode('-', $form['#parents']);
-    $form['#id'] .= '-' . $nid;
-  }
-
-  // recurse through sub-elements
-  foreach (element_children($form) as $key) {
-    // don't squash an existing tree value
-    if (!isset($form[$key]['#tree'])) {
-      $form[$key]['#tree'] = $form['#tree'];
-    }
-
-    // don't squash existing parents value
-    if (!isset($form[$key]['#parents'])) {
-      // Check to see if a tree of child elements is present. If so, continue down the tree if required.
-      $form[$key]['#parents'] = $form[$key]['#tree'] && $form['#tree'] ? array_merge($form['#parents'], array($key)) : array($key);
-    }
-    $form[$key] = editview_make_form_ids_unique($form[$key], $nid);
-  }
-  return $form;
-}
 
 /**
- * A non-caching version of taxonomy_node_get_terms
+ * @addtogroup editview
+ * @{
  */
-function editview_taxonomy_node_get_terms($nid, $key = 'tid') {
-  $result = db_query(db_rewrite_sql('SELECT t.* FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name', 't', 'tid'), $nid);
-  $terms = array();
-  while ($term = db_fetch_object($result)) {
-    $terms[$term->$key] = $term;
-  }
-  return $terms;
-}
-
-function editview_alter_node_form($node, &$form) {
-  // this is done in drupal_get_form, but we need to call it with a different
-  // form id so that various hook_form_alters will recognise this form as a node form.
-  foreach (module_implements('form_alter') as $module) {
-    $function = $module .'_form_alter';
-    $function($node->type . '_node_form', $form);
-  }
-}
 
-function theme_editview_convert_field($field, $view) {
-  if ($field['#type'] == 'textarea') {
-    $field['#resizable'] = false; // resizable causes layout problems in IE
-    $field['#rows'] = 2;
-  }
-  return $field;
+/**
+ * Implementation of hook_views_api().
+ */
+function editview_views_api() {
+  return array('api' => 2.0);
 }
 
-function theme_editview_node_form($form) {
-  $view = $form['#parameters'][2];
-  $view->type = ($type == 'block' ? $view->block_type : $view->page_type);
-  $row = array();
-
-  foreach ($view->field as $field) {
-    // handle taxonomy form items differently
-    $vocab_id = str_replace('term_node_', '', $field['tablename']);
-    if (is_numeric($vocab_id)) {
-      if (isset($form['taxonomy'][$vocab_id])) {
-        $row[] = array('data' => drupal_render($form['taxonomy'][$vocab_id]), 'class' => 'editview-field');
-      }
-    }
-    else {
-      $itemname = str_replace('_value', '', $field['field']);
-      if (isset($form[$itemname])) {
-        // replace textareas with textfields to save space
-        $form[$itemname] = theme('editview_convert_field', ($form[$itemname]), $view);
-        $row[] = array('data' => drupal_render($form[$itemname]), 'class' => 'editview-field', 'valign' => 'top');
-      }
-      else {
-        // this field may be nested within a fieldset, so we'll look inside
-        // fieldsets. TODO: find a better way of finding field form items. Maybe
-        // adding a views handler for rendering form fields?
-        foreach ($form as $key => $item) {
-          if (element_child($key) && array_key_exists($itemname, $form[$key])) {
-            $form[$key][$itemname] = theme('editview_convert_field', $form[$key][$itemname], $view);
-            $row[] = array('data' => drupal_render($form[$key][$itemname]), 'class' => 'editview-field', 'valign' => 'top');
-          }
-        }
-      }
-    }
-  }
-  foreach ($form as $key => $field) {
-    // note that not all elements of the $form array are fields.
-    if (is_array($field) && $field['#type'] == 'submit') {
-      $form[$key]['#attributes']['class'] .= 'editview-button editview-submit ';
-      $form[$key]['#attributes']['id'] = 'editview-submit-' . $form['#node']->nid;
-      // TODO: Make these buttons say 'Update' except for the first one which should say 'Add'.
-      $submit_html = drupal_render($form[$key]);
-    }
-    if ($key == 'delete') {
-      $form[$key]['#attributes']['class'] .= 'editview-button editview-delete ';
-      $form[$key]['#attributes']['id'] = 'editview-delete-' . $form['#node']->nid;
-      $delete_html = drupal_render($form[$key]);
-    }
-  }
-
-  // we'll tack the rest of the form on in a hidden span so that the values
-  // are there but they aren't shown.
-  // TODO: Change most of these values to be of type #value in a form_alter before we get to rendering... 
-  // that way we can send less to the browser
-  $hidden_html = "<span style='display: none;'>" . drupal_render($form) . "</span>\n";
-
-  $result_append = '';
-  if ($view->type == 'editview_compressed') {
-    $result_append = $submit_html.$delete_html.$hidden_html;
-    $header = _views_construct_header($view, $view->fields);
-  } if ($view->type == 'editview_table') {
-    $row[] = $submit_html;
-    $row[] = $delete_html.$hidden_html;
-    $header = ($form['nid']['#value'] == null ?  _views_construct_header($view, $view->fields) : null);
+/**
+ * Implementation of hook_help().
+ */
+function editview_help($path, $arg) {
+  switch ($path) {
+    case 'admin/help#editview':
+      return '<p>'. t('Editview is a Views plug-in that allows you to create views in which nodes are editable and new nodes can be created. Editview works with or without JavaScript enabled.') .'</pre>'."\n".
+      '<h3>'. t('Usage') .'</h3>'."\n".
+      '<p>'. t('Editable node views are created just like any other type of view, with a few caveats:') .'</p>'."\n".
+      '<ol>'."\n".
+      '  <li>'. t('Add or edit a node view.') .'</li>'."\n".
+      '  <li>'. t('If you want to be able to add new nodes in the view, set the style to Editview in Basic settings. Otherwise, you can choose any style that allows you to set a row style and set the row style to Editview.') .'</li>'."\n".
+      '  <li>'. t('Include any required fields in the view, or new nodes will fail validation.') .'</li>'."\n".
+      '</ol>'."\n";
   }
-
-  $result = theme('table', $header, array($row), array('class' => 'editview-row'));
-  $result .= $result_append;
-  return $result;
 }
 
-function editview_delete_form($node, $view) {
-  // TODO: Should check this before we even make it to this function
-  if (node_access('delete', $node)) {
-    $form['nid'] = array('#type' => 'hidden', '#value' => $node->nid);
-    $form['view_name'] = array('#type' => 'hidden', '#value' => $view->name);
-    $form['#attributes'] = array('class' => 'confirmation');
-    $form['actions'] = array('#prefix' => '<div class="container-inline">', '#suffix' => '</div>');
-    $form['actions']['description'] = array('#value' => t('Are you sure you want to delete %title? This action cannot be undone', 
-       array('%title' => $node->title)));
-    $form['actions']['submit'] = array(
-      '#type' => 'submit',
-      '#value' => t('Confirm'),
-      '#attributes' => array('class' => 'editview-delete-button editview-confirm', 'id' => 'editview-confirm-' . $node->nid),
-      );
-    $form['actions']['cancel'] = array(
-      '#type' => 'button',
-      '#value' => t('Cancel'),
-      '#attributes' => array('class' => 'editview-delete-button editview-cancel', 'id' => 'editview-cancel-' . $node->nid),
-      );
-
-    return $form;
-  }
+/**
+ * Implementation of hook_menu().
+ */
+function editview_menu() {
+  $items['editview_js'] = array(
+    'page callback' => 'editview_js',
+    'type' => MENU_CALLBACK,
+    'access callback' => TRUE,
+    'file' => 'editview.views.inc',
+  );
+  return $items;
 }
 
-function editview_delete_form_submit($form_id, $form_values) {
-  if ($form_values['op'] == t('Confirm')) {
-    node_delete($form_values['nid']);
-  }
-
-  return false;
+/**
+ * Implementation of hook_theme().
+ */
+function editview_theme() {
+  return array(
+    'editview_node_form' => array(
+      'arguments' => array('form' => NULL),
+      'file' => 'editview.views.inc',
+    ),
+  );
 }
 
+/**
+ * @} End of "addtogroup editview".
+ */
Index: editview.views.inc
===================================================================
RCS file: editview.views.inc
diff -N editview.views.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ editview.views.inc	4 Feb 2009 18:11:55 -0000
@@ -0,0 +1,277 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Views functions.
+ */
+
+/**
+ * @addtogroup editview
+ * @{
+ */
+
+/**
+ * Implementation of hook_views_plugins().
+ */
+function editview_views_plugins() {
+  return array(
+    'style' => array(
+      'editview' => array(
+        'title' => t('Editview'),
+        'help' => t('Displays a new node form.'),
+        'handler' => 'editview_plugin_style_node_add',
+        'theme' => 'views_view_unformatted',
+        'base' => array('node'),
+        'uses options' => TRUE,
+        'even empty' => TRUE,
+        'type' => 'normal',
+      ),
+    ),
+    'row' => array(
+      'editview' => array(
+        'title' => t('Editview'),
+        'help' => t('Displays a node edit form.'),
+        'handler' => 'editview_plugin_row_node_edit',
+        'theme' => 'editview_view_row_node_edit',
+        'base' => array('node'),
+        'uses fields' => TRUE,
+        'type' => 'normal',
+      ),
+    ),
+  );
+}
+
+/**
+ * Prepare variables for the editview row template.
+ *
+ * @param $variables
+ *   An array of variables from the theme system.
+ */
+function template_preprocess_editview_view_row_node_edit(&$variables) {
+  if ($variables['row']->nid == 'new') {
+    // Create dummy node for new node form.
+    $type = isset($row->node_type) ? $row->node_type : $variables['view']->style_options['editview_node_type'];
+    $node = array('uid' => $variables['user']->uid, 'name' => (isset($variables['user']->name) ? $variables['user']->name : ''), 'type' => $type, 'language' => '');
+  }
+  else {
+    // Load full node for node edit form.
+    $node = node_load($variables['row']->nid);
+  }
+  // Check user permissions.
+  if (isset($node->nid) && node_access('update', $node) || !isset($node->nid) && node_access('create', $type)) {
+    /* This function runs once for each row, so prevent page set-up functions
+     * from being repeated.
+     */
+    static $run = TRUE;
+    if ($run) {
+      drupal_add_js('misc/jquery.form.js');
+      drupal_add_js(drupal_get_path('module', 'editview') .'/editview.js');
+      drupal_add_js(array('editview' => array('submit_url' => url('editview_js'))), 'setting');
+      drupal_add_css(drupal_get_path('module', 'editview') .'/editview.css');
+      module_load_include('inc', 'node', 'node.pages');
+      $run = FALSE;
+    }
+    // Add the node form to the variables array.
+    $variables['form'] = drupal_get_form('editview_node_form_'. $variables['row']->nid, $node, $variables['view'], $variables['id'], request_uri());
+  }
+}
+
+/**
+ * Implementation of hook_forms().
+ */
+function editview_forms($form_id, $args) {
+  $forms = array();
+  if (!strncmp($form_id, 'editview_node_form_', 19)) {
+    $forms[$form_id] = array(
+      'callback' => 'editview_node_form',
+    );
+  }
+  return $forms;
+}
+
+/**
+ * Prepare a node form for the view.
+ *
+ * @param $form_state
+ *   The form state array.
+ * @param $node
+ *   The node object.
+ * @param $view
+ *   The view object.
+ * @return
+ *   A node form array.
+ * @ingroup forms
+ * @see editview_node_form_submit()
+ * @see editview_node_form_delete_submit()
+ */
+function editview_node_form(&$form_state, $node, $view, $order, $uri) {
+  $form = node_form($form_state, $node);
+  // Let modules alter the node form.
+  $form['__drupal_alter_by_ref'] = array(&$form_state);
+  drupal_alter((is_array($node) ? $node['type'] : $node->type) .'_node_form', $form);
+  $form['__drupal_alter_by_ref'] = array(&$form_state);
+  drupal_alter('form', $form, (is_array($node) ? $node['type'] : $node->type) .'_node_form');
+  // Change save and delete functions.
+  $form['buttons']['submit']['#submit'] = array('editview_node_form_submit');
+  $form['buttons']['delete']['#submit'] = array('editview_node_form_delete_submit');
+  $form['editview_view'] = array('#type' => 'hidden', '#value' => $view->name);
+  $form['#id'] = form_clean_id($form['#id']);
+  $form['#theme'] = 'editview_node_form';
+  $form['#cache'] = TRUE;
+  $form['#action'] = $uri;
+  return $form;
+}
+
+/**
+ * Display selected fields from the node form in a table.
+ *
+ * @param $form
+ *   A node form array.
+ * @return
+ *   An HTML form.
+ * @ingroup themeable
+ */
+function theme_editview_node_form($form) {
+  $view = $form['#parameters'][3];
+  $header = array();
+  $row = array();
+  // Add selected fields to table as form fields.
+  foreach ($view->field as $field) {
+    $header[] = $field->label();
+    $classes = array();
+    $cell = array('data' => '');
+    foreach (module_implements('field_form_render') as $module) {
+      $function = $module .'_field_form_render';
+      $result = $function($form, $field);
+      foreach ($result as $key => $value) {
+        switch ($key) {
+          case 'data':
+            $cell['data'] .= $value;
+            break;
+          case 'class':
+            $classes[] = $value;
+            break;
+          default:
+            $cell[$key] = $value;
+            break;
+        }
+      }
+    }
+    $cell['class'] = implode(' ', $classes);
+    $row[] = $cell;
+  }
+  $buttons = drupal_render($form['buttons']['submit']);
+  $buttons .= drupal_render($form['buttons']['delete']) .'<span style="display: none;">'. drupal_render($form) .'</span>'."\n";
+  $handler = $view->style_plugin;
+  $active = !empty($handler->active) ? $handler->active : '';
+  $order = !empty($handler->order) ? $handler->order : 'asc';
+  return theme('table', $header, array($row), array('class' => 'editview-row')) . $buttons;
+}
+
+/**
+ * Implementation of hook_field_form_render().
+ */
+function editview_field_form_render(&$form, $field) {
+  $element = array('class' => 'editview-field', 'valign' => 'top');
+  switch ($field->field_alias) {
+    default:
+      $vocab_id = str_replace('term_node_', '', $field->table_alias);
+      if (is_numeric($vocab_id)) {
+        $element['data'] = drupal_render($form['taxonomy'][$vocab_id]);
+      }
+      else {
+        $element['data'] = _editview_form_field($form, $field->field);
+      }
+      break;
+  }
+  return $element;
+}
+
+/**
+ * Find fields in form.
+ *
+ * @param $elements
+ *   An array of form elements.
+ * @param $field
+ *   A field name string.
+ * @return
+ *   A form element or NULL.
+ */
+function _editview_form_field(&$elements, $field) {
+  if (isset($elements[$field])) {
+    if ($elements[$field]['#type'] == 'textarea') {
+      $elements[$field]['#resizable'] = FALSE;
+      $elements[$field]['#rows'] = 2;
+    }
+    return drupal_render($elements[$field]);
+  }
+  else {
+    foreach (element_children($elements) as $key) {
+      $output = _editview_form_field($elements[$key], $field);
+      if (isset($output)) {
+        return $output;
+      }
+    }
+  }
+}
+
+/**
+ * Override the node form redirect if the form was submitted by JavaScript.
+ */
+function editview_node_form_submit($form, &$form_state) {
+  global $base_root;
+  $uri = request_uri();
+  node_form_submit($form, $form_state);
+  if ($uri == $form['#parameters'][5] || !isset($form['#parameters'][2]->nid)) {
+    $form_state['redirect'] = $base_root . $uri;
+  }
+  else {
+    $form_state['redirect'] = FALSE;
+  }
+}
+
+/**
+ * Override the node delete redirect.
+ */
+function editview_node_form_delete_submit($form, &$form_state) {
+  $uri = request_uri();
+  if ($uri == $form['#parameters'][5]) {
+    node_form_delete_submit($form, $form_state);
+    $form_state['redirect'] = array('node/'. $form_state['values']['nid'] .'/delete', 'destination='. urlencode($_GET['q']));
+  }
+  else {
+    node_delete($form_state['values']['nid']);
+    $form_state['redirect'] = FALSE;
+  }
+}
+
+/**
+ * Menu callback; allow JavaScript to update node in view.
+ */
+function editview_js() {
+  module_load_include('inc', 'node', 'node.pages');
+  $view = views_get_view($_POST['editview_view']);
+  $view->build();
+  $form_build_id = $_POST['form_build_id'];
+  $form_state = array('storage' => NULL, 'submitted' => FALSE);
+  $form = form_get_cache($form_build_id, $form_state);
+  $args = $form['#parameters'];
+  $form_id = array_shift($args);
+  $form_state['post'] = $form['#post'] = $_POST;
+  drupal_process_form($form_id, $form, $form_state);
+  unset($form_state['node']);
+  $args[1] = node_load($form_state['values']['nid'], NULL, TRUE);
+  if (!empty($args[1])) {
+    for ($i = 0; $i < $args[3]; $i++) {
+      $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
+    }
+    $response = drupal_render($form);
+  }
+  drupal_json(theme('status_messages') . (isset($response) ? $response : ''));
+  exit();
+}
+
+/**
+ * @} End of "addtogroup editview".
+ */
Index: editview_plugin_row_node_edit.inc
===================================================================
RCS file: editview_plugin_row_node_edit.inc
diff -N editview_plugin_row_node_edit.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ editview_plugin_row_node_edit.inc	4 Feb 2009 18:11:55 -0000
@@ -0,0 +1,27 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Row style plug-in file.
+ *
+ * This is kept in a separate file and included only when needed to prevent
+ * missing class errors.
+ */
+
+/**
+ * @addtogroup editview
+ * @{
+ */
+
+/**
+ * Row plugin to allow node editing.
+ *
+ * Fields which are added to the view will be editable.
+ */
+class editview_plugin_row_node_edit extends views_plugin_row {
+}
+
+/**
+ * @} End of "addtogroup editview".
+ */
Index: editview_plugin_style_node_add.inc
===================================================================
RCS file: editview_plugin_style_node_add.inc
diff -N editview_plugin_style_node_add.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ editview_plugin_style_node_add.inc	4 Feb 2009 18:11:55 -0000
@@ -0,0 +1,115 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Style plug-in file.
+ *
+ * This is kept in a separate file and included only when needed to prevent
+ * missing class errors.
+ */
+
+/**
+ * @addtogroup editview
+ * @{
+ */
+
+/**
+ * Style plugin to add new node form.
+ *
+ * Fields which are added to the view will be shown.
+ */
+class editview_plugin_style_node_add extends views_plugin_style {
+  /**
+   * Implementation of option_definition().
+   */
+	function option_definition() {
+		$options = parent::option_definition();
+		$options['editview_node_type'] = array();
+		$options['editview_node_position'] = array('default' => 0);
+		return $options;
+	}
+
+	/**
+	 * Implementation of options_form().
+	 */
+	function options_form(&$form, &$form_state) {
+    $form['editview_node_type'] = array(
+      '#type' => 'select',
+      '#title' => t('Node type'),
+      '#default_value' => $this->options['editview_node_type'],
+      '#options' => node_get_types('names'),
+      '#description' => t('Select a node type for the new node form.'),
+      '#required' => TRUE,
+    );
+    $form['editview_node_position'] = array(
+      '#type' => 'radios',
+      '#title' => t('New node position'),
+      '#default_value' => $this->options['editview_node_position'],
+      '#options' => array(t('Above'), t('Below')),
+      '#description' => t('Specify whether a new node form should be above or below existing records.'),
+    );
+    parent::options_form($form, $form_state);
+	}
+
+	/**
+	 * Implementation of uses_row_plugin().
+	 *
+	 * We want to hard-code the row plug-in, so we return TRUE here instead of
+	 * specifying that we use a row plug-in in our style definition.
+	 */
+	function uses_row_plugin() {
+	  return TRUE;
+	}
+
+	/**
+   * Implementation of render().
+   *
+   * Render the view with a new node form.
+   */
+  function render() {
+    // Create empty node.
+    $node = new stdClass();
+    // Add empty view fields (needed for grouped views).
+    foreach ($this->view->field as $field) {
+      foreach ($field->aliases as $alias) {
+        $node->$alias = NULL;
+      }
+      $alias = $field->field_alias;
+      $node->$alias = NULL;
+    }
+    $node->nid = 'new';
+    if ($this->options['grouping'] == 'type' && !empty($this->view->result)) {
+      // If grouping by node type, add an empty node for each type.
+      foreach ($this->view->result as $row) {
+        $types[$row->node_type] = NULL;
+      }
+      foreach (array_keys($types) as $type) {
+        $node->node_type = $type;
+        if (empty($this->options['editview_node_position'])) {
+          array_unshift($this->view->result, $node);
+        }
+        else {
+          array_push($this->view->result, $node);
+        }
+      }
+    }
+    else {
+      // Otherwise, add one empty node.
+      if (empty($this->options['editview_node_position'])) {
+        array_unshift($this->view->result, $node);
+      }
+      else {
+        array_push($this->view->result, $node);
+      }
+    }
+    // Initialize the Editview row plug-in.
+    $this->row_plugin = views_get_plugin('row', 'editview');
+    $this->row_plugin->init($this->view, $this->display);
+    return parent::render();
+  }
+}
+
+/**
+ * @} End of "addtogroup editview".
+ */
Index: form.js
===================================================================
RCS file: form.js
diff -N form.js
--- form.js	20 Feb 2007 23:51:19 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,643 +0,0 @@
-/*
- * jQuery form plugin
- * @requires jQuery v1.0.3
- *
- * Dual licensed under the MIT and GPL licenses:
- *   http://www.opensource.org/licenses/mit-license.php
- *   http://www.gnu.org/licenses/gpl.html
- *
- * Revision: $Id: form.js,v 1.2 2007/02/20 23:51:19 nterbogt Exp $
- */
-
-/**
- * ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX.
- *
- * ajaxSubmit accepts a single argument which can be either a success callback function
- * or an options Object.  If a function is provided it will be invoked upon successful
- * completion of the submit and will be passed the response from the server.
- * If an options Object is provided, the following attributes are supported:
- *
- *  target:   Identifies the element(s) in the page to be updated with the server response.
- *            This value may be specified as a jQuery selection string, a jQuery object,
- *            or a DOM element.
- *            default value: null
- *
- *  url:      URL to which the form data will be submitted.
- *            default value: value of form's 'action' attribute
- *  
- *  method:   @deprecated use 'type'
- *  type:     The method in which the form data should be submitted, 'GET' or 'POST'.
- *            default value: value of form's 'method' attribute (or 'GET' if none found)
- *
- *  before:   @deprecated use 'beforeSubmit'
- *  beforeSubmit:  Callback method to be invoked before the form is submitted.
- *            default value: null
- *
- *  after:    @deprecated use 'success'
- *  success:  Callback method to be invoked after the form has been successfully submitted
- *            and the response has been returned from the server
- *            default value: null
- *
- *  dataType: Expected dataType of the response.  One of: null, 'xml', 'script', or 'json'
- *            default value: null
- *
- *  semantic: Boolean flag indicating whether data must be submitted in semantic order (slower).
- *            default value: false
- *
- *  resetForm: Boolean flag indicating whether the form should be reset if the submit is successful
- *
- *  clearForm: Boolean flag indicating whether the form should be cleared if the submit is successful
- *
- *
- * The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for
- * validating the form data.  If the 'beforeSubmit' callback returns false then the form will
- * not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data
- * in array format, the jQuery object, and the options object passed into ajaxSubmit.  
- * The form data array takes the following form:
- *
- *     [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
- *
- * If a 'success' callback method is provided it is invoked after the response has been returned
- * from the server.  It is passed the responseText or responseXML value (depending on dataType).
- * See jQuery.ajax for further details.
- *
- *
- * The dataType option provides a means for specifying how the server response should be handled.
- * This maps directly to the jQuery.httpData method.  The following values are supported:
- * 
- *      'xml':    if dataType == 'xml' the server response is treated as XML and the 'after'
- *                   callback method, if specified, will be passed the responseXML value
- *      'json':   if dataType == 'json' the server response will be evaluted and passed to
- *                   the 'after' callback, if specified
- *      'script': if dataType == 'script' the server response is evaluated in the global context
- *
- *
- * Note that it does not make sense to use both the 'target' and 'dataType' options.  If both
- * are provided the target will be ignored.
- *
- * The semantic argument can be used to force form serialization in semantic order.
- * This is normally true anyway, unless the form contains input elements of type='image'.
- * If your form must be submitted with name/value pairs in semantic order and your form
- * contains an input of type='image" then pass true for this arg, otherwise pass false 
- * (or nothing) to avoid the overhead for this logic.
- *
- *
- * When used on its own, ajaxSubmit() is typically bound to a form's submit event like this:
- *
- * $("#form-id").submit(function() {
- *     $(this).ajaxSubmit(options);
- *     return false; // cancel conventional submit
- * });
- *
- * When using ajaxForm(), however, this is done for you.
- *
- * @example
- * $('#myForm').ajaxSubmit(function(data) {
- *     alert('Form submit succeeded! Server returned: ' + data);
- * });
- * @desc Submit form and alert server response
- *
- *
- * @example
- * var options = {
- *     target: '#myTargetDiv'
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Submit form and update page element with server response
- *
- *
- * @example
- * var options = {
- *     success: function(responseText) {
- *         alert(responseText);
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Submit form and alert the server response
- *
- *
- * @example
- * var options = {
- *     beforeSubmit: function(formArray, jqForm) {
- *         if (formArray.length == 0) {
- *             alert('Please enter data.');
- *             return false;
- *         }
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Pre-submit validation which aborts the submit operation if form data is empty
- *
- *
- * @example
- * var options = {
- *     url: myJsonUrl.php,
- *     dataType: 'json',
- *     success: function(data) {
- *        // 'data' is an object representing the the evaluated json data
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc json data returned and evaluated
- *
- *
- * @example
- * var options = {
- *     url: myXmlUrl.php,
- *     dataType: 'xml',
- *     success: function(responseXML) {
- *        // responseXML is XML document object
- *        var data = $('myElement', responseXML).text();
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc XML data returned from server
- *
- *
- * @example
- * var options = {
- *     resetForm: true
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc submit form and reset it if successful
- *
- * @example
- * $('#myForm).submit(function() {
- *    $(this).ajaxSubmit();
- *    return false;
- * });
- * @desc Bind form's submit event to use ajaxSubmit
- *
- *
- * @name ajaxSubmit
- * @type jQuery
- * @param options  object literal containing options which control the form submission process
- * @cat Plugins/Form
- * @return jQuery
- * @see formToArray
- * @see ajaxForm
- * @see $.ajax
- * @author jQuery Community
- */
-jQuery.fn.ajaxSubmit = function(options) {
-    if (typeof options == 'function')
-        options = { success: options };
-
-    options = jQuery.extend({
-        url:    this.attr('action') || '',
-        method: this.attr('method') || 'GET'
-    }, options || {});
-
-    // remap deprecated options (temporarily)
-    options.success = options.success || options.after;
-    options.beforeSubmit = options.beforeSubmit || options.before;
-    options.type = options.type || options.method;
-
-    var a = this.formToArray(options.semantic);
-
-    // give pre-submit callback an opportunity to abort the submit
-    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return;
-
-    var q = jQuery.param(a);
-
-    if (options.type.toUpperCase() == 'GET') {
-        // if url already has a '?' then append args after '&'
-        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
-        options.data = null;  // data is null for 'get'
-    }
-    else
-        options.data = q; // data is the query string for 'post'
-
-    var $form = this, callbacks = [];
-    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
-    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
-
-    // perform a load on the target only if dataType is not provided
-    if (!options.dataType && options.target) {
-        var oldSuccess = options.success || function(){};
-        callbacks.push(function(data, status) {
-            jQuery(options.target).html(data).evalScripts().each(oldSuccess, [data, status]);
-        });
-    }
-    else if (options.success) 
-        callbacks.push(options.success);
-
-    options.success = function(data, status) {
-        for (var i=0, max=callbacks.length; i < max; i++)
-            callbacks[i](data, status);
-    };
-        
-    jQuery.ajax(options);
-    return this;
-};
-
-/**
- * ajaxForm() provides a mechanism for fully automating form submission.
- *
- * The advantages of using this method instead of ajaxSubmit() are:
- *
- * 1: This method will include coordinates for <input type="image" /> elements (if the element
- *    is used to submit the form).
- * 2. This method will include the submit element's name/value data (for the element that was
- *    used to submit the form).
- * 3. This method binds the submit() method to the form for you.
- *
- * Note that for accurate x/y coordinates of image submit elements in all browsers
- * you need to also use the "dimensions" plugin (this method will auto-detect its presence).
- *
- * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
- * passes the options argument along after properly binding events for submit elements and
- * the form itself.  See ajaxSubmit for a full description of the options argument.
- *
- *
- * @example
- * var options = {
- *     target: '#myTargetDiv'
- * };
- * $('#myForm').ajaxSForm(options);
- * @desc Bind form's submit event so that 'myTargetDiv' is updated with the server response
- *       when the form is submitted.
- *
- *
- * @example
- * var options = {
- *     success: function(responseText) {
- *         alert(responseText);
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Bind form's submit event so that server response is alerted after the form is submitted.
- *
- *
- * @example
- * var options = {
- *     beforeSubmit: function(formArray, jqForm) {
- *         if (formArray.length == 0) {
- *             alert('Please enter data.');
- *             return false;
- *         }
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Bind form's submit event so that pre-submit callback is invoked before the form
- *       is submitted.
- *
- *
- * @name   ajaxForm
- * @param  options  object literal containing options which control the form submission process
- * @return jQuery
- * @cat    Plugins/Form
- * @type   jQuery
- * @see    ajaxSubmit
- * @author jQuery Community
- */
-jQuery.fn.ajaxForm = function(options) {
-    return this.each(function() {
-        jQuery("input:submit,input:image,button:submit", this).click(function(ev) {
-            var $form = this.form;
-            $form.clk = this;
-            if (this.type == 'image') {
-                if (ev.offsetX != undefined) {
-                    $form.clk_x = ev.offsetX;
-                    $form.clk_y = ev.offsetY;
-                } else if (typeof jQuery.fn.offset == 'function') { // try to use dimensions plugin
-                    var offset = jQuery(this).offset();
-                    $form.clk_x = ev.pageX - offset.left;
-                    $form.clk_y = ev.pageY - offset.top;
-                } else {
-                    $form.clk_x = ev.pageX - this.offsetLeft;
-                    $form.clk_y = ev.pageY - this.offsetTop;
-                }
-            }
-            // clear form vars
-            setTimeout(function() {
-                $form.clk = $form.clk_x = $form.clk_y = null;
-                }, 10);
-        })
-    }).submit(function(e) {
-        jQuery(this).ajaxSubmit(options);
-        return false;
-    });
-};
-
-
-/**
- * formToArray() gathers form element data into an array of objects that can
- * be passed to any of the following ajax functions: $.get, $.post, or load.
- * Each object in the array has both a 'name' and 'value' property.  An example of
- * an array for a simple login form might be:
- *
- * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
- *
- * It is this array that is passed to pre-submit callback functions provided to the
- * ajaxSubmit() and ajaxForm() methods.
- *
- * The semantic argument can be used to force form serialization in semantic order.
- * This is normally true anyway, unless the form contains input elements of type='image'.
- * If your form must be submitted with name/value pairs in semantic order and your form
- * contains an input of type='image" then pass true for this arg, otherwise pass false 
- * (or nothing) to avoid the overhead for this logic.
- *
- * @example var data = $("#myForm").formToArray();
- * $.post( "myscript.cgi", data );
- * @desc Collect all the data from a form and submit it to the server.
- *
- * @name formToArray
- * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
- * @type Array<Object>
- * @cat Plugins/Form
- * @see ajaxForm
- * @see ajaxSubmit
- * @author jQuery Community
- */
-jQuery.fn.formToArray = function(semantic) {
-    var a = [];
-    if (this.length == 0) return a;
-
-    var form = this[0];
-    var els = semantic ? form.getElementsByTagName('*') : form.elements;
-    if (!els) return a;
-    for(var i=0, max=els.length; i < max; i++) {
-        var el = els[i];
-        var n = el.name;
-        if (!n) continue;
-
-        if (semantic && form.clk && el.type == "image") {
-            // handle image inputs on the fly when semantic == true
-            if(!el.disabled && form.clk == el)
-                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
-            continue;
-        }
-        var v = jQuery.fieldValue(el, true);
-        if (v === null) continue;
-        if (v.constructor == Array) {
-            for(var j=0, jmax=v.length; j < jmax; j++)
-                a.push({name: n, value: v[j]});
-        }
-        else 
-            a.push({name: n, value: v});
-    }
-
-    if (!semantic && form.clk) {
-        // input type=='image' are not found in elements array! handle them here
-        var inputs = form.getElementsByTagName("input");
-        for(var i=0, max=inputs.length; i < max; i++) {
-            var input = inputs[i];
-            var n = input.name;
-            if(n && !input.disabled && input.type == "image" && form.clk == input)
-                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
-        }
-    }
-    return a;
-};
-
-
-/**
- * Serializes form data into a 'submittable' string. This method will return a string
- * in the format: name1=value1&amp;name2=value2
- *
- * The semantic argument can be used to force form serialization in semantic order.
- * If your form must be submitted with name/value pairs in semantic order then pass
- * true for this arg, otherwise pass false (or nothing) to avoid the overhead for
- * this logic (which can be significant for very large forms).
- *
- * @example var data = $("#myForm").formSerialize();
- * $.ajax('POST', "myscript.cgi", data);
- * @desc Collect all the data from a form into a single string
- *
- * @name formSerialize
- * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
- * @type String
- * @cat Plugins/Form
- * @see formToArray
- * @author jQuery Community
- */
-jQuery.fn.formSerialize = function(semantic) {
-    //hand off to jQuery.param for proper encoding
-    return jQuery.param(this.formToArray(semantic));
-};
-
-
-/**
- * Serializes all field elements in the jQuery object into a query string. 
- * This method will return a string in the format: name1=value1&amp;name2=value2
- *
- * The successful argument controls whether or not serialization is limited to
- * 'successful' controls (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true.
- *
- * @example var data = $("input").formSerialize();
- * @desc Collect the data from all successful input elements into a query string
- *
- * @example var data = $(":radio").formSerialize();
- * @desc Collect the data from all successful radio input elements into a query string
- *
- * @example var data = $("#myForm :checkbox").formSerialize();
- * @desc Collect the data from all successful checkbox input elements in myForm into a query string
- *
- * @example var data = $("#myForm :checkbox").formSerialize(false);
- * @desc Collect the data from all checkbox elements in myForm (even the unchecked ones) into a query string
- *
- * @example var data = $(":input").formSerialize();
- * @desc Collect the data from all successful input, select, textarea and button elements into a query string
- *
- * @name fieldSerialize
- * @param successful true if only successful controls should be serialized (default is true)
- * @type String
- * @cat Plugins/Form
- */
-jQuery.fn.fieldSerialize = function(successful) {
-    var a = [];
-    this.each(function() {
-        var n = this.name;
-        if (!n) return;
-        var v = jQuery.fieldValue(this, successful);
-        if (v && v.constructor == Array) {
-            for (var i=0,max=v.length; i < max; i++)
-                a.push({name: n, value: v[i]});
-        }
-        else if (v !== null && typeof v != 'undefined')
-            a.push({name: this.name, value: v});
-    });
-    //hand off to jQuery.param for proper encoding
-    return jQuery.param(a);
-};
-
-
-/**
- * Returns the value of the field element in the jQuery object.  If there is more than one field element
- * in the jQuery object the value of the first successful one is returned.
- *
- * The successful argument controls whether or not the field element must be 'successful'
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true.  If this value is false then
- * the value of the first field element in the jQuery object is returned.
- *
- * Note: If no valid value can be determined the return value will be undifined.
- *
- * Note: The fieldValue returned for a select-multiple element or for a checkbox input will
- *       always be an array if it is not undefined.
- *
- *
- * @example var data = $("#myPasswordElement").formValue();
- * @desc Gets the current value of the myPasswordElement element
- *
- * @example var data = $("#myForm :input").formValue();
- * @desc Get the value of the first successful control in the jQuery object.
- *
- * @example var data = $("#myForm :checkbox").formValue();
- * @desc Get the array of values for the first set of successful checkbox controls in the jQuery object.
- *
- * @example var data = $("#mySingleSelect").formValue();
- * @desc Get the value of the select control
- *
- * @example var data = $("#myMultiSelect").formValue();
- * @desc Get the array of selected values for the select-multiple control
- *
- * @name fieldValue
- * @param Boolean successful true if value returned must be for a successful controls (default is true)
- * @type String or Array<String>
- * @cat Plugins/Form
- */
-jQuery.fn.fieldValue = function(successful) {
-    var cbVal, cbName;
-
-    // loop until we find a value
-    for (var i=0, max=this.length; i < max; i++) {
-        var el = this[i];
-        var v = jQuery.fieldValue(el, successful);
-        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
-            continue;
-
-        // for checkboxes, consider multiple elements, for everything else just return first valid value
-        if (el.type != 'checkbox') return v;
-
-        cbName = cbName || el.name;
-        if (cbName != el.name) // return if we hit a checkbox with a different name
-            return cbVal;
-        cbVal = cbVal || [];
-        cbVal.push(v);
-    }
-    return cbVal;
-};
-
-/**
- * Returns the value of the field element.
- *
- * The successful argument controls whether or not the field element must be 'successful'
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true.  If the given element is not
- * successful and the successful arg is not false then the returned value will be null.
- *
- * Note: The fieldValue returned for a select-multiple element will always be an array.
- *
- * @example var data = jQuery.fieldValue($("#myPasswordElement")[0]);
- * @desc Gets the current value of the myPasswordElement element
- *
- * @name fieldValue
- * @param Element el The DOM element for which the value will be returned
- * @param Boolean successful true if value returned must be for a successful controls (default is true)
- * @type String or Array<String>
- * @cat Plugins/Form
- */
-jQuery.fieldValue = function(el, successful) {
-    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
-    if (typeof successful == 'undefined') successful = true;
-
-    if (successful && ( !n || el.disabled || t == 'reset' ||
-        (t == 'checkbox' || t == 'radio') && !el.checked ||
-        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
-        tag == 'select' && el.selectedIndex == -1))
-            return null;
-    
-    if (tag == 'select') {
-        var index = el.selectedIndex;
-        if (index < 0) return null;
-        var a = [], ops = el.options;
-        var one = (t == 'select-one');
-        var max = (one ? index+1 : ops.length);
-        for(var i=(one ? index : 0); i < max; i++) {
-            var op = ops[i];
-            if (op.selected) {
-                // extra pain for IE...
-                var v = jQuery.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
-                if (one) return v;
-                a.push(v);
-            }
-        }
-        return a;
-    }
-    return el.value;
-};
-
-
-/**
- * Clears the form data.  Takes the following actions on the form's input fields:
- *  - input text fields will have their 'value' property set to the empty string
- *  - select elements will have their 'selectedIndex' property set to -1
- *  - checkbox and radio inputs will have their 'checked' property set to false
- *  - inputs of type submit, button, reset, and hidden will *not* be effected
- *  - button elements will *not* be effected
- *
- * @example $('form').clearForm();
- * @desc Clears all forms on the page.
- *
- * @name clearForm
- * @type jQuery
- * @cat Plugins/Form
- * @see resetForm
- */
-jQuery.fn.clearForm = function() {
-    return this.each(function() {
-        jQuery('input,select,textarea', this).clearFields();
-    });
-};
-
-/**
- * Clears the selected form elements.  Takes the following actions on the matched elements:
- *  - input text fields will have their 'value' property set to the empty string
- *  - select elements will have their 'selectedIndex' property set to -1
- *  - checkbox and radio inputs will have their 'checked' property set to false
- *  - inputs of type submit, button, reset, and hidden will *not* be effected
- *  - button elements will *not* be effected
- *
- * @example $('.myInputs').clearFields();
- * @desc Clears all inputs with class myInputs
- *
- * @name clearFields
- * @type jQuery
- * @cat Plugins/Form
- * @see clearForm
- */
-jQuery.fn.clearFields = jQuery.fn.clearInputs = function() {
-    return this.each(function() {
-        var t = this.type, tag = this.tagName.toLowerCase();
-        if (t == 'text' || t == 'password' || tag == 'textarea')
-            this.value = '';
-        else if (t == 'checkbox' || t == 'radio')
-            this.checked = false;
-        else if (tag == 'select')
-            this.selectedIndex = -1;
-    });
-};
-
-
-/**
- * Resets the form data.  Causes all form elements to be reset to their original value.
- *
- * @example $('form').resetForm();
- * @desc Resets all forms on the page.
- *
- * @name resetForm
- * @type jQuery
- * @cat Plugins/Form
- * @see clearForm
- */
-jQuery.fn.resetForm = function() {
-    return this.each(function() {
-        // guard against an input with the name of 'reset'
-        // note that IE reports the reset function as an 'object'
-        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) 
-            this.reset();
-    });
-};
Index: docs/editview.php
===================================================================
RCS file: docs/editview.php
diff -N docs/editview.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ docs/editview.php	4 Feb 2009 18:11:55 -0000
@@ -0,0 +1,51 @@
+<?php
+// $Id$
+
+/**
+ * @defgroup editview Editview
+ * Allows users to add and edit nodes in a view.
+ */
+
+/**
+ * @file
+ * Editview API documentation.
+ */
+
+/**
+ * @addtogroup editview
+ * @{
+ */
+
+/**
+ * Get a node form field for a View field.
+ *
+ * @param $form
+ *   A node form array.
+ * @param $field
+ *   A Views field object.
+ * @return
+ *   A table cell array. See theme_table() for more information.
+ *
+ * @ingroup hooks
+ */
+function hook_field_form_render(&$form, $field) {
+  $element = array('class' => 'editview-field', 'valign' => 'top');
+  switch ($field->field_alias) {
+    default:
+      $element['data'] = _editview_form_field($form, $field->field);
+      break;
+  }
+  return $element;
+}
+
+/**
+ * Placeholder for template file used to theme rows.
+ *
+ * @ingroup themeable
+ */
+function theme_editview_view_row_node_edit() {
+}
+
+/**
+ * @} End of "addtogroup editview".
+ */
Index: translations/editview.pot
===================================================================
RCS file: translations/editview.pot
diff -N translations/editview.pot
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ translations/editview.pot	4 Feb 2009 18:11:55 -0000
@@ -0,0 +1,108 @@
+# $Id$
+#
+# LANGUAGE translation of Drupal (general)
+# Copyright YEAR NAME <EMAIL@ADDRESS>
+# Generated from files:
+#  editview.views.inc: n/a
+#  editview.info: n/a
+#  editview_plugin_style_node_add.inc: n/a
+#  editview.module: n/a
+#  editview.js,v 1.3.2.3 2008/11/25 00:34:07 agileware
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2009-02-04 13:05-0500\n"
+"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
+"Last-Translator: NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: editview.views.inc:21;33 editview.info:0
+msgid "Editview"
+msgstr ""
+
+#: editview.views.inc:22
+msgid "Displays a new node form."
+msgstr ""
+
+#: editview.views.inc:34
+msgid "Displays a node edit form."
+msgstr ""
+
+#: editview_plugin_style_node_add.inc:39
+msgid "Node type"
+msgstr ""
+
+#: editview_plugin_style_node_add.inc:42
+msgid "Select a node type for the new node form."
+msgstr ""
+
+#: editview_plugin_style_node_add.inc:47
+msgid "New node position"
+msgstr ""
+
+#: editview_plugin_style_node_add.inc:49
+msgid "Above"
+msgstr ""
+
+#: editview_plugin_style_node_add.inc:49
+msgid "Below"
+msgstr ""
+
+#: editview_plugin_style_node_add.inc:50
+msgid "Specify whether a new node form should be above or below existing records."
+msgstr ""
+
+#: editview.module:27
+msgid "Editview is a Views plug-in that allows you to create views in which nodes are editable and new nodes can be created. Editview works with or without JavaScript enabled."
+msgstr ""
+
+#: editview.module:28
+msgid "Usage"
+msgstr ""
+
+#: editview.module:29
+msgid "Editable node views are created just like any other type of view, with a few caveats:"
+msgstr ""
+
+#: editview.module:31
+msgid "Add or edit a node view."
+msgstr ""
+
+#: editview.module:32
+msgid "If you want to be able to add new nodes in the view, set the style to Editview in Basic settings. Otherwise, you can choose any style that allows you to set a row style and set the row style to Editview."
+msgstr ""
+
+#: editview.module:33
+msgid "Include any required fields in the view, or new nodes will fail validation."
+msgstr ""
+
+#: editview.module:0
+msgid "editview"
+msgstr ""
+
+#: editview.info:0
+msgid "Allows users to add and edit nodes in a view."
+msgstr ""
+
+#: editview.info:0
+msgid "Views"
+msgstr ""
+
+#: editview.js:0
+msgid "Delete"
+msgstr ""
+
+#: editview.js:0
+msgid "Are you sure you want to delete @name?"
+msgstr ""
+
+#: editview.js:0
+msgid "This action cannot be undone."
+msgstr ""
+
