/** * see if the documentation page exists, if not create it and return the appropriate content_id * * @param array $pPackage * @access public * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure */ function getDocumentionPage($pPackage = NULL) { global $gBitUser, $gBitSystem; $ret = FALSE; if (empty($pPackage) && $this->isValid()) { $pPackage = $this->mPackage; } if (!empty($pPackage)) { $page = ucfirst($pPackage) . "Package"; require_once LIBERTY_PKG_PATH . "LibertyContent.php"; $lc = new LibertyContent(); $ret = $lc->pageExists($page); if ($gBitSystem->isPackageActive('wiki') && !$ret && $gBitUser->hasPermission('p_wiki_edit_page')) { require_once WIKI_PKG_PATH . "BitPage.php"; $wp = new BitPage(); $create = array('title' => $page, 'creator_user_id' => $gBitUser->mUserId, 'modifier_user_id' => $gBitUser->mUserId, 'edit' => "This page contains information about {$pPackage}"); // get some rudimentary page details if ($wp->store($create)) { $ret = $lc->pageExists($page); } } } return $ret; }
/** * required setup */ require_once '../kernel/setup_inc.php'; $gBitSystem->verifyPackage('wiki'); require_once WIKI_PKG_PATH . 'BitPage.php'; if (!empty($_REQUEST['structure_id'])) { include LIBERTY_PKG_PATH . 'display_structure_inc.php'; } else { // if no page set if (!isset($_REQUEST['page']) and !isset($_REQUEST['page_id'])) { // if auto create home page disabled just get a list if ($gBitSystem->isFeatureActive('wiki_disable_auto_home')) { include WIKI_PKG_PATH . 'list_pages.php'; die; } // auto fetch/create default home page $_REQUEST['page'] = $gBitSystem->getConfig('wiki_home_page', 'HomePage'); } $gHome = new BitPage(); $wikiHome = $gBitSystem->getConfig("wiki_home_page", 'HomePage'); if (!$gHome->pageExists($wikiHome)) { $homeHash = array('title' => isset($wikiHome) ? $wikiHome : 'HomePage', 'creator_user_id' => ROOT_USER_ID, 'modifier_user_id' => ROOT_USER_ID, 'edit' => 'Welcome to ' . $gBitSystem->getConfig('site_title', 'our site')); $gHome->store($homeHash); } include WIKI_PKG_PATH . 'lookup_page_inc.php'; if ($gContent->isValid()) { $gBitSystem->setCanonicalLink($gContent->getDisplayUrl()); } include WIKI_PKG_PATH . 'display_bitpage_inc.php'; }
!Viewing the Wiki Book Now that we have created a Wiki Book, we want to view it and see what all this work was for. If you click on the __Wiki Books__ in your left menu, you will see the ===bitweaver Help=== book. Please click on the book, which will take you to a page, where you can see the Wiki Book you just created. The special aspect of these books, is the easy navigation that comes with the hierarchial structuring of the pages. Above the wiki page, you can now see links that allow you to move forwards, backwards and up one level using those simple navigational links. '), array('title' => 'How to set your Wiki Homepage', 'description' => 'How to set a specific wikipage as home', 'edit' => 'This page will guide you through the process of defining a particular wikipage as you Wiki HomePage. ' . $tutorial_intro . ' !Where is the Wiki HomePage setting? ' . $admin_link . '__Wiki__ --> __Wiki Settings__ Clicking this link will take you to a page with a massive number of options. The one we are interested in, are all in the __Wiki Settings__ tab. The topmost setting is the one we want. The name of the page you enter here, will be the one tha is first shown when clicking on the __Wiki Home__ link in the ===Application Menu=== or the __Wiki__ link in the ===top bar menu===. '), array('title' => 'bitweaver Glossary', 'description' => 'Definition of Frequently used Terms', 'edit' => ';Package:A Package is a part of bitweaver that can manipulate, store and/or display information. Packages are always self-contained entities that can be installed, or uninstalled should require additional functionality. A list of currently available packages can be found on [http://www.bitweaver.org|bitweaver]. bitweaver differentiates between internal and foreign packages. Internal packages are packages that have been created inhouse and are meant to work with bitweaver from the ground up and will probably not work with any other application. a Foreign Package is usually a standalone application that has been modified in a way to fit into bitweaver. We try and keep these modifications to a minimum, allowing for easy upgrades to new versions. ;Plugin:Enable or disable pluggable features. These plugins are more powerful than regular features and usually allow manipulation of content. ;Feature:Packages usually contain various features that can be activated or deactivated. All these features can be set from the [' . KERNEL_PKG_URL . 'admin/index.php|Administration Screen]. The number of features can be daunting to begin with, but we are sure you will soon work out what they all do. most features have some short description of what you expect from the setting once turned on or off. ;Module:A module is one of the small boxes in one of the outer columns. You can select what modules and where you want to display these from the [' . KERNEL_PKG_URL . 'admin/index.php?page=layout|Layout Screen]. ;Group:In bitweaver groups are given permissions. You can then assign users to various groups. this makes it easy to allow a set of users to edit wiki pages but not edit blogs or vice versa. ;User:When a user registers with your site, that user is added to your database. every user has a defined set of permissions that allow them to access particular parts of your site. to manage these permissions, you have to first define groups and allocate permissions to them. ;Content:Content is any text that is intered into bitweaver that is stored in the central liberty tables. storing the content in one place makes it accesible from various different places allowing users to mix and match such content as they see fit. This makes it possible to easily display images in a wiki text or even display a blog post in an article since they are all considered to be the same. ')); foreach ($pageHash as $page) { // common settings for all of these pages $page['fSavePage'] = TRUE; $page['user_id'] = ROOT_USER_ID; $page['format_guid'] = 'tikiwiki'; $newPage = new BitPage(); if ($newPage->store($page)) { $pumpedData['Wiki'][] = $page['title']; } else { $error = $newPage->mErrors; $gBitSmarty->assign('error', $error); } }
if (!empty($chapterName)) { unset($params); unset($nodeHash); $nodeHash['parent_id'] = $structure_id; $nodeHash['root_structure_id'] = $structure_id; $nodeHash['level'] = 1; //try to add a new structure $nodePage = new BitPage(); $pageId = $nodePage->findByPageName($chapterName); if ($pageId) { $nodePage->mPageId = $pageId; $nodePage->load(); } else { $params['title'] = trim($chapterName); $params['edit'] = ''; if (!$nodePage->store($params)) { $gBitSystem->fatalError("There was an error storing the page: " . vc($gContent->mErrors)); } } $nodeHash['content_id'] = $nodePage->mContentId; $nodeHash['after_ref_id'] = $gStructure->storeNode($nodeHash); } } header("location: " . WIKI_PKG_URL . "edit_book.php?structure_id=" . $structure_id); } else { $gBitSmarty->assignByRef('errors', $gContent->mErrors); $gBitSmarty->assign('name', $_REQUEST['name']); $gBitSmarty->assign('chapters', $_REQUEST['chapters']); $mid = 'bitpackage:wiki/create_book.tpl'; } } elseif ($gContent->isValid()) {