Creating an ULTRALAB hot seat clone in drupal

alan dawson's picture
| | | |

OK .. rough notes on work in progress of the hot seat software ... basically so I can remember how to do it again.

There are quite a lot of settings to get right. Some through drupal, others on a shell on the webserver ( or however you mod the files on there )

Its work in progress but at this date can be found at http://hs.technologyandsocialaction.org

Creating a Footprints HotSeat

Within Drupal

0. Make sure the nodecomment module and formtweaker modules are installed and working. IMPORTANT nodecomment replaces the core drupal comments functions, and breaks anything that relies on it. BUT if you need to theme/tag comments independently this is the only way to do it.

1. Create a Category ( vocabulary / taxonomy ) for the hot seat - call it something nice but unique. The name will show on the form used in creating a hot seat posting. For example in the Footprints clone of the Ultralab hostseat the name of the taxonomy is "What position do you take". Note the vocabulary ID (vid) of the new taxonomy, we'll need it later.

2. Add some items to the vocabulary. In the Ultralab clone we have

  • Just a Hello
  • I found it interesting
  • Can I suggest
  • How to get more involved
  • General Point

Note the term ID's ( tid's) used

3. Create 2 new content types

In this example we add one called "footprints hotseat" and "footprint"

The first type is used to create the hotseat introduction, the second for all subsequent entries.

After creating the content types, go back and edit them again.

 

with the "footprint" content type

  • enable automatic title generation IF you don't want to have titles added ( also will need to edit the _tpl.php file see later )
  • Set the publishing options
  • Set the Comment options to read write
  • Node type for comments to "footprints"
  • Comments View to be node_comments_threaded or node_comments depending on whether you want an indented and threaded forum or not. In this ultralab clone we wanted a flat forum.
  • On the form tweaker select radios.
  • SAVE your settings

With the "footprints hotseat" content type

  • Set the Workflow
  • set the comment settings to read/write
  • node type for comment as footprint
  • Select the comment view ( see previous )

4. Go back to categories, associate the vocabulary we created earlier with the "footprint" content type.

5. Assign the user roles you want to be able to create and participate in hotseats the correct rights on the user rights admin page.

 

Outside of drupal

1. in your theme directory create a special template file for our new content type. In this case it would be called ndoe-footprint.tpl.php

I'll attach a copy here.

Edit the line in this file that says

$vid = 2; // This should be the vocabulary ID that we want to theme on

Do as it says.

2. Edit style.css and add a section for each tid in our vid with the style we want the hot seat entries to have. A sample style.css is attached

Thats it.

ALSO

 

I've done a tiny hack on formtweaker.module to allow radio buttons to pickup a style similar to the themed nodes ( I'll attach a diff ) and also removed the default color style from the .form-item in styl.css

 

 

ALSO

 

when using autotitles ( See section 3 above ) all nodes have a dumb name. this makes them hard(er) to find later (but they can be edited later)

 

 

 

 

AttachmentSize
formtweaker-diff.txt351 bytes
node-footprint.tpl_.php_.txt1.46 KB
style.css_.txt6.11 KB
alan dawson's picture

Theming and rendering refinements

The nodecomment module provides two views for comments

1. Threaded

2. Flat

There is a requirement to have a semi threaded view though. This is where replies indent one level, but no more after that. I've quickly done this the wrong way. By hacking the prebuilt views. :-(

 

Heres the diff

diff nodecomment_views.inc nodecomment_views.inc.drupal
368,371c368,369
< if ($last_depth < 1 ) {
< $divs++;
< $output .= '<div class="indented">';
< }
---
> $divs++;
> $output .= '<div class="indented">';
376,379c374,375
< if ($last_depth > 0) {
< $divs--;
< $output .= '</div>';
< }
---
> $divs--;
> $output .= '</div>';

Anyhow that works OK... until we need a full threaded view again.

 

The correct way would be to read the theming views documentation and create a new view and corresponding theme for the semithreaded view. .. later ;-)

 

Also there was a requirement to remove the "reply" link from the indented nodes. A change to the .tpl.php sorted this.

<?php
$node->depth = count(explode('.', $node->thread)) - 1;
if ($node->depth == 0): ?>
<div class="links clear-block"><?php print $links ?></div>
<?php endif; ?>

 

Ie only print the links at the bottom if the nodecomment is a first level, rather than a reply to a reply. This should probably be refined further, so that users with the correct access rights / roles ( administer nodes ? comments ? ) will still see the links.

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.