From f99535168e9dafc9804f6ff6d5ca09b1dfe6a7d2 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Nov 2009 14:26:06 +0100 Subject: [PATCH] Lots of GITweb feature tuning - se manual --- content/quickbox.js | 170 ++++++++++++++++++++++------------ content/quickbox.xul | 2 +- locale/da-DK/tv2developer.dtd | 7 +- locale/en-US/tv2developer.dtd | 8 +- version | 2 +- webroot/index.html | 17 +++- webroot/whatsnew.xhtml | 8 ++ 7 files changed, 143 insertions(+), 71 deletions(-) diff --git a/content/quickbox.js b/content/quickbox.js index aa79be8..f6b1dac 100644 --- a/content/quickbox.js +++ b/content/quickbox.js @@ -104,7 +104,7 @@ var TV2DeveloperQuickBox = { if (target.id == 'action') { document.getElementById('sitetype').disabled = !makeSiteURL; document.getElementById('php4branch').disabled = (action != 'go-gitweb'); - document.getElementById('viewsource').disabled = (action != 'go-gitweb'); + document.getElementById('viewcontent').disabled = (action != 'go-gitweb'); document.getElementById('environment').disabled = (action == 'go-gitweb'); } document.getElementById('php4site').disabled = (!makeSiteURL || action == 'go-pdolog' || action == 'go-gitweb') @@ -127,8 +127,10 @@ var TV2DeveloperQuickBox = { _reg_extract_nums: /([0-9]+)/g, _reg_shortlink: /^((https?):\/?\/?)?([^/]*?)(tv2\.dk)?((\/[^#\?]*).*)?$/, _reg_classname: /^[A-Z][a-zA-Z0-9_/]*(\.(p(hp?)?)?)?$/, + _reg_onlyingit: /^conf(\/.*)?/, _reg_git_nopostfix: /^(?:archive|conf|default|phpincludes|symfoni|titoonic-includes)$/, _reg_git_rootfolders: /^\/(((Java|build|inc|opdatering|robot|scripts|sql|template|views|php|php5|fonts|webroot)(\/|$)|\/))/, + _reg_git_indexphpfolders: /^\/(((opdatering|webroot)(\/|$)|\/))/, _reg_git_dnsdomains: /^\/(tv2|tv2news|tv2film|sputnik|charlie|zulu)(\.|\.d|\.dk)?$/, _sitetypes: ['opdatering', 'robot', 'template'], _envs: ['test', 'snapshot'], @@ -244,7 +246,7 @@ var TV2DeveloperQuickBox = { // defaults if (!protocol) protocol = 'http'; - if (!uri) uri = '/'; + if (!uri) uri = ''; if (!site) site = ''; // determind action and options set @@ -281,6 +283,8 @@ var TV2DeveloperQuickBox = { auto_action = 'go-node'; } else if (this._reg_classname.exec(shorturl)) { auto_action = 'go-gitweb'; + } else if (this._reg_onlyingit.exec(shorturl)) { + auto_action = 'go-gitweb'; } else { // if we are using the user input as an url we keep an eventually already selected action if (!this._shouldMakeURL(cur_action.id)) { @@ -428,7 +432,7 @@ var TV2DeveloperQuickBox = { // Magically handle classnames (Enter as e.x. Tree_Node) var classname = this._reg_classname.exec(shorturl); var php4branch = document.getElementById('php4branch').checked; - var git_viewsource = document.getElementById('viewsource').checked; + var git_viewcontent = document.getElementById('viewcontent').checked; if (classname) { // may want to move this section up a bit due to entered_url already set var clsname = classname[0]; // remove ".php" : @@ -438,7 +442,11 @@ var TV2DeveloperQuickBox = { clsname = clsname.replace(/_/g,'/'); // add php if not entered path ends on a slash: if (clsname.substr(-1) != '/') clsname += '.php' - else git_viewsource = false; // if ending with slash, always show directory listing + else { + // if ending with slash, always show directory listing + clsname = clsname.substr(0, clsname.length-1); + git_viewcontent = false; + } uri = uriOnly = '/' + clsname; site = 'globals'; // must update entered url manually since it was stored before these changes @@ -447,6 +455,8 @@ var TV2DeveloperQuickBox = { var git_sitename = (!site) ? 'www' : site.replace(/-(static|dyn)/, ''); url = 'http://flimmer.tv2.dk/git/'; var git_root = '/' + sitetype; + var magicChangeView = (!manual); + var magicChangeViewTo = (uriOnly ? 'content' : 'summary'); if (git_sitename == 'globals') { // special support for globals url += git_sitename; @@ -456,33 +466,51 @@ var TV2DeveloperQuickBox = { git_root = ''; if (git_sitename == 'conf') { // Magic shortcuts for the 'conf' project: - var magicChangeShowSource = true; - var magicToShowSource = true; - if (uriOnly=='/dns') { - uriOnly = '/hosts/dns-master/master/'; - magicToShowSource = false; + var matched = true; + // Shortcuts for apache configurations + if (uriOnly=='/httpd') { + uriOnly = '/hosts/dn/httpd.conf'; + } else if (uriOnly=='/vhosts' || uriOnly=='/public') { + uriOnly = '/hosts/dn/vhosts.d/public.conf'; + } else if (uriOnly=='/symfoni') { + uriOnly = '/hosts/dn/vhosts.d/symfoni.m4'; + } else if (uriOnly=='/softlaunch') { + uriOnly = '/hosts/dn/vhosts.d/softlaunch.conf'; + } else if (uriOnly=='/php') { + uriOnly = '/hosts/dn/php.ini'; + // Shortcuts for DNS information + } else if (uriOnly=='/dns') { + uriOnly = '/hosts/dns-master/master'; } else if (dns_domain=this._reg_git_dnsdomains.exec(uriOnly)) { uriOnly = '/hosts/dns-master/master/'+dns_domain[1]+'.dk'; + // Shortcuts for Crontab Information } else if (uriOnly=='/cron') { uriOnly = '/hosts/robot-new/cronrun.crontab'; } else if (uriOnly=='/cron4') { uriOnly = '/hosts/robot/cronrun.crontab'; + // Shortcuts for scripts } else if (uriOnly=='/flimmer') { - uriOnly = '/hosts/flimmer/'; - magicToShowSource = false; + uriOnly = '/hosts/flimmer/scripts'; } else { - magicChangeShowSource = false; - } - if (magicChangeShowSource && !manual && git_viewsource != magicToShowSource) { - // auto default to show source for files, not for directories - this._autoChange = true; - git_viewsource = document.getElementById('viewsource').checked = magicToShowSource; - this._autoChange = false; + matched = false; } + if (matched) magicChangeViewTo = 'content'; } } else { url += git_sitename + '.tv2.dk'; } + // automatic set defaults for the selection of viewcontent: + if (magicChangeView) { + // how do we want to set the checkboxes? + var checkContent = (magicChangeViewTo == 'content'); + if (git_viewcontent != checkContent) { + // auto defaults + this._autoChange = true; + git_viewcontent = document.getElementById('viewcontent').checked = checkContent; + this._autoChange = false; + } + } + url += '.git'; // .git extension var entered_root = null; if (uriOnly && (entered_root=this._reg_git_rootfolders.exec(uriOnly))) { @@ -491,46 +519,48 @@ var TV2DeveloperQuickBox = { if (entered_root[1]=='/') { // you can exclude 'webroot/opdatering' by written two slashes: '//' uriOnly = uriOnly.substr(1); - } else if (entered_root[4]!='/') { - // be clever and add the missing slash - uriOnly += '/'; } + } else if (!uriOnly) { + // if no uri entered and we are going to show history, we will do this by default for the entire project + git_root = ''; } - var git_view = (!git_viewsource ? 'history' : 'blob') - if (!uriOnly) uriOnly = '/'; + var git_view = (!git_viewcontent ? 'history' : '') // empty let gitweb default to blob or tree + + if (!uriOnly) uriOnly = ''; uriOnly = git_root + uriOnly; // webroot, opdatering, robot,... var php = /^(.*\.php)/.exec(uriOnly); if (php) { - urlOnly = php[1]; + uriOnly = php[1]; } else if (uriOnly.substr(-1) == '/') { - if (git_viewsource) { + // we added index.php only inside webroot, opdatering: + if (this._reg_git_indexphpfolders.exec(uriOnly)) { uriOnly += 'index.php'; } else { - git_view = 'tree'; - // we show the directory listing :-) - } - } - if (uriOnly.length > 1) { - if (uriOnly.substr(-1) == '/') { // strip slash + // remove slash uriOnly = uriOnly.substr(0, uriOnly.length-1); } - if (uriOnly.length > 1) { - url += '?f=' + uriOnly.substr(1); - } + } else if (uriOnly.substr(-2) == '/.') { + // this allows directory listings + uriOnly = uriOnly.substr(0, uriOnly.length-2); } - url += (url.indexOf('?')!=-1?';':'?') + 'a=' + git_view + ';'; - if (php4branch) { - url += 'hb=php4'; - } else { - url += 'hb=HEAD'; + + if (uriOnly.length > 1) { + url += '?f=' + uriOnly.substr(1); + if (!git_viewcontent) { + url += ';a=history'; + } + } else if (git_viewcontent) { + // project tree + url += '?a=tree'; } + url += (url.indexOf('?')!=-1?';':'?') + 'hb=' + (php4branch ? 'php4' : 'HEAD'); break; case 'go-pdolog': uri = '/tool/pdo_log/frameset.php?url='+action_on_url_encoded+'&autostop=1&prefix='+current_user; break; } - // assmble url + // assemble url if (env == 'test' && username == '') { validState = false; username = '?'; @@ -543,8 +573,10 @@ var TV2DeveloperQuickBox = { document.getElementById('url').setAttribute('tooltiptext', document.getElementById('url').value = url); if (manual && this._shouldMakeURL(action)) { - // also change url in field - document.getElementById('shorturl').value = entered_url; + if (document.getElementById('shorturl').value != entered_url) { + // also change url in field + document.getElementById('shorturl').value = entered_url; + } } // are we using the alternativ initials? @@ -555,10 +587,11 @@ var TV2DeveloperQuickBox = { }, /* method to extract short url */ - _reg_fromgitweb: /^https?:\/\/flimmer\.tv2\.dk\/git\/([^/]+)(?:\.tv2\.dk)?\.git.*?(?:f=(?:(webroot|robot|opdatering|template|([^;/&]+)))([^;&]*))/, + _reg_fromgitweb: /^https?:\/\/flimmer\.tv2\.dk\/git\/([^/]+)(?:\.tv2\.dk)?\.git.*?/, + _reg_viewgitfile: /[?;&]f=(?:(webroot|robot|opdatering|template|([^;/&]+)))([^;&#]*)[&;#]?/, _reg_viewgitbranch1: /[?;&]hb=php4[&;#]?/, _reg_viewgitbranch2: /[?;&]h=refs\/heads\/php4[&;#]?/, - _reg_viewgitviewtype: /[?;&]a=(blob|tree)[&;#]?/, + _reg_viewgitviewtype: /[?;&]a=(blob|tree|history)[&;#]?/, _reg_fromi2if: /^http:\/\/i2\.(?:[^.]+\.)?opdatering\.(?:php5\.(?:test|snapshot)\.)?tv2\.dk\/(tango\/(entry|requeue|dynamic)|tool\/pdo_log\/frameset)\.php.*?(?:\?|&)url=([^&]+)/, _reg_fromloginif: /^http:\/\/login\.(?:([^.]+)\.)?opdatering\.(?:php5\.(test|snapshot)\.)?tv2\.dk\/opslag\.php.*?(?:\?|&)(user_id|username)=([^&]+)/, _reg_frombugzilla: /^http:\/\/bugzilla\.tv2\.dk\/(show_bug.cgi.*?(?:\?|&)id=([0-9]+))?/, @@ -630,9 +663,17 @@ var TV2DeveloperQuickBox = { var fromgitweb = this._reg_fromgitweb.exec(paramUrl); if (fromgitweb) { var tv2_sitename = fromgitweb[1]; - var tv2_sitetype = fromgitweb[2]; - var tv2_rootfolder = fromgitweb[3]; - var tv2_uri = fromgitweb[4]; + var tv2_sitetype = null; + var tv2_rootfolder = null; + var tv2_uri = null; + + // extract f= part of url + var fromgitfile = this._reg_viewgitfile.exec(paramUrl); + if (fromgitfile) { + tv2_sitetype = fromgitfile[1]; + tv2_rootfolder = fromgitfile[2]; + tv2_uri = fromgitfile[3]; + } action = 'go-gitweb'; if (tv2_sitename) { @@ -641,29 +682,38 @@ var TV2DeveloperQuickBox = { } url = tv2_sitename; if (!tv2_rootfolder) { - if (this._reg_git_nopostfix.exec(tv2_sitename)) { - // always include sitetype - url += '/'+tv2_sitetype; - } else { - url += (tv2_sitetype == 'webroot' ? '' : '.'+tv2_sitetype); + if (tv2_sitetype) { + if (this._reg_git_nopostfix.exec(tv2_sitename)) { + // always include sitetype + url += '/'+tv2_sitetype; + } else { + if (tv2_sitetype != 'webroot') { + url += '.'+tv2_sitetype; + if (!tv2_uri) url += '/'; + } + } } } else if (this._reg_git_rootfolders.exec(tv2_rootfolder)) { url += tv2_rootfolder; } else { url += '//' + tv2_rootfolder; } - url += tv2_uri; + if (tv2_uri) url += tv2_uri; + if (this._reg_viewgitbranch1.exec(paramUrl) || this._reg_viewgitbranch2.exec(paramUrl)) { document.getElementById('php4branch').checked = true; } var viewtype = this._reg_viewgitviewtype.exec(paramUrl) - if (viewtype) { - if (viewtype[1] == 'tree') { - url += '/'; - } else { // blob - document.getElementById('viewsource').checked = true; - } + if (viewtype && viewtype[1] == 'tree') { + url += '/'; } + + document.getElementById('viewcontent').checked = ( + // default is to show content if a url exists + !viewtype ? (tv2_uri ? true : false) : + // explicit + viewtype[1] == 'blob' || viewtype[1] == 'tree'); + } else { url = ''; } @@ -690,7 +740,7 @@ var TV2DeveloperQuickBox = { function() { TV2DeveloperQuickBox.setManuel(this); }, false); document.getElementById('php4branch').addEventListener('CheckboxStateChange', function() { TV2DeveloperQuickBox.setManuel(this); }, false); - document.getElementById('viewsource').addEventListener('CheckboxStateChange', + document.getElementById('viewcontent').addEventListener('CheckboxStateChange', function() { TV2DeveloperQuickBox.setManuel(this); }, false); // auto go (ALT+4) if (window.arguments && window.arguments[1]) { diff --git a/content/quickbox.xul b/content/quickbox.xul index d4d53fd..84555e9 100644 --- a/content/quickbox.xul +++ b/content/quickbox.xul @@ -67,8 +67,8 @@ + - diff --git a/locale/da-DK/tv2developer.dtd b/locale/da-DK/tv2developer.dtd index d572b74..bd36c53 100644 --- a/locale/da-DK/tv2developer.dtd +++ b/locale/da-DK/tv2developer.dtd @@ -38,7 +38,7 @@ - + @@ -60,11 +60,12 @@ + + + - - diff --git a/locale/en-US/tv2developer.dtd b/locale/en-US/tv2developer.dtd index 9470cf3..ab07860 100644 --- a/locale/en-US/tv2developer.dtd +++ b/locale/en-US/tv2developer.dtd @@ -37,7 +37,7 @@ - + @@ -59,12 +59,12 @@ + + + - - - diff --git a/version b/version index c317a91..9beb74d 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.13.1 +0.13.2 diff --git a/webroot/index.html b/webroot/index.html index 89c5cc2..79baa42 100644 --- a/webroot/index.html +++ b/webroot/index.html @@ -92,20 +92,33 @@
  • Skift mellem opdatering, robot, template ved at bruge forkortelser så som: o, r eller tem
  • Genkender andres test webs hvis der indtastes initialer på 4 bogstaver, eller der angives .t.
  • Slå sider op i Tango, vis den dynamiske version eller slå op i GIT direkte fra en forkortet URL
  • -
  • Genkender klasse-navne (start med stort bogstav) og slår dem op i GIT i globals, indtast f.eks.: ORM
  • +
  • Genkender klasse-navne (start med stort bogstav) og slår dem op i GIT i globals, indtast f.eks.: ORM, tilføj / for at se pakke-bibliotek.
  • Navigér videre rundt i GitWeb let ved hjælp af korte url'er, prøv ALT+3 i GitWeb
  • Genkender URL angivet som parameter i fleste i2-interfaces
  • Ved GitWeb genkendes specielle sites så som globals og specielle mapper så som inc, brug dobbelt slash (//) efter projektnavn for at undgå dette.
  • Slå TV 2 Login brugere op pr. navn eller id
  • Slå Bugzilla opgave op
  • Slå et I2 Regsitry namespace op i node-værktøjet
  • +
  • Eksempler på GIT opslags tricks:
  • +
  • Shortcuts for GIT opslag:
  • diff --git a/webroot/whatsnew.xhtml b/webroot/whatsnew.xhtml index 7d22174..690dfcd 100644 --- a/webroot/whatsnew.xhtml +++ b/webroot/whatsnew.xhtml @@ -6,6 +6,14 @@

    What's new:

    +
  • Bedre og flere GIT opslags tricks, eksempler:
  • +
      +
    • Skriv nyhederne for seneste historik for projektet "nyhederne.tv2.dk"
    • +
    • Skriv nyhederne/ for index.php i webroot i "nyhederne.tv2.dk"
    • +
    • Skriv nyhederne/. for filerne i webroot i "nyhederne.tv2.dk"
    • +
    • Skriv nyhederne// for roden af "nyhederne.tv2.dk"
    • +
    • Se flere detaljer i manualen.
    • +
    • Portet ViewVC functionality for GitWeb
    • New GitWeb navigation support.
    • -- 2.52.0