/[drupal]/contributions/modules/procon/procon.module
ViewVC logotype

Diff of /contributions/modules/procon/procon.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.5, Sat Aug 11 20:34:56 2007 UTC revision 1.1.2.6, Thu Sep 27 06:06:51 2007 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: procon.module,v 1.1.2.4 2007/08/08 09:04:37 fajerstarter Exp $  // $Id: procon.module,v 1.1.2.5 2007/08/11 20:34:56 fajerstarter Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 173  function procon_form_alter($form_id, &$f Line 173  function procon_form_alter($form_id, &$f
173            // Skip validation to be able to check if no option (-1) has been choosen.            // Skip validation to be able to check if no option (-1) has been choosen.
174            '#DANGEROUS_SKIP_CHECK' => true,            '#DANGEROUS_SKIP_CHECK' => true,
175          );          );
176    
177            // Set the value directly if URL contains 1 (pro) or 2 (con) at the end.
178            if (arg(4) == '1' || arg(4) == '2') {
179              $form['procon_type'] = array(
180                '#type' => 'value',
181                '#default_value' => arg(4),
182              );
183            }
184          // Always redirect to parent node for this content type.          // Always redirect to parent node for this content type.
185          $form['#redirect'] = array('node/'. $parent_nid, NULL, 'node-'. $nid);          $form['#redirect'] = array('node/'. $parent_nid, NULL, 'node-'. $nid);
186        }        }
# Line 193  function procon_comment_form_submit($for Line 201  function procon_comment_form_submit($for
201    
202  function procon_render_arguments($node) {  function procon_render_arguments($node) {
203    if ($node->procon_is_enabled) {    if ($node->procon_is_enabled) {
204      // Insert CSS and JavaScript used to enhance the view      // Insert CSS
205      drupal_add_css(drupal_get_path('module', 'procon') .'/procon.css');      drupal_add_css(drupal_get_path('module', 'procon') .'/procon.css');
     drupal_add_js(drupal_get_path('module', 'procon') .'/procon.js');  
     drupal_add_js(array('procon' => array('show' => t('Show all'), 'hide' => t('Hide all'))), 'setting');  
   
     // Add the 'add arguments' link here to have it displayed above the arguments.  
     // Hook_link_alter which might seem more appropriate renders the link below  
     // and several times for each link type (node, term etc) - so this is better.  
     $output = theme('procon_add_argument');  
206    
207      $view_arguments = views_get_view('procon_arguments');      $view_arguments = views_get_view('procon_arguments');
208      $output .= views_build_view('embed', $view_arguments, array($node->nid));      $output .= theme('procon_arguments', views_build_view('embed', $view_arguments, array($node->nid)));
209      return $output;      return $output;
210    }    }
211  }  }
212    
213    /**
214     * Allow themable wrapping of the argument view.
215     */
216    function theme_procon_arguments($view) {
217      // Add the 'add arguments' link here to have it displayed above the arguments.
218      // Hook_link_alter which might seem more appropriate renders the link below
219      // and several times for each link type (node, term etc) - so this is better.
220      $output = theme('procon_add_argument');
221      $output .= $view;
222      return $output;
223    }
224    
225  function theme_procon_add_argument() {  function theme_procon_add_argument() {
226    global $user;    global $user;
227    if (user_access('create procon_argument content')) {    if (user_access('create procon_argument content')) {

Legend:
Removed from v.1.1.2.5  
changed lines
  Added in v.1.1.2.6

  ViewVC Help
Powered by ViewVC 1.1.2