Пример #1
0
 private void writeSiteInfo(Writer writer, String virtualWikiName)
     throws DataAccessException, IOException {
   VirtualWiki virtualWiki = WikiBase.getDataHandler().lookupVirtualWiki(virtualWikiName);
   writer.append("\n<siteinfo>");
   String sitename = virtualWiki.getSiteName();
   writer.append('\n');
   XMLUtil.buildTag(writer, "sitename", sitename, true);
   String base = this.retrieveBaseUrl();
   writer.append('\n');
   XMLUtil.buildTag(writer, "base", base, true);
   String generator = "JAMWiki " + WikiVersion.CURRENT_WIKI_VERSION;
   writer.append('\n');
   XMLUtil.buildTag(writer, "generator", generator, true);
   /*
   Cannot have two titles differing only by case of first letter.  Default behavior through 1.5, $wgCapitalLinks = true
   	<enumeration value="first-letter" />
   Complete title is case-sensitive. Behavior when $wgCapitalLinks = false
   	<enumeration value="case-sensitive" />
   Cannot have two titles differing only by case. Not yet implemented as of MediaWiki 1.5
   	<enumeration value="case-insensitive" />
   */
   writer.append('\n');
   XMLUtil.buildTag(writer, "case", "case-sensitive", true);
   writer.append("\n<namespaces>");
   Map<String, String> attributes = new HashMap<String, String>();
   List<Namespace> namespaces = WikiBase.getDataHandler().lookupNamespaces();
   for (Namespace namespace : namespaces) {
     attributes.put("key", Integer.toString(namespace.getId()));
     writer.append('\n');
     XMLUtil.buildTag(writer, "namespace", namespace.getLabel(virtualWikiName), attributes, true);
   }
   writer.append("\n</namespaces>");
   writer.append("\n</siteinfo>");
 }
Пример #2
0
 /**
  * Given a namespace name, determine the topic type.
  *
  * @param namespace The namespace.
  * @return The topic type that matches the namespace.
  */
 public static TopicType findTopicTypeForNamespace(Namespace namespace) {
   if (namespace != null) {
     if (namespace.getId().equals(Namespace.CATEGORY_ID)) {
       return TopicType.CATEGORY;
     }
     if (namespace.getId().equals(Namespace.TEMPLATE_ID)) {
       return TopicType.TEMPLATE;
     }
     if (namespace.getId().equals(Namespace.JAMWIKI_ID)) {
       return TopicType.SYSTEM_FILE;
     }
     if (namespace.getId().equals(Namespace.FILE_ID)) {
       // FIXME - handle TYPE_FILE
       return TopicType.IMAGE;
     }
   }
   return TopicType.ARTICLE;
 }