From: <var...@us...> - 2009-06-04 17:08:36
|
Revision: 6898 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6898&view=rev Author: vargenau Date: 2009-06-04 17:08:33 +0000 (Thu, 04 Jun 2009) Log Message: ----------- Two new preferences: 1) get major modifications only; 2) do not get my own modifications Modified Paths: -------------- trunk/lib/MailNotify.php trunk/lib/WikiUserNew.php trunk/themes/default/templates/userprefs.tmpl Modified: trunk/lib/MailNotify.php =================================================================== --- trunk/lib/MailNotify.php 2009-06-04 16:49:55 UTC (rev 6897) +++ trunk/lib/MailNotify.php 2009-06-04 17:08:33 UTC (rev 6898) @@ -111,7 +111,37 @@ $emails = array(); $userids = array(); foreach ($notify as $page => $users) { if (glob_match($page, $this->pagename)) { + + global $request; + $curuser = $request->getUser(); + $curusername = $curuser->UserName(); + $curuserprefs = $curuser->getPreferences(); + $curuserprefsemail = $curuserprefs->get('email'); + $ownModifications = $curuserprefs->get('ownModifications'); + $majorModificationsOnly = $curuserprefs->get('majorModificationsOnly'); + foreach ($users as $userid => $user) { + + $usermail = $user['email']; + + if (($usermail == $curuserprefsemail) + and ($ownModifications)) { + // It's my own modification + // and I do not want to receive it + continue; + } + + if ($majorModificationsOnly) { + $backend = &$request->_dbi->_backend; + $version = $backend->get_latest_version($this->pagename); + $versiondata = $backend->get_versiondata($this->pagename, $version, true); + if ($versiondata['is_minor_edit']) { + // It's a minor modification + // and I do not want to receive it + continue; + } + } + if (!$user) { // handle the case for ModeratePage: // no prefs, just userid's. $emails[] = $this->userEmail($userid, false); Modified: trunk/lib/WikiUserNew.php =================================================================== --- trunk/lib/WikiUserNew.php 2009-06-04 16:49:55 UTC (rev 6897) +++ trunk/lib/WikiUserNew.php 2009-06-04 17:08:33 UTC (rev 6898) @@ -1941,6 +1941,8 @@ 'timeOffset' => new _UserPreference_numeric(TIMEOFFSET_DEFAULT_HOURS, TIMEOFFSET_MIN_HOURS, TIMEOFFSET_MAX_HOURS), + 'ownModifications' => new _UserPreference_bool(), + 'majorModificationsOnly' => new _UserPreference_bool(), 'relativeDates' => new _UserPreference_bool(), 'googleLink' => new _UserPreference_bool(), // 1.3.10 'doubleClickEdit' => new _UserPreference_bool(), // 1.3.11 Modified: trunk/themes/default/templates/userprefs.tmpl =================================================================== --- trunk/themes/default/templates/userprefs.tmpl 2009-06-04 16:49:55 UTC (rev 6897) +++ trunk/themes/default/templates/userprefs.tmpl 2009-06-04 17:08:33 UTC (rev 6898) @@ -29,6 +29,14 @@ else $timeOffsetInput = $pref->get('timeOffset'); +$OwnModificationsCB = HTML::input(array('type' => 'checkbox', + 'name' => 'pref[ownModifications]', + 'value' => '1', + 'checked' => (bool) $pref->get('ownModifications'))); +$MajorModificationsOnlyCB = HTML::input(array('type' => 'checkbox', + 'name' => 'pref[majorModificationsOnly]', + 'value' => '1', + 'checked' => (bool) $pref->get('majorModificationsOnly'))); $RelativeDatesCB = HTML::input(array('type' => 'checkbox', 'name' => 'pref[relativeDates]', 'value' => '1', @@ -169,6 +177,31 @@ <td><?=$pref->get('notifyPages')?></td><td></td> <?php } ?> </tr> + + <tr> + <td> + <p><?=_("Do not send my own modifications:")?></p> + </td> + <td> + <p><?= $OwnModificationsCB ?></p> + </td> + <td> + <p class="hint"><?=_("Check if you do not want to be notified of your own modifications.")?></p> + </td> + </tr> + + <tr> + <td> + <p><?=_("Do not send minor modifications:")?></p> + </td> + <td> + <p><?= $MajorModificationsOnlyCB ?></p> + </td> + <td> + <p class="hint"><?=_("Check if you do not want to be notified of minor modifications.")?></p> + </td> + </tr> + <?php } ?> <tr><td colspan="3"><h2><?=_("Appearance")?></h2></td></tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |