r21194 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21193‎ | r21194 | r21195 >
Date:11:37, 12 April 2007
Author:vrandezo
Status:old
Tags:
Comment:
Changing style of browser
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEn.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/skins/SMW_custom.css (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php
@@ -40,7 +40,7 @@
4141 $offset = $wgRequest->getVal( 'offset' );
4242 if ('' == $offset) $offset = 0;
4343 $mode = $wgRequest->getVal( 'mode' );
44 - if (('' == $mode) || ('in' == $mode) || (wfMsg('smw_browse_in') == $mode)) { $mode = 'in'; } else { $mode = 'out'; }
 44+ if (('' == $mode) || ('out' == $mode)) { $mode = 'out'; } else { $mode = 'in'; }
4545 $html = '';
4646 $spectitle = Title::makeTitle( NS_SPECIAL, 'SMWBrowse' );
4747
@@ -48,9 +48,8 @@
4949 $html .= '<form name="smwbrowse" action="' . $spectitle->escapeLocalURL() . '" method="get">' . "\n";
5050 $html .= '<input type="hidden" name="title" value="' . $spectitle->getPrefixedText() . '"/>' ;
5151 $html .= wfMsg('smw_browse_article') . "<br />\n";
52 - $html .= '<input type="submit" name="mode" value="' . wfMsg('smw_browse_in') .'"/>'."\n";
5352 $html .= '<input type="text" name="article" value="' . htmlspecialchars($articletext) . '" />' . "\n";
54 - $html .= '<input type="submit" name="mode" value="' . wfMsg('smw_browse_out') . "\"/>\n</form>\n";
 53+ $html .= '<input type="submit" value="' . wfMsg('smw_browse_go') . "\"/>\n</form>\n";
5554
5655 if ('' == $articletext) { // empty, no article name given
5756 $html .= wfMsg('smw_browse_docu') . "\n";
@@ -65,61 +64,45 @@
6665
6766 // prepare navigation bar
6867 if ($offset > 0)
69 - $navigation = '<a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse','offset=' . max(0,$offset-$limit) . '&limit=' . $limit . '&article=' . urlencode($articletext) )) . '">' . wfMsg('smw_result_prev') . '</a>';
 68+ $navigation = '<a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse','offset=' . max(0,$offset-$limit) . '&article=' . urlencode($articletext) )) . '&mode=in">' . wfMsg('smw_result_prev') . '</a>';
7069 else
7170 $navigation = wfMsg('smw_result_prev');
7271
7372 $navigation .= '&nbsp;&nbsp;&nbsp;&nbsp; <b>' . wfMsg('smw_result_results') . ' ' . ($offset+1) . '&ndash; ' . ($offset + min(count($results), $limit)) . '</b>&nbsp;&nbsp;&nbsp;&nbsp;';
7473
7574 if (count($results)==($limit+1))
76 - $navigation .= ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse', 'offset=' . ($offset+$limit) . '&limit=' . $limit . '&article=' . urlencode($articletext) )) . '">' . wfMsg('smw_result_next') . '</a>';
 75+ $navigation .= ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse', 'offset=' . ($offset+$limit) . '&article=' . urlencode($articletext) )) . '&mode=in">' . wfMsg('smw_result_next') . '</a>';
7776 else
7877 $navigation .= wfMsg('smw_result_next');
7978
80 - $max = false; $first=true;
81 - foreach (array(10,20,50,100,200) as $l) {
82 - if ($max) continue;
83 - if ($first) {
84 - $navigation .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(';
85 - $first = false;
86 - } else
87 - $navigation .= ' | ';
88 - if ($l > $smwgIQMaxLimit) {
89 - $l = $smwgIQMaxLimit;
90 - $max = true;
91 - }
92 - if ( $limit != $l ) {
93 - $navigation .= '<a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse','offset=' . $offset . '&limit=' . $l . '&article=' . urlencode($articletext) )) . '">' . $l . '</a>';
94 - } else {
95 - $navigation .= '<b>' . $l . '</b>';
96 - }
97 - }
98 - $navigation .= ')';
99 -
100 - // no need to show the navigation bars when there is not enough to navigate
101 - if (($offset>0) || (count($results)>$limit))
102 - $html .= '<br />' . $navigation;
10379 if (count($results) == 0) {
10480 $html .= wfMsg( 'smw_browse_noin', $skin->makeSpecialUrl('SMWBrowse', 'article=' . urlencode($articletext) . '&mode=out' ));
10581 } else {
106 - $html .= '<table style="width: 100%; ">' . "\n";
 82+ $html .= 'See all <a href="' . $skin->makeSpecialUrl('SMWBrowse', 'mode=out&article=' . urlencode($articletext)) . '">outgoing links of ' . $article->getText() . "</a><br /><br />\n"; // TODO
 83+ // no need to show the navigation bars when there is not enough to navigate
 84+ if (($offset>0) || (count($results)>$limit))
 85+ $html .= $navigation;
 86+ $html .= '<table style="width: 100%; "><tr><td colspan="2"><hr /></td></tr>' . "\n";
10787 foreach ($results as $result) {
10888 $innerlimit = 6;
10989 $subjectoptions = new SMWRequestOptions();
11090 $subjectoptions->limit = $innerlimit;
111 - $html .= '<tr><td class="smwattname">' . "\n";
 91+ $html .= '<tr><td class="smwsubjects">' . "\n";
11292 $subjects = &smwfGetStore()->getRelationSubjects($result, $article, $subjectoptions);
113 - $more = (count($subjects) == $innerlimit);
 93+ $subjectcount = count($subjects);
 94+ $more = ($subjectcount == $innerlimit);
11495 $innercount = 0;
11596 foreach ($subjects as $subject) {
11697 $innercount += 1;
11798 if (($innercount < $innerlimit) || !$more) {
118 - $html .= $skin->makeKnownLinkObj($subject) . ' <span class="smwsearch"><a href="' . $skin->makeSpecialUrl('SMWBrowse', 'article=' . urlencode($subject->getText())) . '">+</a></span>' . "<br />\n";
 99+ $subjectlink = SMWInfolink::newBrowsingLink('+',$subject->getText(), FALSE);
 100+ $html .= $skin->makeKnownLinkObj($subject) . '&nbsp;' . $subjectlink->getHTML($skin);
 101+ if ($innercount<$subjectcount) $html .= ", \n";
119102 } else {
120103 $html .= '<a href="' . $skin->makeSpecialUrl('SearchByRelation', 'type=' . urlencode($result->getText()) . '&target=' . urlencode($article->getText())) . '">' . wfMsg("smw_browse_more") . "</a><br />\n";
121104 }
122105 }
123 - $html .= '</td><td class="smwatts">' . $skin->makeLinkObj($result, $result->getText()) . " " . $skin->makeLinkObj($article) . "</td></tr>\n";
 106+ $html .= '</td><td class="smwrelright">' . $skin->makeLinkObj($result, $result->getText()) . " " . $article->getText() . '</td></tr><tr><td colspan="2"><hr /></td></tr>' . "\n";
124107 }
125108 $html .= "</table>\n";
126109 }
@@ -127,52 +110,14 @@
128111 $html .= $navigation;
129112 } else { // outgoing links
130113 $options = new SMWRequestOptions();
131 - $options->limit = $limit+1;
132 - $options->offset = $offset;
133 - // get results (get one more, to see if we have to add a link to more)
134114 $results = &smwfGetStore()->getOutRelations($article, $options);
135115
136116 $html .= "<p>&nbsp;</p>\n" . wfMsg('smw_browse_displayout', $skin->makeLinkObj($article)) . "<br />\n";
137117
138 - // prepare navigation bar
139 - if ($offset > 0)
140 - $navigation = '<a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse','offset=' . max(0,$offset-$limit) . '&limit=' . $limit . '&article=' . urlencode($articletext) )) . '">' . wfMsg('smw_result_prev') . '</a>';
141 - else
142 - $navigation = wfMsg('smw_result_prev');
143 -
144 - $navigation .= '&nbsp;&nbsp;&nbsp;&nbsp; <b>' . wfMsg('smw_result_results') . ' ' . ($offset+1) . '&ndash; ' . ($offset + min(count($results), $limit)) . '</b>&nbsp;&nbsp;&nbsp;&nbsp;';
145 -
146 - if (count($results)==($limit+1))
147 - $navigation .= ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse', 'offset=' . ($offset+$limit) . '&limit=' . $limit . '&article=' . urlencode($articletext) )) . '">' . wfMsg('smw_result_next') . '</a>';
148 - else
149 - $navigation .= wfMsg('smw_result_next');
150 -
151 - $max = false; $first=true;
152 - foreach (array(10,20,50,100,200) as $l) {
153 - if ($max) continue;
154 - if ($first) {
155 - $navigation .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(';
156 - $first = false;
157 - } else
158 - $navigation .= ' | ';
159 - if ($l > $smwgIQMaxLimit) {
160 - $l = $smwgIQMaxLimit;
161 - $max = true;
162 - }
163 - if ( $limit != $l ) {
164 - $navigation .= '<a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse','offset=' . $offset . '&limit=' . $l . '&article=' . urlencode($articletext) )) . '">' . $l . '</a>';
165 - } else {
166 - $navigation .= '<b>' . $l . '</b>';
167 - }
168 - }
169 - $navigation .= ')';
170 -
171 - // no need to show the navigation bars when there is not enough to navigate
172 - if (($offset>0) || (count($results)>$limit))
173 - $html .= '<br />' . $navigation;
174118 if (count($results) == 0) {
175119 $html .= wfMsg( 'smw_browse_noout', $skin->makeSpecialUrl('SMWBrowse', 'article=' . urlencode($articletext) . '&mode=in' ));
176120 } else {
 121+ $html .= 'See all <a href="' . $skin->makeSpecialUrl('SMWBrowse', 'mode=in&article=' . urlencode($articletext)) . '">incoming links of ' . $article->getText() . "</a><br /><br />\n"; // TODO
177122 $html .= '<table style="width: 100%; ">' . "\n";
178123 foreach ($results as $result) {
179124 $objectoptions = new SMWRequestOptions();
@@ -181,14 +126,13 @@
182127 $html .= '</td><td class="smwatts">' . "\n";
183128 $objects = &smwfGetStore()->getRelationObjects($article, $result, $objectoptions);
184129 foreach ($objects as $object) {
185 - $html .= $skin->makeLinkObj($object) . ' <span class="smwsearch"><a href="' . $skin->makeSpecialUrl('SMWBrowse', 'article=' . urlencode($object->getText()) . '&mode=out') . '">+</a></span>' . "<br />\n";
 130+ $searchlink = SMWInfolink::newBrowsingLink('+',$object->getText());
 131+ $html .= $skin->makeLinkObj($object) . $searchlink->getHTML($skin) . "<br />\n";
186132 }
187133 $html .= "</td></tr>\n";
188134 }
189135 $html .= "</table>\n";
190136 }
191 - if (($offset>0) || (count($results)>$limit))
192 - $html .= $navigation;
193137 }
194138
195139 $wgOut->addHTML($html);
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEn.php
@@ -184,6 +184,7 @@
185185 // Messages for the browsing system
186186 'smwbrowse' => 'Browse article',
187187 'smw_browse_article' => 'Enter the name of the article to start browsing from.',
 188+ 'smw_browse_go' => 'Go',
188189 'smw_browse_in' => 'Incoming',
189190 'smw_browse_out' => 'Outgoing',
190191 'smw_browse_docu' => '<p>Search for all properties of the given article.</p>',
Index: trunk/extensions/SemanticMediaWiki/skins/SMW_custom.css
@@ -83,6 +83,17 @@
8484 padding-right: 1em;
8585 }
8686
 87+td.smwsubjects{
 88+ text-align: right;
 89+ vertical-align: top;
 90+ padding-right: 1em;
 91+ width: 65%;
 92+}
 93+
 94+td.swmrelright{
 95+ vertical-align: middle;
 96+}
 97+
8798 td.smwrels, td.smwatts, td.smwspecs{
8899 vertical-align: top;
89100 width: 75%;
@@ -154,7 +165,7 @@
155166 padding-right: 20px;
156167 color: #888888;
157168 background: url(rdf_flyer.18.gif) center right no-repeat;
158 -
 169+
159170 }
160171
161172 #bodyContent span.rdflink a:hover{

Status & tagging log