Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changed the html structure of Document View

  • Loading branch information...
commit fc639cb101baeb92ddcbf01413b86cffb6261c7e 1 parent 92bbf5d
@marubinotto authored
View
123 src/main/java/marubinotto/piggydb/ui/page/DocumentViewPage.java
@@ -10,66 +10,65 @@
public class DocumentViewPage extends AbstractTemplateWebResource {
- @Override
- protected boolean needsAuthentication() {
- return false;
- }
-
- //
- // Input
- //
-
- public Long id;
- public Fragment fragment;
-
- @Override
- protected boolean onPreInit() throws Exception {
- if (this.id == null) {
- getLogger().info("Missing parameter: id");
- return true;
- }
-
- this.fragment = getDomain().getFragmentRepository().get(this.id.longValue());
- if (this.fragment == null) {
- getLogger().info("Missing fragment: #" + this.id);
- return true;
- }
-
- if (!isAuthenticated() && !this.fragment.isPublic()) {
- getLogger().info("Forbidden: #" + this.id);
- setRedirectToLogin();
- return false;
- }
-
- fetchTagsAdditionally(this.fragment);
-
- return true;
- }
-
- private void fetchTagsAdditionally(Fragment fragment) throws Exception {
- List<Fragment> tagNotFetched = new ArrayList<Fragment>();
-
- // Grandchildren
- tagNotFetched.addAll(ModelUtils.collectChildrenOfEach(fragment
- .getChildren()));
- // Great-grandchildren
- tagNotFetched.addAll(ModelUtils.collectChildrenOfEach(tagNotFetched));
-
- getDomain().getFragmentRepository().refreshClassifications(tagNotFetched);
- }
-
- //
- // Model
- //
-
- public Boolean publicOnly;
- public String additionalCssImports;
-
- @Override
- protected void setModels() throws Exception {
- super.setModels();
-
- this.publicOnly = !isAuthenticated();
- this.additionalCssImports = PageImports.additionalCssImports.toString();
- }
+ @Override
+ protected boolean needsAuthentication() {
+ return false;
+ }
+
+ //
+ // Input
+ //
+
+ public Long id;
+ public Fragment fragment;
+
+ @Override
+ protected boolean onPreInit() throws Exception {
+ if (this.id == null) {
+ getLogger().info("Missing parameter: id");
+ return true;
+ }
+
+ this.fragment = getDomain().getFragmentRepository().get(this.id.longValue());
+ if (this.fragment == null) {
+ getLogger().info("Missing fragment: #" + this.id);
+ return true;
+ }
+
+ if (!isAuthenticated() && !this.fragment.isPublic()) {
+ getLogger().info("Forbidden: #" + this.id);
+ setRedirectToLogin();
+ return false;
+ }
+
+ fetchTagsAdditionally(this.fragment);
+
+ return true;
+ }
+
+ private void fetchTagsAdditionally(Fragment fragment) throws Exception {
+ List<Fragment> tagNotFetched = new ArrayList<Fragment>();
+
+ // Grandchildren
+ tagNotFetched.addAll(ModelUtils.collectChildrenOfEach(fragment.getChildren()));
+ // Great-grandchildren
+ tagNotFetched.addAll(ModelUtils.collectChildrenOfEach(tagNotFetched));
+
+ getDomain().getFragmentRepository().refreshClassifications(tagNotFetched);
+ }
+
+ //
+ // Model
+ //
+
+ public Boolean publicOnly;
+ public String additionalCssImports;
+
+ @Override
+ protected void setModels() throws Exception {
+ super.setModels();
+
+ this.publicOnly = !isAuthenticated();
+ this.additionalCssImports = PageImports.additionalCssImports.toString();
+ }
}
View
81 src/main/webapp/document-view.htm
@@ -15,56 +15,71 @@
<script type="text/javascript" src="$context/js/vendor/prettify/prettify.js?$version"></script>
</head>
<body onload="prettyPrint()">
-#if ($fragment.title) <h1>$fragment.title</h1> #end
-
-#fragmentContentForDoc($fragment)
+#set ($emptyTitle = $utils.raw("—"))
-<div class="toc">
+<div id="parents">
<ul>
- #foreach ($childRel in $fragment.getChildRelations($publicOnly))
<li>
- <a href="#r${childRel.id}">
- $utils.blankToNbsp($utils.raw($html.fragmentHeadline($childRel.to)))
- </a>
+ <a href="">test
+ <sub><img src="$context/images/arrow-in.gif" border="0" alt="-"/></sub></a>
</li>
- #end
</ul>
</div>
-#set ($emptyTitle = $utils.raw("—"))
-#foreach ($childRel in $fragment.getChildRelations($publicOnly))
-<div class="section">
- <h2 id="r${childRel.id}">
- <a class="title-link" href="$context/document-view.htm?id=$childRel.to.id">
- $utils.defaultIfNull($childRel.to.title, $emptyTitle)</a>
- </h2>
-
- #fragmentContentForDoc($childRel.to)
+<div id="main">
+ #if ($fragment.title) <h1>$fragment.title</h1> #end
- #foreach ($grandchildRel in $childRel.to.getChildRelations($publicOnly))
- <div class="subsection">
- <h3 id="r${grandchildRel.id}">
- <a class="title-link" href="$context/document-view.htm?id=$grandchildRel.to.id">
- $utils.defaultIfNull($grandchildRel.to.title, $emptyTitle)
- #if ($grandchildRel.to.hasChildren($publicOnly))
- <img class="arrow-button" src="$context/images/arrow-with-children.gif" alt="&rarr; ..."/>
- #end
- </a>
- </h3>
-
- #fragmentContentForDoc($grandchildRel.to)
+ #fragmentContentForDoc($fragment)
+
+ <div class="toc">
+ <ul>
+ #foreach ($childRel in $fragment.getChildRelations($publicOnly))
+ <li>
+ <a href="#r${childRel.id}">
+ $utils.blankToNbsp($utils.raw($html.fragmentHeadline($childRel.to)))
+ </a>
+ </li>
+ #end
+ </ul>
</div>
- #end ## foreach grandchildren
-
+
+ #foreach ($childRel in $fragment.getChildRelations($publicOnly))
+ <div class="section">
+ <h2 id="r${childRel.id}">
+ <a class="title-link" href="$context/document-view.htm?id=$childRel.to.id">
+ $utils.defaultIfNull($childRel.to.title, $emptyTitle)</a>
+ </h2>
+
+ #fragmentContentForDoc($childRel.to)
+
+ #foreach ($grandchildRel in $childRel.to.getChildRelations($publicOnly))
+ <div class="subsection">
+ <h3 id="r${grandchildRel.id}">
+ <a class="title-link" href="$context/document-view.htm?id=$grandchildRel.to.id">
+ $utils.defaultIfNull($grandchildRel.to.title, $emptyTitle)
+ #if ($grandchildRel.to.hasChildren($publicOnly))
+ <img class="arrow-button" src="$context/images/arrow-with-children.gif" alt="&rarr; ..."/>
+ #end
+ </a>
+ </h3>
+
+ #fragmentContentForDoc($grandchildRel.to)
+ </div>
+ #end ## foreach grandchildren
+
+ </div>
+ #end ## foreach children
+
</div>
-#end ## foreach children
#else ## fragment is null
+
<title>&nbsp;</title>
<link rel="shortcut icon" href="$context/images/favicon.ico" type="image/vnd.microsoft.icon"/>
</head>
<body>
#end
+
</body>
</html>
View
6 src/main/webapp/style/piggydb-document-view-phone.css
@@ -1,5 +1,9 @@
body {
- padding: 0;
+
+}
+
+#main {
+ padding: 5px;
}
div.toc {
View
20 src/main/webapp/style/piggydb-document-view.css
@@ -1,7 +1,9 @@
body {
+ margin: 0;
+ padding: 0;
+
color: #000000;
background-color: #fff;
- padding: 0px 10px 10px 10px;
font-family: Arial, Helvetica, sans-serif;
font-weight: normal;
@@ -10,6 +12,22 @@ body {
-webkit-text-size-adjust: 100%;
}
+#parents {
+ margin: 0;
+ padding: 5px;
+ background-color: #f8f8f8;
+ border-bottom: 1px solid #ddd;
+}
+
+#parents ul {
+ list-style: none;
+ margin-left: 5px;
+}
+
+#main {
+ padding: 0px 10px 10px 10px;
+}
+
h1 {
font-size: 1.5em;
}
Please sign in to comment.
Something went wrong with that request. Please try again.