Index: trunk/extensions/Wikidata/WiktionaryZ/SpecialTransaction.php |
— | — | @@ -26,9 +26,19 @@ |
27 | 27 | initializeAttributes();
|
28 | 28 |
|
29 | 29 | $fromTransactionId = $wgRequest->getInt('from-transaction');
|
| 30 | + $transactionCount = $wgRequest->getInt('transaction-count');
|
| 31 | + $userName = $wgRequest->getText('user-name');
|
30 | 32 |
|
31 | | -// $wgOut->addHTML(getFilterOptionsPanel($fromTransactionId));
|
32 | | - $wgOut->addHTML(getTransactionOverview());
|
| 33 | + if ($fromTransactionId == 0)
|
| 34 | + $fromTransactionId = getLatestTransactionId();
|
| 35 | +
|
| 36 | + if ($transactionCount == 0)
|
| 37 | + $transactionCount = 10;
|
| 38 | + else
|
| 39 | + $transactionCount = min($transactionCount, 20);
|
| 40 | +
|
| 41 | + $wgOut->addHTML(getFilterOptionsPanel($fromTransactionId, $transactionCount, $userName));
|
| 42 | + $wgOut->addHTML(getTransactionOverview($fromTransactionId, $transactionCount, $userName));
|
33 | 43 | $wgOut->addHTML(DefaultEditor::getExpansionCss());
|
34 | 44 | $wgOut->addHTML("<script language='javascript'><!--\nexpandEditors();\n--></script>");
|
35 | 45 | }
|
— | — | @@ -37,15 +47,28 @@ |
38 | 48 | SpecialPage::addPage(new SpecialTransaction());
|
39 | 49 | }
|
40 | 50 |
|
41 | | -function getFilterOptionsPanel($fromTransactionId) {
|
| 51 | +function getFilterOptionsPanel($fromTransactionId, $transactionCount, $userName) {
|
| 52 | + $countOptions = array();
|
| 53 | +
|
| 54 | + for ($i = 1; $i <= 20; $i++)
|
| 55 | + $countOptions[$i] = $i;
|
| 56 | +
|
42 | 57 | return getOptionPanel(array(
|
43 | | - "From transaction" => getSuggest(
|
44 | | - 'from-transaction',
|
45 | | - 'transaction',
|
46 | | - $fromTransactionId,
|
47 | | - getTransactionLabel($fromTransactionId),
|
48 | | - array(0, 2, 3)
|
49 | | - )
|
| 58 | + "From transaction" =>
|
| 59 | + getSuggest(
|
| 60 | + 'from-transaction',
|
| 61 | + 'transaction',
|
| 62 | + $fromTransactionId,
|
| 63 | + getTransactionLabel($fromTransactionId),
|
| 64 | + array(0, 2, 3)
|
| 65 | + ),
|
| 66 | + "Count" =>
|
| 67 | + getSelect('transaction-count',
|
| 68 | + $countOptions,
|
| 69 | + $transactionCount
|
| 70 | + ),
|
| 71 | + "User name" =>
|
| 72 | + getTextBox('user-name', $userName)
|
50 | 73 | ));
|
51 | 74 | }
|
52 | 75 |
|
— | — | @@ -145,7 +168,7 @@ |
146 | 169 | $updatesInTransactionAttribute = new Attribute('updates-in-transaction', 'Updates in transaction', new RecordType($updatesInTransactionStructure));
|
147 | 170 | }
|
148 | 171 |
|
149 | | -function getTransactionOverview() {
|
| 172 | +function getTransactionOverview($fromTransactionId, $transactionCount, $userName) {
|
150 | 173 | global
|
151 | 174 | $transactionsTable, $transactionAttribute, $transactionIdAttribute, $userAttribute, $userIPAttribute,
|
152 | 175 | $timestampAttribute, $summaryAttribute, $updatesInTransactionAttribute, $updatedDefinitionAttribute,
|
— | — | @@ -154,6 +177,11 @@ |
155 | 178 |
|
156 | 179 | $queryTransactionInformation = new QueryLatestTransactionInformation();
|
157 | 180 |
|
| 181 | + $restrictions = array("transaction_id <= $fromTransactionId");
|
| 182 | +
|
| 183 | + if ($userName != "")
|
| 184 | + $restrictions[] = "EXISTS (SELECT user_name FROM user WHERE user.user_id=transactions.user_id)";
|
| 185 | +
|
158 | 186 | $recordSet = queryRecordSet(
|
159 | 187 | $queryTransactionInformation,
|
160 | 188 | $transactionIdAttribute,
|
— | — | @@ -161,9 +189,9 @@ |
162 | 190 | 'transaction_id' => $transactionIdAttribute
|
163 | 191 | ),
|
164 | 192 | $transactionsTable,
|
165 | | - array(),
|
| 193 | + $restrictions,
|
166 | 194 | array('transaction_id DESC'),
|
167 | | - 10
|
| 195 | + $transactionCount
|
168 | 196 | );
|
169 | 197 |
|
170 | 198 | $recordSet->getStructure()->attributes[] = $transactionIdAttribute;
|