Hi,
Is there any way to add a default behaviour so that all node edit forms appear in colorboxes?

Also, whats the procedure for opening up html content?

Thanks for a great module,

Joe

Comments

frjo’s picture

For information how to use the Colorbox script I recommend you go to the scripts homepage, http://colorpowered.com/colorbox/.

Colorbox does not have a node form function built in yet. It should not be to hard to do with the Colorbox script. If you do it a patch is welcome. You can also submit a feature request and hope someone else does it :-).

joecanti’s picture

Hi frjo,

Thanks for the reply - I'll have a dig around and see what I can do... I'm really just looking for a popup solution for content editing and adding images - it would make sense to combine this with the image display - eg colorbox or lightbox etc, but i may have to have another look at the popup/popups modules and try it from that angle,

Thanks, Joe

gooddesignusa’s picture

Here is the issue I ran into. I tried doing this manually with jquery UI dialog the other day. I would imagine colorbox would have the same "issues" if you want to even call them that.

First I tried to just load the node edit page in an iframe in the overlay. That worked fine but depending on your theme / admin theme is set up it might look funny. My site has 2 side areas that are always loaded and the content is in the middle. So in the overlay it had the whole site. This made sense b/c thats what a iframe does. If I used an admin theme I'm sure I could get it to work but I just don't have the time for this current site.

Next I tried to load it using ajax and load only the node edit form. This worked as expected and showed only the form edit area. But I soon discovered that b/c it didn't load all the styles and js like the iframe would have some things weren't working / looking correctly.

Basic editing of the body did work though.

It can def be done but will take a little thinking / time. I just wanted to share my days worth of messing around with this idea. It would be a great addition though.

joecanti’s picture

I've had a look around, but not sure how to implement this using the colorbox scripts homepage. It's beyond my skills so I think I might put in a feature request. Thanks for the input gooddesignusa. Does colorbox use iframes or ajax?

If anyone else has any ideas on this please help! Else I'll put in a feature request. I might even get some funding going and get a little module built - that hooks into colorbox and into the drupal core - so colorbox takes over selectable parts of the core editing system.

So many of the big sites now use lightbox style pop ups for their content additions...

Another quick question - what does a users computer need exactly to run the colorbox? Im guessing 99% of users can, and if not it degrades gracefully?

Many thanks, I will continue to experiment and write back here,

Joe

frjo’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

gorgo’s picture

I would love to know how this can be done too....

gorgo’s picture

Status: Closed (fixed) » Active

I don't really see a fix here so changing it to 'active'. Hope that's alright.

Manuel Garcia’s picture

Title: Node Edit Form » Add support for Node Edit forms
Version: 6.x-1.0-beta2 » 6.x-1.x-dev
Category: support » feature

I figured we might as well just keep the discussion here, and change it to a feature request.

Dp-Mtl’s picture

I tried some node forms recently, it works perfectly, exept for some collapsed fieldsets.

My way is like as follow:

(1) Implement a hook_menu() im your module, add an items[]

  $items['color_box/form'] = array(
    'title' => 'Form',
    'page callback' => 'colorbox_popup_form_page',
    'page arguments' => array(2,3),
    //'access callback' => '_colorbox_form_page_access',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
    'file' => 'yourmodule.pages.inc',
  );

(2)make a callback page

/**
 * Menu callback for corlobox popup.
 */
function colorbox_popup_form_page($form_id, $nid) {
  switch ($form_id) {
    case 'yourtype_1_node_form':
      $node = new stdClass();
      $node ->type = yourtype;
      $node ->.....
      ..........
      include_once(drupal_get_path('module', 'node') . '/node.pages.inc');
      $form = drupal_get_form($form_id, $node);
      if (!empty($form)) {
        print $form;
      }
      break;
    
    case 'yourtype_2_node_form':
      ......
      break;
   }
}

(3) then make links

l($text, "color_box/form/yourtype_1_node_form/$node->nid", array('attributes' => array('class' =>'colorbox-load'),'query' => drupal_get_destination()))
...................

that's it,have a fun!
Any commnts will be highly appreciated.

fenda’s picture

Just adding onto #10:

You can add this to the top of colorbox_popup_form_page() to catch form errors and redirect users correctly.

function colorbox_popup_form_page($form_id, $nid) {
  if (isset($_POST['form_id'] && $_POST['form_id'] == $form_id)) {
      return drupal_get_form($form_id, $node); 
  }

...

frjo’s picture

Status: Active » Closed (won't fix)

Form support will most likely be moved from Colorbox module to the new Modal forms module.

http://drupal.org/sandbox/frjo/1095052