1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2020 - Samuel GOUGEON
4 // This file is hereby licensed under the terms of the GNU GPL v2.0,
5 // pursuant to article 5.3.4 of the CeCILL v.2.1.
6 // This file was originally licensed under the terms of the CeCILL v2.1,
7 // and continues to be available under such terms.
8 // For more information, see the COPYING file which you should have received
9 // along with this program.
11 function helpbrowser_menus_cb(action, param)
12 // PRIVATE function used by the help browser
14 jimport org.scilab.modules.gui.helpbrowser.ScilabHelpBrowser
15 hb = ScilabHelpBrowser.getHelpBrowserWithoutCreation()
16 url = hb.getCurrentURL()
17 [?,?,?, currentLang] = regexp(url, "/scilab_(.+?)_help.jar/")
18 id = hb.getCurrentID()
19 isSection = grep(id, "/^section_/", "r") <> []
20 tmp = msprintf("#^jar:file:/%s/modules/helptools/jar#", SCI)
21 isExternal = grep(url, tmp, "r") == []
25 if currentLang == param then
30 helpbrowser(%helps(:,1), id, param, %f);
34 msg = _("Help browser: Pages of external modules can''t be viewed online")
35 messagebox(msg, "modal")
39 msg = _("Help browser: Tables of contents can''t be targeted online")
40 messagebox(msg, "modal")
43 v = getversion("scilab")
44 v = msprintf("%d.%d.%d", v(1),v(2),v(3))
45 url = "https://help.scilab.org/docs/%s/%s/%s.html"
46 url = msprintf(url,v, currentLang, id)
51 msg = _("Help browser: Bugs of external modules can''t be listed.")
52 messagebox(msg, "modal")
56 msg = _("Help browser: Table of contents can''t be targeted in Bugzilla")
57 messagebox(msg, "modal")
60 BugzillaSearch = "http://bugzilla.scilab.org/buglist.cgi" + ..
61 "?product=Scilab software&query_format=advanced" + ..
62 "&short_desc_type=regexp&short_desc=£"+..
63 "&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED" + ..
64 "&order=resolution,bug_id DESC"
65 if ~isdef("param","l") | type(param)<>10 | param(1)<>"unresolved"
66 BugzillaSearch = BugzillaSearch + "&bug_status=RESOLVED"
68 prepend = "(^|[^a-zA-Z_])"
69 append = "([^0-9a-zA-Z_%3B]|$)"
70 url = strsubst(BugzillaSearch, "£", prepend+"("+id+")"+append)
75 // ---------------------------------------------------------------------------
78 v = xmlGetValues("//web/body/web", ["default-browser" "command-browser"])
79 [default, cmd] = (v(1)=="true", v(2))
86 unix(msprintf("start """" %s ""%s""", v(2), url))
90 if default, cmd = "xdg-open ", end
91 unix(cmd + """" + url + """")
94 if default, cmd = "open ", end
95 unix(cmd + """" + url + """")