--- epublish.css	1 Feb 2007 11:33:06 -0000	1.1
+++ epublish.css	1 Feb 2007 11:34:01 -0000	1.2
@@ -1,7 +1,6 @@
 .epublish {
   padding: 0px 0 10px 10px;
 }
-
 .epublish .one_two .other_heads {
   margin-top: 10px;
   border-top: 1px solid #666;
@@ -40,6 +39,7 @@
   color: #900;
   text-transform: uppercase;
   margin-top: 10px;
+  background-color: #BBBBBB;
 }
 
 .epublish .one_two .description, .epublish .regular .description, .epublish .nodes .description  {
@@ -71,4 +71,75 @@
 .epublish_navigation {
 	border-top: 1px solid black;
 	border-bottom: 1px solid black;
-}
\ No newline at end of file
+}
+.epublish .advertisement{
+	float:right; 
+	width:auto; 
+	margin-top: 20px; 
+	border-left:1px solid #000; 
+	border-bottom:1px solid #000;
+	border-top:1px solid #000;
+	border-right:1px solid #000;
+	height:350;
+	display:block;
+	background-color:#fff;
+	padding: 2px;
+}
+.epublish .regular{
+	border-left:1px solid #000; 
+	border-bottom:1px solid #000;
+	border-top:1px solid #000;
+	border-right:1px solid #000;
+	padding: 2px ;
+}
+
+.abstract {
+  font-family: Verdana;
+  font-size: 9 pt;
+}
+.epub-title a {
+  font-family: "Verdana", "Arial", "Helvetica", "sans-serif"; 
+  font-size: 11 pt;  
+  font-weight: bold;
+  color: #069;
+}
+.epub-title a:link { color: #006699; }
+.epub-title a:hover { color: #006699; }
+.link-title a {
+  font-family: "Verdana", "Arial", "Helvetica", "sans-serif"; 
+  font-size: 9 pt;
+  font-weight: bold;
+  color: #069;
+  text-decoration: underline;
+}
+.ad-link-title a {
+  font-family: "Verdana", "Arial", "Helvetica", "sans-serif"; 
+  font-size: 9 pt;
+  color: #900;
+  text-decoration: underline;
+}
+.ad-title a {
+  font-family: "Verdana", "Arial", "Helvetica", "sans-serif"; 
+  font-size: 9 pt;
+  font-weight: bold;
+  color: #900;
+}
+.ad-title a:link { color: #990000; }
+.ad-title a:hover { color: #990000; }
+.topic{
+  color: #000;
+}
+.abstract a {
+  font-family: "Verdana", "Arial", "Helvetica", "sans-serif"; 
+  font-size: 9 pt;
+  color: #069;
+}
+.ad-abstract {
+  font-family: Verdana;
+  font-size: 9 pt;
+}
+.ad-abstract a {
+  font-family: "Verdana", "Arial", "Helvetica", "sans-serif"; 
+  font-size: 9 pt;
+  color: #990000;
+}

--- epublish.module	1 Feb 2007 11:33:06 -0000	1.1
+++ epublish.module	1 Feb 2007 11:34:01 -0000	1.2
@@ -1,5 +1,5 @@
 <?php
-// $Id: epublish.module,v 1.1 2007/02/01 11:33:06 server Exp $
+// $Id: epublish.module,v 1.2 2007/02/01 11:34:01 server Exp $
 
 /*
     epublish.module - Part of the epublish module for Drupal
@@ -130,6 +130,8 @@
   $output .= form_select(t("Display order for listing editions"), "epublish_edition_order", variable_get('epublish_edition_order', 'DESC'), $order, t("Descending order means that the most recent editions will appear at the top of the list."));
   $output .= form_textfield(t('Top stories'), 'epublish_top_stories', variable_get('epublish_top_stories', t('top stories')), 50, 128, t('The subtitle used for top stories in a headlines section.'));
   $output .= form_textfield(t('Miscellaneous stories'), 'epublish_miscellaneous', variable_get('epublish_miscellaneous', t('miscellaneous')), 50, 128, t('The subtitle used for miscellaneous stories in a headlines section.'));
+	//Addition default topic **20061208**
+  $output .= form_textfield(t('Advertisement stories'), 'epublish_advertisement', variable_get('epublish_advertisement', t('advertisement')), 50, 128, t('The subtitle used for advertisement stories in a headlines section.'));
 
   // layouts
   $layouts = epublish_layouts('page');
@@ -762,7 +764,12 @@
   while ($topic = db_fetch_object($result)) {
     $included_node_types = _epublish_build_node_inclusions(array_unique(array_merge(explode(',', $section->node_types), explode(',', $topic->node_types))));
 	$exclusions = _epublish_build_node_exclusions($all_nodes);
-    if ($topic->tid == -1) {
+	// -2 condition added 
+	// Condition to handle another default section **20061208**
+	if ($topic->tid == -2) { //**20061208**
+			$topic->name = variable_get('epublish_advertisement', t('advertisement'));
+			$result2 = db_query("SELECT DISTINCT(n.nid) FROM {node} n WHERE ($exclusions) AND ($included_node_types) AND n.promote = 1 AND n.status = 1$timeframe AND n.sticky = 1 ORDER by n.created DESC LIMIT $topic->count");
+		} else if ($topic->tid == -1) {
       $topic->name = variable_get('epublish_top_stories', t('top stories'));
       $result2 = db_query("SELECT DISTINCT(n.nid) FROM {node} n WHERE ($exclusions) AND ($included_node_types) AND n.promote = 1 AND n.status = 1$timeframe AND n.sticky = 1 ORDER by n.created DESC LIMIT $topic->count");
     } else if ($topic->tid == 0) {
@@ -945,7 +952,9 @@
   $result = db_query("SELECT et.tid, td.name FROM {epublish_topic} et LEFT JOIN {term_data} td USING (tid) WHERE et.sid='%d' ORDER BY et.weight", $sid);
   $topics = array();
   while ($topic = db_fetch_object($result)) {
-    if ($topic->tid == -1) {
+	if ($topic->tid == -2) { // condition added to handle additional default topic **20061208**
+		$topic->name = variable_get('epublish_advertisement', t('advertisement'));
+	} else if ($topic->tid == -1) {
 	  $topic->name = variable_get('epublish_top_stories', t('top stories'));
 	} else if ($topic->tid == 0) {
 	  $topic->name = variable_get('epublish_miscellaneous', t('miscellaneous'));
@@ -1042,7 +1051,14 @@
     $rows = array();
     $result2 = db_query("SELECT et.*, td.name FROM {epublish_topic} et LEFT JOIN {term_data} td USING (tid) WHERE et.sid='%d' ORDER BY et.weight", $edit["sid"]);
     while ($topic = db_fetch_object($result2)) {
-      if ($topic->tid == -1) {
+	// condition added to handle additional default field **20061208**
+	if ($topic->tid == -2) { 
+	    $topic->name = variable_get('epublish_advertisement', t('advertisement'));
+		$rows[] = array("$topic->name",
+                form_hidden('weight]['. $topic->tid, -98),
+                l(t('options'), "admin/epublish/edit/topic/" . $edit["sid"] . "/$topic->tid")
+         );
+	 } elseif ($topic->tid == -1) {	
         $topic->name = variable_get('epublish_top_stories', t('top stories'));
 		$rows[] = array("$topic->name",
                 form_hidden('weight]['. $topic->tid, -99),
@@ -1189,7 +1205,7 @@
  * @param $sid
  *   A section ID
  * @param $tid
- *   A term ID (a taxonomy term, or else 0 for "top stories" or -1 for "miscellaneous")
+ *	 A term ID (a taxonomy term, or else 0 for "top stories" or -1 for "miscellaneous" or -2 for "advertisement")//**20061208**
  *
  * @return
  *   An object containing all of the values for a single record in the 
@@ -1223,6 +1239,7 @@
     // If creating a new topic, display a pulldown menu to select it
     $form .= "<h3>Add topic to section \"$section->title\"</h3>\n";
     $terms = array();
+	$terms[-2] = variable_get('epublish_advertisement', t('advertisement')); //**20061208**	
     $terms[-1] = variable_get('epublish_top_stories', t('top stories'));
     $tree = module_invoke('taxonomy', 'get_tree', $section->vid);
     $edit["tid"] = 0;
@@ -1252,6 +1269,9 @@
   $range = drupal_map_assoc(range(-10, 10));
   if ($topic && $edit['tid'] == 0) {
     $form .= form_hidden('weight', 99);
+  } elseif ($topic && $edit['tid'] == -2) {
+    $form .= form_hidden('weight', -98);
+	$form .= form_submit(t("Delete"));
   } elseif ($topic && $edit['tid'] == -1) {
     $form .= form_hidden('weight', -99);
 	$form .= form_submit(t("Delete"));
@@ -1350,7 +1370,7 @@
 
 function epublish_section_topics($sid, $eid) {
   $section = epublish_get_section($sid);
-  $result = db_query("SELECT DISTINCT(n.nid), een.tid FROM {node} n LEFT JOIN {epublish_edition_node} een USING (nid) LEFT JOIN {epublish_topic} et ON et.tid=een.tid WHERE eid='$eid' AND et.sid='$sid' ORDER BY et.weight, een.weight, n.changed DESC");
+	$result = db_query("SELECT DISTINCT(n.nid), een.tid, et.weight FROM {node} n LEFT JOIN {epublish_edition_node} een USING (nid) LEFT JOIN {epublish_topic} et ON et.tid=een.tid WHERE eid='$eid' AND et.sid='$sid' ORDER BY et.weight, een.weight, n.changed DESC"); //**20061208**
   $last_tid = NULL;
   $topics = array();
   $topic = NULL;
@@ -1359,8 +1379,10 @@
 	  if ($topic) {
 	    $topics[] = $topic;
 	  }
-      $topic = db_fetch_object(db_query("SELECT et.tid, td.name FROM {epublish_topic} et LEFT JOIN {term_data} td USING (tid) WHERE et.sid='%d' AND et.tid='%d'", $sid, $node->tid));
-      if ($topic->tid == -1) {
+			$topic = db_fetch_object(db_query("SELECT et.tid, td.name, et.weight FROM {epublish_topic} et LEFT JOIN {term_data} td USING (tid) WHERE et.sid='%d' AND et.tid='%d'", $sid, $node->tid)); //**20061208**
+			if ($topic->tid == -2) { //**20061208**
+				$topic->name = variable_get('epublish_advertisement', t('advertisement'));
+			} else if ($topic->tid == -1) {
         $topic->name = variable_get('epublish_top_stories', t('top stories'));
       } else if ($topic->tid == 0) {
         $topic->name = variable_get('epublish_miscellaneous', t('miscellaneous'));
@@ -1689,7 +1711,7 @@
           form_select(NULL, 'tid]['.$node->nid, $node->tid, $topics),
           node_invoke($node, 'node_name'),
           ($node->status ? t('published') : t('not published')),
-          form_weight(NULL, 'node_weight]['. $node->nid, $node->weight, 10)
+          form_weight(NULL, 'node_weight]['. $node->nid, $node->weight, 30)
         );
     }
     $group .= theme('table', $header, $rows);
@@ -2002,7 +2024,7 @@
 		form_select(NULL, 'tid]['.$node->nid, $node->tid, $topics),
         node_invoke($node, 'node_name'),
         ($node->status ? t('published') : t('not published')),
-	    form_weight(NULL, 'weight]['. $node->nid, $node->weight, 10)
+	    form_weight(NULL, 'weight]['. $node->nid, $node->weight, 30)
       );
   }
 
@@ -2033,8 +2055,11 @@
   }
   $section = epublish_get_section($sid);
   $vid = $section->vid;
-  if ($tid == -1) {
-    $term = db_fetch_object(db_query("SELECT vid FROM {vocabulary} WHERE vid = '%d'", $vid));
+	if ($tid == -2) { //**20061208**
+		$term = db_fetch_object(db_query("SELECT vid FROM {vocabulary} WHERE vid = '%d'", $vid));
+	$term->name = variable_get('epublish_advertisement', t('advertisement'));
+	} else if ($tid == -1) {
+		$term = db_fetch_object(db_query("SELECT vid FROM {vocabulary} WHERE vid = '%d'", $vid));
 	$term->name = variable_get('epublish_top_stories', t('top stories'));
   } else {
     $term = db_fetch_object(db_query("SELECT vid FROM {vocabulary} WHERE vid = '%d'", $vid));
@@ -2139,7 +2164,7 @@
     if ($next = epublish_next($node, $topics)) {
 			$links[] = "Next story: " . l($next->title, 'node/'. $next->nid);
     }
-		$output .= "<h3>Published in " . l("$publication->name", "epublish/$publication->pid") . ", " .l(theme('epublish_edition_reference', $edition), "epublish/$publication->pid/$edition->eid") . "</h3>\n";
+		$output .= "<h3>Published in " . l("$publication->name", "epublish/$publication->pid") . ", " .l(theme('epublish_edition_reference', $edition), "epublish/$publication->pid/$edition->eid") . "</h3><br/>\n";
 		$output .= theme('item_list', $links);
 
     $output .= '</div>';

++-- Contents of layout_indexed.inc. Copy the contents below and create a new file layout_indexed.inc
<?php
// $Id: layout_indexed.inc,v 1.4.2.1 2006/09/08 04:47:21 dheeraj Exp $

$description = 'indexed';
$context = 'page';

/** 
 * theme_epublish_layout_indexed: A themeable function to produce a list of section topics and their nodes.
 *                                An Table of content is displayed on top with abstract of each node following 
 *                                TOC grouped on topics.
 * @param $topics
 *   An array of topics
 * @param $params
 *   An associative array of parameters. This exists so that the function
 *   can be themed to handle whatever value(s) the theme designer wants passed
 *   into the layout. For example, an image might be passed into the function
 *   using $params = ('image_path' => $url, 'image_width' => $width, 'image_height' => $height, 'caption' => $caption)
 *
 * @return
 *   An HTML-formatted list of topics and their nodes.
 */
function theme_epublish_layout_indexed($topics, $params=NULL) {
  if ($params['description']) {
    //$description = '<div class="description">' . $params['description'] . '</div>';
  }

  $o_index = "" ;
  $o_detail = "" ;
  $o_header = "" ;
  $o_footer = "" ;
  $o_advertisement = "" ;
  $counter = 1 ;
  
  // define class variables
  $css_title = "epub-title"; 
  $css_linktitle = "link-title" ;
  $css_abstract = "abstract" ;

  foreach ($topics as $topic) { // begin foreach (two)
    if (count($topic->nodes)) {
      $subsection = epublish_get_section_by_title($topic->name);

      // Add topic to output string, ignore if topic is top or bottom one
      if ( ($topic->weight != 99) && ($topic->weight != (-99)) && ($topic->weight != (-98)) ){

	// HTML Documentation comments
	$o_index .= "<!-- BEGIN : " . t($topic->name) . " Links Section -->\n" ;
	$o_detail .= "<!-- BEGIN : " . t($topic->name) . " Section -->\n" ;

	if ($subsection->sid) {
	  if(arg(2)) {
	   $o_index .= '<div class="topic">  ' . l( $topic->name,"epublish/".arg(1)."/".arg(2).'#T'.$sid. '_'.$counter). "</div>\n";
	   }else {
	   $o_index .= '<div class="topic">  ' . l( $topic->name,"epublish/".arg(1).'#T'.$sid. '_'.$counter). "</div>\n";
	   }
	   $o_detail .= '<div class="topic">' . l(t($topic->name), "headlines/" . $subsection->sid) . '<a name="T'.$sid.'_'.$counter.'">&nbsp;</a>' . "</div>\n";
        } else {
	   if(arg(2)) {
           $o_index .= '<div class="topic"> ' . l( $topic->name,"epublish/".arg(1)."/".arg(2).'#T'.$sid. '_'.$counter)."</div>\n";
           }else {
	   $o_index .= '<div class="topic"> ' . l( $topic->name,"epublish/".arg(1).'#T'.$sid. '_'.$counter)."</div>\n";
	   }
	   $o_detail .= '<div class="topic"><a name="T'.$sid.'_'.$counter.'">&nbsp;</a>' . $topic->name . "</div>\n";
       }
      } 
      
	// for translation
      foreach ($topic->nodes as $nid) { // beigin of foreach (one)
				if (module_exist('translation')) {
 					$lang = i18n_get_lang();
		 			$transnid .= translation_node_nid($nid, $lang);
					if ($transnid) { $nid = $transnid; $transnid = '';}
				}
        $node = node_load((array('nid' => $nid)));

	// if it is not top or bottom topic add node title
       if ( ($topic->weight != 99) && ($topic->weight != (-99)) && ($topic->weight != (-98)) ){

		if(arg(2)) {
     			$o_index .= '<div class="' . $css_title . '"><font color="#990000"><b>o</b></font> '. l( $node->title,"epublish/".arg(1)."/".arg(2).'#N'.$sid. '_'.$counter).'</div> ';
		}else{
			$o_index .= '<div class="' . $css_title . '"><font color="#990000"><b>o</b></font> '. l( $node->title,"epublish/".arg(1).'#N'.$sid. '_'.$counter).'</div> ';
		}
			$o_detail .= '<div class="' . $css_linktitle . ' ' . strtolower(preg_replace('|[^a-zA-Z0-9_]+|','-',$topic->name) ) . '-' .   $css_title . '"><font color="#990000"><b>o</b></font> ' . l(t($node->title), "node/$nid") . '<a name="N'.$sid.'_'.$counter.'">&nbsp;</a>' . "</div>\n" ;

	}
	
	// Add commented section 
        //$o_index .= '<div class="user">' . t('by') . ' ' . l($node->name, "blog/" . $node->uid) . "</div>\n";
        //$o_detail .= '<div class="user">' . t('by') . ' ' . l($node->name, "blog/" . $node->uid) . "</div>\n";


	// Now detail has got additional information
	// Add Abstract
        if ($node->epublish_abstract) {
	      if ( ($topic->weight != 99) && ($topic->weight != (-99)) && ($topic->weight != (-98)) ){
		$o_detail .= '<div class="' . $css_abstract . '">' . check_output($node->epublish_abstract . ' <span class="morelink"> ' . l("[more..]", "node/$nid")  . ' </span>', $node->format) . " </div>\n";
	      } else {
	        // Footer
		if ( ($topic->weight == 99) ){
		   $o_footer .= '<div class="' . $css_abstract . '">' . check_output($node->epublish_abstract, $node->format) . "</div>\n";
		} 
		// Header
		if ( $topic->weight == (-99)) {
		   $o_header .= '<div class="' . $css_abstract . '">' . check_output($node->epublish_abstract, $node->format) . "</div>\n";
		}
		// Advertisement
		if ( ($topic->weight == (-98)) ){ 
			$o_advertisement .= ''. check_output($node->epublish_abstract, $node->format );
		}
	      }
        } // end of if for abstract

	$counter++ ;
      } // end of foreach statement (one)

    }
	if ( ($topic->weight != 99) && ($topic->weight != (-99)) && ($topic->weight != (-98)) ) {
		$o_index .= "\n<!-- END : " . t($topic->name) . " Links Section -->\n" ;
		$o_detail .= "\n<!-- END : " . t($topic->name) . " Section -->\n" ;
	   $o_detail .= '<div>'.l( "Top","epublish/".arg(1)."/".arg(2).'#').' </div>' ;
	}

  } //end of foreach (two)


  if ( $o_advertisement ) {
	  $o_advertisement = '<div class="advertisement" >' . $o_advertisement . "</div>\n";
  }
  // Add a line after header if exists
  if ( $o_header ) {
	  $o_header = $o_header . '<hr/>' ;
  }
  // Add a line before footer if exists
  if ( $o_footer ) {
	  $o_footer = '<hr/>' . $o_footer ;
  }

  $output .= $o_header . $o_advertisement  . $o_index . $o_detail . $o_footer  ;

  $output = '<div class="epublish">' . '<div class="regular">' . $description . $output . '</div>' .'</div>';
  return $output ;
}
?>
