r78898 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78897‎ | r78898 | r78899 >
Date:17:55, 23 December 2010
Author:reedy
Status:deferred
Tags:
Comment:
Add SpecialNova, abstract base class for SpecialNova*

Put common functionality in there - notLoggedIn, noCredentials, notInProject
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackManager.php (modified) (history)
  • /trunk/extensions/OpenStackManager/SpecialNova.php (added) (history)
  • /trunk/extensions/OpenStackManager/SpecialNovaDomain.php (modified) (history)
  • /trunk/extensions/OpenStackManager/SpecialNovaInstance.php (modified) (history)
  • /trunk/extensions/OpenStackManager/SpecialNovaKey.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/SpecialNovaInstance.php
@@ -1,5 +1,5 @@
22 <?php
3 -class SpecialNovaInstance extends SpecialPage {
 3+class SpecialNovaInstance extends SpecialNova {
44
55 var $adminNova, $userNova;
66 var $userLDAP;
@@ -59,31 +59,6 @@
6060 }
6161 }
6262
63 - function notLoggedIn() {
64 - global $wgOut;
65 -
66 - $this->setHeaders();
67 - $wgOut->setPagetitle("Not logged in");
68 - $wgOut->addHTML('<p>You must be logged in to perform this action</p>');
69 - }
70 -
71 - function noCredentials() {
72 - global $wgOut;
73 -
74 - $this->setHeaders();
75 - $wgOut->setPagetitle("No Nova credentials found for your account");
76 - $wgOut->addHTML('<p>There were no Nova credentials found for your user account. '
77 - . 'Please ask a Nova administrator to create credentials for you.</p>');
78 - }
79 -
80 - function notInProject() {
81 - global $wgOut;
82 -
83 - $this->setHeaders();
84 - $wgOut->setPagetitle("Your account is not in the project requested");
85 - $wgOut->addHTML('<p>You can not complete the action requested as your user account is not in the project requested.</p>');
86 - }
87 -
8863 function createInstance() {
8964 global $wgRequest, $wgOut;
9065
Index: trunk/extensions/OpenStackManager/SpecialNovaDomain.php
@@ -1,5 +1,5 @@
22 <?php
3 -class SpecialNovaDomain extends SpecialPage {
 3+class SpecialNovaDomain extends SpecialNova {
44
55 var $userNova, $adminNova;
66
@@ -36,23 +36,6 @@
3737 }
3838 }
3939
40 - function notLoggedIn() {
41 - global $wgOut;
42 -
43 - $this->setHeaders();
44 - $wgOut->setPagetitle("Not logged in");
45 - $wgOut->addHTML('<p>You must be logged in to perform this action</p>');
46 - }
47 -
48 - function noCredentials() {
49 - global $wgOut;
50 -
51 - $this->setHeaders();
52 - $wgOut->setPagetitle("No Nova credentials found for your account");
53 - $wgOut->addHTML('<p>There were no Nova credentials found for your user account. ' .
54 - 'Please ask a Nova administrator to create credentials for you.</p>');
55 - }
56 -
5740 function createDomain() {
5841 global $wgRequest, $wgOut;
5942
Index: trunk/extensions/OpenStackManager/SpecialNovaKey.php
@@ -1,5 +1,5 @@
22 <?php
3 -class SpecialNovaKey extends SpecialPage {
 3+class SpecialNovaKey extends SpecialNova {
44
55 var $userNova, $userLDAP;
66
@@ -34,31 +34,6 @@
3535 }
3636 }
3737
38 - function notLoggedIn() {
39 - global $wgOut;
40 -
41 - $this->setHeaders();
42 - $wgOut->setPagetitle("Not logged in");
43 - $wgOut->addHTML('<p>You must be logged in to perform this action</p>');
44 - }
45 -
46 - function noCredentials() {
47 - global $wgOut;
48 -
49 - $this->setHeaders();
50 - $wgOut->setPagetitle("No Nova credentials found for your account");
51 - $wgOut->addHTML('<p>There were no Nova credentials found for your user account. ' .
52 - 'Please ask a Nova administrator to create credentials for you.</p>');
53 - }
54 -
55 - function notInProject() {
56 - global $wgOut;
57 -
58 - $this->setHeaders();
59 - $wgOut->setPagetitle("Your account is not in the project requested");
60 - $wgOut->addHTML('<p>You can not complete the action requested as your user account is not in the project requested.</p>');
61 - }
62 -
6338 function importKey() {
6439 global $wgRequest, $wgOut;
6540 global $wgOpenStackManagerNovaKeypairStorage;
Index: trunk/extensions/OpenStackManager/OpenStackManager.php
@@ -50,6 +50,7 @@
5151 $wgAutoloadClasses['SpecialNovaKey'] = $dir . 'SpecialNovaKey.php';
5252 $wgAutoloadClasses['SpecialNovaProject'] = $dir . 'SpecialNovaProject.php';
5353 $wgAutoloadClasses['SpecialNovaDomain'] = $dir . 'SpecialNovaDomain.php';
 54+$wgAutoloadClasses['SpecialNova'] = $dir . 'SpecialNova.php';
5455 $wgAutoloadClasses['AmazonEC2'] = $dir . 'aws-sdk/sdk.class.php';
5556 $wgSpecialPages['NovaInstance'] = 'SpecialNovaInstance';
5657 $wgSpecialPageGroups['NovaInstance'] = 'other';
Index: trunk/extensions/OpenStackManager/SpecialNova.php
@@ -0,0 +1,28 @@
 2+<?php
 3+
 4+abstract class SpecialNova extends SpecialPage {
 5+ function notLoggedIn() {
 6+ global $wgOut;
 7+
 8+ $this->setHeaders();
 9+ $wgOut->setPagetitle("Not logged in");
 10+ $wgOut->addHTML('<p>You must be logged in to perform this action</p>');
 11+ }
 12+
 13+ function noCredentials() {
 14+ global $wgOut;
 15+
 16+ $this->setHeaders();
 17+ $wgOut->setPagetitle("No Nova credentials found for your account");
 18+ $wgOut->addHTML('<p>There were no Nova credentials found for your user account. ' .
 19+ 'Please ask a Nova administrator to create credentials for you.</p>');
 20+ }
 21+
 22+ function notInProject() {
 23+ global $wgOut;
 24+
 25+ $this->setHeaders();
 26+ $wgOut->setPagetitle("Your account is not in the project requested");
 27+ $wgOut->addHTML('<p>You can not complete the action requested as your user account is not in the project requested.</p>');
 28+ }
 29+}
Property changes on: trunk/extensions/OpenStackManager/SpecialNova.php
___________________________________________________________________
Added: svn:eol-style
130 + native

Status & tagging log