diff --git a/FIRESTORM-FEATURETABLE.txt b/FIRESTORM-FEATURETABLE.txt index 3eec57919f..5aeccf44d1 100644 --- a/FIRESTORM-FEATURETABLE.txt +++ b/FIRESTORM-FEATURETABLE.txt @@ -64,3 +64,4 @@ ImprovedRadar LGPL Resizable_Profiles LGPL Derender LGPL RezUnderLandGroup LGPL +JiraLinkParsing LGPL diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 03b382a5af..17d3b7be73 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -38,6 +38,8 @@ #include "lluicolortable.h" #include "message.h" +#include //for boost::ifind_first -KC + #define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+/app)|(secondlife:///app))" // Utility functions @@ -1207,3 +1209,38 @@ std::string LLUrlEntryIcon::getIcon(const std::string &url) LLStringUtil::trim(mIcon); return mIcon; } + +// +// LLUrlEntryJira Describes Jira issue names -KC +// +LLUrlEntryJira::LLUrlEntryJira() +{ + mPattern = boost::regex("((?:ECC|SH|SOCIAL|LEAP|DN|MISC|SNOW|LLSD|CTS|PYO|STORM|PLAT|ER|VWR|SVC|WEB|SEC|ARVD|OPEN|SCR|PHOE|FIRE|SPOT)-\\d+)", + boost::regex::perl|boost::regex::icase); + mMenuName = "menu_url_http.xml"; + mTooltip = LLTrans::getString("TooltipHttpUrl"); +} + +std::string LLUrlEntryJira::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +{ + return unescapeUrl(url); +} + +std::string LLUrlEntryJira::getTooltip(const std::string &string) const +{ + return getUrl(string); +} + +std::string LLUrlEntryJira::getUrl(const std::string &string) const +{ + if (boost::ifind_first(string, "PHOE") || + boost::ifind_first(string, "FIRE") || + boost::ifind_first(string, "SPOT")) + { + return llformat("http://jira.phoenixviewer.com/browse/%s", string.c_str()); + } + else + { + return llformat("https://jira.secondlife.com/browse/%s", string.c_str()); + } +} diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 8834a73a3a..80e744fd07 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -440,5 +440,16 @@ public: /*virtual*/ std::string getIcon(const std::string &url); }; +/// +/// LLUrlEntryJira Describes Jira issue names -KC +/// +class LLUrlEntryJira : public LLUrlEntryBase +{ +public: + LLUrlEntryJira(); + /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); + /*virtual*/ std::string getTooltip(const std::string &string) const; + /*virtual*/ std::string getUrl(const std::string &string) const; +}; #endif diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 877a1e6e6b..2ccaaea4c8 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -29,6 +29,7 @@ #include "llurlregistry.h" #include +#include //for boost::ifind_first -KC // default dummy callback that ignores any label updates from the server void LLUrlRegistryNullCallback(const std::string &url, const std::string &label, const std::string& icon) @@ -73,6 +74,8 @@ LLUrlRegistry::LLUrlRegistry() // most common pattern is a URL without any protocol, // e.g., "secondlife.com" registerUrl(new LLUrlEntryHTTPNoProtocol()); + // parse jira issue names to links -KC + registerUrl(new LLUrlEntryJira()); } LLUrlRegistry::~LLUrlRegistry() @@ -151,10 +154,38 @@ static bool stringHasUrl(const std::string &text) text.find("