Improved Unfuddle Tickets Plugin.
This commit is contained in:
parent
d60b6881cb
commit
0c2552c2eb
2 changed files with 57 additions and 24 deletions
|
@ -3,29 +3,40 @@
|
||||||
<xsl:output method="html"/>
|
<xsl:output method="html"/>
|
||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
<div id="UnfuddleTicketsDiv">
|
<div id="UnfuddleTicketsDiv">
|
||||||
|
<!-- JavaScript -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
// <![CDATA[
|
||||||
|
function ToggleTicketDetails(ticketId) {
|
||||||
|
var descr = document.getElementById("ticket_description_" + ticketId);
|
||||||
|
if(descr.style["display"] == "none") descr.style["display"] = "";
|
||||||
|
else descr.style["display"] = "none";
|
||||||
|
}
|
||||||
|
// ]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
<!-- Highest -->
|
<!-- Highest -->
|
||||||
<xsl:if test="count(/root/ticket-report/groups/group/title[text() = 'Highest']/parent::group/tickets) > 0">
|
<xsl:if test="count(/root/ticket-report/groups/group/title[text() = 'Highest']/parent::group/tickets) > 0">
|
||||||
<h2 class="separator">Priority: Highest</h2>
|
<h2 class="separator">Highest Priority</h2>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:apply-templates select="/root/ticket-report/groups/group/title[text() = 'Highest']/parent::group/tickets"/>
|
<xsl:apply-templates select="/root/ticket-report/groups/group/title[text() = 'Highest']/parent::group/tickets"/>
|
||||||
<!-- High -->
|
<!-- High -->
|
||||||
<xsl:if test="count(/root/ticket-report/groups/group/title[text() = 'High']/parent::group/tickets) > 0">
|
<xsl:if test="count(/root/ticket-report/groups/group/title[text() = 'High']/parent::group/tickets) > 0">
|
||||||
<h2 class="separator">Priority: High</h2>
|
<h2 class="separator">High Priority</h2>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:apply-templates select="/root/ticket-report/groups/group/title[text() = 'High']/parent::group/tickets"/>
|
<xsl:apply-templates select="/root/ticket-report/groups/group/title[text() = 'High']/parent::group/tickets"/>
|
||||||
<!-- Normal -->
|
<!-- Normal -->
|
||||||
<xsl:if test="count(/root/ticket-report/groups/group/title[text() = 'Normal']/parent::group/tickets) > 0">
|
<xsl:if test="count(/root/ticket-report/groups/group/title[text() = 'Normal']/parent::group/tickets) > 0">
|
||||||
<h2 class="separator">Priority: Normal</h2>
|
<h2 class="separator">Normal Priority</h2>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:apply-templates select="/root/ticket-report/groups/group/title[text() = 'Normal']/parent::group/tickets"/>
|
<xsl:apply-templates select="/root/ticket-report/groups/group/title[text() = 'Normal']/parent::group/tickets"/>
|
||||||
<!-- Low -->
|
<!-- Low -->
|
||||||
<xsl:if test="count(/root/ticket-report/groups/group/title[text() = 'Low']/parent::group/tickets) > 0">
|
<xsl:if test="count(/root/ticket-report/groups/group/title[text() = 'Low']/parent::group/tickets) > 0">
|
||||||
<h2 class="separator">Priority: Low</h2>
|
<h2 class="separator">Low Priority</h2>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:apply-templates select="/root/ticket-report/groups/group/title[text() = 'Low']/parent::group/tickets"/>
|
<xsl:apply-templates select="/root/ticket-report/groups/group/title[text() = 'Low']/parent::group/tickets"/>
|
||||||
<!-- Lowest -->
|
<!-- Lowest -->
|
||||||
<xsl:if test="count(/root/ticket-report/groups/group/title[text() = 'Lowest']/parent::group/tickets) > 0">
|
<xsl:if test="count(/root/ticket-report/groups/group/title[text() = 'Lowest']/parent::group/tickets) > 0">
|
||||||
<h2 class="separator">Priority: Lowest</h2>
|
<h2 class="separator">Lowest Priority</h2>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:apply-templates select="/root/ticket-report/groups/group/title[text() = 'Lowest']/parent::group/tickets"/>
|
<xsl:apply-templates select="/root/ticket-report/groups/group/title[text() = 'Lowest']/parent::group/tickets"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -59,6 +70,7 @@
|
||||||
<br />
|
<br />
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
<xsl:template match="/root/ticket-report/groups/group/tickets/ticket">
|
<xsl:template match="/root/ticket-report/groups/group/tickets/ticket">
|
||||||
|
<xsl:variable name="number" select="number"/>
|
||||||
<tr>
|
<tr>
|
||||||
<xsl:if test="position() mod 2 != 1">
|
<xsl:if test="position() mod 2 != 1">
|
||||||
<xsl:attribute name="class">priority_{priority} tablerowalternate</xsl:attribute>
|
<xsl:attribute name="class">priority_{priority} tablerowalternate</xsl:attribute>
|
||||||
|
@ -68,10 +80,16 @@
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:variable name="priority" select="priority"/>
|
<xsl:variable name="priority" select="priority"/>
|
||||||
<td class='priority_{priority}' style="text-align: left;">
|
<td class='priority_{priority}' style="text-align: left;">
|
||||||
|
<a href="#" onclick="javascript:ToggleTicketDetails('{number}'); return false;">
|
||||||
<xsl:value-of select="number"/>
|
<xsl:value-of select="number"/>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class='priority_{priority}'>
|
<td class='priority_{priority}'>
|
||||||
|
<a href="#" onclick="javascript:ToggleTicketDetails('{number}'); return false;">
|
||||||
|
<b>
|
||||||
<xsl:value-of select="summary" disable-output-escaping="yes"/>
|
<xsl:value-of select="summary" disable-output-escaping="yes"/>
|
||||||
|
</b>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class='priority_{priority}'>
|
<td class='priority_{priority}'>
|
||||||
<xsl:variable name="c" select="substring(status,1,1)"/>
|
<xsl:variable name="c" select="substring(status,1,1)"/>
|
||||||
|
@ -97,5 +115,17 @@
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr style="display: none;" id="ticket_description_{number}">
|
||||||
|
<xsl:if test="position() mod 2 != 1">
|
||||||
|
<xsl:attribute name="class">tablerowalternate</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="position() mod 2 != 0">
|
||||||
|
<xsl:attribute name="class">tablerow</xsl:attribute>
|
||||||
|
</xsl:if>
|
||||||
|
<td colspan="5" style="padding: 10px;">
|
||||||
|
<!-- This could also be description-formatted -->
|
||||||
|
<xsl:value-of select="description" disable-output-escaping="yes"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace ScrewTurn.Wiki.Plugins.PluginPack {
|
||||||
private const string ConfigHelpHtmlValue = "Config consists of three lines:<br/><i><Url></i> - The base url to the Unfuddle API (i.e. http://account_name.unfuddle.com/api/v1/projects/project_ID)<br/><i><Username></i> - The username to the unfuddle account to use for authentication<br/><i><Password></i> - The password to the unfuddle account to use for authentication<br/>";
|
private const string ConfigHelpHtmlValue = "Config consists of three lines:<br/><i><Url></i> - The base url to the Unfuddle API (i.e. http://account_name.unfuddle.com/api/v1/projects/project_ID)<br/><i><Username></i> - The username to the unfuddle account to use for authentication<br/><i><Password></i> - The password to the unfuddle account to use for authentication<br/>";
|
||||||
private const string LoadErrorMessage = "Unable to load ticket report at this time.";
|
private const string LoadErrorMessage = "Unable to load ticket report at this time.";
|
||||||
private static readonly Regex UnfuddleRegex = new Regex(@"{unfuddle}", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
private static readonly Regex UnfuddleRegex = new Regex(@"{unfuddle}", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||||
private static readonly ComponentInformation Info = new ComponentInformation("Unfuddle Tickets Plugin", "Threeplicate Srl", "3.0.2.538", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/UnfuddleTickets2.txt");
|
private static readonly ComponentInformation Info = new ComponentInformation("Unfuddle Tickets Plugin", "Threeplicate Srl", "3.0.4.575", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/UnfuddleTickets2.txt");
|
||||||
|
|
||||||
private string _config;
|
private string _config;
|
||||||
private IHostV30 _host;
|
private IHostV30 _host;
|
||||||
|
@ -77,14 +77,17 @@ namespace ScrewTurn.Wiki.Plugins.PluginPack {
|
||||||
|
|
||||||
if(block.Key != -1) {
|
if(block.Key != -1) {
|
||||||
string unfuddleTickets = null;
|
string unfuddleTickets = null;
|
||||||
if(HttpContext.Current != null)
|
if(HttpContext.Current != null) {
|
||||||
unfuddleTickets = HttpContext.Current.Cache["UnfuddleTicketsStore"] as string;
|
unfuddleTickets = HttpContext.Current.Cache["UnfuddleTicketsStore"] as string;
|
||||||
|
}
|
||||||
|
|
||||||
if(string.IsNullOrEmpty(unfuddleTickets))
|
if(string.IsNullOrEmpty(unfuddleTickets)) {
|
||||||
unfuddleTickets = LoadUnfuddleTicketsFromWeb();
|
unfuddleTickets = LoadUnfuddleTicketsFromWeb();
|
||||||
|
}
|
||||||
|
|
||||||
if(string.IsNullOrEmpty(unfuddleTickets))
|
if(string.IsNullOrEmpty(unfuddleTickets)) {
|
||||||
unfuddleTickets = LoadErrorMessage;
|
unfuddleTickets = LoadErrorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
buffer.Insert(block.Key, unfuddleTickets);
|
buffer.Insert(block.Key, unfuddleTickets);
|
||||||
|
@ -211,7 +214,7 @@ namespace ScrewTurn.Wiki.Plugins.PluginPack {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tickets = GetXml("/ticket_reports/dynamic?sort_by=priority&sort_direction=DESC&conditions_string=status-neq-closed&group_by=priority&fields_string=number,priority,summary,milestone,status,version", _username, _password);
|
var tickets = GetXml("/ticket_reports/dynamic?sort_by=priority&sort_direction=DESC&conditions_string=status-neq-closed&group_by=priority&fields_string=number,priority,summary,milestone,status,version,description&formatted=true", _username, _password);
|
||||||
if(tickets == null) {
|
if(tickets == null) {
|
||||||
LogWarning("Exception occurred while pulling unfuddled ticket information from the API.");
|
LogWarning("Exception occurred while pulling unfuddled ticket information from the API.");
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue