aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-05-04 17:26:31 +0300
committerBoris Kolpackov <boris@codesynthesis.com>2016-05-06 15:18:18 +0200
commit3f7d602fd4e56c9b20a2ee8769ecd4cf69e6b696 (patch)
tree55d38a3118f6397de2c553505b0eaeaed28871da /mod
parentd2cef486101075942746f58a7fdbc31eb707553d (diff)
Add repository location to package version details and repository details pages
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-package-details.cxx6
-rw-r--r--mod/mod-package-version-details.cxx8
-rw-r--r--mod/mod-repository-details.cxx2
-rw-r--r--mod/page20
-rw-r--r--mod/page.cxx19
5 files changed, 42 insertions, 13 deletions
diff --git a/mod/mod-package-details.cxx b/mod/mod-package-details.cxx
index 2ff93c9..1ee7a7a 100644
--- a/mod/mod-package-details.cxx
+++ b/mod/mod-package-details.cxx
@@ -225,9 +225,9 @@ handle (request& rq, response& rs)
assert (p->internal ());
- // @@ Shouldn't we make package location to be a link to the proper
+ // @@ Shouldn't we make package repository name to be a link to the proper
// place of the About page, describing corresponding repository?
- // Yes, I think that's sounds reasonable, once we have about.
+ // Yes, I think that's sounds reasonable.
// Or maybe it can be something more valuable like a link to the
// repository package search page ?
//
@@ -238,7 +238,7 @@ handle (request& rq, response& rs)
//
// Hm, I am not so sure about this. Consider: stable/testing/unstable.
//
- s << TR_LOCATION (p->internal_repository.object_id (), root)
+ s << TR_REPOSITORY (p->internal_repository.object_id (), root)
<< TR_DEPENDS (p->dependencies, root)
<< TR_REQUIRES (p->requirements)
<< ~TBODY
diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx
index 149c8f9..80a87ef 100644
--- a/mod/mod-package-version-details.cxx
+++ b/mod/mod-package-version-details.cxx
@@ -162,6 +162,8 @@ handle (request& rq, response& rs)
assert (pkg->location && pkg->sha256sum);
+ const repository_location& rl (pkg->internal_repository.load ()->location);
+
s << TABLE(CLASS="proplist", ID="version")
<< TBODY
@@ -171,9 +173,9 @@ handle (request& rq, response& rs)
<< TR_PRIORITY (pkg->priority)
<< TR_LICENSES (pkg->license_alternatives)
- << TR_LOCATION (pkg->internal_repository.object_id (), root)
- << TR_DOWNLOAD (pkg->internal_repository.load ()->location.string () +
- "/" + pkg->location->string ())
+ << TR_REPOSITORY (rl.canonical_name (), root)
+ << TR_LOCATION (rl)
+ << TR_DOWNLOAD (rl.string () + "/" + pkg->location->string ())
<< TR_SHA256SUM (*pkg->sha256sum)
<< ~TBODY
<< ~TABLE
diff --git a/mod/mod-repository-details.cxx b/mod/mod-repository-details.cxx
index 91f0d1b..dffd0df 100644
--- a/mod/mod-repository-details.cxx
+++ b/mod/mod-repository-details.cxx
@@ -127,6 +127,8 @@ handle (request& rq, response& rs)
s << ~P;
}
+ s << P << A(HREF=r.location.string ()) << r.location << ~A << ~P;
+
ostringstream o;
butl::to_stream (o,
max (r.packages_timestamp, r.repositories_timestamp),
diff --git a/mod/page b/mod/page
index b326d6c..a01307c 100644
--- a/mod/page
+++ b/mod/page
@@ -264,12 +264,12 @@ namespace brep
const priority& priority_;
};
- // Generates package location element.
+ // Generates repository name element.
//
- class TR_LOCATION
+ class TR_REPOSITORY
{
public:
- TR_LOCATION (const string& n, const dir_path& r)
+ TR_REPOSITORY (const string& n, const dir_path& r)
: name_ (n), root_ (r) {}
void
@@ -280,6 +280,20 @@ namespace brep
const dir_path& root_;
};
+ // Generates repository location element.
+ //
+ class TR_LOCATION
+ {
+ public:
+ TR_LOCATION (const repository_location& l): location_ (l) {}
+
+ void
+ operator() (xml::serializer&) const;
+
+ private:
+ const repository_location& location_;
+ };
+
// Generates package download URL element.
//
class TR_DOWNLOAD
diff --git a/mod/page.cxx b/mod/page.cxx
index 7fc2e90..2ebbe7b 100644
--- a/mod/page.cxx
+++ b/mod/page.cxx
@@ -448,13 +448,13 @@ namespace brep
<< ~TR;
}
- // TR_LOCATION
+ // TR_REPOSITORY
//
- void TR_LOCATION::
+ void TR_REPOSITORY::
operator() (serializer& s) const
{
- s << TR(CLASS="location")
- << TH << "location" << ~TH
+ s << TR(CLASS="repository")
+ << TH << "repository" << ~TH
<< TD
<< SPAN(CLASS="value")
<< A
@@ -468,6 +468,17 @@ namespace brep
<< ~TR;
}
+ // TR_LOCATION
+ //
+ void TR_LOCATION::
+ operator() (serializer& s) const
+ {
+ s << TR(CLASS="location")
+ << TH << "location" << ~TH
+ << TD << SPAN(CLASS="value") << location_ << ~SPAN << ~TD
+ << ~TR;
+ }
+
// TR_DOWNLOAD
//
void TR_DOWNLOAD::