summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2005-08-24 21:00:26 +0000
committerMax Kremmel <xing@synapse.plus.com>2005-08-24 21:00:26 +0000
commit1b60aee645de67c474ce11b6e4db2c9ee36719ca (patch)
treeec578c7f094bfe298e39e36337f264aab77ccdb0
parentca7b77ea4f420c59e096aad4a5c5ae4865aee70c (diff)
downloadwiki-1b60aee645de67c474ce11b6e4db2c9ee36719ca.tar.gz
wiki-1b60aee645de67c474ce11b6e4db2c9ee36719ca.tar.bz2
wiki-1b60aee645de67c474ce11b6e4db2c9ee36719ca.zip
synch recent changes from R1 to HEAD
-rw-r--r--BitPage.php149
-rw-r--r--admin/admin_wiki_inc.php38
-rw-r--r--admin/schema_inc.php1
-rw-r--r--admin/upgrade_inc.php14
-rw-r--r--bit_setup_inc.php4
-rw-r--r--diff.php46
-rw-r--r--display_bitpage_inc.php36
-rw-r--r--edit.php123
-rw-r--r--lookup_page_inc.php7
-rw-r--r--templates/edit_page.tpl252
-rw-r--r--templates/page_icons.tpl8
11 files changed, 337 insertions, 341 deletions
diff --git a/BitPage.php b/BitPage.php
index c1e1c42..71b57b5 100644
--- a/BitPage.php
+++ b/BitPage.php
@@ -1,11 +1,11 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_wiki/BitPage.php,v 1.7 2005/08/07 17:46:49 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_wiki/BitPage.php,v 1.8 2005/08/24 21:00:26 squareing Exp $
* @package wiki
*
* @author spider <spider@steelsun.com>
*
- * @version $Revision: 1.7 $ $Date: 2005/08/07 17:46:49 $ $Author: squareing $
+ * @version $Revision: 1.8 $ $Date: 2005/08/24 21:00:26 $ $Author: squareing $
*
* Copyright (c) 2004 bitweaver.org
* Copyright (c) 2003 tikwiki.org
@@ -13,7 +13,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: BitPage.php,v 1.7 2005/08/07 17:46:49 squareing Exp $
+ * $Id: BitPage.php,v 1.8 2005/08/24 21:00:26 squareing Exp $
*/
/**
@@ -63,16 +63,20 @@ class BitPage extends LibertyAttachable {
if( $this->verifyId( $this->mPageId ) || $this->verifyId( $this->mContentId ) ) {
global $gBitSystem;
$lookupColumn = !empty( $this->mPageId )? 'page_id' : 'content_id';
- $lookupId = !empty( $this->mPageId )? $this->mPageId : $this->mContentId;
- $query = "select tp.*, tc.*, " .
- "uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name, " .
- "uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name " .
- "FROM `".BIT_DB_PREFIX."tiki_pages` tp " .
- "INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON (tc.`content_id` = tp.`content_id`) " .
- "LEFT JOIN `".BIT_DB_PREFIX."users_users` uue ON (uue.`user_id` = tc.`modifier_user_id`) " .
- "LEFT JOIN `".BIT_DB_PREFIX."users_users` uuc ON (uuc.`user_id` = tc.`user_id`) " .
- "WHERE tp.`$lookupColumn`=?";
- $result = $this->mDb->query( $query, array( $lookupId ) );
+
+ $bindVars = array(); $selectSql = ''; $joinSql = ''; $whereSql = '';
+ $this->getServicesSql( 'content_load_function', $selectSql, $joinSql, $whereSql, $bindVars );
+
+ array_push( $bindVars, $lookupId = !empty( $this->mPageId )? $this->mPageId : $this->mContentId );
+ $query = "select tp.*, tc.*,
+ 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."tiki_pages` tp
+ INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON (tc.`content_id` = tp.`content_id`) $joinSql
+ LEFT JOIN `".BIT_DB_PREFIX."users_users` uue ON (uue.`user_id` = tc.`modifier_user_id`)
+ LEFT JOIN `".BIT_DB_PREFIX."users_users` uuc ON (uuc.`user_id` = tc.`user_id`)
+ WHERE tp.`$lookupColumn`=? $whereSql";
+ $result = $this->mDb->query( $query, $bindVars );
if ( $result && $result->numRows() ) {
$this->mInfo = $result->fields;
@@ -228,26 +232,40 @@ class BitPage extends LibertyAttachable {
}
// check for name issues, first truncate length if too long
- if( !empty( $pParamHash['title']) || !empty($this->mPageName)) {
+ if( empty( $pParamHash['title'] ) ) {
+ $this->mErrors['title'] = 'You must specify a name';
+ }
+ elseif( !empty( $pParamHash['title']) || !empty($this->mPageName)) {
if( empty( $this->mPageId ) ) {
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 );
+ if ($gBitSystem->isFeatureActive( 'feature_allow_dup_wiki_page_names')) {
+ # silently allow pages with duplicate names to be created
+ }
+ else {
+ if( $this->pageExists( $pParamHash['title'] ) ) {
+ $this->mErrors['title'] = 'Page "'.$pParamHash['title'].'" already exists. Please choose a different name.';
+ }
+ }
}
} else {
$pParamHash['content_store']['title'] = ( isset( $pParamHash['title'] ) ) ? substr( $pParamHash['title'], 0, 160 ) : $this->mPageName;
-/* if( $gBitUser->hasPermission( 'bit_p_rename' ) && (isset( $this->mInfo['title'] ) && ($pParamHash['title'] != $this->mInfo['title'])) ) {
- if( $this->pageExists( $pParamHash['title'] ) ) {
- $this->mErrors['title'] = 'Page "'.$pParamHash['title'].'" already exists. Please choose a different name.';
- } else {
- $pParamHash['page_store']['title'] = substr( $pParamHash['title'], 0, 160 );
+ if ($gBitSystem->isFeatureActive( 'feature_allow_dup_wiki_page_names')) {
+ # silently allow pages with duplicate names to be created
+ }
+ else {
+ if( $gBitUser->hasPermission( 'bit_p_rename' )
+ && (isset( $this->mInfo['title'] )
+ && ($pParamHash['title'] != $this->mInfo['title'])) ) {
+ if( $this->pageExists( $pParamHash['title'] ) ) {
+ $this->mErrors['title'] = 'Page "'.$pParamHash['title'].'" already exists. Please choose a different name.';
+ }
+ }
}
-*/
}
- } elseif( empty( $pParamHash['title'] ) ) {
- // no name specified
- $this->mErrors['title'] = 'You must specify a name';
+
/* } elseif( !empty( $pParamHash['page'] ) && !empty( $pParamHash['newpage'] ) && ( $pParamHash['page'] != $pParamHash['newpage'] ) ) {
// check for rename, and rename it now if we can
if ($this->wiki_rename_page( $pParamHash['page'], $pParamHash['newpage'])) {
@@ -281,7 +299,7 @@ class BitPage extends LibertyAttachable {
/**
* Remove page from database
- */
+ */
function expunge() {
$ret = FALSE;
if( $this->isValid() ) {
@@ -435,7 +453,7 @@ class BitPage extends LibertyAttachable {
$pPageName = $this->mPageName;
}
$rewrite_tag = $gBitSystem->isFeatureActive( 'feature_pretty_urls_extended' ) ? 'view/':'';
- if ($gBitSystem->isFeatureActive( 'pretty_urls' )
+ if ($gBitSystem->isFeatureActive( 'pretty_urls' )
|| $gBitSystem->isFeatureActive( 'feature_pretty_urls_extended' ) ) {
$baseUrl = WIKI_PKG_URL . $rewrite_tag;
$baseUrl .= urlencode( $pPageName );
@@ -443,7 +461,7 @@ class BitPage extends LibertyAttachable {
else {
$baseUrl = WIKI_PKG_URL . 'index.php?page=';
$baseUrl .= urlencode( $pPageName );
- }
+ }
return $baseUrl;
}
@@ -586,7 +604,7 @@ class BitPage extends LibertyAttachable {
$res = $result->fetchRow();
$res['comment'] = 'Rollback to version '.$pVersion.' by '.$gBitUser->getDisplayName();
// JHT 2005-06-19_15:22:18
- // set ['force_history'] to
+ // set ['force_history'] to
// make sure we don't destory current content without leaving a copy in history
// if rollback can destroy the current page version, it can be used
// maliciously
@@ -783,50 +801,50 @@ class BitPage extends LibertyAttachable {
FROM `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON (tc.`content_id` = tp.`content_id`), `".BIT_DB_PREFIX."users_users` uue, `".BIT_DB_PREFIX."users_users` uuc
WHERE tc.`content_type_guid`=? AND tc.`modifier_user_id`=uue.`user_id` AND tc.`user_id`=uuc.`user_id` $mid
ORDER BY ".$this->mDb->convert_sortmode($sort_mode);
- $query_cant = "select count(*) from
- `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc
- ON (tc.`content_id` = tp.`content_id`)
+ $query_cant = "select count(*) from
+ `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc
+ ON (tc.`content_id` = tp.`content_id`)
WHERE tc.`content_type_guid`=? $mid";
if ($pOrphansOnly) {
- $query = "SELECT
- uue.`login` AS modifier_user,
- uue.`real_name` AS modifier_real_name,
- uuc.`login` AS creator_user,
+ $query = "SELECT
+ uue.`login` AS modifier_user,
+ uue.`real_name` AS modifier_real_name,
+ uuc.`login` AS creator_user,
uuc.`real_name` AS creator_real_name ,
- `page_id`,
- `hits`,
- `page_size` as `len`,
- tc.`title`,
- tc.`format_guid`,
- tp.`description`,
- tc.`last_modified`,
- tc.`created`,
- `ip`,
- `comment`,
- `version`,
- `flag`,
+ `page_id`,
+ `hits`,
+ `page_size` as `len`,
+ tc.`title`,
+ tc.`format_guid`,
+ tp.`description`,
+ tc.`last_modified`,
+ tc.`created`,
+ `ip`,
+ `comment`,
+ `version`,
+ `flag`,
tp.`content_id`
- FROM `".BIT_DB_PREFIX."tiki_pages` tp
- LEFT JOIN `".BIT_DB_PREFIX."tiki_links` tl ON tp.`content_id` = tl.`to_content_id`
- INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc
+ FROM `".BIT_DB_PREFIX."tiki_pages` tp
+ LEFT JOIN `".BIT_DB_PREFIX."tiki_links` tl ON tp.`content_id` = tl.`to_content_id`
+ INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc
ON (tc.`content_id` = tp.`content_id`),
- `".BIT_DB_PREFIX."users_users` uue,
+ `".BIT_DB_PREFIX."users_users` uue,
`".BIT_DB_PREFIX."users_users` uuc
- WHERE tc.`content_type_guid`=?
- AND tc.`modifier_user_id`=uue.`user_id`
+ WHERE tc.`content_type_guid`=?
+ AND tc.`modifier_user_id`=uue.`user_id`
AND tc.`user_id`=uuc.`user_id` $mid
AND tl.`to_content_id` is NULL
ORDER BY "
. $this->mDb->convert_sortmode($sort_mode);
- $query_cant = "select count(*)
- FROM `".BIT_DB_PREFIX."tiki_pages` tp
- LEFT JOIN `".BIT_DB_PREFIX."tiki_links` tl on tp.`content_id` = tl.`to_content_id`
- INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc
+ $query_cant = "select count(*)
+ FROM `".BIT_DB_PREFIX."tiki_pages` tp
+ LEFT JOIN `".BIT_DB_PREFIX."tiki_links` tl on tp.`content_id` = tl.`to_content_id`
+ INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc
ON (tc.`content_id` = tp.`content_id`)
- WHERE tc.`content_type_guid`=?
+ WHERE tc.`content_type_guid`=?
AND tl.`to_content_id` is NULL";
- }
+ }
// If sort mode is versions then offset is 0, maxRecords is -1 (again) and sort_mode is nil
@@ -1157,17 +1175,20 @@ class WikiLib extends BitPage {
}
function wiki_get_link_structure($page, $level) {
- $query = "select `to_page` from `".BIT_DB_PREFIX."tiki_links` where `from_page`=?";
+ $query = "select tc2.`title` from `".BIT_DB_PREFIX."tiki_links` tl
+ INNER JOIN tiki_content tc1 ON tc1.`content_id` = tl.`from_content_id`
+ INNER JOIN tiki_content tc2 ON tc2.`content_id` = tl.`to_content_id`
+ WHERE tc1.`title`=?";
$result = $this->mDb->query($query,array($page));
$aux['pages'] = array();
$aux['name'] = $page;
while ($res = $result->fetchRow()) {
if ($level) {
- $aux['pages'][] = $this->wiki_get_link_structure($res['to_page'], $level - 1);
+ $aux['pages'][] = $this->wiki_get_link_structure($res['title'], $level - 1);
} else {
- $inner['name'] = $res['to_page'];
- $inner['pages'] = array();
- $aux['pages'][] = $inner;
+ $inner['name'] = $res['title'];
+ $inner['pages'] = array();
+ $aux['pages'][] = $inner;
}
}
return $aux;
@@ -1604,7 +1625,7 @@ class WikiLib extends BitPage {
/**
* the wikilib class
- * @global WikiLib $wikilib
+ * @global WikiLib $wikilib
*/
global $wikilib;
// Perhaps someone overrode the wikilib class to do there own magic, and have alread instantiated...
diff --git a/admin/admin_wiki_inc.php b/admin/admin_wiki_inc.php
index 55ff2b7..5a8db54 100644
--- a/admin/admin_wiki_inc.php
+++ b/admin/admin_wiki_inc.php
@@ -1,5 +1,5 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_wiki/admin/admin_wiki_inc.php,v 1.4 2005/08/07 17:46:50 squareing Exp $
+// $Header: /cvsroot/bitweaver/_bit_wiki/admin/admin_wiki_inc.php,v 1.5 2005/08/24 21:00:26 squareing Exp $
// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
@@ -64,7 +64,7 @@ $formWikiLists = array(
$gBitSmarty->assign( 'formWikiLists',$formWikiLists );
if (isset($_REQUEST["wikilistconf"])) {
-
+
foreach( $formWikiLists as $item => $data ) {
simple_set_toggle( $item );
}
@@ -79,6 +79,10 @@ $formWikiFeatures = array(
'label' => 'Like Pages',
'note' => 'Display a list of pages that have a common word in the names.',
),
+ "feature_allow_dup_wiki_page_names" => array(
+ 'label' => 'Allow Duplicate Page Names',
+ 'note' => 'Allow Wiki Pages with dupliczte page names',
+ ),
"feature_history" => array(
'label' => 'History',
'note' => 'Allow access to the page\'s history.',
@@ -135,7 +139,7 @@ $formWikiFeatures = array(
$gBitSmarty->assign( 'formWikiFeatures',$formWikiFeatures );
if (isset($_REQUEST["wikifeatures"])) {
-
+
foreach( $formWikiFeatures as $item => $data ) {
simple_set_toggle( $item,'wiki' );
}
@@ -217,7 +221,7 @@ $formWikiInOut = array(
$gBitSmarty->assign( 'formWikiInOut',$formWikiInOut );
if (isset($_REQUEST["wikiinout"])) {
-
+
foreach( $formWikiInOut as $item => $data ) {
simple_set_toggle( $item,'wiki' );
}
@@ -240,11 +244,15 @@ $formWikiBooks = array(
'label' => 'Use navigation icons instead of words',
'note' => 'This option will remove the names of the navigation controls and replace them with appropriate icons for navigation. This can be useful if you feel that navigation is too cluttered when showing that many words.',
),
+ "wikibook_hide_add_content" => array(
+ 'label' => 'Hide Edit "Structure Content"',
+ 'note' => 'Hide the tabbed panel to add content to the structure. This might be hidden for performance reasons.',
+ ),
);
$gBitSmarty->assign( 'formWikiBooks',$formWikiBooks );
if (isset($_REQUEST["wikibooks"])) {
-
+
foreach( $formWikiBooks as $item => $data ) {
simple_set_toggle( $item,'wiki' );
}
@@ -267,20 +275,20 @@ $formWikiWatch = array(
$gBitSmarty->assign( 'formWikiWatch',$formWikiWatch );
if (isset($_REQUEST["wikiwatch"])) {
-
+
foreach( $formWikiWatch as $item => $data ) {
simple_set_toggle( $item,'wiki' );
}
}
if (isset($_REQUEST["dump"])) {
-
+
include (UTIL_PKG_PATH."tar.class.php");
error_reporting (E_ERROR | E_WARNING);
$wikilib->dumpPages();
}
if (isset($_REQUEST["createtag"])) {
-
+
// Check existance
if ($adminlib->tag_exists($_REQUEST["tagname"])) {
$gBitSmarty->assign('msg', tra("Tag already exists"));
@@ -290,7 +298,7 @@ if (isset($_REQUEST["createtag"])) {
$adminlib->create_tag($_REQUEST["tagname"]);
}
if (isset($_REQUEST["restoretag"])) {
-
+
// Check existance
if (!$adminlib->tag_exists($_REQUEST["restagname"])) {
$gBitSmarty->assign('msg', tra("Tag not found"));
@@ -300,17 +308,17 @@ if (isset($_REQUEST["restoretag"])) {
$adminlib->restore_tag($_REQUEST["restagname"]);
}
if (isset($_REQUEST["removetag"])) {
-
+
// Check existance
$adminlib->remove_tag($_REQUEST["remtagname"]);
}
if (isset($_REQUEST["setwikihome"])) {
-
+
$gBitSystem->storePreference('wikiHomePage', $_REQUEST["wikiHomePage"]);
$gBitSmarty->assign('wikiHomePage', $_REQUEST["wikiHomePage"]);
}
if (isset($_REQUEST["wikidiscussprefs"])) {
-
+
if (isset($_REQUEST["feature_wiki_discuss"])) {
$gBitSystem->storePreference('feature_wiki_discuss', 'y');
$gBitSmarty->assign('feature_wiki_discuss', 'y');
@@ -327,14 +335,14 @@ if (isset($_REQUEST["wikidiscussprefs"])) {
}
}
if (isset($_REQUEST["setwikiregex"])) {
-
+
$gBitSystem->storePreference('wiki_page_regex', $_REQUEST["wiki_page_regex"]);
$gBitSmarty->assign( 'wiki_page_regex', $_REQUEST["wiki_page_regex"] );
} else {
$gBitSmarty->assign( 'wiki_page_regex', $gBitSystem->getPreference( 'wiki_page_regex', 'strict' ) );
}
if (isset($_REQUEST["wikisetprefs"])) {
-
+
if (isset($_REQUEST["maxVersions"])) {
$gBitSystem->storePreference("maxVersions", $_REQUEST["maxVersions"]);
}
@@ -344,7 +352,7 @@ if (isset($_REQUEST["wikisetprefs"])) {
}
}
if (isset($_REQUEST["wikisetcopyright"])) {
-
+
simple_set_toggle( 'wiki_feature_copyrights','wiki' );
if (isset($_REQUEST["wikiLicensePage"])) {
$gBitSystem->storePreference("wikiLicensePage", $_REQUEST["wikiLicensePage"]);
diff --git a/admin/schema_inc.php b/admin/schema_inc.php
index ed99dad..31252d3 100644
--- a/admin/schema_inc.php
+++ b/admin/schema_inc.php
@@ -162,6 +162,7 @@ $gBitInstaller->registerPreferences( WIKI_PKG_NAME, array(
array(WIKI_PKG_NAME, 'feature_history','y'),
array(WIKI_PKG_NAME, 'feature_lastChanges','y'),
array(WIKI_PKG_NAME, 'feature_likePages','y'),
+ array(WIKI_PKG_NAME, 'feature_allow_dup_wiki_page_names','y'),
array(WIKI_PKG_NAME, 'feature_listPages','y'),
array(WIKI_PKG_NAME, 'feature_page_title','y'),
array(WIKI_PKG_NAME, 'feature_ranking','n'),
diff --git a/admin/upgrade_inc.php b/admin/upgrade_inc.php
index 60fd508..b6f52f0 100644
--- a/admin/upgrade_inc.php
+++ b/admin/upgrade_inc.php
@@ -31,8 +31,7 @@ array( 'RENAMECOLUMN' => array(
),
'tiki_actionlog' => array( '`lastModif`' => '`last_modified` I8' ),
'tiki_history' => array( '`lastModif`' => '`last_modified` I8' ),
- 'tiki_copyrights' => array( // '`userName`' => '`user_name` C(200)',
- '`copyrightId`' => '`copyright_id` I4 AUTO' ),
+ 'tiki_copyrights' => array( '`copyrightId`' => '`copyright_id` I4 AUTO' ),
'tiki_extwiki' => array( '`extwikiId`' => '`extwiki_id` I4 AUTO' ),
'tiki_semaphores' => array( '`semName`' => '`sem_name` C(250)',
'`timestamp`' => '`created` I8' ),
@@ -44,6 +43,10 @@ array( 'ALTER' => array(
'tiki_pages' => array(
'content_id' => array( '`content_id`', 'I4' ), // , 'NOTNULL' ),
),
+ 'tiki_copyrights' => array(
+ 'user_id' => array( '`user_id`', 'I4' ), // , 'NOTNULL' ),
+ 'page_id' => array( '`page_id`', 'I4' ), // , 'NOTNULL' ),
+ ),
'tiki_page_footnotes' => array(
'user_id' => array( '`user_id`', 'I4' ), // , 'NOTNULL' ),
'page_id' => array( '`page_id`', 'I4' ), // , 'NOTNULL' ),
@@ -121,6 +124,9 @@ array( 'QUERY' =>
"UPDATE `".BIT_DB_PREFIX."tiki_structures` SET `content_id`= (SELECT `content_id` FROM `".BIT_DB_PREFIX."tiki_pages` tp WHERE tp.`page_id`=`".BIT_DB_PREFIX."tiki_structures`.`page_id`)",
"UPDATE `".BIT_DB_PREFIX."tiki_semaphores` SET `user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."tiki_semaphores`.`user`)",
"UPDATE `".BIT_DB_PREFIX."tiki_semaphores` SET `user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."tiki_semaphores`.`user`)",
+ "UPDATE `".BIT_DB_PREFIX."tiki_copyrights` SET `page_id`= (SELECT `page_id` FROM `".BIT_DB_PREFIX."tiki_pages` tp WHERE tp.`pageName`=`".BIT_DB_PREFIX."tiki_copyrights`.`page`)",
+ "UPDATE `".BIT_DB_PREFIX."tiki_copyrights` SET `user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."tiki_copyrights`.`userName`)",
+ "UPDATE `".BIT_DB_PREFIX."tiki_copyrights` SET `user_id`=".ROOT_USER_ID." WHERE `user_id` IS NULL",
"UPDATE `".BIT_DB_PREFIX."tiki_page_footnotes` SET `page_id`= (SELECT `page_id` FROM `".BIT_DB_PREFIX."tiki_pages` tp WHERE tp.`pageName`=`".BIT_DB_PREFIX."tiki_page_footnotes`.`pageName`)",
"UPDATE `".BIT_DB_PREFIX."tiki_page_footnotes` SET `user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."tiki_page_footnotes`.`user`)",
"UPDATE `".BIT_DB_PREFIX."tiki_page_footnotes` SET `user_id`=".ROOT_USER_ID." WHERE `user_id` IS NULL",
@@ -228,6 +234,7 @@ array( 'DATADICT' => array(
array( 'DROPCOLUMN' => array(
'tiki_pages' => array( '`lastModif`', '`data`', '`pageName`', '`ip`', '`hits`', '`user`', '`creator`' ),
'tiki_semaphores' => array( '`user`' ),
+ 'tiki_copyrights' => array( '`userName`', '`page`' ),
'tiki_page_footnotes' => array( '`user`', '`pageName`' ),
'tiki_actionlog' => array( '`user`', '`pageName`' ),
'tiki_history' => array( '`user`', '`pageName`' ),
@@ -240,6 +247,9 @@ array( 'DATADICT' => array(
array( 'DATADICT' => array(
array( 'CREATEINDEX' => array(
'tiki_actlog_page_idx' => array( 'tiki_actionlog', '`page_id`', array() ),
+ 'tiki_copyrights_page_idx' => array( 'tiki_copyrights', '`page_id`', array() ),
+ 'tiki_copyrights_user_idx' => array( 'tiki_copyrights', '`user_id`', array() ),
+ 'tiki_copyrights_up_idx' => array( 'tiki_copyrights', '`user_id`,`page_id`', array( 'UNIQUE' ) ),
'tiki_footnotes_page_idx' => array( 'tiki_page_footnotes', '`page_id`', array() ),
'tiki_footnotes_user_idx' => array( 'tiki_page_footnotes', '`user_id`', array() ),
'tiki_footnotes_up_idx' => array( 'tiki_page_footnotes', '`user_id`,`page_id`', array( 'UNIQUE' ) ),
diff --git a/bit_setup_inc.php b/bit_setup_inc.php
index 60307a6..552f36d 100644
--- a/bit_setup_inc.php
+++ b/bit_setup_inc.php
@@ -5,7 +5,9 @@
define('BITPAGE_CONTENT_TYPE_GUID', 'bitpage' );
if($gBitSystem->isPackageActive( 'wiki' ) ) {
- $gBitSystem->registerAppMenu( 'wiki', 'Wiki', WIKI_PKG_URL.'index.php', 'bitpackage:wiki/menu_wiki.tpl', 'wiki');
+ if ($gBitUser->hasPermission( 'bit_p_view' )) {
+ $gBitSystem->registerAppMenu( 'wiki', 'Wiki', WIKI_PKG_URL.'index.php', 'bitpackage:wiki/menu_wiki.tpl', 'wiki');
+ }
$gBitSystem->registerNotifyEvent( array( "wiki_page_changes" => tra("Any wiki page is changed") ) );
diff --git a/diff.php b/diff.php
index 0f8f83b..6aa8424 100644
--- a/diff.php
+++ b/diff.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_wiki/Attic/diff.php,v 1.2 2005/06/28 07:46:27 spiderr Exp $
+ * $Header: /cvsroot/bitweaver/_bit_wiki/Attic/diff.php,v 1.3 2005/08/24 21:00:26 squareing Exp $
*
* A PHP diff engine for phpwiki.
*
@@ -10,7 +10,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: diff.php,v 1.2 2005/06/28 07:46:27 spiderr Exp $
+ * $Id: diff.php,v 1.3 2005/08/24 21:00:26 squareing Exp $
* @package wiki
*/
@@ -47,6 +47,15 @@ class _WikiDiffEngine
$n_from = sizeof($from_lines);
$n_to = sizeof($to_lines);
$endskip = 0;
+ // Ignore differences in line endings
+ for ($i = 0; $i < $n_from; $i++)
+ {
+ $from_lines[$i] = rtrim($from_lines[$i]);
+ }
+ for ($i = 0; $i < $n_to; $i++)
+ {
+ $to_lines[$i] = rtrim($to_lines[$i]);
+ }
// Ignore trailing and leading matching lines.
while ($n_from > 0 && $n_to > 0)
{
@@ -766,7 +775,7 @@ class WikiDiffFormatter
}
function format ($diff, $from_lines)
{
- $html = '<table bgcolor="black" ' .
+ $html = '<table style="background-color: black" ' .
'cellspacing="2" cellpadding="2" border="0"><br />';
$html .= $this->_format($diff->edits, $from_lines);
$html .= "</table>\n";
@@ -863,14 +872,14 @@ class WikiDiffFormatter
reset($lines);
while (list ($junk, $line) = each($lines))
{
- $html .= "<tr bgcolor=\"$color\"><td><tt>$prefix</tt>";
+ $html .= "<tr style=\"background-color: $color\"><td><tt>$prefix</tt>";
$html .= "<tt>" . htmlspecialchars($line) . "</tt></td></tr>\n";
}
return $html;
}
function _emit_diff ($xbeg,$xlen,$ybeg,$ylen,$hunks)
{
- $html = '<tr><td><table bgcolor="white"'
+ $html = '<tr><td><table style="background-color: white"'
. ' cellspacing="0" border="0" cellpadding="4"><br />'
. '<tr bgcolor="#cccccc"><td><tt>'
. $this->_diff_header($xbeg, $xlen, $ybeg, $ylen)
@@ -880,8 +889,8 @@ class WikiDiffFormatter
'a' => $this->adds_prefix,
'd' => $this->deletes_prefix);
$color = array('c' => '#ffffff',
- 'a' => '#ffcccc',
- 'd' => '#ccffcc');
+ 'a' => '#ccffcc',
+ 'd' => '#ffcccc');
for (reset($hunks); $hunk = current($hunks); next($hunks))
{
if (!empty($hunk['c']))
@@ -889,10 +898,10 @@ class WikiDiffFormatter
$this->context_prefix, '#ffffff');
if (!empty($hunk['d']))
$html .= $this->_emit_lines($hunk['d'],
- $this->deletes_prefix, '#ccffcc');
+ $this->deletes_prefix, '#ffcccc');
if (!empty($hunk['a']))
$html .= $this->_emit_lines($hunk['a'],
- $this->adds_prefix, '#ffcccc');
+ $this->adds_prefix, '#ccffcc');
}
$html .= "</table></td></tr></table></td></tr>\n";
return $html;
@@ -998,4 +1007,21 @@ if ($diff)
htmlspecialchars($pagename)), 0);
}
*/
-?> \ No newline at end of file
+
+
+ // \todo remove html hardcoded in diff2
+ function diff2($page1, $page2) {
+ $page1 = split("\n", $page1);
+ $page2 = split("\n", $page2);
+ $z = new WikiDiff($page1, $page2);
+ if ($z->isEmpty()) {
+ $html = '<hr><br />[' . tra("Versions are identical"). ']<br /><br />';
+ } else {
+ //$fmt = new WikiDiffFormatter;
+ $fmt = new WikiUnifiedDiffFormatter;
+ $html = $fmt->format($z, $page1);
+ }
+ return $html;
+ }
+
+?>
diff --git a/display_bitpage_inc.php b/display_bitpage_inc.php
index f11fd14..91aab29 100644
--- a/display_bitpage_inc.php
+++ b/display_bitpage_inc.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_wiki/display_bitpage_inc.php,v 1.5 2005/08/01 18:42:04 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_wiki/display_bitpage_inc.php,v 1.6 2005/08/24 21:00:26 squareing Exp $
*
* Copyright (c) 2004 bitweaver.org
* Copyright (c) 2003 tikwiki.org
@@ -8,7 +8,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: display_bitpage_inc.php,v 1.5 2005/08/01 18:42:04 squareing Exp $
+ * $Id: display_bitpage_inc.php,v 1.6 2005/08/24 21:00:26 squareing Exp $
* @package wiki
* @subpackage functions
*/
@@ -18,10 +18,6 @@
*/
include_once( WIKI_PKG_PATH.'BitBook.php');
-if (defined("CATEGORIES_PKG_PATH")) {
- include_once( CATEGORIES_PKG_PATH.'categ_lib.php');
-}
-
$gBitSystem->verifyPackage( 'wiki' );
$gBitSystem->verifyPermission( 'bit_p_view' );
@@ -31,6 +27,9 @@ if( !$gContent->isValid() ) {
$gBitSystem->fatalError( 'Page cannot be found' );
}
+$displayHash = array( 'perm_name' => 'bit_p_view' );
+$gContent->invokeServices( 'content_display_function', $displayHash );
+
/*
$gBitSmarty->assign('structure','n');
//Has a structure page been requested
@@ -92,7 +91,7 @@ if(!in_array($gContent->mInfo['title'],$_SESSION["breadCrumb"])) {
}
//print_r($_SESSION["breadCrumb"]);
// Now increment page hits since we are visiting this page
-if($count_admin_pvs == 'y' || !$gBitUser->isAdmin()) {
+if( $gBitSystem->isFeatureActive( 'count_admin_pvs' ) || !$gBitUser->isAdmin() ) {
$gContent->addHit();
}
// Check if we have to perform an action for this page
@@ -106,7 +105,7 @@ if( isset( $_REQUEST["action"] ) && (($_REQUEST["action"] == 'lock' || $_REQUEST
// Save to notepad if user wants to
if( $gBitSystem->isPackageActive( 'notepad' ) && $gBitUser->isValid() && $gBitUser->hasPermission( 'bit_p_notepad' ) && isset($_REQUEST['savenotepad'])) {
-
+
require_once( NOTEPAD_PKG_PATH.'notepad_lib.php' );
$notepadlib->replace_note( $user, 0, $gContent->mPageName, $gContent->mInfo['data'] );
}
@@ -122,7 +121,7 @@ if($gBitUser->hasPermission( 'bit_p_admin_wiki' )) {
}
// Process an undo here
if(isset($_REQUEST["undo"])) {
-
+
if($gBitUser->hasPermission( 'bit_p_admin_wiki' ) || ($gContent->mInfo["flag"]!='L' && ( ($gBitUser->hasPermission( 'bit_p_edit' ) && $gContent->mInfo["user"]==$user)||($bit_p_remove=='y')) )) {
// Remove the last version
$gContent->removeLastVersion();
@@ -148,7 +147,7 @@ if ($wiki_uses_slides == 'y') {
$gBitSmarty->assign('show_slideshow','n');
}
if(isset($_REQUEST['refresh'])) {
-
+
$wikilib->invalidate_cache($gContent->mInfo['title']);
}
// Here's where the data is parsed
@@ -221,14 +220,14 @@ if( $gBitSystem->isFeatureActive( 'feature_wiki_comments' ) ) {
$section='wiki';
if( $gBitSystem->isFeatureActive( 'feature_wiki_attachments' ) ) {
if(isset($_REQUEST["removeattach"])) {
-
+
$owner = $wikilib->get_attachment_owner($_REQUEST["removeattach"]);
if( ($user && ($owner == $user) ) || ($gBitUser->hasPermission( 'bit_p_wiki_admin_attachments' )) ) {
$wikilib->remove_wiki_attachment($_REQUEST["removeattach"]);
}
}
if(isset($_REQUEST["attach"]) && ($gBitUser->hasPermission( 'bit_p_wiki_admin_attachments' ) || $gBitUser->hasPermission( 'bit_p_wiki_attach_files' ))) {
-
+
// Process an attachment here
if(isset($_FILES['userfile1'])&&is_uploaded_file($_FILES['userfile1']['tmp_name'])) {
$fp = fopen($_FILES['userfile1']['tmp_name'],"rb");
@@ -280,7 +279,7 @@ if( $gBitSystem->isFeatureActive( 'wiki_feature_copyrights' ) ) {
$gBitSmarty->assign('wiki_extras','y');
if( $gBitSystem->isFeatureActive( 'feature_theme_control' ) ) {
- $cat_type=BITPAGE_CONTENT_TYPE_GUID;
+ $cat_obj_type=BITPAGE_CONTENT_TYPE_GUID;
$cat_objid = $gContent->mContentId;
include( THEMES_PKG_PATH.'tc_inc.php' );
}
@@ -325,17 +324,6 @@ if(isset($_REQUEST['mode']) && $_REQUEST['mode']=='mobile') {
include_once( HAWHAW_PKG_PATH."hawtiki_lib.php" );
HAWBIT_index($gContent->mInfo);
}
-if( $gBitSystem->isPackageActive( 'categories' ) ) {
- // Check to see if page is categorized
- $cat_objid = $gContent->mContentId;
- $cat_obj_type = BITPAGE_CONTENT_TYPE_GUID;
- include_once( CATEGORIES_PKG_PATH.'categories_display_inc.php' );
-}
-
-// get the pigeonholes info
-if( $gBitSystem->isPackageActive( 'pigeonholes' ) ) {
- include_once( PIGEONHOLES_PKG_PATH.'get_pigeonholes_info_inc.php' );
-}
// Flag for 'page bar' that currently 'Page view' mode active
// so it is needed to show comments & attachments panels
diff --git a/edit.php b/edit.php
index ec448ed..3beea5e 100644
--- a/edit.php
+++ b/edit.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_wiki/edit.php,v 1.7 2005/08/11 13:03:48 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_wiki/edit.php,v 1.8 2005/08/24 21:00:26 squareing Exp $
*
* Copyright (c) 2004 bitweaver.org
* Copyright (c) 2003 tikwiki.org
@@ -8,7 +8,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: edit.php,v 1.7 2005/08/11 13:03:48 squareing Exp $
+ * $Id: edit.php,v 1.8 2005/08/24 21:00:26 squareing Exp $
* @package wiki
* @subpackage functions
*/
@@ -28,6 +28,11 @@ include( WIKI_PKG_PATH.'lookup_page_inc.php' );
// Get plugins with descriptions
global $wikilib, $gLibertySystem;
+#edit preview needs this
+if (!isset($_REQUEST['title']) && isset($gContent->mInfo['title'])) {
+ $_REQUEST['title'] = $gContent->mInfo['title'];
+}
+
$sandbox = FALSE;
if ( (!empty($_REQUEST['page']) && $_REQUEST['page'] == 'SandBox') ||
(!empty($_REQUEST['title']) && $_REQUEST['title'] == 'SandBox') ) {
@@ -83,7 +88,7 @@ function walk_and_parse(&$c, &$src, &$p)
switch ($c[$i]["data"]["name"])
{
case "br": $src .= "\n"; break;
- case "title"; $src .= "\n!"; $p['stack'][] = array('tag' => 'title', 'string' => "\n"); break;
+ case "title": $src .= "\n!"; $p['stack'][] = array('tag' => 'title', 'string' => "\n"); break;
case "p": $src .= "\n"; $p['stack'][] = array('tag' => 'p', 'string' => "\n"); break;
case "b": $src .= '__'; $p['stack'][] = array('tag' => 'b', 'string' => '__'); break;
case "i": $src .= "''"; $p['stack'][] = array('tag' => 'i', 'string' => "''"); break;
@@ -253,7 +258,7 @@ if ($gBitSystem->isFeatureActive( 'feature_wiki_footnotes' ) ) {
$gBitSmarty->assign('has_footnote', 'y');
$gBitSmarty->assign('parsed_footnote', $wikilib->parseData($footnote));
if (isset($_REQUEST['footnote'])) {
-
+
$gBitSmarty->assign('parsed_footnote', $wikilib->parseData($_REQUEST['footnote']));
$gBitSmarty->assign('footnote', $_REQUEST['footnote']);
$gBitSmarty->assign('has_footnote', 'y');
@@ -284,45 +289,7 @@ if (isset($_REQUEST["comment"])) {
$formInfo['comment'] = $_REQUEST["comment"];
}
-$cat_type = BITPAGE_CONTENT_TYPE_GUID;
-
-if(isset($_REQUEST["preview"])) {
- if ($gBitSystem->isPackageActive( 'categories' ) && isset( $_REQUEST['cat_categories'] ) ) {
- $cat_objid = $gContent->mContentId;
- include_once( CATEGORIES_PKG_PATH.'categorize_list_inc.php' );
- foreach( $categories['data'] as $key => $cat ) {
- foreach( $_REQUEST['cat_categories'] as $rCat ) {
- if( $cat['category_id'] == $rCat ) {
- $categories['data'][$key]['incat'] = 'y';
- }
- }
- }
- }
-
- // get files from all packages that process this data further
- foreach( $gBitSystem->getPackageIntegrationFiles( 'form_processor_inc.php', TRUE ) as $package => $file ) {
- if( $gBitSystem->isPackageActive( $package ) ) {
- include_once( $file );
- }
- }
-
- $gBitSmarty->assign('preview',1);
- $gBitSmarty->assign('title',!empty($_REQUEST["title"])?$_REQUEST["title"]:$gContent->mPageName);
-
- $parsed = $gContent->parseData($formInfo['edit'], (!empty( $_REQUEST['format_guid'] ) ? $_REQUEST['format_guid'] :
- ( isset($gContent->mInfo['format_guid']) ? $gContent->mInfo['format_guid'] : 'tikiwiki' ) ) );
- /* SPELLCHECKING INITIAL ATTEMPT */
- //This nice function does all the job!
- if ($wiki_spellcheck == 'y') {
- if (isset($_REQUEST["spellcheck"]) && $_REQUEST["spellcheck"] == 'on') {
- $parsed = $gBitSystem->spellcheckreplace($edit_data, $parsed, $gBitLanguage->mLanguage, 'editwiki');
- $gBitSmarty->assign('spellcheck', 'y');
- } else {
- $gBitSmarty->assign('spellcheck', 'n');
- }
- }
- $gBitSmarty->assign_by_ref('parsed', $parsed);
-}
+$cat_obj_type = BITPAGE_CONTENT_TYPE_GUID;
if( $gBitSystem->isFeatureActive( 'wiki_feature_copyrights' ) ) {
if (isset($_REQUEST['copyrightTitle'])) {
@@ -375,7 +342,7 @@ if (isset($_REQUEST["fCancel"])) {
}
die;
} elseif (isset($_REQUEST["fSavePage"])) {
-
+
// Check if all Request values are delivered, and if not, set them
// to avoid error messages. This can happen if some features are
// disabled
@@ -415,28 +382,6 @@ if (isset($_REQUEST["fCancel"])) {
}
if( $gContent->store( $_REQUEST ) ) {
- if( $gBitSystem->isPackageActive( 'categories' ) ) {
- $cat_objid = $gContent->mContentId;
- $cat_obj_type = 'bitpage';
- $cat_desc = ($gBitSystem->isFeatureActive( 'feature_wiki_description' ) && !empty( $_REQUEST["description"] )) ? substr($_REQUEST["description"],0,200) : '';
- $cat_name = $gContent->mPageName;
- $cat_href = WIKI_PKG_URL."index.php?content_id=".$cat_objid;
- include_once( CATEGORIES_PKG_PATH.'categorize_inc.php' );
- }
- // nexus menu item storage
- if( $gBitSystem->isPackageActive( 'nexus' ) && $gBitUser->hasPermission( 'bit_p_insert_nexus_item' ) ) {
- $nexusHash['title'] = ( isset( $_REQUEST['title'] ) ? $_REQUEST['title'] : NULL );
- $nexusHash['hint'] = ( isset( $_REQUEST['description'] ) ? $_REQUEST['description'] : NULL );
- include_once( NEXUS_PKG_PATH.'insert_menu_item_inc.php' );
- }
-
- // get files from all packages that process this data further
- foreach( $gBitSystem->getPackageIntegrationFiles( 'form_processor_inc.php', TRUE ) as $package => $file ) {
- if( $gBitSystem->isPackageActive( $package ) ) {
- include_once( $file );
- }
- }
-
if ( $gBitSystem->isFeatureActive( 'wiki_watch_author' ) ) {
$gBitUser->storeWatch( "wiki_page_changed", $gContent->mPageId, $gContent->mContentTypeGuid, $_REQUEST['title'], $gContent->getDisplayUrl() );
}
@@ -456,26 +401,27 @@ if ($gBitSystem->isFeatureActive( 'feature_wiki_templates' ) && $gBitUser->hasPe
}
$gBitSmarty->assign_by_ref('templates', $templates["data"]);
-// External Packages
-// Categories
-if ($gBitSystem->isPackageActive( 'categories' ) ) {
- $cat_objid = $gContent->mContentId;
- include_once( CATEGORIES_PKG_PATH.'categorize_list_inc.php' );
-}
+if(isset($_REQUEST["preview"])) {
+ $gBitSmarty->assign('preview',1);
+ $gBitSmarty->assign('title',!empty($_REQUEST["title"])?$_REQUEST["title"]:$gContent->mPageName);
-// get files from all packages that process this data further
-foreach( $gBitSystem->getPackageIntegrationFiles( 'get_form_info_inc.php', TRUE ) as $package => $file ) {
- if( $gBitSystem->isPackageActive( $package ) ) {
- include_once( $file );
+ $parsed = $gContent->parseData($formInfo['edit'], (!empty( $_REQUEST['format_guid'] ) ? $_REQUEST['format_guid'] :
+ ( isset($gContent->mInfo['format_guid']) ? $gContent->mInfo['format_guid'] : 'tikiwiki' ) ) );
+ /* SPELLCHECKING INITIAL ATTEMPT */
+ //This nice function does all the job!
+ if ($wiki_spellcheck == 'y') {
+ if (isset($_REQUEST["spellcheck"]) && $_REQUEST["spellcheck"] == 'on') {
+ $parsed = $gBitSystem->spellcheckreplace($edit_data, $parsed, $gBitLanguage->mLanguage, 'editwiki');
+ $gBitSmarty->assign('spellcheck', 'y');
+ } else {
+ $gBitSmarty->assign('spellcheck', 'n');
+ }
}
-}
-
-// assign the integration template files
-$gBitSmarty->assign( 'integrationFiles', $gBitSystem->getPackageIntegrationFiles( 'templates/form_info_inc.tpl', TRUE ) );
+ $gBitSmarty->assign_by_ref('parsed', $parsed);
-// Nexus menus
-if( $gBitSystem->isPackageActive( 'nexus' ) && $gBitUser->hasPermission( 'bit_p_insert_nexus_item' ) ) {
- include_once( NEXUS_PKG_PATH.'insert_menu_item_inc.php' );
+ $gContent->invokeServices( 'content_preview_function' );
+} else {
+ $gContent->invokeServices( 'content_edit_function' );
}
// Configure quicktags list
@@ -490,16 +436,11 @@ if ($gBitSystem->isFeatureActive( 'feature_theme_control' ) ) {
if( $gContent->isInStructure() ) {
$gBitSmarty->assign('showstructs', $gContent->getStructures() );
}
+
// Flag for 'page bar' that currently 'Edit' mode active
// so no need to show comments & attachments, but need
// to show 'wiki quick help'
$gBitSmarty->assign('edit_page', 'y');
-// Set variables so the preview page will keep the newly inputted category information
-if (isset($_REQUEST['cat_categorize'])) {
- if ($_REQUEST['cat_categorize'] == 'on') {
- $gBitSmarty->assign('categ_checked', 'y');
- }
-}
// WYSIWYG and Quicktag variable
$gBitSmarty->assign( 'textarea_id', 'editwiki' );
@@ -508,6 +449,10 @@ $gBitSmarty->assign( 'textarea_id', 'editwiki' );
if( empty( $formInfo ) ) {
$formInfo = &$gContent->mInfo;
}
+
+// make original page title available for template
+$formInfo['original_title'] = (!empty($gContent->mInfo['title'])) ? $gContent->mInfo['title'] : "" ;
+
$gBitSmarty->assign_by_ref( 'pageInfo', $formInfo );
$gBitSmarty->assign_by_ref( 'errors', $gContent->mErrors );
$gBitSmarty->assign( (!empty( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : 'body').'TabSelect', 'tdefault' );
diff --git a/lookup_page_inc.php b/lookup_page_inc.php
index 75e16a9..e826296 100644
--- a/lookup_page_inc.php
+++ b/lookup_page_inc.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_wiki/lookup_page_inc.php,v 1.3 2005/08/01 18:42:04 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_wiki/lookup_page_inc.php,v 1.4 2005/08/24 21:00:26 squareing Exp $
*
* Copyright (c) 2004 bitweaver.org
* Copyright (c) 2003 tikwiki.org
@@ -8,7 +8,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: lookup_page_inc.php,v 1.3 2005/08/01 18:42:04 squareing Exp $
+ * $Id: lookup_page_inc.php,v 1.4 2005/08/24 21:00:26 squareing Exp $
* @package wiki
* @subpackage functions
*/
@@ -99,7 +99,8 @@
}
if (isset($_SESSION["edit_lock"])) {
- $gBitUser->expungeSemaphore($purlquery["page"], $_SESSION["edit_lock"]);
+ // TODO - find out if this function is supposed to exist - wolff_borg
+ //$gBitUser->expungeSemaphore($purlquery["page"], $_SESSION["edit_lock"]);
}
}
diff --git a/templates/edit_page.tpl b/templates/edit_page.tpl
index c489279..2e39e99 100644
--- a/templates/edit_page.tpl
+++ b/templates/edit_page.tpl
@@ -1,35 +1,37 @@
-{* $Header: /cvsroot/bitweaver/_bit_wiki/templates/edit_page.tpl,v 1.7 2005/08/11 13:03:48 squareing Exp $ *}
+{* $Header: /cvsroot/bitweaver/_bit_wiki/templates/edit_page.tpl,v 1.8 2005/08/24 21:00:26 squareing Exp $ *}
<div class="floaticon">{bithelp}</div>
-<div class="admin wiki">
+{assign var=serviceEditTpls value=$gLibertySystem->getServiceValues('content_edit_tpl')}
+
+<div class="edit wiki">
<div class="header">
<h1>
- {* this weird dual assign thing is cause smarty wont interpret backticks to object in assign tag - spiderr *}
- {assign var=conDescr value=$gContent->mType.content_description}
- {if $pageInfo.page_id}
- {assign var=editLabel value="{tr}Edit{/tr} $conDescr"}
- {tr}{tr}Edit{/tr} {$pageInfo.title}{/tr}
- {else}
- {assign var=editLabel value="{tr}Create{/tr} $conDescr"}
- {tr}{$editLabel}{/tr}
- {/if}
+ {* this weird dual assign thing is cause smarty wont interpret backticks to object in assign tag - spiderr *}
+ {assign var=conDescr value=$gContent->mType.content_description}
+ {if $pageInfo.page_id}
+ {assign var=editLabel value="{tr}Edit{/tr} $conDescr"}
+ {tr}{tr}Edit{/tr} {$pageInfo.original_title}{/tr}
+ {else}
+ {assign var=editLabel value="{tr}Create{/tr} $conDescr"}
+ {tr}{$editLabel}{/tr}
+ {/if}
</h1>
</div>
{* Check to see if there is an editing conflict *}
{if $errors.edit_conflict}
- <script language="javascript" type="text/javascript">
- <!--
+ <script type="text/javascript">
+ //<![CDATA[
alert( "{$errors.edit_conflict|strip_tags}" );
- -->
+ //]]>
</script>
{formfeedback warning=`$errors.edit_conflict`}
{/if}
- {strip}
+{strip}
<div class="body">
{if $preview}
- <h2>Preview {$title}</h2>
+ <h2>{tr}Preview {$title}{/tr}</h2>
<div class="preview">
{include file="bitpackage:wiki/page_header.tpl"}
{include file="bitpackage:wiki/page_display.tpl"}
@@ -82,6 +84,8 @@
</div>
{/if}
+ {include file="bitpackage:liberty/edit_format.tpl"}
+
{if $gBitSystem->isPackageActive( 'smileys' )}
{include file="bitpackage:smileys/smileys_full.tpl"}
{/if}
@@ -116,6 +120,10 @@
</div>
{/if}
+ {if $serviceEditTpls.access_control }
+ {include file=$serviceEditTpls.access_control"}
+ {/if}
+
{if $gBitUser->hasPermission( 'bit_p_minor' )}
<div class="row">
{formlabel label="Minor save" for="isminor"}
@@ -126,7 +134,6 @@
</div>
{/if}
-
<div class="row submit">
<input type="submit" name="fCancel" value="{tr}Cancel{/tr}" />&nbsp;
<input type="submit" name="preview" value="{tr}Preview{/tr}" />&nbsp;
@@ -139,20 +146,14 @@
{/legend}
{/jstab}
- {if $gBitSystem->isPackageActive( 'categories' )}
+ {if $serviceEditTpls.categorization }
{jstab title="Categorize"}
{legend legend="Categorize"}
- {include file="bitpackage:categories/categorize.tpl"}
+ {include file=$serviceEditTpls.categorization"}
{/legend}
{/jstab}
{/if}
- {foreach from=$integrationFiles item=file key=package}
- {if $gBitSystem->isPackageActive( $package )}
- {include file=$file}
- {/if}
- {/foreach}
-
{if $gBitSystem->isFeatureActive( 'feature_wiki_attachments' ) && $show_attachments eq 'y' && $gBitUser->hasPermission('bit_p_content_attachments')}
{jstab title="Attachments"}
{legend legend="Attachments"}
@@ -161,129 +162,128 @@
{/jstab}
{/if}
- {jstab title="Advanced Options"}
- {legend legend="Advanced Options"}
- {include file="bitpackage:liberty/edit_format.tpl"}
+ {if $gBitSystem->isFeatureActive( 'feature_wiki_icache' ) or $serviceEditTpls.menu or $wiki_spellcheck eq 'y'}
+ {jstab title="Advanced"}
+ {legend legend="Advanced Options"}
+ {if $wiki_spellcheck eq 'y'}
+ <div class="row">
+ {formlabel label="Spellcheck" for="spellcheck"}
+ {forminput}
+ <input type="checkbox" name="spellcheck" id="spellcheck" {if $spellcheck eq 'y'}checked="checked"{/if} />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+ {/if}
- {if $gBitSystem->isFeatureActive( 'wiki_feature_copyrights' )}
- <div class="row">
- {formlabel label="Copyright" for="copyrightTitle"}
- {forminput}
- <div class="row">
- {formlabel label="Title" for="copyrightTitle"}
- {forminput}
- <input size="40" type="text" name="copyrightTitle" id="copyrightTitle" value="{$copyrightTitle|escape}" />
- {/forminput}
- </div>
+ {if $gBitSystem->isFeatureActive( 'feature_wiki_icache' )}
+ <div class="row">
+ {formlabel label="Cache" for="wiki_cache"}
+ {forminput}
+ <select name="wiki_cache" id="wiki_cache">
+ <option value="0" {if $wiki_cache eq 0}selected="selected"{/if}>{tr}0 (no cache){/tr}</option>
+ <option value="60" {if $wiki_cache eq 60}selected="selected"{/if}>{tr}1 minute{/tr}</option>
+ <option value="300" {if $wiki_cache eq 300}selected="selected"{/if}>{tr}5 minutes{/tr}</option>
+ <option value="600" {if $wiki_cache eq 600}selected="selected"{/if}>{tr}10 minutes{/tr}</option>
+ <option value="900" {if $wiki_cache eq 900}selected="selected"{/if}>{tr}15 minutes{/tr}</option>
+ <option value="1800" {if $wiki_cache eq 1800}selected="selected"{/if}>{tr}30 minutes{/tr}</option>
+ <option value="3600" {if $wiki_cache eq 3600}selected="selected"{/if}>{tr}1 hour{/tr}</option>
+ <option value="7200" {if $wiki_cache eq 7200}selected="selected"{/if}>{tr}2 hours{/tr}</option>
+ </select>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+ {/if}
+ {/legend}
- <div class="row">
- {formlabel label="Authors" for="copyrightAuthors"}
- {forminput}
- <input size="40" type="text" name="copyrightAuthors" id="copyrightAuthors" value="{$copyrightAuthors|escape}" />
- {/forminput}
- </div>
+ {if $serviceEditTpls.menu}
+ {legend legend="Insert Link in Menu"}
+ {include file=$serviceEditTpls.menu"}
+ {/legend}
+ {/if}
+ {/jstab}
+ {/if}
+
+ {if $gBitSystem->isFeatureActive( 'wiki_feature_copyrights' )}
+ {jstab title="Copyright"}
+ <div class="row">
+ {legend legend="Copyright Settings" for="copyrightTitle"}
+ <div class="row">
+ {formlabel label="Title" for="copyrightTitle"}
+ {forminput}
+ <input size="40" type="text" name="copyrightTitle" id="copyrightTitle" value="{$copyrightTitle|escape}" />
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Authors" for="copyrightAuthors"}
+ {forminput}
+ <input size="40" type="text" name="copyrightAuthors" id="copyrightAuthors" value="{$copyrightAuthors|escape}" />
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Year" for="copyrightYear"}
+ {forminput}
+ <input size="4" type="text" name="copyrightYear" id="copyrightYear" value="{$copyrightYear|escape}" />
+ {/forminput}
+ </div>
+ <div class="row">
+ {formlabel label="License"}
+ {forminput}
+ <a href="{$smarty.const.WIKI_PKG_URL}index.php?page={$wikiLicensePage}">{tr}{$wikiLicensePage}{/tr}</a>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ {if $wikiSubmitNotice neq ""}
<div class="row">
- {formlabel label="Year" for="copyrightYear"}
+ {formlabel label="Important"}
{forminput}
- <input size="4" type="text" name="copyrightYear" id="copyrightYear" value="{$copyrightYear|escape}" />
+ {$wikiSubmitNotice}
+ {formhelp note=""}
{/forminput}
</div>
- {/forminput}
- </div>
- {/if}
+ {/if}
+ {/legend}
+ </div>
+ {/jstab}
+ {/if}
- {if $wiki_spellcheck eq 'y'}
+ {if $gBitSystem->isFeatureActive( 'feature_wiki_url_import' )}
+ {jstab title="Import HMTL"}
+ {legend legend="Import HMTL"}
<div class="row">
- {formlabel label="Spellcheck" for="spellcheck"}
+ {formlabel label="Import HTML from URL" for="suck_url"}
{forminput}
- <input type="checkbox" name="spellcheck" id="spellcheck" {if $spellcheck eq 'y'}checked="checked"{/if} />
+ <input type="text" size="50" name="suck_url" id="suck_url" value="{$suck_url|escape}" />
{formhelp note=""}
{/forminput}
</div>
- {/if}
- {if $gBitSystem->isFeatureActive( 'feature_wiki_icache' )}
<div class="row">
- {formlabel label="Cache" for="wiki_cache"}
+ {formlabel label="Try to convert HTML to wiki" for="parsehtml"}
{forminput}
- <select name="wiki_cache" id="wiki_cache">
- <option value="0" {if $wiki_cache eq 0}selected="selected"{/if}>{tr}0 (no cache){/tr}</option>
- <option value="60" {if $wiki_cache eq 60}selected="selected"{/if}>{tr}1 minute{/tr}</option>
- <option value="300" {if $wiki_cache eq 300}selected="selected"{/if}>{tr}5 minutes{/tr}</option>
- <option value="600" {if $wiki_cache eq 600}selected="selected"{/if}>{tr}10 minutes{/tr}</option>
- <option value="900" {if $wiki_cache eq 900}selected="selected"{/if}>{tr}15 minutes{/tr}</option>
- <option value="1800" {if $wiki_cache eq 1800}selected="selected"{/if}>{tr}30 minutes{/tr}</option>
- <option value="3600" {if $wiki_cache eq 3600}selected="selected"{/if}>{tr}1 hour{/tr}</option>
- <option value="7200" {if $wiki_cache eq 7200}selected="selected"{/if}>{tr}2 hours{/tr}</option>
- </select>
+ <input type="checkbox" name="parsehtml" id="parsehtml" {if $parsehtml eq 'y'}checked="checked"{/if} />
{formhelp note=""}
{/forminput}
</div>
- {/if}
- {if $wiki_feature_copyrights eq 'y'}
- <div class="row">
- {formlabel label="License"}
- {forminput}
- <a href="{$smarty.const.WIKI_PKG_URL}index.php?page={$wikiLicensePage}">{tr}{$wikiLicensePage}{/tr}</a>
- {formhelp note=""}
- {/forminput}
- </div>
+ {* SPIDERKILL - disable wiki Import
+ {if $gBitUser->hasPermission( 'bit_p_admin_wiki' )}
+ <tr><td>
+ {tr}Import file{/tr}:</td><td>
+ <input name="userfile1" type="file" />
+ { * <a href="{$smarty.const.WIKI_PKG_URL}export_wiki_pages.php?page_id={$pageInfo.page_id}&amp;all=1">{tr}export all versions{/tr}</a> * }
+ </td></tr>
+ {/if} { * end upload file row * }
+ *}
- {if $wikiSubmitNotice neq ""}
- <div class="row">
- {formlabel label="Important"}
- {forminput}
- {$wikiSubmitNotice}
- {formhelp note=""}
- {/forminput}
- </div>
- {/if}
- {/if}
- {/legend}
-
- {if $gBitSystem->isPackageActive( 'nexus' )}
- {legend legend="Insert Link in Menu"}
- {include file="bitpackage:nexus/insert_menu_item_inc.tpl"}
+ <div class="row submit">
+ <input type="submit" name="do_suck" value="{tr}Import{/tr}" />
+ </div>
{/legend}
- {/if}
- {/jstab}
-
- {if $gBitSystem->isFeatureActive( 'feature_wiki_url_import' )}
- {jstab title="Import HMTL"}
- {legend legend="Import HMTL"}
- <div class="row">
- {formlabel label="Import HTML from URL" for="suck_url"}
- {forminput}
- <input type="text" size="50" name="suck_url" id="suck_url" value="{$suck_url|escape}" />
- {formhelp note=""}
- {/forminput}
- </div>
-
- <div class="row">
- {formlabel label="Try to convert HTML to wiki" for="parsehtml"}
- {forminput}
- <input type="checkbox" name="parsehtml" id="parsehtml" {if $parsehtml eq 'y'}checked="checked"{/if} />
- {formhelp note=""}
- {/forminput}
- </div>
-
- {* SPIDERKILL - disable wiki Import
- {if $gBitUser->hasPermission( 'bit_p_admin_wiki' )}
- <tr><td>
- {tr}Import file{/tr}:</td><td>
- <input name="userfile1" type="file" />
- { * <a href="{$smarty.const.WIKI_PKG_URL}export_wiki_pages.php?page_id={$pageInfo.page_id}&amp;all=1">{tr}export all versions{/tr}</a> * }
- </td></tr>
- {/if} { * end upload file row * }
- *}
-
- <div class="row submit">
- <input type="submit" name="do_suck" value="{tr}Import{/tr}" />
- </div>
- {/legend}
- {/jstab}
+ {/jstab}
{/if}
{/jstabs}
{/form}
diff --git a/templates/page_icons.tpl b/templates/page_icons.tpl
index a7bd839..e4a4b80 100644
--- a/templates/page_icons.tpl
+++ b/templates/page_icons.tpl
@@ -43,13 +43,7 @@
{if $gBitUser->hasPermission( 'bit_p_print' )}
<a title="{tr}print{/tr}" style="display:none;" href="{$smarty.const.WIKI_PKG_URL}print.php?{if $structureInfo.root_structure_id}structure_id={$structureInfo.root_structure_id}{else}page_id={$pageInfo.page_id}{/if}">{biticon ipackage=liberty iname="print" iexplain="print"}</a>
{/if}
- {if $gBitSystem->isPackageActive( 'pdf' ) && $gContent->hasUserPermission( 'bit_p_pdf_generation' )}
- {if $structureInfo.root_structure_id}
- <a title="{tr}create PDF{/tr}" href="{$smarty.const.PDF_PKG_URL}?structure_id={$structureInfo.root_structure_id}">{biticon ipackage="pdf" iname="pdf" iexplain="PDF"}</a>
- {else}
- <a title="{tr}create PDF{/tr}" href="{$smarty.const.PDF_PKG_URL}?content_id={$pageInfo.content_id}">{biticon ipackage="pdf" iname="pdf" iexplain="PDF"}</a>
- {/if}
- {/if}
+ {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='icon'}
{if $user and $gBitSystem->isPackageActive( 'notepad' ) and $gBitUser->hasPermission( 'bit_p_notepad' )}
<a title="{tr}Save{/tr}" href="{$smarty.const.WIKI_PKG_URL}index.php?page_id={$pageInfo.page_id}&amp;savenotepad=1">{biticon ipackage="wiki" iname="save" iexplain="save"}</a>
{/if}