Revision: 48323 Author: ashley Date: 2009-03-11 19:26:33 +0000 (Wed, 11 Mar 2009)
Log Message: ----------- SocialProfile: spacing & XHTML tweaks for GiftManager special page Modified Paths: -------------- trunk/extensions/SocialProfile/UserGifts/SpecialGiftManager.php trunk/extensions/SocialProfile/UserGifts/UserGifts.css Modified: trunk/extensions/SocialProfile/UserGifts/SpecialGiftManager.php =================================================================== --- trunk/extensions/SocialProfile/UserGifts/SpecialGiftManager.php 2009-03-11 18:58:38 UTC (rev 48322) +++ trunk/extensions/SocialProfile/UserGifts/SpecialGiftManager.php 2009-03-11 19:26:33 UTC (rev 48323) @@ -6,7 +6,7 @@ * Constructor */ public function __construct(){ - parent::__construct('GiftManager', 'giftadmin'); + parent::__construct( 'GiftManager'/*class*/, 'giftadmin'/*restriction*/ ); } /** @@ -15,40 +15,36 @@ * @param $par Mixed: parameter passed to the page or null */ public function execute( $par ){ - global $wgUser, $wgOut, $wgRequest, $wgSiteView, $IP, $wgScriptPath; - wfLoadExtensionMessages('UserGifts'); + global $wgUser, $wgOut, $wgRequest, $wgScriptPath; + wfLoadExtensionMessages( 'UserGifts' ); - $wgOut->setPageTitle( wfMsg('giftmanager') ); + $wgOut->setPageTitle( wfMsg( 'giftmanager' ) ); if( $wgUser->isAnon() || !$this->canUserManage() ){ $wgOut->errorpage( 'error', 'badaccess' ); } - $css = "<style> - .view-form { font-weight:800; font-size:12px; font-color:#666666; } - .view-status { font-weight:800; font-size:12px; background-color:#FFFB9B; color:#666666; padding:5px ;margin-bottom:5px; } - </style>"; - $wgOut->addHTML($css); + $wgOut->addStyle( $wgScriptPath . '/extensions/SocialProfile/UserGifts/UserGifts.css' ); if( count( $_POST ) ){ if( !( $_POST['id'] ) ){ - $gift_id = Gifts::addGift($_POST['gift_name'], $_POST['gift_description'], $_POST['access']); - $wgOut->addHTML('<span class="view-status">'.wfMsg('giftmanager-giftcreated').'</span><br /><br />'); + $gift_id = Gifts::addGift( $_POST['gift_name'], $_POST['gift_description'], $_POST['access'] ); + $wgOut->addHTML( '<span class="view-status">'.wfMsg( 'giftmanager-giftcreated' ).'</span><br /><br />' ); } else { $gift_id = $_POST['id']; - Gifts::updateGift($gift_id, $_POST['gift_name'], $_POST['gift_description'], $_POST['access']); - $wgOut->addHTML('<span class="view-status">'.wfMsg('giftmanager-giftsaved').'</span><br /><br />'); + Gifts::updateGift( $gift_id, $_POST['gift_name'], $_POST['gift_description'], $_POST['access'] ); + $wgOut->addHTML( '<span class="view-status">'.wfMsg( 'giftmanager-giftsaved' ).'</span><br /><br />' ); } - $wgOut->addHTML( $this->displayForm($gift_id) ); + $wgOut->addHTML( $this->displayForm( $gift_id ) ); } else { $gift_id = $wgRequest->getVal( 'id' ); if( $gift_id || $wgRequest->getVal( 'method' ) == 'edit' ){ - $wgOut->addHTML( $this->displayForm($gift_id) ); + $wgOut->addHTML( $this->displayForm( $gift_id ) ); } else { - if ( $this->canUserCreateGift() ){ - $wgOut->addHTML('<div><b><a href="'.$wgScriptPath.'/index.php?title=Special:GiftManager&method=edit">'.wfMsg('giftmanager-addgift').'</a></b></div><p>'); + $wgOut->addHTML( '<div><b><a href="'.$wgScriptPath.'/index.php?title=Special:GiftManager&method=edit">' + .wfMsg( 'giftmanager-addgift' ).'</a></b></div>' ); } $wgOut->addHTML( $this->displayGiftList() ); } @@ -71,7 +67,7 @@ return true; } - if( $wgUser->isAllowed('giftadmin') || in_array( 'giftadmin', $wgUser->getGroups() ) ){ + if( $wgUser->isAllowed( 'giftadmin' ) || in_array( 'giftadmin', $wgUser->getGroups() ) ){ return true; } @@ -90,7 +86,7 @@ return false; } - if( $wgUser->isAllowed('giftadmin') || in_array( 'giftadmin', $wgUser->getGroups() ) ){ + if( $wgUser->isAllowed( 'giftadmin' ) || in_array( 'giftadmin', $wgUser->getGroups() ) ){ return true; } @@ -111,7 +107,7 @@ } $created_count = Gifts::getCustomCreatedGiftCount( $wgUser->getID() ); - if( $wgUser->isAllowed('giftadmin') || in_array( 'giftadmin', ( $wgUser->getGroups() ) ) || ( $wgMaxCustomUserGiftCount > 0 && $created_count < $wgMaxCustomUserGiftCount ) ){ + if( $wgUser->isAllowed( 'giftadmin' ) || in_array( 'giftadmin', ( $wgUser->getGroups() ) ) || ( $wgMaxCustomUserGiftCount > 0 && $created_count < $wgMaxCustomUserGiftCount ) ){ return true; } else { return false; @@ -120,16 +116,17 @@ function displayGiftList(){ global $wgScriptPath; - wfLoadExtensionMessages('UserGifts'); + wfLoadExtensionMessages( 'UserGifts' ); $output = ''; // Prevent E_NOTICE - // FIXME: undefined variables per_page and page + // FIXME: undefined variable page $per_page = 10; $gifts = Gifts::getManagedGiftList( $per_page, $page ); if( $gifts ){ foreach( $gifts as $gift ) { - $output .= "<div class=\"Item\"> - <a href=\"".$wgScriptPath."/index.php?title=Special:GiftManager&id={$gift["id"]}\">{$gift["gift_name"]}</a> " . ( ( $this->canUserDelete() ) ? "<a href=\"" . SpecialPage::getTitleFor( 'RemoveMasterGift' )->escapeFulLURL("gift_id={$gift["id"]}") . "\" style=\"font-size:10px;color:red;\">".wfMsg('delete')."</a>" : '' ) . " - </div>\n"; + $output .= '<div class="Item"> + <a href="'.$wgScriptPath.'/index.php?title=Special:GiftManager&id='. $gift['id'] .'">'. $gift['gift_name'] .'</a> ' . + ( ( $this->canUserDelete() ) ? '<a href="' . SpecialPage::getTitleFor( 'RemoveMasterGift' )->escapeFulLURL("gift_id={$gift["id"]}") . '" style="font-size:10px; color:red;">'.wfMsg( 'delete' ).'</a>' : '' ) + . "</div>\n"; } } return '<div id="views">' . $output . '</div>'; @@ -137,72 +134,72 @@ function displayForm( $gift_id ){ global $wgUser, $wgOut, $wgScriptPath; - wfLoadExtensionMessages('UserGifts'); + wfLoadExtensionMessages( 'UserGifts' ); if( !$gift_id && !$this->canUserCreateGift() ){ return $this->displayGiftList(); } - $form = '<div><b><a href="'.$wgScriptPath.'/index.php?title=Special:GiftManager">'.wfMsg('giftmanager-view').'</a></b></div><p>'; + $form = '<div><b><a href="'.$wgScriptPath.'/index.php?title=Special:GiftManager">'.wfMsg( 'giftmanager-view' ).'</a></b></div>'; if( $gift_id ){ - $gift = Gifts::getGift($gift_id); - if( $wgUser->getID() != $gift['creator_user_id'] && ( !in_array( 'giftadmin', $wgUser->getGroups() ) && !$wgUser->isAllowed('delete') ) ){ + $gift = Gifts::getGift( $gift_id ); + if( $wgUser->getID() != $gift['creator_user_id'] && ( !in_array( 'giftadmin', $wgUser->getGroups() ) && !$wgUser->isAllowed( 'delete' ) ) ){ $wgOut->errorpage( 'error', 'badaccess' ); } } - $form .= '<form action="" method="POST" enctype="multipart/form-data" name="gift">'; + $form .= '<form action="" method="post" enctype="multipart/form-data" name="gift">'; $form .= '<table border="0" cellpadding="5" cellspacing="0" width="500">'; // FIXME: undefined variable gift (twice) $form .= '<tr> - <td width="200" class="view-form">'.wfMsg('g-gift-name').'</td> + <td width="200" class="view-form">'.wfMsg( 'g-gift-name' ).'</td> <td width="695"><input type="text" size="45" class="createbox" name="gift_name" value="'. $gift['gift_name'] . '"/></td> </tr> <tr> - <td width="200" class="view-form" valign="top">'.wfMsg('giftmanager-description').'</td> + <td width="200" class="view-form" valign="top">'.wfMsg( 'giftmanager-description' ).'</td> <td width="695"><textarea class="createbox" name="gift_description" rows="2" cols="30">'. $gift['gift_description'] . '</textarea></td> </tr>'; if( $gift_id ){ $creator = Title::makeTitle( NS_USER, $gift['creator_user_name'] ); $form .= '<tr> - <td class="view-form">'.wfMsgExt('g-created-by', 'parsemag', $gift['creator_user_name'] ).'</td><td><a href="' . $creator->escapeFullURL() . '">' . $gift['creator_user_name'] . '</a></td> + <td class="view-form">'.wfMsgExt( 'g-created-by', 'parsemag', $gift['creator_user_name'] ).'</td> + <td><a href="' . $creator->escapeFullURL() . '">' . $gift['creator_user_name'] . '</a></td> </tr>'; } global $wgUploadPath; - if( !in_array('giftadmin', $wgUser->getGroups() ) ){ - $form .= '<input type="hidden" name="access" value="1">'; + if( !in_array( 'giftadmin', $wgUser->getGroups() ) ){ + $form .= '<input type="hidden" name="access" value="1" />'; } else { // FIXME: undefined variable gift (twice) $form .= '<tr> - <td class="view-form">'.wfMsg('giftmanager-access').'</td> + <td class="view-form">'.wfMsg( 'giftmanager-access' ).'</td> <td> <select name="access"> - <option value=0 ' . ( ( $gift['access'] == 0 ) ? 'selected' : '' ) . '>'.wfMsg('giftmanager-public').'</option> - <option value=1 ' . ( ( $gift['access'] == 1 ) ? 'selected' : '' ) . '>'.wfMsg('giftmanager-private').'</option> + <option value="0"' . ( ( $gift['access'] == 0 ) ? ' selected="selected"' : '' ) . '>'.wfMsg( 'giftmanager-public' ).'</option> + <option value="1"' . ( ( $gift['access'] == 1 ) ? ' selected="selected"' : '' ) . '>'.wfMsg( 'giftmanager-private' ).'</option> </select> </td> </tr>'; } - global $wgScriptPath; if( $gift_id ){ - $gift_image = "<img src=\"{$wgUploadPath}/awards/" . Gifts::getGiftImage( $gift_id, 'l' ) . "\" border=\"0\" alt=\"".wfMsg('g-gift')."\" />"; - $form .= '<tr> - <td width="200" class="view-form" valign="top">'.wfMsg('giftmanager-giftimage').'</td> + $gift_image = '<img src="' . $wgUploadPath . '/awards/' . Gifts::getGiftImage( $gift_id, 'l' ) . '" border="0" alt="'.wfMsg( 'g-gift' ).'" />'; + $form .= '<tr> + <td width="200" class="view-form" valign="top">'.wfMsg( 'giftmanager-giftimage' ).'</td> <td width="695">' . $gift_image . ' <p> - <a href="'.$wgScriptPath.'/index.php?title=Special:GiftManagerLogo&gift_id=' . $gift_id . '">'.wfMsg('giftmanager-image').'</a> + <a href="'.$wgScriptPath.'/index.php?title=Special:GiftManagerLogo&gift_id=' . $gift_id . '">'.wfMsg( 'giftmanager-image' ).'</a> </td> </tr>'; } // FIXME: undefined variable gift (twice) - $form .= ' + $form .= ' <tr> <td colspan="2"> - <input type=hidden name="id" value="' . $gift['gift_id'] . '"> - <input type="button" class="createbox" value="' . ( ( $gift['gift_id'] ) ? wfMsg('edit') : wfMsg('g-create-gift') ) . '" size="20" onclick="document.gift.submit()" /> - <input type="button" class="createbox" value="'.wfMsg('cancel').'" size="20" onclick="history.go(-1)" /> + <input type="hidden" name="id" value="' . $gift['gift_id'] . '" /> + <input type="button" class="createbox" value="' . ( ( $gift['gift_id'] ) ? wfMsg( 'edit' ) : wfMsg( 'g-create-gift' ) ) . '" size="20" onclick="document.gift.submit()" /> + <input type="button" class="createbox" value="'.wfMsg( 'cancel' ).'" size="20" onclick="history.go(-1)" /> </td> </tr> </table> Modified: trunk/extensions/SocialProfile/UserGifts/UserGifts.css =================================================================== --- trunk/extensions/SocialProfile/UserGifts/UserGifts.css 2009-03-11 18:58:38 UTC (rev 48322) +++ trunk/extensions/SocialProfile/UserGifts/UserGifts.css 2009-03-11 19:26:33 UTC (rev 48323) @@ -1,230 +1,246 @@ .back-links { - margin:0px 0px 10px 0px; + margin: 0px 0px 10px 0px; } .back-links a { - text-decoration:none; - font-weight:bold; + text-decoration: none; + font-weight: bold; } .g-count { - margin:0px 0px 15px 0px; + margin: 0px 0px 15px 0px; } .g-item { - border:1px solid #D7DEE8; - padding:7px; - float:left; - margin:0px 15px 15px 0px; - width:350px; + border: 1px solid #D7DEE8; + padding: 7px; + float: left; + margin: 0px 15px 15px 0px; + width: 350px; } .g-item a { - text-decoration:none; + text-decoration: none; } .g-item img { - border:1px solid #dcdcdc; - background-color:#fff; - padding:3px; - display:block; - float:left; - margin:0px 10px 0px 0px; + border: 1px solid #dcdcdc; + background-color: #fff; + padding: 3px; + display: block; + float: left; + margin: 0px 10px 0px 0px; } .g-title { - font-size:16px; - font-weight:bold; - margin:0px 0px 8px 0px; + font-size: 16px; + font-weight: bold; + margin: 0px 0px 8px 0px; } .g-from { - font-weight:bold; - font-size:11px; + font-weight: bold; + font-size: 11px; } .g-actions { - font-size:10px; + font-size: 10px; } .g-actions a { - font-size:10px; + font-size: 10px; } .g-delete { - margin:0px 0px 0px 12px; + margin: 0px 0px 0px 12px; } .page-nav a { - font-weight:bold; + font-weight: bold; } .g-new { - background-color:#FFFB9B; - border:1px solid #FDC745; - font-weight:bold; - padding:0px 5px; - font-size:12px; - margin:0px 0px 0px 10px; + background-color: #FFFB9B; + border: 1px solid #FDC745; + font-weight: bold; + padding: 0px 5px; + font-size: 12px; + margin: 0px 0px 0px 10px; } .g-name { - font-size:16px; - font-weight:bold; - margin:0px 0px 2px; + font-size: 16px; + font-weight: bold; + margin: 0px 0px 2px; } .g-timestamp { - font-size:9px; - color:#999; + font-size: 9px; + color: #999; } .g-user-message { - margin:8px 0px; - color:#666; - font-weight:bold; + margin: 8px 0px; + color: #666; + font-weight: bold; } .g-gift-count { - font-size:9px; - margin:2px 0px 10px 0px; + font-size: 9px; + margin: 2px 0px 10px 0px; } .g-description-container { - width:480px; - margin:20px 0px; + width: 480px; + margin: 20px 0px; } .g-recent { - border-top:1px solid #EFEFEF; - padding:10px 0px 0px 0px; + border-top: 1px solid #EFEFEF; + padding: 10px 0px 0px 0px; } .g-recent img { - vertical-align:middle; - padding:3px; - background-color:#fff; - border:1px solid #dcdcdc; - margin:0px 10px 0px 0px; + vertical-align: middle; + padding: 3px; + background-color: #fff; + border: 1px solid #dcdcdc; + margin: 0px 10px 0px 0px; } .g-recent a { - display:block; - float:left; - text-decoration:none; + display: block; + float: left; + text-decoration: none; } .g-recent-title { - font-size:14px; - font-weight:bold; - color:#777; - margin:0px 0px 2px 0px; + font-size: 14px; + font-weight: bold; + color: #777; + margin: 0px 0px 2px 0px; } .g-recent-item { - margin:0px 0px 5px 0px; + margin: 0px 0px 5px 0px; } .g-description { - margin:0px 0px 15px 0px; + margin: 0px 0px 15px 0px; } .g-description img { - border:1px solid #dcdcdc; - background-color:#fff; - padding:3px; - display:block; - float:left; - margin:0px 10px 0px 0px; + border: 1px solid #dcdcdc; + background-color: #fff; + padding: 3px; + display: block; + float: left; + margin: 0px 10px 0px 0px; } .g-container { - margin:15px 0px 0px 0px; + margin: 15px 0px 0px 0px; } .g-container img { - border:1px solid #dcdcdc; - background-color:#fff; - padding:3px; - display:block; - float:left; - margin:0px 10px 0px 0px; + border: 1px solid #dcdcdc; + background-color: #fff; + padding: 3px; + display: block; + float: left; + margin: 0px 10px 0px 0px; } .g-buttons { - padding:15px 0px 0px 0px; + padding: 15px 0px 0px 0px; } .g-message { - margin:0px 0px 15px 0px; + margin: 0px 0px 15px 0px; } .g-give-container { - background-color:#F2F4F7; - border:1px solid #D7DEE8; - padding:10px; - width:500px; - margin:0px 0px 20px 0px; + background-color: #F2F4F7; + border: 1px solid #D7DEE8; + padding: 10px; + width: 500px; + margin: 0px 0px 20px 0px; } .g-give-title { - font-size:13px; - color:#888; - margin:0px 0px 6px 0px; - font-weight:bold; + font-size: 13px; + color: #888; + margin: 0px 0px 6px 0px; + font-weight: bold; } .g-give-separator { - margin:10px 0px; - font-weight:bold; + margin: 10px 0px; + font-weight: bold; } .g-add-message { - margin:15px 0px 4px 0px; - color:#666; - font-weight:bold; - font-size:14px; + margin: 15px 0px 4px 0px; + color: #666; + font-weight: bold; + font-size: 14px; } .g-describe { - font-size:11px; - line-height:12px !important; + font-size: 11px; + line-height: 12px !important; } .g-give-all { - border:1px solid #DCDCDC; - cursor:pointer; - float:left; - min-height:110px; - margin:0px 10px 10px 0px; - padding:8px; - width:250px; - overflow:hidden; + border: 1px solid #DCDCDC; + cursor: pointer; + float: left; + min-height: 110px; + margin: 0px 10px 10px 0px; + padding: 8px; + width: 250px; + overflow: hidden; } .g-give-all img { - float:left; - margin:0px 10px 0px 0px; - display:block; - border:1px solid #dcdcdc; - padding:3px; - background-color:#fff; + float: left; + margin: 0px 10px 0px 0px; + display: block; + border: 1px solid #dcdcdc; + padding: 3px; + background-color: #fff; } .g-blue { - color:#285C98 !important; + color: #285C98 !important; } .g-give-all-message-title { - color:#666; - font-weight:bold; - margin:10px 0px 5px 0px; + color: #666; + font-weight: bold; + margin: 10px 0px 5px 0px; } .g-give-all-highlight { - background-color:#FAF9F9; + background-color: #FAF9F9; } .g-give-all-selected { - border:1px solid red; + border: 1px solid red; +} + +/* Special:GiftManager */ +.view-form { + font-weight: 800; + font-size: 12px; + color: #666666; +} + +.view-status { + font-weight: 800; + font-size: 12px; + background-color: #FFFB9B; + color: #666666; + padding: 5px; + margin-bottom: 5px; } \ No newline at end of file _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs