From: <var...@us...> - 2009-09-22 12:35:53
|
Revision: 7148 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7148&view=rev Author: vargenau Date: 2009-09-22 12:35:44 +0000 (Tue, 22 Sep 2009) Log Message: ----------- Add Gforge menu items preferences and page notification per project Modified Paths: -------------- trunk/lib/WikiUserNew.php Modified: trunk/lib/WikiUserNew.php =================================================================== --- trunk/lib/WikiUserNew.php 2009-09-21 12:20:37 UTC (rev 7147) +++ trunk/lib/WikiUserNew.php 2009-09-22 12:35:44 UTC (rev 7148) @@ -1,6 +1,7 @@ <?php //-*-php-*- rcs_id('$Id$'); /* Copyright (C) 2004,2005,2006,2007,2009 $ThePhpWikiProgrammingTeam + * Copyright (C) 2009 Marc-Etienne Vargenau, Alcatel-Lucent * * This file is part of PhpWiki. * @@ -1920,6 +1921,8 @@ */ class UserPreferences { + var $notifyPagesAll; + function UserPreferences($saved_prefs = false) { // userid stored too, to ensure the prefs are being loaded for // the correct (currently signing in) userid if stored in a @@ -1954,6 +1957,31 @@ 'googleLink' => new _UserPreference_bool(), // 1.3.10 'doubleClickEdit' => new _UserPreference_bool(), // 1.3.11 ); + + // This should be probably be done with $customUserPreferenceColumns + // For now, we use GFORGE define + if (defined('GFORGE') and GFORGE) { + $gforgeprefs = array( + 'pageTrail' => new _UserPreference_bool(), + 'diffMenuItem' => new _UserPreference_bool(), + 'pageInfoMenuItem' => new _UserPreference_bool(), + 'pdfMenuItem' => new _UserPreference_bool(), + 'lockMenuItem' => new _UserPreference_bool(), + 'chownMenuItem' => new _UserPreference_bool(), + 'setaclMenuItem' => new _UserPreference_bool(), + 'removeMenuItem' => new _UserPreference_bool(), + 'renameMenuItem' => new _UserPreference_bool(), + 'revertMenuItem' => new _UserPreference_bool(), + 'backLinksMenuItem' => new _UserPreference_bool(), + 'watchPageMenuItem' => new _UserPreference_bool(), + 'recentChangesMenuItem' => new _UserPreference_bool(), + 'randomPageMenuItem' => new _UserPreference_bool(), + 'likePagesMenuItem' => new _UserPreference_bool(), + 'specialPagesMenuItem' => new _UserPreference_bool(), + ); + $this->_prefs = array_merge($this->_prefs, $gforgeprefs); + } + // add custom theme-specific pref types: // FIXME: on theme changes the wiki_user session pref object will fail. // We will silently ignore this. @@ -2101,6 +2129,17 @@ $prefs['passwd'] = $value; } } + + if (defined('GFORGE') and GFORGE) { + // Merge current notifyPages with notifyPagesAll + // notifyPages are pages to notify in the current project + // while $notifyPagesAll is used to store all the monitored pages. + if (isset($prefs['notifyPages'])) { + $this->notifyPagesAll[PAGE_PREFIX] = $prefs['notifyPages']; + $prefs['notifyPages'] = @serialize($this->notifyPagesAll); + } + } + return $this->pack($prefs); } @@ -2139,6 +2178,21 @@ $prefs[$name] = $packed_pref; } } + + if (defined('GFORGE') and GFORGE) { + // Restore notifyPages from notifyPagesAll + // notifyPages are pages to notify in the current project + // while $notifyPagesAll is used to store all the monitored pages. + if (isset($prefs['notifyPages'])) { + $this->notifyPagesAll = $prefs['notifyPages']; + if (isset($this->notifyPagesAll[PAGE_PREFIX])) { + $prefs['notifyPages'] = $this->notifyPagesAll[PAGE_PREFIX]; + } else { + $prefs['notifyPages'] = ''; + } + } + } + return $prefs; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |