Index: trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php |
— | — | @@ -15,6 +15,7 @@ |
16 | 16 | |
17 | 17 | SpecialPage::addPage( new SpecialPage('CreateTemplate','',true,'doSpecialCreateTemplate',false) ); |
18 | 18 | |
| 19 | +// Custom sort function, used in getSemanticProperties() |
19 | 20 | function cmp($a, $b) |
20 | 21 | { |
21 | 22 | if ($a == $b) { |
— | — | @@ -30,7 +31,7 @@ |
31 | 32 | $all_properties = array(); |
32 | 33 | |
33 | 34 | $res = $dbr->query("SELECT page_title FROM " . $dbr->tableName('page') . |
34 | | - " WHERE page_namespace = " . SMW_NS_ATTRIBUTE); |
| 35 | + " WHERE page_namespace = " . SMW_NS_ATTRIBUTE . " AND page_is_redirect = 0"); |
35 | 36 | while ($row = $dbr->fetchRow($res)) { |
36 | 37 | $attribute_name = str_replace('_', ' ', $row[0]); |
37 | 38 | $all_properties[$attribute_name . ":="] = $attribute_name; |
— | — | @@ -38,13 +39,15 @@ |
39 | 40 | $dbr->freeResult($res); |
40 | 41 | |
41 | 42 | $res = $dbr->query("SELECT page_title FROM " . $dbr->tableName('page') . |
42 | | - " WHERE page_namespace = " . SMW_NS_RELATION); |
| 43 | + " WHERE page_namespace = " . SMW_NS_RELATION . " AND page_is_redirect = 0"); |
43 | 44 | while ($row = $dbr->fetchRow($res)) { |
44 | 45 | $relation_name = str_replace('_', ' ', $row[0]); |
45 | 46 | $all_properties[$relation_name . "::"] = $relation_name; |
46 | 47 | } |
47 | 48 | $dbr->freeResult($res); |
48 | 49 | |
| 50 | + // sort properties list alphabetically - custom sort function is needed |
| 51 | + // because the regular sort function destroys the "keys" of the array |
49 | 52 | uasort($all_properties, "cmp"); |
50 | 53 | return $all_properties; |
51 | 54 | } |