From: <ru...@us...> - 2008-11-19 08:53:10
|
Revision: 6347 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6347&view=rev Author: rurban Date: 2008-11-19 08:53:06 +0000 (Wed, 19 Nov 2008) Log Message: ----------- add new feature ENABLE_PAGE_PUBLIC Modified Paths: -------------- trunk/config/config-default.ini trunk/config/config-dist.ini trunk/lib/IniConfig.php trunk/lib/editpage.php trunk/themes/default/templates/editpage.tmpl Modified: trunk/config/config-default.ini =================================================================== --- trunk/config/config-default.ini 2008-11-18 10:43:26 UTC (rev 6346) +++ trunk/config/config-default.ini 2008-11-19 08:53:06 UTC (rev 6347) @@ -33,6 +33,7 @@ ; UNITS_EXE = /usr/bin/units ENABLE_SEARCHHIGHLIGHT = true ENABLE_RECENTCHANGESBOX = false +ENABLE_PAGE_PUBLIC = false WIKI_NAME = PhpWiki ENABLE_REVERSE_DNS = true Modified: trunk/config/config-dist.ini =================================================================== --- trunk/config/config-dist.ini 2008-11-18 10:43:26 UTC (rev 6346) +++ trunk/config/config-dist.ini 2008-11-19 08:53:06 UTC (rev 6347) @@ -161,6 +161,11 @@ ; Default: false ;ENABLE_RECENTCHANGESBOX = true +; You can enable an admin checkbox to set a "public" page attribute, to +; be used by external tools to generate a seperate public wiki. +; Default: false +;ENABLE_PAGE_PUBLIC = true + ;========================================================================== ; Part One: Authentication and security settings. ; Modified: trunk/lib/IniConfig.php =================================================================== --- trunk/lib/IniConfig.php 2008-11-18 10:43:26 UTC (rev 6346) +++ trunk/lib/IniConfig.php 2008-11-19 08:53:06 UTC (rev 6347) @@ -201,7 +201,7 @@ 'ENABLE_MARKUP_DIVSPAN', 'USE_BYTEA', 'UPLOAD_USERDIR', 'DISABLE_UNITS', 'ENABLE_SEARCHHIGHLIGHT', 'DISABLE_UPLOAD_ONLY_ALLOWED_EXTENSIONS', 'ENABLE_AUTH_OPENID', 'INSECURE_ACTIONS_LOCALHOST_ONLY', - 'ENABLE_MAILNOTIFY', 'ENABLE_RECENTCHANGESBOX' + 'ENABLE_MAILNOTIFY', 'ENABLE_RECENTCHANGESBOX', 'ENABLE_PAGE_PUBLIC' ); $rs = @parse_ini_file($file); Modified: trunk/lib/editpage.php =================================================================== --- trunk/lib/editpage.php 2008-11-18 10:43:26 UTC (rev 6346) +++ trunk/lib/editpage.php 2008-11-19 08:53:06 UTC (rev 6347) @@ -233,19 +233,35 @@ } function updateLock() { - if ((bool)$this->page->get('locked') == (bool)$this->locked) - return false; // Not changed. + $changed = false; + if (!ENABLE_PAGE_PUBLIC) { + if ((bool)$this->page->get('locked') == (bool)$this->locked) + return false; // Not changed. + } if (!$this->user->isAdmin()) { // FIXME: some sort of message return false; // not allowed. } - $this->page->set('locked', (bool)$this->locked); - $this->tokens['LOCK_CHANGED_MSG'] - = $this->locked ? _("Page now locked.") : _("Page now unlocked."); + if (ENABLE_PAGE_PUBLIC) { + if ((bool)$this->page->get('public') != (bool)$this->public) { + $this->page->set('public', (bool)$this->public); + $this->tokens['LOCK_CHANGED_MSG'] + = ($this->public + ? _("Page now public.") + : _("Page now not-public.")) . " "; + $changed = true; + } - return true; // lock changed. + $this->page->set('locked', (bool)$this->locked); + $this->tokens['LOCK_CHANGED_MSG'] + .= $this->locked + ? _("Page now locked.") + : _("Page now unlocked."); + $changed = true; + } + return $changed; // lock changed. } function savePage () { @@ -654,6 +670,14 @@ 'disabled' => (bool) !$this->user->isadmin(), 'checked' => (bool) $this->locked)); + if (ENABLE_PAGE_PUBLIC) { + $el['PUBLIC_CB'] + = HTML::input(array('type' => 'checkbox', + 'name' => 'edit[public]', + 'id' => 'edit-public', + 'disabled' => (bool) !$this->user->isAdmin(), + 'checked' => (bool) $this->page->get('public'))); + } if (ENABLE_WYSIWYG) { if (($this->version == 0) and ($request->getArg('mode') != 'wysiwyg')) { $el['WYSIWYG_B'] = Button(array("action" => "edit", "mode" => "wysiwyg"), "Wysiwyg Editor"); @@ -746,6 +770,8 @@ $this->meta = array_merge($this->meta, $meta); $this->locked = !empty($posted['locked']); + if (ENABLE_PAGE_PUBLIC) + $this->public = !empty($posted['public']); foreach (array('preview','save','edit_convert', 'keep_old','overwrite','diff','upload') as $o) Modified: trunk/themes/default/templates/editpage.tmpl =================================================================== --- trunk/themes/default/templates/editpage.tmpl 2008-11-18 10:43:26 UTC (rev 6346) +++ trunk/themes/default/templates/editpage.tmpl 2008-11-19 08:53:06 UTC (rev 6347) @@ -60,12 +60,11 @@ <tr valign="middle"> <td> <?=$MINOR_EDIT_CB ?> <label for="edit-minor_edit"><?=_("This is a minor change.")?></label><br /> - <?=$OLD_MARKUP_CB?> <label for="useOldMarkup"><?=_("Use old markup")?></label> <?=$OLD_MARKUP_CONVERT?> + <?=$OLD_MARKUP_CB ?> <label for="useOldMarkup"><?=_("Use old markup")?></label> <?=$OLD_MARKUP_CONVERT?> </td> <td align="center"> <?php if (!empty($WYSIWYG_B)){ ?> - <?=$WYSIWYG_B?> - <?=$SEP?> + <?=$WYSIWYG_B?><?=$SEP?> <?php } ?> <?= $PREVIEW_B ?> <?php if ($SAVE_B) { ?> @@ -78,8 +77,10 @@ <tr> <td> <?php if ($user->isAdmin()) { ?> - <?= $LOCKED_CB ?> <label for="edit-locked"><?=_("Locked")?></label> - <?php } ?> + <?= $LOCKED_CB ?> <label for="edit-locked" title="<?=_("Make the page read-only?")?>"><?=_("Locked")?></label> + <?php if (ENABLE_PAGE_PUBLIC) { ?> + <?= $PUBLIC_CB ?> <label for="edit-public" title="<?=_("Export to a seperate public area?")?>"><?=_("Public")?></label> + <?php }} ?> </td> <td colspan="2" align="right"> <?php if (!$user->isAuthenticated()) { ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |