Skip to content

Commit

Permalink
Fixed wording and spacing, updated URL in README
Browse files Browse the repository at this point in the history
Change-Id: Iaa04d4552140e6e669caf024c9bb912506ad109d
  • Loading branch information
yaronkoren committed Nov 15, 2012
1 parent 18f93db commit 66657f2
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 105 deletions.
17 changes: 10 additions & 7 deletions README
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
These is the readme file for the Semantic Watchlist extension.

Extension page on mediawiki.org: http://www.mediawiki.org/wiki/Extension:SemanticWatchlist
Latest version of the readme file: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticWatchlist/README?view=co
This is the README file for the Semantic Watchlist extension.

Extension page on mediawiki.org:
http://www.mediawiki.org/wiki/Extension:SemanticWatchlist
Latest version of the README file:
https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/SemanticWatchlist.git;a=blob;f=README

== About ==

Semantic Watchlist enables users to watch semantic properties by adding a new
watchlist page (Special:SemanticWatchlist) that lists changes to these properties.
watchlist page (Special:SemanticWatchlist) that lists changes to these
properties.
Users can choose to follow one or more watchlist groups, which are administrator
defined, and cover a set of properties and a set of pages (category, namespace,
or SMW concept). Notification of changes to watched properties is also possible
via email.
via email.

=== Feature overview ===

Expand All @@ -20,4 +23,4 @@ via email.
groups they want to follow, and if they want to receive emails on changes.
* Special:WatchListConditions as administration interface for watchlist groups.
* API module to query property changes grouped by edit for a single user.
* API modules to add, modify and delete the watchlist groups.
* API modules to add, modify and delete the watchlist groups.
24 changes: 12 additions & 12 deletions includes/SWL_CustomTexts.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public function __construct( SWLGroup $group ) {
$this->group = $group;
}

/**
/**
* Sets an array of CustomTexts by reading from the db
* for this group.
*
* @since 0.2
*/
*
* @since 0.2
*/
protected function initCustomTexts() {
if( !is_null( $this->customTexts ) ) {
return;
Expand All @@ -63,17 +63,17 @@ protected function initCustomTexts() {
}
}

/**
* Returns an array of CustomTexts set by the admin in WatchlistConditions
/**
* Returns an array of CustomTexts set by the admin in WatchlistConditions
* for this group and property.
*
* @since 0.2
*
* @param SMWDIProperty $property
* @param String $newValue
*
* @since 0.2
*
* @param SMWDIProperty $property
* @param String $newValue
*
* @return String or false
*/
*/
public function getPropertyCustomText( SMWDIProperty $property, $newValue ) {
$this->initCustomTexts();
if( array_key_exists( $property->getLabel(), $this->customTexts ) && array_key_exists( $newValue, $this->customTexts[$property->getLabel()] ) ) {
Expand Down
172 changes: 86 additions & 86 deletions includes/SWL_Emailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,92 +13,92 @@
*/
final class SWLEmailer {

/**
* Notifies a single user of the changes made to properties in a single edit.
*
* @since 0.1
*
* @param SWLGroup $group
* @param User $user
* @param SWLChangeSet $changeSet
* @param boolean $describeChanges
*
* @return Status
*/
public static function notifyUser( SWLGroup $group, User $user, SWLChangeSet $changeSet, $describeChanges ) {
global $wgLang, $wgPasswordSender, $wgPasswordSenderName;

$emailText = wfMsgExt(
'swl-email-propschanged-long',
'parse',
$GLOBALS['wgSitename'],
$changeSet->getEdit()->getUser()->getName(),
SpecialPage::getTitleFor( 'SemanticWatchlist' )->getFullURL(),
$wgLang->time( $changeSet->getEdit()->getTime() ),
$wgLang->date( $changeSet->getEdit()->getTime() )
);

if ( $describeChanges ) {
$emailText .= '<h3> ' . wfMsgExt(
'swl-email-changes',
'parse',
$changeSet->getEdit()->getTitle()->getFullText(),
$changeSet->getEdit()->getTitle()->getFullURL()
) . ' </h3>';

$emailText .= self::getChangeListHTML( $changeSet, $group );
}

$title = wfMsgReal(
'swl-email-propschanged',
array( $changeSet->getEdit()->getTitle()->getFullText() ),
true,
$user->getOption( 'language' )
);

wfRunHooks( 'SWLBeforeEmailNotify', array( $group, $user, $changeSet, $describeChanges, &$title, &$emailText ) );

return UserMailer::send(
new MailAddress( $user ),
new MailAddress( $wgPasswordSender, $wgPasswordSenderName ),
$title,
$emailText,
null,
'text/html; charset=ISO-8859-1'
);
}

/**
* Creates and returns the HTML representatation of the change set.
*
* @since 0.1
*
* @param SWLChangeSet $changeSet
* @param SWLGroup $group
*
* @return string
*/
protected static function getChangeListHTML( SWLChangeSet $changeSet, SWLGroup $group ) {
$propertyHTML = array();
/**
* Notifies a single user of the changes made to properties in a single edit.
*
* @since 0.1
*
* @param SWLGroup $group
* @param User $user
* @param SWLChangeSet $changeSet
* @param boolean $describeChanges
*
* @return Status
*/
public static function notifyUser( SWLGroup $group, User $user, SWLChangeSet $changeSet, $describeChanges ) {
global $wgLang, $wgPasswordSender, $wgPasswordSenderName;

$emailText = wfMsgExt(
'swl-email-propschanged-long',
'parse',
$GLOBALS['wgSitename'],
$changeSet->getEdit()->getUser()->getName(),
SpecialPage::getTitleFor( 'SemanticWatchlist' )->getFullURL(),
$wgLang->time( $changeSet->getEdit()->getTime() ),
$wgLang->date( $changeSet->getEdit()->getTime() )
);

if ( $describeChanges ) {
$emailText .= '<h3> ' . wfMsgExt(
'swl-email-changes',
'parse',
$changeSet->getEdit()->getTitle()->getFullText(),
$changeSet->getEdit()->getTitle()->getFullURL()
) . ' </h3>';

$emailText .= self::getChangeListHTML( $changeSet, $group );
}

$title = wfMsgReal(
'swl-email-propschanged',
array( $changeSet->getEdit()->getTitle()->getFullText() ),
true,
$user->getOption( 'language' )
);

wfRunHooks( 'SWLBeforeEmailNotify', array( $group, $user, $changeSet, $describeChanges, &$title, &$emailText ) );

return UserMailer::send(
new MailAddress( $user ),
new MailAddress( $wgPasswordSender, $wgPasswordSenderName ),
$title,
$emailText,
null,
'text/html; charset=ISO-8859-1'
);
}

/**
* Creates and returns the HTML representation of the change set.
*
* @since 0.1
*
* @param SWLChangeSet $changeSet
* @param SWLGroup $group
*
* @return string
*/
protected static function getChangeListHTML( SWLChangeSet $changeSet, SWLGroup $group ) {
$propertyHTML = array();
$customTexts = new SWLCustomTexts( $group );
foreach ( $changeSet->getAllProperties() as /* SMWDIProperty */ $property ) {
$propertyHTML[] = self::getPropertyHTML( $property, $changeSet->getAllPropertyChanges( $property ), $customTexts );
}

return implode( '', $propertyHTML );
}

/**
* Creates and returns the HTML representatation of the property and it's changes.
*
* @since 0.1
*
* @param SMWDIProperty $property
* @param array $changes
* @param SWLCustomTexts $customTexts
* @return string
*/
protected static function getPropertyHTML( SMWDIProperty $property, array $changes, $customTexts ) {
foreach ( $changeSet->getAllProperties() as /* SMWDIProperty */ $property ) {
$propertyHTML[] = self::getPropertyHTML( $property, $changeSet->getAllPropertyChanges( $property ), $customTexts );
}

return implode( '', $propertyHTML );
}

/**
* Creates and returns the HTML representation of the property and it's changes.
*
* @since 0.1
*
* @param SMWDIProperty $property
* @param array $changes
* @param SWLCustomTexts $customTexts
* @return string
*/
protected static function getPropertyHTML( SMWDIProperty $property, array $changes, $customTexts ) {
$insertions = array();
$deletions = array();
$customMessages = array();
Expand Down Expand Up @@ -144,6 +144,6 @@ protected static function getPropertyHTML( SMWDIProperty $property, array $chang
);

return $html;
}
}

}

0 comments on commit 66657f2

Please sign in to comment.