Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Hard-Coded Bugzilla Link ("Report Bug") #36

Closed
tomschr opened this issue Jul 2, 2015 · 5 comments
Closed

Fix Hard-Coded Bugzilla Link ("Report Bug") #36

tomschr opened this issue Jul 2, 2015 · 5 comments
Assignees
Labels
cat-enhancement Enhancements format-html html, xhtml, html5, webhelp, jsp support
Milestone

Comments

@tomschr
Copy link
Collaborator

tomschr commented Jul 2, 2015

In our HTML, each section (or title) contains a "Report Bug" link. At the moment, this points to Bugzilla. It would be nice, to make this customizable, for example, to link to GitHub.

At the moment, this file is responsible for that: suse2013/static/js/script.js

@jcayouette Is that good enough?

@tomschr tomschr added cat-enhancement Enhancements xhtml format-html html, xhtml, html5, webhelp, jsp support labels Jul 2, 2015
@tomschr tomschr self-assigned this Jul 2, 2015
@tomschr tomschr added this to the 2.1 milestone Jul 2, 2015
@jcayouette
Copy link

yes thanks I will run it by the team perhaps we can fix it quickly.

@tomschr tomschr assigned fsundermeyer and unassigned tomschr Jul 2, 2015
@tomschr
Copy link
Collaborator Author

tomschr commented Jul 2, 2015

@fsundermeyer Could you look into the JavaScript code and see if this is possible? Thanks!

@tomschr
Copy link
Collaborator Author

tomschr commented Jul 16, 2015

Idea

A tracker URL shouldn't be hard-coded into the JavaScript code. Maybe we should integrate the tracker URL into our XML sources as meta information. Or we pass it as a parameter to our XSLT stylesheets set by daps.

Anyway, the variable bugzillaURLprefix are set by a hard-coded URL:

var bugzillaURLprefix = 'https://bugzilla.suse.com/enter_bug.cgi?&product=' // ...

we should better replace it with a function that returns the complete tracker URL:

var bugzillaURLprefix = extractTrackerURL(encodeURIComponent(bugzillaProduct), encodeURIComponent(bugzillaComponent));

The idea is, to add information about the tracker URL to our XML sources and transform it into a <meta> HTML tag. The JavaScript code could extract the element easily. If the tracker URL is not set, we could assume Bugzilla as default. The <meta> tag could look like this:

<meta name="tracker-url" content="{$tracker.url}"/>

The advantage is we don't have any hard-coded URLs anymore and we are more flexible.

Don't know how to code this in JavaScript...

tomschr added a commit that referenced this issue Jul 17, 2015
@mschnitzer
Copy link
Member

tomschr added a commit that referenced this issue Jul 20, 2015
* Removed switch/case cascade -> this should go into the corresponding
  XML source
* Removed hard-coded Bugzilla URL -> should go also in the XML source
* URL componentss are retrieved by <meta> tags
@tomschr
Copy link
Collaborator Author

tomschr commented Jul 20, 2015

Ok, here is the current state:

  1. Add the relevant tracker information into your XML source, preferably inside the dm:docmanager element (this is currently TBD and an issue for Add Tracker Meta Information docmanager#56).

  2. The docbook.xsl XSLT file extracts the respective dm:docmanager elements and creates (X)HTML <meta/> elements, for example:

    <meta name="tracker-url" content="https://bugzilla.suse.com/enter_bug.cgi"/>
    <meta name="tracker-bsc-product" content="SUSE Linux Enterprise High Availability Extension 12"/>
    <meta name="tracker-bsc-assignee" content="tux@example.com"/>
  3. The JS script script.js extracts the <meta/> information, assembles the tracker URL, and creates a link.

As Manuel already mentioned, the Bugzilla and GitHub URLs can contain "query strings". The following table lists the relevant field keywords for each tracker:

Bugzilla¹ GitHub
product n/a
component² n/a
comment body
short_desc title
assigned_to³ assignee³
version milestone

Footnotes:

  1. More field names can be seen here: http://devzing.com/blog/index.php/bugzilla-file-a-bug-by/
  2. By default set to Documentation
  3. Assignee account name. For Bugzilla it's the Bugzilla email, for GitHub the name.

The advantage of the above approch is:

  • We can use separate assignees for different files; so we can sort it out before any new bug entry is created.
  • We can change the components or product name without ever touching the JS script.
  • In case we need to support more trackers, it should be extended easily .
  • GitHub is also supported. Currently, we can set labels, milestones, assignees, titles, and the comment.

tomschr added a commit that referenced this issue Jul 22, 2015
* Introduced new parameter use.tracker.meta:
  used to control meta creation of bugtracker information

* Removed obsolete tracker.url template

* Created new tracker.meta.xsl file which handles all
  tracker related transformation

* Include tracker.meta.xsl in docbook.xsl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat-enhancement Enhancements format-html html, xhtml, html5, webhelp, jsp support
Projects
None yet
Development

No branches or pull requests

4 participants