[cvs-annodex] commit (/annodex): Anode/trunk/acidfree/class_annodex.inc

ctford nobody at lists.annodex.net
Fri Feb 3 11:33:24 EST 2006


Update of /annodex (new revision 1941)

Modified files:
   Anode/trunk/acidfree/class_annodex.inc

Log Message:
*Output clips in a pretty themed table.
*Make sure case where end is not defined doesn't break insert.

Modified: Anode/trunk/acidfree/class_annodex.inc
===================================================================
--- Anode/trunk/acidfree/class_annodex.inc	2006-02-02 23:35:10 UTC (rev 1940)
+++ Anode/trunk/acidfree/class_annodex.inc	2006-02-03 00:33:24 UTC (rev 1941)
@@ -206,12 +206,32 @@
 
 		$result = db_query("SELECT * FROM {acidfree_cmml_clips} WHERE nid={$node->nid} ORDER BY `start`;");	
 
+		/* Output clip information in a themed table. */
+		$table_rows = array();
+		$header = array();
+
 		while( $row = db_fetch_object($result) ) {
+
+			$cells = array();
+
+			$cells[] = array('data'=>l($row->id, "node/{$node->nid}",NULL,"$arg_name=annodex&id={$row->id}")."<br />");
 			if( $row->img ) {
-				$output .= "<a href =\"?q=node/{$node->nid}&$arg_name=annodex&id={$row->id}\"><img height=120 width=120 src=\"{$row->img}\"></a>";
+				$cells[] = array('data'=>"<a href =\"?q=node/{$node->nid}&$arg_name=annodex&id={$row->id}\"><img height=120 width=120 src=\"{$row->img}\"></a>");
+			} else {
+				$cells[] = array('data'=>NULL);
 			}
-			$output .= l($row->id, "node/{$node->nid}",NULL,"$arg_name=annodex&id={$row->id}")."<br />";
+
+			if( $row->desc ) {
+				$cells[] = array('data'=>$row->desc);
+			} else {
+				$cells[] = array('data'=>NULL);
+			}
+
+			/* Add cells */
+			$table_rows[] = $cells;
 		}
+		/* Add table */
+		$output .= theme_table( $header, $table_rows );
 
 		/* Add new clip form */
 		if( $editing ) {
@@ -247,7 +267,7 @@
 		$occurances = db_result(db_query("SELECT COUNT(`id`) FROM {acidfree_cmml_clips} WHERE `id` = '{$attributes['id']}';"));
 
 		if( $occurances == 0 ) {
-			$result = db_query("INSERT INTO {acidfree_cmml_clips} (`nid`, `a_href`, `a_text`, `img`, `desc`, `start`, `end`, `id`, `track`) VALUES('{$node->nid}', '{$attributes['a_href']}', '{$attributes['a_text']}', '{$attributes['img']}', '{$attributes['desc']}', $start, {$attributes['end']},'{$attributes['id']}', '{$attributes['track']}');");		
+			$result = db_query("INSERT INTO {acidfree_cmml_clips} (`nid`, `a_href`, `a_text`, `img`, `desc`, `start`, `end`, `id`, `track`) VALUES('{$node->nid}', '{$attributes['a_href']}', '{$attributes['a_text']}', '{$attributes['img']}', '{$attributes['desc']}', $start, ".(float)$attributes['end'].",'{$attributes['id']}', '{$attributes['track']}');");		
 		} else {
 			$result = db_query("UPDATE {acidfree_cmml_clips} SET `nid` = '{$node->nid}', `a_href` = '{$attributes['a_href']}', `a_text` = '{$attributes['a_text']}', `img` = '{$attributes['img']}', `desc` = '{$attributes['desc']}', `start` = '$start', `end` = '{$attributes['end']}', `id` = '{$attributes['id']}', `track` = '{$attributes['track']}' WHERE `id` = '{$attributes['id']}';");
 		}


-- 
ctford



More information about the cvs-annodex mailing list