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

Diff of /contributions/modules/contemplate/contemplate.module

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

revision 1.8.4.62.2.1, Sat Sep 12 02:25:14 2009 UTC revision 1.8.4.62.2.2, Sat Sep 12 03:46:51 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: contemplate.module,v 1.8.4.62 2009/08/03 20:59:19 jrglasgow Exp $  // $Id: contemplate.module,v 1.8.4.62.2.1 2009/09/12 02:25:14 jrglasgow Exp $
3  // by Jeff Robbins - Lullabot - www.lullabot.com  // by Jeff Robbins - Lullabot - www.lullabot.com
4    
5  define('CONTEMPLATE_TEASER_ENABLED', 0x0001);  define('CONTEMPLATE_TEASER_ENABLED', 0x0001);
# Line 92  function contemplate_menu() { Line 92  function contemplate_menu() {
92    return $items;    return $items;
93  }  }
94    
95    /**
96     * build the system settings form
97     */
98  function contemplate_system_settings() {  function contemplate_system_settings() {
99    $form = array();    $form = array();
100    $form['contemplate_remove_node_content'] = array(    $form['contemplate_remove_node_content'] = array(
# Line 184  function contemplate_node_build_alter(&$ Line 187  function contemplate_node_build_alter(&$
187          $node->body = contemplate_eval($template['body'], $node, $xml_elements);          $node->body = contemplate_eval($template['body'], $node, $xml_elements);
188        }        }
189        break;        break;
190        }
191    }    }
192  }  }
193    
# Line 259  function contemplate_delete_type_form_su Line 263  function contemplate_delete_type_form_su
263   */   */
264  function contemplate_edit_type_form(&$form_state, $type = NULL) {  function contemplate_edit_type_form(&$form_state, $type = NULL) {
265    $example = contemplate_examples($type);    $example = contemplate_examples($type);
266      //drupal_set_message('$example = <pre>'. print_r($example, TRUE) .'</pre>');
267    $template = contemplate_get_template($type);    $template = contemplate_get_template($type);
268    
269    $intro = t('<p>An example node has been loaded and its properties appear below. Click on the the property names to add them to your template.</p>');    $intro = t('<p>An example node has been loaded and its properties appear below. Click on the the property names to add them to your template.</p>');
# Line 312  function contemplate_edit_type_form(&$fo Line 316  function contemplate_edit_type_form(&$fo
316    );    );
317    
318    $form['teaser']['teaser_example']['example'] = array(    $form['teaser']['teaser_example']['example'] = array(
319      '#type' => 'markup',      '#markup' => '<div class="contemplate-tips form-item"><div id="edit-teaserfield-keys" class="contemplate-scroller resizable">'. $intro . $example['teaser'] .'</div><div class="description">'. $example_help .'</div></div>'
     '#value' => '<div class="contemplate-tips form-item"><div id="edit-teaserfield-keys" class="contemplate-scroller resizable">'. $intro . $example['teaser'] .'</div><div class="description">'. $example_help .'</div></div>'  
320    );    );
321    
322    $form['body'] = array(    $form['body'] = array(
# Line 357  function contemplate_edit_type_form(&$fo Line 360  function contemplate_edit_type_form(&$fo
360    );    );
361    
362    $form['body']['body_example']['example'] = array(    $form['body']['body_example']['example'] = array(
363      '#type' => 'markup',      '#markup' => '<div class="contemplate-tips form-item"><div id="edit-bodyfield-keys" class="contemplate-scroller resizable">'. $intro . $example['body'] .'</div><div class="description">'. $example_help .'</div></div>'
     '#value' => '<div class="contemplate-tips form-item"><div id="edit-bodyfield-keys" class="contemplate-scroller resizable">'. $intro . $example['body'] .'</div><div class="description">'. $example_help .'</div></div>'  
364    );    );
365    
366    /* START RSS STUFF */    /* START RSS STUFF */
# Line 404  function contemplate_edit_type_form(&$fo Line 406  function contemplate_edit_type_form(&$fo
406    );    );
407    
408    $form['rss']['rss_example']['example'] = array(    $form['rss']['rss_example']['example'] = array(
409      '#type' => 'markup',      '#markup' => '<div class="contemplate-tips form-item"><div id="edit-rss-keys" class="contemplate-scroller resizable">'. $intro . $example['rss'] .'</div><div class="description">'. $example_help .'</div></div>'
     '#value' => '<div class="contemplate-tips form-item"><div id="edit-rss-keys" class="contemplate-scroller resizable">'. $intro . $example['rss'] .'</div><div class="description">'. $example_help .'</div></div>'  
410    );    );
411    
412    $form['rss'][] = array(    $form['rss'][] = array(
# Line 478  function contemplate_get_template($type) Line 479  function contemplate_get_template($type)
479    if (!isset($types[$type])) {    if (!isset($types[$type])) {
480    
481      // first check to see what's stored in the contemplate table      // first check to see what's stored in the contemplate table
482      $types[$type] = db_fetch_array(db_query("SELECT * FROM {contemplate} WHERE type = '%s'", $type));      $types[$type] = (array)db_fetch_object(db_query("SELECT * FROM {contemplate} WHERE type = '%s'", $type));;
483      if (empty($types[$type])) {      if (empty($types[$type]['flags'])) {
484        $types[$type] = array('flags' => 0);        $types[$type]['flags'] = 0;
485      }      }
486      // now check to see if there are files      // now check to see if there are files
487      $fields = array(      $fields = array(
# Line 758  function contemplate_array_variables($ar Line 759  function contemplate_array_variables($ar
759            $insert = "'<?php print \$node->". addslashes($field) ." ?>'";            $insert = "'<?php print \$node->". addslashes($field) ." ?>'";
760          }          }
761    
762          $output .= "<dt><a href=\"#\" onclick=\"insertAtCursor(document.getElementById('edit-$target'), $insert);return FALSE;\" title=\"insert this variable into $target\">\$node->$field</a>{$security}{$type}</dt>\n";          $output .= "<dt><a href=\"#\" onclick=\"return insertAtCursor(document.getElementById('edit-$target'), $insert);\" title=\"insert this variable into $target\">\$node->$field</a>{$security}{$type}</dt>\n";
763        }        }
764        else {        else {
765          $output .= "<dt>\$node->$field$type</dt>\n";          $output .= "<dt>\$node->$field$type</dt>\n";
# Line 792  function contemplate_array_variables($ar Line 793  function contemplate_array_variables($ar
793  function contemplate_template_node_view($node, $build_mode) {  function contemplate_template_node_view($node, $build_mode) {
794    $node = (object)$node;    $node = (object)$node;
795    
796    $node = node_build_content($node, $teaser, $page);    $node = node_build_content($node, $build_mode);
797      //drupal_set_message('$node = <pre>'. print_r($node, TRUE) .'</pre>');
   if ($links) {  
     $node->links = module_invoke_all('link', 'node', $node, !$page);  
     drupal_alter('link', $node->links, $node);  
   }  
798    
799    // Set the proper node part, then unset unused $node part so that a bad    // Set the proper node part, then unset unused $node part so that a bad
800    // theme can not open a security hole.    // theme can not open a security hole.
801      /*
802    $content = drupal_render($node->content);    $content = drupal_render($node->content);
803    if ($teaser) {    if ($teaser) {
804      $node->teaser = $content;      $node->teaser = $content;
# Line 810  function contemplate_template_node_view( Line 808  function contemplate_template_node_view(
808      $node->body = $content;      $node->body = $content;
809      unset($node->teaser);      unset($node->teaser);
810    }    }
811      */
   // Allow modules to modify the fully-built node.  
   module_invoke_all('node_build_alter', $node, $build_mode);  
812    return $node;    return $node;
813  }  }
814    
# Line 854  function contemplate_eval_enclosure($fie Line 850  function contemplate_eval_enclosure($fie
850    return FALSE;    return FALSE;
851  }  }
852    
853    /**
854     * get fields for the template edit form
855     */
856  function contemplate_cck_get_fields($type_name) {  function contemplate_cck_get_fields($type_name) {
857    if (module_exists('content')) {    if (module_exists('content')) {
858      $return = array();      $return = array();

Legend:
Removed from v.1.8.4.62.2.1  
changed lines
  Added in v.1.8.4.62.2.2

  ViewVC Help
Powered by ViewVC 1.1.2