From 6cd2241d51e4b38acd8d7801736cde8245bae47e Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 19 May 2013 16:35:14 +0200 Subject: Initial commit --- scrumelo.el | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 scrumelo.el (limited to 'scrumelo.el') diff --git a/scrumelo.el b/scrumelo.el new file mode 100644 index 0000000..711075a --- /dev/null +++ b/scrumelo.el @@ -0,0 +1,56 @@ +;;; scrumelo.el --- Scrum with elnode and org-mode + +;; Copyright (C) 2013 Tom Willemse + +;; Author: Tom Willemse +;; Keywords: tools, hypermedia, outlines, comm + +;;; Commentary: + +;; A scrum web app. + +(require 'elnode) +(require 'esxml) +(require 'org) + +;;; Code: + +(defvar scrum-project-file "~/projects/scrumelo/aeos.org" + "The file containing the scrumm backlog.") + +(defun scrumelo-backlog-page (httpcon) + "Send the backlog overview over HTTPCON." + (let ((buffer (find-file-noselect scrum-project-file))) + (elnode-http-start httpcon 200 '("Content-Type" . "text/html")) + (elnode-http-return + httpcon + (concat + "\n" + (sxml-to-xml + `(html (head (title "Scrumelo") + (link (@ (href "http://ryuslash.org/bootstrap2/css/bootstrap.min.css") + (type "text/css") (rel "stylesheet")))) + (body + (div (@ (class "container")) + (table (@ (class "table")) + ,@(with-current-buffer buffer + (delq nil + (org-map-entries + (lambda () + (when (= (car (org-heading-components)) 1) + `(tr (td ,(org-entry-get (point) "TODO")) + (td ,(format "As a %s, I %s to %s" + (org-entry-get (point) "Role") + (org-entry-get (point) "Necessity") + (nth 4 (org-heading-components))))))) nil nil 'comment)))))))))))) + +(defun scrumelo-handler (httpcon) + "Send the right requests in HTTPCON to the right functions." + (elnode-dispatcher + httpcon + '(("^/$" . scrumelo-backlog-page)))) + +(elnode-start 'scrumelo-handler :port 8028 :host "localhost") + +(provide 'scrumelo) +;;; scrumelo.el ends here -- cgit v1.2.3-54-g00ecf