? -
? .git
? .kdev4
? 0,
? 0001-convert-user-argument-validation-to-dbng.patch
? 348975-clone-display.patch
? 788950-override.patch
? 856186-remove-views_handlers_1.patch
? NULL,
? TRUE,
? b
? complex-views-799604.patch
? complex-views-799604_2.patch
? display-removed-
? field-sortable.patch
? foo.patch
? id,
? order,
? position
? position,
? reorder-displays_5_0.patch
? sibling,
? substitsion-ongoing-work.patch
? views-722454-8-fix-taxonomy-integration.patch
? views-873238-css.patch
? views-DRUPAL-7--3.kdev4
? views-drupal_clean_css_identifier_0.patch
? views-new-paths.patch
? views-or.patch
? views-revert-destination.patch
? views_812970-3.patch
? views_handler_argument_dates_various.inc_.526106_1.patch
Index: views_ui.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/views_ui.module,v
retrieving revision 1.109.6.9
diff -u -p -r1.109.6.9 views_ui.module
--- views_ui.module	15 May 2010 07:49:21 -0000	1.109.6.9
+++ views_ui.module	14 Aug 2010 06:18:11 -0000
@@ -135,6 +135,17 @@ function views_ui_menu() {
     );
   }
 
+  $items['admin/build/views/nojs/clone-display/%views_ui_cache'] = $callback + array(
+    'page callback' => 'views_ui_clone_display',
+    'page arguments' => array(FALSE, 5, 6),
+  );
+
+  $items['admin/build/views/ajax/clone-display/%views_ui_cache'] = $callback + array(
+    'page callback' => 'views_ui_clone_display',
+    'page arguments' => array(TRUE, 5, 6),
+    'delivery callback' => 'views_ui_ajax_deliver',
+  );
+
   $items['admin/structure/views/nojs/%/%views_ui_cache'] = $callback + array(
     'page callback' => 'views_ui_ajax_form',
     'page arguments' => array(FALSE, 4, 5),
Index: css/views-admin.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/css/views-admin.css,v
retrieving revision 1.14.4.7
diff -u -p -r1.14.4.7 views-admin.css
--- css/views-admin.css	4 Aug 2010 18:22:46 -0000	1.14.4.7
+++ css/views-admin.css	14 Aug 2010 06:18:11 -0000
@@ -643,6 +643,7 @@ html.js .views-hidden {
   max-width: 95%;
 }
 
+.clone-display,
 .remove-display {
   float: right;
   margin: 0;
@@ -652,7 +653,9 @@ html.js .views-hidden {
 }
 
 .views-display .remove-display form,
-.remove-display input {
+.remove-display input,
+.views-display .clone-display form,
+.clone-display input {
   margin: 0 !important;
 }
 
Index: includes/admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/includes/admin.inc,v
retrieving revision 1.161.4.43
diff -u -p -r1.161.4.43 admin.inc
--- includes/admin.inc	13 Aug 2010 22:08:16 -0000	1.161.4.43
+++ includes/admin.inc	14 Aug 2010 06:18:12 -0000
@@ -1152,12 +1152,14 @@ function template_preprocess_views_ui_ed
   // submit again.
 
   $vars['remove'] = '';
+  $vars['clone'] = '';
   if (empty($plugin['no remove'])) {
-    if (!empty($_POST['form_id']) && $_POST['form_id'] == 'views_ui_remove_display_form') {
+    if (!empty($_POST['form_id']) && in_array($_POST['form_id'], array('views_ui_remove_display_form', 'views_ui_clone_display_form'))) {
       unset($_POST['form_id']);
     }
     $form_state = array('view' => &$view, 'display_id' => $display->id, 'ajax' => FALSE, 'build_info' => array('args' => array()));
     $vars['remove'] = drupal_render(drupal_build_form('views_ui_remove_display_form', $form_state));
+    $vars['clone'] = drupal_render(drupal_build_form('views_ui_clone_display_form', $form_state));
   }
 
   // basic fields
@@ -1777,6 +1779,86 @@ function views_ui_add_display_form_submi
 }
 
 /**
+ * AJAX callback to add a display.
+ */
+function views_ui_clone_display($js, $view, $id) {
+  views_include('ajax');
+  $form_state = array(
+    'view' => &$view,
+    'ajax' => $js,
+    'display_id' => $id,
+  );
+
+  $output = views_ajax_form_wrapper('views_ui_clone_display_form', $form_state);
+
+  if ($js) {
+    // If we don't have an output object, it was submitted. Set up the submission.
+    if (empty($output)) {
+      $id = $form_state['id'];
+
+      // Make sure the new display is active
+      if (!$view->set_display('default')) {
+        views_ajax_render(t('Unable to initialize default display'));
+      }
+
+      // Render the new display
+      list($title, $body) = views_ui_display_tab($view, $view->display[$id]);
+
+      // Instruct the javascript on the browser to render the new tab.
+      $output = new stdClass;
+      $output->tab = array('#views-tab-' . $id => array('title' => $title, 'body' => $body));
+    }
+    // Render the command object. This automatically exits.
+    views_ajax_render($output);
+  }
+
+  // But the non-js variant will return output if it didn't redirect us.
+  return $output;
+}
+
+/**
+ * From to clone a display from a view.
+ */
+function views_ui_clone_display_form($form, &$form_state) {
+  $view = &$form_state['view'];
+  $display_id = $form_state['display_id'];
+
+  $form['clone_display'] = array(
+    '#type' => 'submit',
+    '#value' => t('Clone display'),
+    '#submit' => array('views_ui_clone_display_form_submit'),
+  );
+
+  $form['#id'] = 'views-clone-display-form';
+  $form['#action'] = url("admin/build/views/nojs/clone-display/$view->name/$display_id");
+  $form['#attributes'] = array('class' => 'views-ajax-form');
+
+  return $form;
+}
+
+/**
+ * Submit handler to add a clone to a display from a view.
+ */
+function views_ui_clone_display_form_submit($form, &$form_state) {
+  // Create the new display
+  $id = $form_state['display_id'];
+  $display = $form_state['view']->display[$id];
+
+  $new_id = $form_state['view']->add_display($display->display_plugin);
+  $form_state['id'] = $new_id;
+
+  // Replace the new display by a copy of the old
+  $form_state['view']->display[$new_id] = clone $display;
+  $form_state['view']->display[$new_id]->id = $new_id;
+
+  // Store in cache
+  views_ui_cache_set($form_state['view']);
+
+  // Send it back
+  $form_state['redirect'] = array('admin/structure/views/edit/' . $form_state['view']->name, array('fragment' =>  'views-tab-' . $new_id));
+}
+
+/**
  * Form to remove a display from a view.
  */
 function views_ui_remove_display_form($form, &$form_state) {
Index: includes/view.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/includes/view.inc,v
retrieving revision 1.167.4.22
diff -u -p -r1.167.4.22 view.inc
--- includes/view.inc	13 Aug 2010 23:07:31 -0000	1.167.4.22
+++ includes/view.inc	14 Aug 2010 06:18:12 -0000
@@ -1782,21 +1782,14 @@ class views_db_object {
       $plugin['title'] = t('Broken');
     }
 
-    // 'default' is singular and is unique, so just go with 'default'
-    // for it. For all others, start counting.
+
     if (empty($id)) {
-      $id = ($type == 'default') ? $type : $type . '_1';
       $title = $plugin['title'];
 
-      $count = 1;
-
-      // Loop through IDs based upon our style plugin name until
-      // we find one that is unused.
-      while (!empty($this->display[$id])) {
-        $id = $type . '_' . ++$count;
-        if (empty($title)) {
-          $title = $plugin['title'] . ' ' . $count;
-        }
+      $id = $this->generate_display_id($type);
+      $count = str_replace($type . '_', '', $id);
+      if (empty($title)) {
+        $title = $plugin['title'] . ' ' . $count;
       }
     }
 
@@ -1810,6 +1803,31 @@ class views_db_object {
   }
 
   /**
+   * Generate a display id of a certain plugin type.
+   *
+   * @param $type
+   *   Which plugin should be used for the new display id.
+   */
+  function generate_display_id($type) {
+    // 'default' is singular and is unique, so just go with 'default'
+    // for it. For all others, start counting.
+    if ($type == 'default') {
+      return 'default';
+    }
+    // Initial id.
+    $id = $type . '_1';
+    $count = 1;
+
+    // Loop through IDs based upon our style plugin name until
+    // we find one that is unused.
+    while (!empty($this->display[$id])) {
+      $id = $type . '_' . ++$count;
+    }
+
+    return $id;
+  }
+
+  /**
    * Create a new display and a display handler for it.
    * @param $type
    *   The plugin type from the views plugin data. Defaults to 'page'.
Index: theme/views-ui-edit-tab.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/theme/views-ui-edit-tab.tpl.php,v
retrieving revision 1.11.6.2
diff -u -p -r1.11.6.2 views-ui-edit-tab.tpl.php
--- theme/views-ui-edit-tab.tpl.php	7 Feb 2010 13:44:07 -0000	1.11.6.2
+++ theme/views-ui-edit-tab.tpl.php	14 Aug 2010 06:18:12 -0000
@@ -10,6 +10,9 @@
   <?php if ($remove): ?>
     <div class="remove-display"><?php print $remove ?></div>
   <?php endif; ?>
+  <?php if ($clone): ?>
+    <div class="clone-display"><?php print $clone ?></div>
+  <?php endif; ?>
   <div class="top">
     <div class="inside">
       <?php print $display_help_icon; ?>
