commit/mtrack: 4 new changesets

0 views
Skip to first unread message

Bitbucket

unread,
Apr 17, 2012, 1:51:16 PM4/17/12
to mtr...@googlegroups.com
4 new commits in mtrack:


https://bitbucket.org/wez/mtrack/changeset/c3836ea734f5/
changeset: c3836ea734f5
user: wez
date: 2012-04-17 15:17:06
summary: add breadcrumbs to wiki
affected #: 3 files

diff -r 41b5d0436e87fb332f38db8c88b8abcd54c8a814 -r c3836ea734f5d75d8742a57ffe23b25479cbc7d8 inc/web.php
--- a/inc/web.php
+++ b/inc/web.php
@@ -345,6 +345,42 @@
}
}

+function mtrack_breadcrumb($path, $base_url = null)
+{
+ if ($path[0] != '/') {
+ $path = '/' . $path;
+ }
+ if ($path == '/') {
+ $crumbs = array('');
+ } else {
+ $crumbs = explode('/', $path);
+ }
+
+ $html = "<ul class='breadcrumb'>";
+ $location = $base_url;
+ foreach ($crumbs as $i => $ele) {
+ if (!strlen($ele)) {
+ $path = '<i class="icon-home"></i> ';
+ } else {
+ $location .= '/' . urlencode($ele);
+ $path = htmlentities($ele, ENT_QUOTES, 'utf-8');
+ }
+ if ($i == count($crumbs) - 1) {
+ $html .= "<li class='active'>";
+ } else {
+ $html .= "<li>";
+ }
+ $html .= "<a href='$location'>$path</a> ";
+
+ if ($i < count($crumbs) - 1) {
+ $html .= "<span class='divider'>/</span>";
+ }
+ $html .= "</li>";
+ }
+ $html .= "</ul>";
+ return $html;
+}
+
function mtrack_nav($id, $nav) {
global $ABSWEB;


diff -r 41b5d0436e87fb332f38db8c88b8abcd54c8a814 -r c3836ea734f5d75d8742a57ffe23b25479cbc7d8 web/css/wiki.css
--- a/web/css/wiki.css
+++ b/web/css/wiki.css
@@ -253,6 +253,7 @@
padding-left: 0.5em;
padding-right: 0.5em;
padding-bottom: 1em;
+ margin-top: 8px; /* don't collide with breadcrumbs */
}

ol#outline {


diff -r 41b5d0436e87fb332f38db8c88b8abcd54c8a814 -r c3836ea734f5d75d8742a57ffe23b25479cbc7d8 web/wiki.php
--- a/web/wiki.php
+++ b/web/wiki.php
@@ -14,6 +14,8 @@
$rev = null;
}

+$hide_outline = false;
+
try {
if ($rev) {
$W = MTrackAPI::invoke('GET', '/wiki/page/' . $pi, null, array(
@@ -29,34 +31,88 @@
if ($e->getCode() != 404) {
throw $e;
}
- /* fake an empty one so that we can give the user the option of creating
- * a new page */
- $W = new stdclass;
- $W->id = $pi;
- $W->version = null;
- $W->content = null;
- $W->content_html = '';
- $W->changelog_html = null;
- $W->changelog = null;
- $W->when = null;
- $W->who = null;
- $ATTACH = json_encode(array());
- $edit = MTrackACL::hasAnyRights("wiki:$pi", 'create');

- if (!$edit) {
- header("HTTP/1.0 404 Not Found");
- mtrack_head($pi);
- echo "<h1>Page Not Found</h1>";
- mtrack_foot();
- exit;
+ /* if they're looking at a directory, give them a list of candidate
+ * pages to look at instead */
+ $tree = MTrackWikiItem::get_wiki_tree();
+ $path_bits = explode('/', $pi);
+ $dir = $tree;
+ foreach ($path_bits as $name) {
+ if (!isset($tree->{$name})) {
+ $tree = null;
+ break;
+ }
+ $tree = $tree->{$name};
+ }
+
+ if ($tree) {
+ $edit = false;
+
+ /* fake an empty summary page listing out the elements on this one */
+ $W = new stdclass;
+ $W->id = $pi;
+ $W->version = null;
+ $W->content = "\n\n";
+
+ foreach ($tree as $k => $name) {
+ $W->content .= " * [wiki:$pi/$k $k]\n";
+ }
+ $W->content .= "\n\n[help: Complete List of Wiki Pages]\n";
+
+ $W->content_html = MTrackWiki::format_to_html($W->content);
+ $W->changelog_html = null;
+ $W->changelog = null;
+ $W->when = null;
+ $W->who = null;
+ $ATTACH = json_encode(array());
+ $hide_outline = true;
+
+ } else {
+
+ /* fake an empty one so that we can give the user the option of creating
+ * a new page */
+ $W = new stdclass;
+ $W->id = $pi;
+ $W->version = null;
+ $W->content = null;
+ $W->content_html = '';
+ $W->changelog_html = null;
+ $W->changelog = null;
+ $W->when = null;
+ $W->who = null;
+ $ATTACH = json_encode(array());
+ $edit = MTrackACL::hasAnyRights("wiki:$pi", 'create');
+
+ if (!$edit) {
+ header("HTTP/1.0 404 Not Found");
+ mtrack_head($pi);
+ echo "<h1>Page Not Found</h1>";
+ mtrack_foot();
+ exit;
+ }
}
}
mtrack_head($pi);
+
+if ($hide_outline) {
+ echo <<<HTML
+<script>
+$(document).ready(function() {
+ $('#outlinetoggle').hide();
+ $('#wikiinfo').hide();
+});
+</script>
+HTML;
+}
+
+
$edit = json_encode($edit);
$latest = json_encode($rev == null);
$J = json_encode($W);
+$crumbs = mtrack_breadcrumb($pi, $ABSWEB . 'wiki.php');
echo <<<HTML
<div id='wikiview'>
+ $crumbs
<div id='wiki' class='wikipage'></div><div id='attachments'><h2>Attachments</h2>

https://bitbucket.org/wez/mtrack/changeset/0aee16142fe6/
changeset: 0aee16142fe6
user: wez
date: 2012-04-17 15:24:54
summary: avoid mercurial nuances with older versions when the requested file or dir doesn't exist.
affected #: 1 file

diff -r c3836ea734f5d75d8742a57ffe23b25479cbc7d8 -r 0aee16142fe684823d63a6e7fa4fbc1fdb853086 inc/wiki-item.php
--- a/inc/wiki-item.php
+++ b/inc/wiki-item.php
@@ -218,7 +218,17 @@
MTrackAPI::error(404, "no such page", $page);
}
if ($W->file) {
- $hist = $W->file->getChangeEvent();
+ try {
+ $hist = $W->file->getChangeEvent();
+ } catch (Exception $e) {
+ // Happens with certain older versions of mercurial; map it as
+ // a 404
+ if ($method == 'GET') {
+ MTrackAPI::error(404, "no such page", array($page, $rev, $w));
+ }
+ // otherwise, pass it on
+ throw $e;
+ }
$w->version = $hist->rev;
}
if ($method == 'GET' && (($rev && $w->version != $rev) || (!$W->file))) {

https://bitbucket.org/wez/mtrack/changeset/50827c63e1ca/
changeset: 50827c63e1ca
user: wez
date: 2012-04-17 17:13:43
summary: 'closed' == true in PHP, be more specific
affected #: 1 file

diff -r 0aee16142fe684823d63a6e7fa4fbc1fdb853086 -r 50827c63e1cab4a8dd3b098592f9af3f678e4179 inc/milestone.php
--- a/inc/milestone.php
+++ b/inc/milestone.php
@@ -32,7 +32,7 @@

static function enumMilestones($all = false)
{
- if ($all == 'closed') {
+ if ($all === 'closed') {
$q = MTrackDB::q('select mid, name from milestones where completed is not null and deleted != 1');
} elseif ($all) {
$q = MTrackDB::q('select mid, name from milestones where deleted != 1');

https://bitbucket.org/wez/mtrack/changeset/00cffedd98b8/
changeset: 00cffedd98b8
user: wez
date: 2012-04-17 19:49:26
summary: turn off this log...
affected #: 1 file

diff -r 50827c63e1cab4a8dd3b098592f9af3f678e4179 -r 00cffedd98b8313bd12426a1733a3cba1a5991ec inc/web.php
--- a/inc/web.php
+++ b/inc/web.php
@@ -1215,9 +1215,9 @@
echo htmlentities($cmd) . "<br>\n";
}
}
- $log = fopen('/var/tmp/mtrack.popen.log', 'a');
- fwrite($log, date('Y-m-d H:i:s') . " $cmd\n");
- fclose($log);
+# $log = fopen('/var/tmp/mtrack.popen.log', 'a');
+# fwrite($log, date('Y-m-d H:i:s') . " $cmd\n");
+# fclose($log);
switch ($mode) {
case 'read': return popen($cmd, 'r');
case 'write': return popen($cmd, 'w');

Repository URL: https://bitbucket.org/wez/mtrack/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.

Bitbucket

unread,
Apr 20, 2012, 7:16:17 PM4/20/12
to mtr...@googlegroups.com
4 new commits in mtrack:


https://bitbucket.org/wez/mtrack/changeset/748c69f83d8d/
changeset: 748c69f83d8d
user: wez
date: 2012-04-20 20:05:06
summary: fix width of progress bar
affected #: 1 file

diff -r 4f8a72167e883274439a6c0a6faabb1de37bf04f -r 748c69f83d8d9ab81be8f25f883ec8d88d7c845d inc/milestone.php
--- a/inc/milestone.php
+++ b/inc/milestone.php
@@ -405,7 +405,7 @@
}
$cpct = 100 - $apct;
$html .= <<<HTML
-<div class='progress progress-success progress-striped' style='width: 36.5em'>
+<div class='progress progress-success progress-striped' style='width: 50%'><div class='bar' style='width:$cpct%;'></div></div>
HTML;

https://bitbucket.org/wez/mtrack/changeset/5bcfda6feee7/
changeset: 5bcfda6feee7
user: wez
date: 2012-04-20 20:58:49
summary: add a two-up wiki edit mode. Auto-select two-up when we're wide enough.
affected #: 2 files

diff -r 748c69f83d8d9ab81be8f25f883ec8d88d7c845d -r 5bcfda6feee787596d251f7718f59043482049f0 web/js/views.js
--- a/web/js/views.js
+++ b/web/js/views.js
@@ -681,7 +681,7 @@
/* hide any pre-existing preview while we edit, so that it doesn't
* collide with a possible search-for-text in page initiated by
* the user */
- view.$('div.wiki-preview').hide();
+ view.$('div.wiki-preview').remove();
overlay = $('<div class="overlay"/>');
overlay.appendTo('body').fadeIn('fast');
container = $('<div class="popupForm"/>');
@@ -726,12 +726,30 @@
// Add preview size toggle button
var toggle = $('<button class="wikipreviewtoggle btn"><i class="icon-resize-small"></i></button>');
$('div.markItUpHeader', container).append(toggle);
+ // There are three states:
+ // "small", "full" and "twoup"
+ var state = 0;
+ var icon_classes = ['icon-resize-small', 'icon-resize-full',
+ 'icon-resize-full'];
+ var container_classes = ['', 'maximized', 'twoup'];
+
+ function set_state(s) {
+ container.removeClass(container_classes[state]);
+ $('i', toggle).removeClass(icon_classes[state]);
+ state = s;
+ if (state > 2) state = 0;
+ container.addClass(container_classes[state]);
+ $('i', toggle).addClass(icon_classes[state]);
+ }
+ /* if we're wide enough, default to two-up */
+ var measure = $('<div style="width:50em"></div>');
+ container.append(measure);
+ if (measure.width() * 1.75 < container.width()) {
+ set_state(2);
+ }
+ measure.remove();
toggle.click(function () {
- var maxi = container.hasClass('maximized') ? false : true;
- container.toggleClass('maximized', maxi);
- $('i', toggle)
- .toggleClass('icon-resize-full', maxi)
- .toggleClass('icon-resize-small', !maxi);
+ set_state(state + 1);
});
toggle.tooltip({
title: "Adjust preview/editor proportions",


diff -r 748c69f83d8d9ab81be8f25f883ec8d88d7c845d -r 5bcfda6feee787596d251f7718f59043482049f0 web/mtrack.css
--- a/web/mtrack.css
+++ b/web/mtrack.css
@@ -653,6 +653,7 @@
left: 1em;
right: 1em;

+ border: solid 1px #eee;
top: 70%;
/* accomodates buttons and optional caption heading */
margin-top: 8.5em;
@@ -668,6 +669,39 @@
top: 30%;
}

+/* and for the two-up variation */
+.popupForm.twoup div.wiki {
+ width: 50em;
+ position: absolute;
+ top: 1em;
+ bottom: 5em;
+ height: auto;
+}
+
+/* push down when we have a caption */
+.popupForm.twoup h1.caption + div.wiki {
+ top: 3em;
+}
+
+.popupForm.twoup div.wiki-preview {
+ left: 52em;
+ top: 0px;
+ bottom: 0px;
+ margin-top: 0px;
+ z-index: 1;
+ padding-left: 1em;
+ padding-top: 1em;
+ background-color: white;
+ border: none;
+ border-left: solid 1px #eee;
+}
+.popupForm.twoup div.modal-footer {
+ position: absolute;
+ bottom: 0px;
+ left: 0px;
+ width: 50em;
+ z-index: 0;
+}

input[type=submit]#confirm-upload {
font-size: 1.1em;

https://bitbucket.org/wez/mtrack/changeset/ed96c1192c25/
changeset: ed96c1192c25
user: wez
date: 2012-04-20 23:16:41
summary: if the user down-sizes from a two-up, don't allow selecting a two-up
unless there is enough width. Keep the resize button top-right for
easier toggling.
affected #: 2 files

diff -r 5bcfda6feee787596d251f7718f59043482049f0 -r ed96c1192c250c405bcccde00dc356c6bb619b04 web/js/views.js
--- a/web/js/views.js
+++ b/web/js/views.js
@@ -732,22 +732,22 @@
var icon_classes = ['icon-resize-small', 'icon-resize-full',
'icon-resize-full'];
var container_classes = ['', 'maximized', 'twoup'];
+ var measure = $('<div style="width:50em"></div>');
+ container.append(measure);

function set_state(s) {
container.removeClass(container_classes[state]);
$('i', toggle).removeClass(icon_classes[state]);
state = s;
+ if (state == 2 && measure.width() * 1.75 > container.width()) {
+ state = 0;
+ }
if (state > 2) state = 0;
container.addClass(container_classes[state]);
$('i', toggle).addClass(icon_classes[state]);
}
/* if we're wide enough, default to two-up */
- var measure = $('<div style="width:50em"></div>');
- container.append(measure);
- if (measure.width() * 1.75 < container.width()) {
- set_state(2);
- }
- measure.remove();
+ set_state(2);
toggle.click(function () {
set_state(state + 1);
});
@@ -776,6 +776,7 @@
container.fadeOut('fast', function () {
container.remove();
});
+ measure.remove();
}
$(document).off('keyup.dismiss.wikimodal');
$('body').removeClass('modal-open')


diff -r 5bcfda6feee787596d251f7718f59043482049f0 -r ed96c1192c250c405bcccde00dc356c6bb619b04 web/mtrack.css
--- a/web/mtrack.css
+++ b/web/mtrack.css
@@ -630,7 +630,10 @@

/* alternative wiki editor layout */
.popupForm button.wikipreviewtoggle {
- float: right;
+ position: fixed;
+ right: 2em;
+ z-index: 100;
+ top: 2.5em;
height: 1.75em;
width: 1.75em;
}

https://bitbucket.org/wez/mtrack/changeset/29de4fbd0200/
changeset: 29de4fbd0200
user: wez
date: 2012-04-20 23:45:21
summary: add estimated and remaining columns to ticket query
affected #: 2 files

diff -r ed96c1192c250c405bcccde00dc356c6bb619b04 -r 29de4fbd02006b144cb0a70548eb03d672dc2c4f inc/report.php
--- a/inc/report.php
+++ b/inc/report.php
@@ -303,6 +303,7 @@
$sort = 'mtrackdate';
break;
case 'remaining':
+ case 'estimated':
$sort = 'digit';
break;
case 'is_child':


diff -r ed96c1192c250c405bcccde00dc356c6bb619b04 -r 29de4fbd02006b144cb0a70548eb03d672dc2c4f web/query.php
--- a/web/query.php
+++ b/web/query.php
@@ -66,7 +66,7 @@
}

$fields = array('cc', 'component', 'milestone',
- 'status', 'owner', 'closedmilestone',
+ 'status', 'owner', 'closedmilestone', 'estimated', 'remaining',
'type', 'summary', 'ticket', 'priority', 'keyword', 'depends', 'blocks');

asort($fields);

Reply all
Reply to author
Forward
0 new messages