From 08bf61461f4a7138f2a9fa1721ee80691032d32b Mon Sep 17 00:00:00 2001 From: Hash9 Date: Wed, 12 Jul 2006 17:00:33 +0000 Subject: allow content to be assigned to boards and get some extra data for the queries, also get more templates for comments from liberty --- BitBoard.php | 424 ++++++++++++++++++++++++++++++++++--------- BitBoardForum.php | 167 +++++++++++++++++ BitBoardTopic.php | 127 +++++++------ admin/schema_inc.php | 11 ++ ajax.php | 7 +- assign.php | 50 +++++ board.php | 8 +- edit.php | 71 ++++++++ icons/db_update.png | Bin 0 -> 1867 bytes index.php | 4 +- lookup_inc.php | 15 +- post.php | 7 +- templates/ajax.tpl | 2 +- templates/board.tpl | 17 +- templates/board_assign.tpl | 59 ++++++ templates/board_edit.tpl | 86 +++++++++ templates/comment_post.tpl | 8 +- templates/menu_bitboards.tpl | 6 +- templates/post.tpl | 95 ++-------- templates/topic.tpl | 47 ++--- templates/topic_move.tpl | 4 +- topic.php | 15 +- topic_move.php | 5 +- 23 files changed, 954 insertions(+), 281 deletions(-) create mode 100644 BitBoardForum.php create mode 100644 assign.php create mode 100644 edit.php create mode 100755 icons/db_update.png create mode 100644 templates/board_assign.tpl create mode 100644 templates/board_edit.tpl diff --git a/BitBoard.php b/BitBoard.php index f10bdef..3b3936e 100644 --- a/BitBoard.php +++ b/BitBoard.php @@ -1,72 +1,364 @@ -* @version $Revision: 1.1 $ $Date: 2006/06/28 15:45:26 $ $Author: spiderr $ -* @class BitBoardBoard +* @version $Revision: 1.2 $ $Date: 2006/07/12 16:57:33 $ $Author: hash9 $ +* @class BitBoard */ require_once( LIBERTY_PKG_PATH.'LibertyAttachable.php' ); +/** +* This is used to uniquely identify the object +*/ +define( 'BITFORUM_CONTENT_TYPE_GUID', 'bitforum' ); + class BitBoard extends LibertyAttachable { + /** + * Primary key for our mythical BitBoard class object & table + * @public + */ + var $mBitBoardId; /** * During initialisation, be sure to call our base constructors **/ - function BitBoard() { + function BitBoard( $pBitBoardId=NULL, $pContentId=NULL ) { LibertyAttachable::LibertyAttachable(); + $this->mBitBoardId = $pBitBoardId; + $this->mContentId = $pContentId; + $this->mContentTypeGuid = BITFORUM_CONTENT_TYPE_GUID; + $this->registerContentType( BITFORUM_CONTENT_TYPE_GUID, array( + 'content_type_guid' => BITFORUM_CONTENT_TYPE_GUID, + 'content_description' => 'Forum Board', + 'handler_class' => 'BitBoard', + 'handler_package' => 'bitboards', + 'handler_file' => 'BitBoard.php', + 'maintainer_url' => 'http://www.bitweaver.org' + ) ); } - function loadContent($contentId) { - global $gBitDb; - global $gBitUser; - //var_dump($GLOBALS); - if( LibertyContent::verifyId( $contentId ) ) { + /** + * Load the data from the database + * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash + **/ + function load() { + if( $this->verifyId( $this->mBitBoardId ) || $this->verifyId( $this->mContentId ) ) { // LibertyContent::load()assumes you have joined already, and will not execute any sql! // This is a significant performance optimization + $lookupColumn = $this->verifyId( $this->mBitBoardId ) ? 'board_id' : 'content_id'; $bindVars = array(); $selectSql = $joinSql = $whereSql = ''; - array_push( $bindVars, $contentId ); - $gBitUser->getServicesSql( 'content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars ); + array_push( $bindVars, $lookupId = @BitBase::verifyId( $this->mBitBoardId ) ? $this->mBitBoardId : $this->mContentId ); + $this->getServicesSql( 'content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars ); - $query = "SELECT lc.*, uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name, uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name $selectSql - FROM `".BIT_DB_PREFIX."liberty_content` lc $joinSql - LEFT JOIN `".BIT_DB_PREFIX."users_users` uue ON( uue.`user_id` = lc.`modifier_user_id` ) - LEFT JOIN `".BIT_DB_PREFIX."users_users` uuc ON( uuc.`user_id` = lc.`user_id` ) - WHERE lc.`content_id`=? $whereSql"; - $result = $gBitDb->query( $query, $bindVars ); + $query = "SELECT s.*, lc.*, " . + "uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name, " . + "uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name " . + "$selectSql " . + "FROM `".BIT_DB_PREFIX."forum_board` s " . + "INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON( lc.`content_id` = s.`content_id` ) $joinSql" . + "LEFT JOIN `".BIT_DB_PREFIX."users_users` uue ON( uue.`user_id` = lc.`modifier_user_id` )" . + "LEFT JOIN `".BIT_DB_PREFIX."users_users` uuc ON( uuc.`user_id` = lc.`user_id` )" . + "WHERE s.`$lookupColumn`=? $whereSql"; + $result = $this->mDb->query( $query, $bindVars ); - $ret = array(); if( $result && $result->numRows() ) { - $ret = $result->fields; + $this->mInfo = $result->fields; + $this->mContentId = $result->fields['content_id']; + $this->mBitBoardId = $result->fields['board_id']; + + $this->mInfo['creator'] =( isset( $result->fields['creator_real_name'] )? $result->fields['creator_real_name'] : $result->fields['creator_user'] ); + $this->mInfo['editor'] =( isset( $result->fields['modifier_real_name'] )? $result->fields['modifier_real_name'] : $result->fields['modifier_user'] ); + $this->mInfo['display_url'] = $this->getDisplayUrl(); + $this->mInfo['parsed_data'] = $this->parseData(); + + LibertyAttachable::load(); + } + } + return( count( $this->mInfo ) ); + } + + /** + * Any method named Store inherently implies data will be written to the database + * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash + * This is the ONLY method that should be called in order to store( create or update )an bitforum! + * It is very smart and will figure out what to do for you. It should be considered a black box. + * + * @param array pParams hash of values that will be used to store the page + * + * @return bool TRUE on success, FALSE if store could not occur. If FALSE, $this->mErrors will have reason why + * + * @access public + **/ + function store( &$pParamHash ) { + if( $this->verify( $pParamHash )&& LibertyAttachable::store( $pParamHash ) ) { + $table = BIT_DB_PREFIX."forum_board"; + $this->mDb->StartTrans(); + if( $this->mBitBoardId ) { + $locId = array( "board_id" => $pParamHash['board_id'] ); + $result = $this->mDb->associateUpdate( $table, $pParamHash['bitforum_store'], $locId ); + } else { + $pParamHash['bitforum_store']['content_id'] = $pParamHash['content_id']; + if( @$this->verifyId( $pParamHash['board_id'] ) ) { + // if pParamHash['board_id'] is set, some is requesting a particular board_id. Use with caution! + $pParamHash['bitforum_store']['board_id'] = $pParamHash['board_id']; + } else { + $pParamHash['bitforum_store']['board_id'] = $this->mDb->GenID( 'forum_board_id_seq' ); + } + $this->mBitBoardId = $pParamHash['bitforum_store']['board_id']; + + $result = $this->mDb->associateInsert( $table, $pParamHash['bitforum_store'] ); + $result = $this->mDb->associateInsert( BIT_DB_PREFIX."forum_map",array('board_content_id'=>$pParamHash['bitforum_store']['content_id'],'topic_content_id'=>$pParamHash['bitforum_store']['content_id'])); + } + + + $this->mDb->CompleteTrans(); + $this->load(); + } + return( count( $this->mErrors )== 0 ); + } + + /** + * Make sure the data is safe to store + * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash + * This function is responsible for data integrity and validation before any operations are performed with the $pParamHash + * NOTE: This is a PRIVATE METHOD!!!! do not call outside this class, under penalty of death! + * + * @param array pParams reference to hash of values that will be used to store the page, they will be modified where necessary + * + * @return bool TRUE on success, FALSE if verify failed. If FALSE, $this->mErrors will have reason why + * + * @access private + **/ + function verify( &$pParamHash ) { + // make sure we're all loaded up of we have a mBitBoardId + if( $this->verifyId( $this->mBitBoardId ) && empty( $this->mInfo ) ) { + $this->load(); + } + + if( @$this->verifyId( $this->mInfo['content_id'] ) ) { + $pParamHash['content_id'] = $this->mInfo['content_id']; + } + + // It is possible a derived class set this to something different + if( @$this->verifyId( $pParamHash['content_type_guid'] ) ) { + $pParamHash['content_type_guid'] = $this->mContentTypeGuid; + } + + if( @$this->verifyId( $pParamHash['content_id'] ) ) { + $pParamHash['bitforum_store']['content_id'] = $pParamHash['content_id']; + } + + // check some lengths, if too long, then truncate + if( $this->isValid() && !empty( $this->mInfo['description'] ) && empty( $pParamHash['description'] ) ) { + // someone has deleted the description, we need to null it out + $pParamHash['bitforum_store']['description'] = ''; + } else if( empty( $pParamHash['description'] ) ) { + unset( $pParamHash['description'] ); + } else { + $pParamHash['bitforum_store']['description'] = substr( $pParamHash['description'], 0, 200 ); + } + + if( !empty( $pParamHash['data'] ) ) { + $pParamHash['edit'] = $pParamHash['data']; + } + + // check for name issues, first truncate length if too long + if( !empty( $pParamHash['title'] ) ) { + if( empty( $this->mBitBoardId ) ) { + if( empty( $pParamHash['title'] ) ) { + $this->mErrors['title'] = 'You must enter a name for this page.'; + } else { + $pParamHash['content_store']['title'] = substr( $pParamHash['title'], 0, 160 ); + } + } else { + $pParamHash['content_store']['title'] =( isset( $pParamHash['title'] ) )? substr( $pParamHash['title'], 0, 160 ): ''; + } + } else if( empty( $pParamHash['title'] ) ) { + // no name specified + $this->mErrors['title'] = 'You must specify a name'; + } + + return( count( $this->mErrors )== 0 ); + } + + /** + * This function removes a bitforum entry + **/ + function expunge() { + $ret = FALSE; + if( $this->isValid() ) { + $this->mDb->StartTrans(); + $query = "DELETE FROM `".BIT_DB_PREFIX."forum_map` WHERE `board_content_id` = ?"; + $result = $this->mDb->query( $query, array( $this->mContentId ) ); + $query = "DELETE FROM `".BIT_DB_PREFIX."forum_board` WHERE `content_id` = ?"; + $result = $this->mDb->query( $query, array( $this->mContentId ) ); + if( LibertyAttachable::expunge() ) { + $ret = TRUE; + $this->mDb->CompleteTrans(); + } else { + $this->mDb->RollbackTrans(); + } + } + return $ret; + } + + /** + * Make sure bitforum is loaded and valid + **/ + function isValid() { + return( $this->verifyId( $this->mBitBoardId ) ); + } - $ret['creator'] =( isset( $result->fields['creator_real_name'] )? $result->fields['creator_real_name'] : $result->fields['creator_user'] ); - $ret['editor'] =( isset( $result->fields['modifier_real_name'] )? $result->fields['modifier_real_name'] : $result->fields['modifier_user'] ); - $ret['display_url'] = BIT_ROOT_URL."index.php?content_id=$contentId"; + function getAllMap() { + $b = new BitBoard(); + $listHash = array(); + $l = $b->getList($listHash); + $ret = array(); + foreach ($l as $k => $boardd) { + $board = new BitBoard($boardd['board_id']); + $board->mInfo=$boardd; + $ret['map'][$k]=$boardd; + $ret['map'][$k]['map'] = $board->getMap(); + $ret['map'][$k]['integrity'] = $board->verifyIntegrity(); + } + $ret['umap'] = $b->getUnMapped(); + return $ret; + } + + function getUnMapped() { + global $gBitSystem; + $ret = NULL; + $sql = "SELECT + lc.`title`, + lc.`content_id`, + lct.`content_description`, + ( SELECT count(*) + FROM `".BIT_DB_PREFIX."liberty_comments` lcom + WHERE lcom.`root_id`=lcom.`parent_id` AND lcom.`root_id`=lc.`content_id` + ) AS thread_count + FROM `".BIT_DB_PREFIX."liberty_content` lc + INNER JOIN `".BIT_DB_PREFIX."liberty_content_types` lct ON (lc.`content_type_guid`=lct.`content_type_guid`) + WHERE lc.`content_id` NOT IN ( + SELECT lc.`content_id` AS content_id + FROM `".BIT_DB_PREFIX."forum_board` b + INNER JOIN `".BIT_DB_PREFIX."liberty_content` blc ON (blc.`content_id`=b.`content_id`) + INNER JOIN `".BIT_DB_PREFIX."forum_map` map ON (map.`board_content_id`= blc.`content_id`) + INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON (lc.`content_id`=map.`topic_content_id`) + ) + AND lc.`content_type_guid` != 'pigeonholes' + AND lc.`content_type_guid` != 'bitforum' + AND lc.`content_type_guid` != 'bitcomment' + AND lc.`title` != '' + ORDER BY lc.`content_type_guid`, lc.`title` + "; + $rs = $this->mDb->query( $sql ); + while( $row = $rs->fetchRow() ) { + $ret[$row['content_id']] = $row; + } + return $ret; + } + + function addContent($content_id) { + if (@BitBase::verifyId($content_id)) { + $data = array( + 'board_content_id'=>$this->mContentId, + 'topic_content_id'=>$content_id, + ); + $this->mDb->associateInsert( BIT_DB_PREFIX."forum_map",$data); + } + } + + function removeContent($content_id) { + if (@BitBase::verifyId($content_id) && @BitBase::verifyId($this->mContentId)) { + $sql = "DELETE FROM `".BIT_DB_PREFIX."forum_map` WHERE `board_content_id` = ? AND `topic_content_id` = ?"; + $result = $this->mDb->query( $sql, array( $this->mContentId,$content_id ) ); + } + } + + function verifyIntegrity() { + global $gBitSystem; + $ret = false; + if( $this->isValid() ) { + $sql = "SELECT + COUNT(*) + FROM `".BIT_DB_PREFIX."forum_board` b + INNER JOIN `".BIT_DB_PREFIX."forum_map` map ON (map.`board_content_id`= b.`content_id`) + WHERE b.`board_id`=? AND map.`board_content_id` = map.`topic_content_id` + "; + $count = $this->mDb->getOne( $sql, array( $this->mBitBoardId )); + return ($count==1); + } + return $ret; + } + + function fixContentMap() { + if( $this->isValid() && @BitBase::verifyId($this->mContentId)) { + $this->removeContent($this->mContentId); + $this->addContent($this->mContentId); + } + } + + function lookupMapRev($content_id) { + global $gBitDb; + $ret = NULL; + if (@BitBase::verifyId($content_id)) { + $sql = "SELECT `board_content_id` FROM `".BIT_DB_PREFIX."forum_map` map WHERE map.`topic_content_id`=?"; + $ret = $gBitDb->getOne( $sql, array( $content_id )); + } + return $ret; + } + + function getMap() { + global $gBitSystem; + $ret = NULL; + if( $this->isValid() ) { + $sql = "SELECT + lc.`title` AS t_title, + lc.`content_id` AS t_content_id, + blc.`title` AS b_title, + blc.`content_id` AS b_content_id, + b.`board_id` AS b_board_id, + ( SELECT count(*) + FROM `".BIT_DB_PREFIX."liberty_comments` lcom + WHERE lcom.`root_id`=lcom.`parent_id` AND lcom.`root_id`=lc.`content_id` + ) AS thread_count, + ((blc.`content_id`- lc.`content_id)*(blc.`content_id`- lc.`content_id)) AS order_key + FROM `".BIT_DB_PREFIX."forum_board` b + INNER JOIN `".BIT_DB_PREFIX."liberty_content` blc ON (blc.`content_id`=b.`content_id`) + INNER JOIN `".BIT_DB_PREFIX."forum_map` map ON (map.`board_content_id`= blc.`content_id`) + INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON (lc.`content_id`=map.`topic_content_id`) + WHERE b.`board_id`=? AND map.`board_content_id`!=map.`topic_content_id` + ORDER BY order_key + "; + $rs = $this->mDb->query( $sql, array( $this->mBitBoardId )); + while( $row = $rs->fetchRow() ) { + $ret[$row['t_content_id']] = $row; } } - return( $ret ); + return $ret; } /** * This function generates a list of records from the liberty_content database for use in a list page **/ - function getFullList( &$pParamHash ) { + function getList( &$pParamHash ) { global $gBitSystem, $gBitUser; - $BIT_DB_PREFIX=BIT_DB_PREFIX; // this makes sure parameters used later on are set - LibertyAttachable::prepGetList( $pParamHash ); + LibertyContent::prepGetList( $pParamHash ); $selectSql = $joinSql = $whereSql = ''; $bindVars = array(); + array_push( $bindVars, $this->mContentTypeGuid ); $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars ); // this will set $find, $sort_mode, $max_records and $offset @@ -82,75 +374,41 @@ class BitBoard extends LibertyAttachable { $bindVars[] = '%' . strtoupper( $find ). '%'; } - if (empty($pParamHash['ct'])) { - $query= "SELECT DISTINCT lcom.`root_id` AS root_id, lc.`content_id` AS content_id, lc.`title` AS title, lc.`content_type_guid` AS content_type_guid, - ( SELECT count(*) FROM `".BIT_DB_PREFIX."liberty_comments` slcom WHERE slcom.`root_id`=slcom.`parent_id` AND slcom.`root_id`=lc.`content_id` ) AS post_count - $selectSql - FROM ".BIT_DB_PREFIX."liberty_content lc - INNER JOIN ".BIT_DB_PREFIX."liberty_comments lcom ON( lc.`content_id`=lcom.`root_id` ) - $joinSql - WHERE TRUE $whereSql - "; - - $query_cant= "SELECT COUNT(DISTINCT lcom.root_id) - FROM ".BIT_DB_PREFIX."liberty_content lc - INNER JOIN ".BIT_DB_PREFIX."liberty_comments lcom ON( lc.content_id=lcom.root_id ) - $joinSql - WHERE TRUE $whereSql - "; - } else { - $whereSql .= " AND lc.`content_type_guid`= '{$pParamHash['ct']}'"; - $query= "SELECT lc.`content_id` AS content_id, lc.`title` AS title, lc.`content_type_guid` AS content_type_guid, - ( SELECT count(*) FROM `".BIT_DB_PREFIX."liberty_comments` lcom WHERE lcom.`root_id`=lcom.`parent_id` AND lcom.`root_id`=lc.`content_id` ) AS post_count - $selectSql - FROM ".BIT_DB_PREFIX."liberty_content lc - $joinSql - WHERE TRUE $whereSql - "; - - $query_cant= "SELECT COUNT(*) - FROM ".BIT_DB_PREFIX."liberty_content lc - $joinSql - WHERE TRUE $whereSql - "; - } + $query = "SELECT ts.*, lc.`content_id`, lc.`title`, lc.`data`, + ( SELECT count(*) + FROM `".BIT_DB_PREFIX."forum_map` AS map + INNER JOIN `".BIT_DB_PREFIX."liberty_comments` lcom ON (map.`topic_content_id` = lcom.`root_id`) + WHERE lcom.`root_id`=lcom.`parent_id` AND map.`board_content_id`=lc.`content_id` + ) AS post_count + $selectSql + FROM `".BIT_DB_PREFIX."forum_board` ts INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON( lc.`content_id` = ts.`content_id` ) $joinSql + WHERE lc.`content_type_guid` = ? $whereSql + ORDER BY ".$this->mDb->convert_sortmode( $sort_mode ); + $query_cant = "select count(*) + FROM `".BIT_DB_PREFIX."forum_board` ts INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON( lc.`content_id` = ts.`content_id` ) $joinSql + WHERE lc.`content_type_guid` = ? $whereSql"; $result = $this->mDb->query( $query, $bindVars, $max_records, $offset ); $ret = array(); while( $res = $result->fetchRow() ) { - $res['url']= BITBOARDS_PKG_URL."index.php?c={$res['content_id']}"; + $res['url']= BITBOARDS_PKG_URL."index.php?b={$res['board_id']}"; $ret[] = $res; } $pParamHash["cant"] = $this->mDb->getOne( $query_cant, $bindVars ); - // add all pagination info to pParamHash - LibertyAttachable::postGetList( $pParamHash ); - return $ret; - } - function getForumBoardSelectList() { - global $gBitDb; - $query = "SELECT lc.`content_id` as content_id, lc.`title` as title, lct.`content_description` AS description, - ( SELECT count(*) FROM `".BIT_DB_PREFIX."liberty_comments` slcom WHERE slcom.`root_id`=slcom.`parent_id` AND slcom.`root_id`=lc.`content_id ) AS post_count - FROM `".BIT_DB_PREFIX."liberty_content` lc - INNER JOIN `".BIT_DB_PREFIX."liberty_content_types` lct ON( lc.`content_type_guid` = lct.`content_type_guid` ) - WHERE lc.`content_type_guid`!='bitcomment' - ORDER BY lc.`content_type_guid` ASC"; - - $result = $gBitDb->query( $query); - $ret = array(); - while( $res = $result->fetchRow() ) { - $ret[] = $res; - } + // add all pagination info to pParamHash + LibertyContent::postGetList( $pParamHash ); return $ret; } /** - * Generates the URL to the bitboard page + * Generates the URL to the bitforum page + * @param pExistsHash the hash that was returned by LibertyContent::pageExists * @return the link to display the page. */ - function getForumDisplayUrl(&$lcontent) { + function getDisplayUrl() { $ret = NULL; - if( @$lcontent->verifyId( $lcontent->mContentId ) ) { - $ret = BITBOARDS_PKG_URL."index.php?c=".$lcontent->mContentId; + if( @$this->verifyId( $this->mBitBoardId ) ) { + $ret = BITBOARDS_PKG_URL."index.php?b=".$this->mBitBoardId; } return $ret; } diff --git a/BitBoardForum.php b/BitBoardForum.php new file mode 100644 index 0000000..25609b9 --- /dev/null +++ b/BitBoardForum.php @@ -0,0 +1,167 @@ + +* @version $Revision: 1.1 $ $Date: 2006/07/12 17:00:32 $ $Author: hash9 $ +* @class BitBoardBoard +*/ + +require_once( LIBERTY_PKG_PATH.'LibertyAttachable.php' ); + +class BitBoardForum extends LibertyAttachable { + + /** + * During initialisation, be sure to call our base constructors + **/ + function BitBoardForum() { + LibertyAttachable::LibertyAttachable(); + } + + function loadContent($contentId) { + global $gBitDb; + global $gBitUser; + //var_dump($GLOBALS); + if( LibertyContent::verifyId( $contentId ) ) { + // LibertyContent::load()assumes you have joined already, and will not execute any sql! + // This is a significant performance optimization + $bindVars = array(); + $selectSql = $joinSql = $whereSql = ''; + array_push( $bindVars, $contentId ); + $gBitUser->getServicesSql( 'content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars ); + + $query = "SELECT lc.*, uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name, uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name $selectSql + FROM `".BIT_DB_PREFIX."liberty_content` lc $joinSql + LEFT JOIN `".BIT_DB_PREFIX."users_users` uue ON( uue.`user_id` = lc.`modifier_user_id` ) + LEFT JOIN `".BIT_DB_PREFIX."users_users` uuc ON( uuc.`user_id` = lc.`user_id` ) + WHERE lc.`content_id`=? $whereSql"; + $result = $gBitDb->query( $query, $bindVars ); + + $ret = array(); + if( $result && $result->numRows() ) { + $ret = $result->fields; + + $ret['creator'] =( isset( $result->fields['creator_real_name'] )? $result->fields['creator_real_name'] : $result->fields['creator_user'] ); + $ret['editor'] =( isset( $result->fields['modifier_real_name'] )? $result->fields['modifier_real_name'] : $result->fields['modifier_user'] ); + $ret['display_url'] = BIT_ROOT_URL."index.php?content_id=$contentId"; + } + } + return( $ret ); + } + + /** + * This function generates a list of records from the liberty_content database for use in a list page + **/ + function getFullList( &$pParamHash ) { + global $gBitSystem, $gBitUser; + $BIT_DB_PREFIX=BIT_DB_PREFIX; + // this makes sure parameters used later on are set + LibertyAttachable::prepGetList( $pParamHash ); + + $selectSql = $joinSql = $whereSql = ''; + $bindVars = array(); + $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars ); + + // this will set $find, $sort_mode, $max_records and $offset + extract( $pParamHash ); + + if( is_array( $find ) ) { + // you can use an array of pages + $whereSql .= " AND lc.`title` IN( ".implode( ',',array_fill( 0,count( $find ),'?' ) )." )"; + $bindVars = array_merge ( $bindVars, $find ); + } elseif( is_string( $find ) ) { + // or a string + $whereSql .= " AND UPPER( lc.`title` )like ? "; + $bindVars[] = '%' . strtoupper( $find ). '%'; + } + + if (empty($pParamHash['ct'])) { + $query= "SELECT DISTINCT lcom.`root_id` AS root_id, lc.`content_id` AS content_id, lc.`title` AS title, lc.`content_type_guid` AS content_type_guid, + ( SELECT count(*) FROM `".BIT_DB_PREFIX."liberty_comments` slcom WHERE slcom.`root_id`=slcom.`parent_id` AND slcom.`root_id`=lc.`content_id` ) AS post_count + $selectSql + FROM ".BIT_DB_PREFIX."liberty_content lc + INNER JOIN ".BIT_DB_PREFIX."liberty_comments lcom ON( lc.`content_id`=lcom.`root_id` ) + $joinSql + WHERE TRUE $whereSql + "; + + $query_cant= "SELECT COUNT(DISTINCT lcom.root_id) + FROM ".BIT_DB_PREFIX."liberty_content lc + INNER JOIN ".BIT_DB_PREFIX."liberty_comments lcom ON( lc.content_id=lcom.root_id ) + $joinSql + WHERE TRUE $whereSql + "; + } else { + $whereSql .= " AND lc.`content_type_guid`= '{$pParamHash['ct']}'"; + $query= "SELECT lc.`content_id` AS content_id, lc.`title` AS title, lc.`content_type_guid` AS content_type_guid, + ( SELECT count(*) FROM `".BIT_DB_PREFIX."liberty_comments` lcom WHERE lcom.`root_id`=lcom.`parent_id` AND lcom.`root_id`=lc.`content_id` ) AS post_count + $selectSql + FROM ".BIT_DB_PREFIX."liberty_content lc + $joinSql + WHERE TRUE $whereSql + "; + + $query_cant= "SELECT COUNT(*) + FROM ".BIT_DB_PREFIX."liberty_content lc + $joinSql + WHERE TRUE $whereSql + "; + } + $result = $this->mDb->query( $query, $bindVars, $max_records, $offset ); + $ret = array(); + while( $res = $result->fetchRow() ) { + $res['url']= BITBOARDS_PKG_URL."index.php?c={$res['content_id']}"; + $ret[] = $res; + } + $pParamHash["cant"] = $this->mDb->getOne( $query_cant, $bindVars ); + // add all pagination info to pParamHash + LibertyAttachable::postGetList( $pParamHash ); + return $ret; + } + + function getForumBoardSelectList() { + global $gBitDb; + $query = "SELECT lc.`content_id` as content_id, lc.`title` as title, + ( SELECT count(*) + FROM `".BIT_DB_PREFIX."forum_map` AS map + INNER JOIN `".BIT_DB_PREFIX."liberty_comments` lcom ON (map.`topic_content_id` = lcom.`root_id`) + WHERE lcom.`root_id`=lcom.`parent_id` AND map.`board_content_id`=lc.`content_id` + ) AS post_count + FROM `".BIT_DB_PREFIX."forum_board` b + INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON( lc.`content_id` = b.`content_id` ) + ORDER BY lc.`title` ASC"; + + $result = $gBitDb->query( $query); + $ret = array(); + while( $res = $result->fetchRow() ) { + $ret[] = $res; + } + return $ret; + } + + /** + * Generates the URL to the bitboard page + * @return the link to display the page. + */ + function getForumDisplayUrl(&$lcontent) { + global $gBitDb; + $ret = NULL; + if( @$lcontent->verifyId( $lcontent->mContentId ) ) { + if ($lcontent->mInfo['content_type_guid']=='bitforum') { + $bId = $gBitDb->getOne("SELECT `board_id` FROM `".BIT_DB_PREFIX."forum_board` s WHERE s.`content_id`=?",array($lcontent->mContentId)); + $ret = BITBOARDS_PKG_URL."index.php?b=$bId"; + } else { + $ret = BITBOARDS_PKG_URL."index.php?c=".$lcontent->mContentId; + } + } + return $ret; + } +} +?> diff --git a/BitBoardTopic.php b/BitBoardTopic.php index 1406e92..8f0a004 100644 --- a/BitBoardTopic.php +++ b/BitBoardTopic.php @@ -1,7 +1,7 @@ -* @version $Revision: 1.3 $ $Date: 2006/07/06 19:44:26 $ $Author: hash9 $ +* @version $Revision: 1.4 $ $Date: 2006/07/12 16:57:33 $ $Author: hash9 $ * @class BitBoardTopic */ @@ -20,7 +20,7 @@ require_once( BITBOARDS_PKG_PATH.'BitBoardPost.php' ); /** * This is used to uniquely identify the object */ -define( 'BitBoardTopic_CONTENT_TYPE_GUID', 'BitForumTopic' ); +define( 'BitBoardTopic_CONTENT_TYPE_GUID', 'BitBoardTopic' ); class BitBoardTopic extends LibertyAttachable { /** @@ -83,11 +83,14 @@ SELECT lcom.`root_id` AS th_root_id, lcom.`root_id` AS content_id, - lc.`content_type_guid` AS content_type_guid + lc.`content_type_guid` AS content_type_guid, + + map.`board_content_id` AS board_content_id $selectSql FROM `${BIT_DB_PREFIX}liberty_comments` AS lcom INNER JOIN `${BIT_DB_PREFIX}liberty_content` AS lc ON( lc.`content_id` = lcom.`content_id` ) + INNER JOIN `${BIT_DB_PREFIX}forum_map` map ON (map.`topic_content_id`=lcom.`root_id` ) LEFT JOIN `${BIT_DB_PREFIX}forum_thread` th ON (th.`parent_id`=lcom.`comment_id`) LEFT JOIN `${BIT_DB_PREFIX}forum_post` AS post ON(post.`comment_id`=lcom.`comment_id`) $joinSql @@ -238,11 +241,14 @@ WHERE $bindVars[] = '%' . strtoupper( $find ). '%'; } - if(!empty($pParamHash['c'])) { - $whereSql .= " AND lcom.`root_id` = ". $pParamHash['c'] ; + if(!empty($pParamHash['b'])) { + $joinSql .= " INNER JOIN `${BIT_DB_PREFIX}forum_map` AS map ON (map.`topic_content_id` = lcom.`root_id`)"; + $joinSql .= " INNER JOIN `${BIT_DB_PREFIX}forum_board` AS b ON (b.`content_id` = map.`board_content_id`)"; + $whereSql .= " AND b.`board_id` = ". $pParamHash['b'] ; } + if (!($gBitUser->hasPermission('p_bitboards_edit') || $gBitUser->hasPermission('p_bitboards_post_edit'))) { /*$whereSql .= " AND ((post.`approved` = TRUE) OR (lc.`user_id` >= 0))"; $selectSql = " 0 AS unreg";*/ @@ -270,8 +276,8 @@ WHERE post.`unreg_uname` AS first_unreg_uname, unreg DESC, */ - $query = <<mDb->query( $query, $bindVars, $max_records, $offset ); $ret = array(); while( $res = $result->fetchRow() ) { @@ -327,6 +338,8 @@ SQL; } else { $res['url']=BITBOARDS_PKG_URL."index.php?t=".$res['th_thread_id']; } + $llc_data = BitBoardTopic::getLastPost($res); + $res = array_merge($res,$llc_data); $res['flip']=BitBoardTopic::getFlipFlop($res); $ret[] = $res; } @@ -334,52 +347,62 @@ SQL; // add all pagination info to pParamHash LibertyAttachable::postGetList( $pParamHash ); return $ret; -} + } -/** + function getLastPost($data) { + $BIT_DB_PREFIX = BIT_DB_PREFIX; + $query="SELECT MAX(lc.`last_modified`) AS llc_last_modified, MAX(lc.`user_id`) AS llc_user_id + FROM `".BIT_DB_PREFIX."liberty_comments` lcom + INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON (lcom.`content_id` = lc.`content_id`) + WHERE SUBSTRING(lcom.`thread_forward_sequence`,1,10) LIKE '".sprintf("%09d.",$data['th_thread_id'])."%'"; + $result = $this->mDb->getRow( $query); + return $result; + } + + /** * Generates the URL to the bitboard page * @param pExistsHash the hash that was returned by LibertyAttachable::pageExists * @return the link to display the page. */ -function getDisplayUrl() { - $ret = NULL; - if( @$this->verifyId( $this->mRootId ) ) { - $res['url']=BITBOARDS_PKG_URL."index.php?c=".$this->mContentId; + function getDisplayUrl() { + $ret = NULL; + if( @$this->verifyId( $this->mRootId ) ) { + $res['url']=BITBOARDS_PKG_URL."index.php?c=".$this->mContentId; + } + return $ret; } - return $ret; -} -function isLocked($thread_id=false) { - global $gBitSystem; - if (!$thread_id) { - $thread_id = $this->mRootId; + function isLocked($thread_id=false) { + global $gBitSystem; + if (!$thread_id) { + $thread_id = $this->mRootId; + } + return $gBitSystem->mDb->getOne("SELECT `locked` FROM `".BIT_DB_PREFIX."forum_thread` WHERE `parent_id` = $thread_id"); } - return $gBitSystem->mDb->getOne("SELECT `locked` FROM `".BIT_DB_PREFIX."forum_thread` WHERE `parent_id` = $thread_id"); -} -function getFlipFlop($arr=false) { - if(! $arr) { - $arr = $this->mInfo; + function getFlipFlop($arr=false) { + if(! $arr) { + $arr = $this->mInfo; + } + global $gBitSmarty; + $flip['locked']['state']=$arr['th_locked']; + $flip['locked']['req']=2; + $flip['locked']['id']=$arr['th_thread_id']; + $flip['locked']['idname']='t'; + $flip['locked']['up']='locked'; + $flip['locked']['upname']='Thread Locked'; + $flip['locked']['down']='unlocked'; + $flip['locked']['downname']='Thread Unlocked'; + + $flip['sticky']['state']=$arr['th_sticky']; + $flip['sticky']['req']=3; + $flip['sticky']['id']=$arr['th_thread_id']; + $flip['sticky']['idname']='t'; + $flip['sticky']['up']='idea'; + $flip['sticky']['upname']='Sticky Thread'; + $flip['sticky']['down']='agt_uninstall-product'; + $flip['sticky']['downname']='Non Sticky Thread'; + return $flip; } - global $gBitSmarty; - $flip['locked']['state']=$arr['th_locked']; - $flip['locked']['req']=2; - $flip['locked']['id']=$arr['th_thread_id']; - $flip['locked']['idname']='t'; - $flip['locked']['up']='locked'; - $flip['locked']['upname']='Thread Locked'; - $flip['locked']['down']='unlocked'; - $flip['locked']['downname']='Thread Unlocked'; - - $flip['sticky']['state']=$arr['th_sticky']; - $flip['sticky']['req']=3; - $flip['sticky']['id']=$arr['th_thread_id']; - $flip['sticky']['idname']='t'; - $flip['sticky']['up']='idea'; - $flip['sticky']['upname']='Sticky Thread'; - $flip['sticky']['down']='agt_uninstall-product'; - $flip['sticky']['downname']='Non Sticky Thread'; - return $flip; -} } ?> diff --git a/admin/schema_inc.php b/admin/schema_inc.php index dc0dddb..fe40699 100644 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -15,6 +15,16 @@ $tables = array( deleted I1 NOTNULL DEFAULT(0), sticky I1 NOTNULL DEFAULT(0) ", + 'forum_board' => " + board_id I4 PRIMARY, + content_id I4 NOTNULL + ", + 'forum_map' => " + board_content_id I4 NOTNULL, + topic_content_id I4 PRIMARY + CONSTRAINT ', CONSTRAINT `bitforums_topics_forum_ref` FOREIGN KEY (`board_content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content` (`content_id`) + , CONSTRAINT `bitforums_topics_related_ref` FOREIGN KEY (`topic_content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content` (`content_id`)' + " ); global $gBitInstaller; @@ -38,6 +48,7 @@ $gBitInstaller->registerSchemaIndexes( BITBOARDS_PKG_NAME, $indices ); // ### Sequences $sequences = array ( + 'forum_board_id_seq' => array( 'start' => 1 ), 'bitboards_id_seq' => array( 'start' => 1 ), 'bitboards_topic_id_seq' => array( 'start' => 1 ), ); diff --git a/ajax.php b/ajax.php index 3160654..6d11b07 100644 --- a/ajax.php +++ b/ajax.php @@ -1,9 +1,9 @@ verifyPackage( 'bitboards' ); @@ -86,7 +87,7 @@ set_error_handler("ajax_nice_error"); switch ($_GET['req']) { case 1: - $board = new BitBoard(); + $board = new BitBoardForum(); $boardList=$board->getForumBoardSelectList(); $gBitSmarty->assign_by_ref('boardList',$boardList); $gBitSmarty->display('bitpackage:bitboards/ajax.tpl'); diff --git a/assign.php b/assign.php new file mode 100644 index 0000000..fe597a4 --- /dev/null +++ b/assign.php @@ -0,0 +1,50 @@ +verifyPackage( 'bitboards' ); + +// Now check permissions to access this page +$gBitSystem->verifyPermission('p_bitboards_edit' ); + +require_once(BITBOARDS_PKG_PATH.'lookup_inc.php' ); + +if (!empty($_REQUEST['remove'])) { + foreach ($_REQUEST['remove'] as $board_id => $content_ids) { + $b = new BitBoard($board_id); + $b->load(); + foreach ($content_ids as $content_id => $remove) { + if ($remove) { + $b->removeContent($content_id); + } + } + } +} +if (!empty($_REQUEST['assign'])) { + foreach ($_REQUEST['assign'] as $board_id => $content_ids) { + $b = new BitBoard($board_id); + $b->load(); + foreach ($content_ids as $content_id) { + $b->addContent($content_id); + } + } +} +if (!empty($_REQUEST['integrity'])) { + $board_id = $_REQUEST['integrity']; + $b = new BitBoard($board_id); + $b->load(); + $b->fixContentMap(); +} + +$data = BitBoard::getAllMap(); +$gBitSmarty->assign_by_ref('data',$data); + +// Display the template +$gBitSystem->display( 'bitpackage:bitboards/board_assign.tpl', tra('Assign content to Board') ); +?> \ No newline at end of file diff --git a/board.php b/board.php index a71c928..f43c21a 100644 --- a/board.php +++ b/board.php @@ -1,5 +1,5 @@ getFullList( $_REQUEST ); +$boardsList = $boards->getList( $_REQUEST ); $gBitSmarty->assign_by_ref( 'boardsList', $boardsList ); -if (!empty($_REQUEST['content_type_guid'])) { +/*if (!empty($_REQUEST['content_type_guid'])) { $gBitSmarty->assign_by_ref( 'cType', $gLibertySystem->mContentTypes[$_REQUEST['content_type_guid']] ); -} +}*/ // getList() has now placed all the pagination information in $_REQUEST['listInfo'] $gBitSmarty->assign_by_ref( 'listInfo', $_REQUEST['listInfo'] ); diff --git a/edit.php b/edit.php new file mode 100644 index 0000000..4e5f759 --- /dev/null +++ b/edit.php @@ -0,0 +1,71 @@ +verifyPackage( 'bitboards' ); + +// Now check permissions to access this page +$gBitSystem->verifyPermission('p_bitboards_edit' ); + +if( isset( $_REQUEST['bitforum']['board_id'] ) ) { + $_REQUEST['b'] = $_REQUEST['bitforum']['board_id']; +} + +require_once(BITBOARDS_PKG_PATH.'lookup_inc.php' ); + +if( isset( $_REQUEST['bitforum']["title"] ) ) { + $gContent->mInfo["title"] = $_REQUEST['bitforum']["title"]; +} + +if( isset( $_REQUEST['bitforum']["description"] ) ) { + $gContent->mInfo["description"] = $_REQUEST['bitforum']["description"]; +} + +if( isset( $_REQUEST["format_guid"] ) ) { + $gContent->mInfo['format_guid'] = $_REQUEST["format_guid"]; +} + +if( isset( $_REQUEST['bitforum']["edit"] ) ) { + $gContent->mInfo["data"] = $_REQUEST['bitforum']["edit"]; + $gContent->mInfo['parsed_data'] = $gContent->parseData(); +} + +// If we are in preview mode then preview it! +if( isset( $_REQUEST["preview"] ) ) { + $gBitSmarty->assign('preview', 'y'); + $gContent->invokeServices( 'content_preview_function' ); +} else { + $gContent->invokeServices( 'content_edit_function' ); +} + +// Pro +// Check if the page has changed +if( !empty( $_REQUEST["save_bitforum"] ) ) { + // Check if all Request values are delivered, and if not, set them + // to avoid error messages. This can happen if some features are + // disabled + if( $gContent->store( $_REQUEST['bitforum'] ) ) { + header( "Location: ".$gContent->getDisplayUrl() ); + die; + } else { + $gBitSmarty->assign_by_ref( 'errors', $gContent->mErrors ); + } +} + +// Configure quicktags list +if( $gBitSystem->isPackageActive( 'quicktags' ) ) { + include_once( QUICKTAGS_PKG_PATH.'quicktags_inc.php' ); +} + +// WYSIWYG and Quicktag variable +$gBitSmarty->assign( 'textarea_id', 'editbitforum' ); + +// Display the template +$gBitSystem->display( 'bitpackage:bitboards/board_edit.tpl', tra('Board') ); +?> diff --git a/icons/db_update.png b/icons/db_update.png new file mode 100755 index 0000000..013e94d Binary files /dev/null and b/icons/db_update.png differ diff --git a/index.php b/index.php index 7db2bc7..03859c1 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ load(); diff --git a/post.php b/post.php index 05074dd..ee756cf 100644 --- a/post.php +++ b/post.php @@ -1,6 +1,7 @@ mInfo['th_root_id'])) { $gBitSystem->fatalError(tra( "Invalid thread selection." ) ); } -$board = new LibertyContent(); -$board->mContentId=$thread->mInfo['th_root_id']; -$board->mInfo['content_id']=$thread->mInfo['th_root_id']; -$board->mInfo=BitBoard::loadContent($thread->mInfo['th_root_id']); -$board->mInfo['display_url']=BitBoard::getForumDisplayUrl($board); +$board = new BitBoard(null,$thread->mInfo['board_content_id']); $board->load(); $gBitSmarty->assign_by_ref( 'board', $board ); diff --git a/templates/ajax.tpl b/templates/ajax.tpl index c1b88b8..6989e77 100644 --- a/templates/ajax.tpl +++ b/templates/ajax.tpl @@ -1,6 +1,6 @@ {strip} {foreach from=$boardList item=board} - + {/foreach} {/strip} \ No newline at end of file diff --git a/templates/board.tpl b/templates/board.tpl index b4fcdc8..ab081ad 100644 --- a/templates/board.tpl +++ b/templates/board.tpl @@ -1,16 +1,15 @@ -{* $Header: /cvsroot/bitweaver/_bit_boards/templates/Attic/board.tpl,v 1.2 2006/07/06 19:44:26 hash9 Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_boards/templates/Attic/board.tpl,v 1.3 2006/07/12 16:57:33 hash9 Exp $ *} {strip}
{bithelp}
-

{$cType.content_description|escape|default:"Forum Group"}s

+

Forums

- {minifind sort_mode=$sort_mode category_id=$smarty.request.category_id} + {minifind sort_mode=$sort_mode b=$smarty.request.b} {form id="checkform"} - @@ -24,10 +23,10 @@ {assign var=board_title value="(Content $board_title)"} {/if} 0}-unapproved{/if}"> - - + {* + {biticon ipackage=liberty iname="view" iexplain="Show: $board_title"} - + *} {$board_title} {* {if $gBitUser->hasPermission('p_bitboards_edit') || $gBitUser->hasPermission('p_bitboards_post_edit')} @@ -40,7 +39,7 @@ {/if} *} {if $board.post_count > 0}{$board.post_count} Threads{/if} - + {foreachelse} @@ -69,7 +68,7 @@ *} {/form} - {pagination} + {pagination b=$smarty.request.b}
{/strip} diff --git a/templates/board_assign.tpl b/templates/board_assign.tpl new file mode 100644 index 0000000..4574d20 --- /dev/null +++ b/templates/board_assign.tpl @@ -0,0 +1,59 @@ +
{bithelp}
+ +
+
+

+ {tr}Assign Content to Boards{/tr} +

+
+
+ {jstabs tab=$smarty.request.tab} + {foreach item=board from=$data.map name='board_loop'} + {capture assign=title} + + {if ! $board.integrity} + Integrity Check Failed + {/if} + {$board.title} + + {/capture} + {jstab title=$title} + {form legend="`$board.title`"} + + {if ! $board.integrity} + + {formfeedback warning="Integrity Check Failed"} + {/if} + + {foreach item=mapping from=$board.map} + + + + + + + {/foreach} + + + + + + + +
{biticon ipackage=liberty iname="delete" iexplain="Remove from board"}{$mapping.thread_count}{$mapping.t_title}
+ +
+ {/form} + {/jstab} + {/foreach} + {/jstabs} +
+
\ No newline at end of file diff --git a/templates/board_edit.tpl b/templates/board_edit.tpl new file mode 100644 index 0000000..37ecdcd --- /dev/null +++ b/templates/board_edit.tpl @@ -0,0 +1,86 @@ +{* $Header: /cvsroot/bitweaver/_bit_boards/templates/board_edit.tpl,v 1.1 2006/07/12 17:00:33 hash9 Exp $ *} +{strip} +
{bithelp}
+ +
+ {if $preview} +

Preview {$gContent->mInfo.title|escape}

+
+ {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='nav' serviceHash=$gContent->mInfo} +
+
+

{$gContent->mInfo.title|escape|default:"Board"}

+
+
+
+ {$gContent->mInfo.parsed_data} +
+
+
+ {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='view' serviceHash=$gContent->mInfo} +
+ {/if} + +
+

+ {if $gContent->isValid()} + {tr}{tr}Edit{/tr} {$gContent->getTitle()|escape}{/tr} + {else} + {tr}Create New Board{/tr} + {/if} +

+
+ +
+ {jstabs} + {if $gContent->isValid()} + {assign var='leg' value=$gContent->getTitle()|escape} + {assign var='leg' value="Edit Board: $leg"} + {else} + {assign var='leg' value='Create Board'} + {/if} + {jstab title=$leg} + {form enctype="multipart/form-data" id="editbitforumform"} + {legend legend=$leg} + + +
+ {formlabel label="Title" for="title"} + {forminput} + + {/forminput} +
+ + {include file="bitpackage:liberty/edit_format.tpl"} + + {if $gBitSystem->isFeatureActive('package_smileys')} + {include file="bitpackage:smileys/smileys_full.tpl"} + {/if} + + {if $gBitSystem->isFeatureActive('package_quicktags')} + {include file="bitpackage:quicktags/quicktags_full.tpl"} + {/if} + +
+ {forminput} + + {/forminput} +
+ + {* any simple service edit options *} + {include file="bitpackage:liberty/edit_services_inc.tpl serviceFile=content_edit_mini_tpl} + +
+ + +
+ {/legend} + {/form} + {/jstab} + {* any service edit template tabs *} + {include file="bitpackage:liberty/edit_services_inc.tpl serviceFile=content_edit_tab_tpl} + {/jstabs} +
+
+ +{/strip} diff --git a/templates/comment_post.tpl b/templates/comment_post.tpl index d3d14e7..2798c12 100644 --- a/templates/comment_post.tpl +++ b/templates/comment_post.tpl @@ -1,3 +1,4 @@ +{if $smarty.request.post_comment_request} {strip}
@@ -35,7 +36,7 @@ {*assign var=gContent value=$commentpost*} {*include file="bitpackage:liberty/edit_format.tpl"*} - + {assign var=textarea_id value="commentpost"} {if $gBitSystem->isPackageActive( 'smileys' )} {include file="bitpackage:smileys/smileys_full.tpl"} @@ -44,7 +45,7 @@ {if $gBitSystem->isPackageActive( 'quicktags' )} {include file="bitpackage:quicktags/quicktags_full.tpl" formId="commentpost"} {/if} - +
{formlabel label="Comment" for="commentpost"} {forminput} @@ -62,8 +63,9 @@ {/if} {/form} - + {libertypagination hash=$commentsPgnHash}
{/strip} +{/if} \ No newline at end of file diff --git a/templates/menu_bitboards.tpl b/templates/menu_bitboards.tpl index 39401d7..16e2983 100644 --- a/templates/menu_bitboards.tpl +++ b/templates/menu_bitboards.tpl @@ -1,7 +1,11 @@ {strip} {/strip} diff --git a/templates/post.tpl b/templates/post.tpl index 11cba4e..e426438 100644 --- a/templates/post.tpl +++ b/templates/post.tpl @@ -1,44 +1,5 @@ -{* $Header: /cvsroot/bitweaver/_bit_boards/templates/Attic/post.tpl,v 1.3 2006/07/06 19:44:26 hash9 Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_boards/templates/Attic/post.tpl,v 1.4 2006/07/12 16:57:33 hash9 Exp $ *} {strip} - {if $comments and $gBitSystem->isFeatureActive('comments_display_option_bar')} - {form action="`$comments_return_url`#editcomments"} - - - - - - - - - - -
{tr}Comments Filter{/tr}
- - - - - - - - -
- {/form} - {/if}
{assign var=flip value=$thread->getFlipFlop()} {assign var=flip_name value="locked"} @@ -51,50 +12,28 @@

{$thread->mInfo.flc_title|escape}

- Back to {$board->mInfo.title|escape} + Back to {$board->mInfo.title|escape}
+ {include file="bitpackage:liberty/comments_display_option_bar.tpl"} {minifind sort_mode=$sort_mode thread_id=$smarty.request.thread_id} - {form id="checkform"} - - - + + {foreach item=comment from=$comments} + mInfo.deleted==1}-deleted{else}{if $post->mInfo.user_id<0 and $post->mInfo.approved==0}-unapproved{/if}{/if}"> + {displaycomment comment=$comment template=$comment_template} + + {foreachelse} + + {/foreach} +
+ {tr}No posts found{/tr} +
+

{tr}Post on this thread{/tr} {biticon ipackage=bitboard iname="mail_new" iexplain="Post on this thread"}

- - {foreach item=comment from=$comments} - mInfo.deleted==1}-deleted{else}{if $post->mInfo.user_id<0 and $post->mInfo.approved==0}-unapproved{/if}{/if}"> - {displaycomment comment=$comment template=$comment_template} - - {foreachelse} - - {/foreach} -
- {tr}No records found{/tr} -
-

{tr}Post on this thread{/tr} {biticon ipackage=bitboard iname="mail_new" iexplain="Post on this thread"}

- {if $gBitUser->hasPermission( 'p_bitboards_remove' )} -
- - - - - -
- {/if} - {/form} - - {pagination} + {libertypagination hash=$comments}
- {include file="bitpackage:bitboards/comment_post.tpl"} + {include file="bitpackage:liberty/comments_post_inc.tpl" post_title="Post" hide=1} {/strip} diff --git a/templates/topic.tpl b/templates/topic.tpl index 9db5c46..1496608 100644 --- a/templates/topic.tpl +++ b/templates/topic.tpl @@ -1,20 +1,33 @@ -{* $Header: /cvsroot/bitweaver/_bit_boards/templates/Attic/topic.tpl,v 1.3 2006/07/06 19:44:26 hash9 Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_boards/templates/Attic/topic.tpl,v 1.4 2006/07/12 16:57:33 hash9 Exp $ *} {strip}
+
+ {if $print_page ne 'y'} + {if $gBitUser->hasPermission( 'p_bitforum_edit' )} + {biticon ipackage=liberty iname="edit" iexplain="Edit BitForum"} + {/if} + {if $gBitUser->hasPermission( 'p_bitforum_remove' )} + {biticon ipackage=liberty iname="delete" iexplain="Remove BitForum"} + {/if} + {/if} +
-

{$board->mInfo.title|escape|default:"Forum Topic"}

+

{$board->mInfo.title|escape|default:"Forum Topic"} {if empty($smarty.request.show)}+{else}-{/if}

- {tr}Posted by{/tr}: {displayname user=$board->mInfo.creator_user user_id=$board->mInfo.creator_user_id real_name=$board->mInfo.creator_real_name} on {$board->getField('created')|bit_short_datetime} + {tr}Created by{/tr}: {displayname user=$board->mInfo.creator_user user_id=$board->mInfo.creator_user_id real_name=$board->mInfo.creator_real_name} on {$board->getField('created')|bit_short_datetime} {if $board->getField('last_modified') != $board->getField('created')} -
{tr}Edited by{/tr}: {displayname user=$board->mInfo.modifier_user user_id=$board->mInfo.modifier_user_id real_name=$board->mInfo.modifier_real_name}, {$board->getField('last_modified')|bit_short_datetime} +   {tr}Edited by{/tr}: {displayname user=$board->mInfo.modifier_user user_id=$board->mInfo.modifier_user_id real_name=$board->mInfo.modifier_real_name}, {$board->getField('last_modified')|bit_short_datetime} {/if}
- - Back to {$board->mInfo.content_type.content_description}s + + Back to {$board->mInfo.content_type.content_description}s
+
+ {$board->mInfo.parsed_data} +

{tr}Start a new thread{/tr} {biticon ipackage=bitboard iname="mail_new" iexplain="Start a new thread"}

{minifind sort_mode=$sort_mode board_id=$smarty.request.board_id} {form id="checkform"} @@ -23,17 +36,6 @@ - {* - - - - - - {if $gBitUser->hasPermission( 'p_bitboards_remove' )} - - {/if} - *} - {foreach item=thread from=$threadList} {if $gBitUser->hasPermission('p_bitboards_edit') || $gBitUser->hasPermission('p_bitboards_post_edit')} @@ -74,7 +77,7 @@ {if $gBitUser->hasPermission( 'p_bitboards_edit' )} {*smartlink ititle="Edit" ifile="edit.php" ibiticon="liberty/edit" board_id=$thread.board_id*} {/if} {/form} - {pagination} + {pagination b=$smarty.request.b} -{include file="bitpackage:bitboards/comment_post.tpl"} +{include file="bitpackage:liberty/comments_post_inc.tpl" post_title="Post" hide=1} {/strip} diff --git a/templates/topic_move.tpl b/templates/topic_move.tpl index 26b80ce..680a584 100644 --- a/templates/topic_move.tpl +++ b/templates/topic_move.tpl @@ -1,4 +1,4 @@ -{* $Header: /cvsroot/bitweaver/_bit_boards/templates/topic_move.tpl,v 1.1 2006/06/28 15:45:26 spiderr Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_boards/templates/topic_move.tpl,v 1.2 2006/07/12 16:57:33 hash9 Exp $ *} {strip}
{bithelp}
@@ -17,7 +17,7 @@ {forminput}
{smartlink ititle="Title" isort=flc_title iurl=$request.url offset=$control.offset}{smartlink ititle="Started By" isort=flc_user_id offset=$control.offset}{smartlink ititle="Started" isort=flc_created offset=$control.offset}{smartlink ititle="Last Update By" isort=llc_user_id offset=$control.offset}{smartlink ititle="Last Update" isort=llc_created offset=$control.offset}{tr}Actions{/tr}
- {$thread.flc_title|escape}, started by {if $thread.flc_user_id < 0}{$thread.first_unreg_uname|escape}{else}{displayname user_id=$thread.flc_user_id}{/if} {$thread.flc_created|reltime|escape}{if $thread.post_count > 1}, with {$thread.post_count|escape} posts, last update by {if $thread.flc_user_id < 0}{$thread.first_unreg_uname|escape}{else}{displayname user_id=$thread.flc_user_id}{/if} {$thread.llc_last_modified|reltime|escape}{/if}. + {$thread.flc_title|default:"[Thread `$thread.th_thread_id`]"|escape}, started by {if $thread.flc_user_id < 0}{$thread.first_unreg_uname|escape}{else}{displayname user_id=$thread.flc_user_id}{/if} {$thread.flc_created|reltime|escape}{if $thread.post_count > 1}, with {$thread.post_count|escape} posts, + last update by {if $thread.llc_user_id < 0}{$thread.first_unreg_uname|escape}{else}{displayname user_id=$thread.llc_user_id}{/if} {$thread.llc_last_modified|reltime|escape}{/if} {if $thread.unreg > 0}{$thread.unreg} Unregistered Posts{/if}