summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/myhtml.py4
-rw-r--r--scripts/timesheet.min.css2
-rw-r--r--scripts/timesheet.min.js1
-rwxr-xr-xscripts/timesheet.py64
4 files changed, 71 insertions, 0 deletions
diff --git a/scripts/myhtml.py b/scripts/myhtml.py
index 2e4636a..a3d7c89 100755
--- a/scripts/myhtml.py
+++ b/scripts/myhtml.py
@@ -346,6 +346,10 @@ class periject_html(base.base):
html("h1").print("Wiki")
self.menu_wiki()
+ html("h1").print("Schedule")
+ html("a", {"target":"summary",
+ "href":"./schedule.html"}).print("schedule")
+
html("h1").print("Folder")
with html("ul"):
self.menu_folder("./projects")
diff --git a/scripts/timesheet.min.css b/scripts/timesheet.min.css
new file mode 100644
index 0000000..999daad
--- /dev/null
+++ b/scripts/timesheet.min.css
@@ -0,0 +1,2 @@
+.timesheet{width:720px;height:500px;margin:0 auto}.timesheet{border-top:1px solid rgba(250,250,250,0.5);background-color:#333;position:relative}.timesheet.color-scheme-default .bubble-default{background-color:RGBA(252, 70, 74, 1)}.timesheet.color-scheme-default .bubble-lorem{background-color:RGBA(154, 202, 39, 1)}.timesheet.color-scheme-default .bubble-ipsum{background-color:RGBA(60, 182, 227, 1)}.timesheet.color-scheme-default .bubble-dolor{background-color:RGBA(244, 207, 48, 1)}.timesheet.color-scheme-default .bubble-sit{background-color:RGBA(169, 105, 202, 1)}.timesheet.color-scheme-alternative .bubble-default{background-color:#f3552e}.timesheet.color-scheme-alternative .bubble-lorem{background-color:#88c33a}.timesheet.color-scheme-alternative .bubble-ipsum{background-color:#436ae0}.timesheet.color-scheme-alternative .bubble-dolor{background-color:#f4d234}.timesheet.color-scheme-alternative .bubble-sit{background-color:#707d86}.timesheet .scale{height:100%;position:absolute;top:0;left:0;float:left}.timesheet .scale section{float:left;width:59px;text-align:center;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;line-height:24px;font-weight:lighter;border-left:1px dashed rgba(250,250,250,0.2);height:100%}.timesheet .data{margin:28px 0 0 0;padding:0;text-align:left;list-style-type:none;color:rgba(250,250,250,0.8);font-family:"Signika Negative";font-size:13px;overflow:hidden}.timesheet .data li{margin:0 0 3px 0;line-height:22px;height:21px;display:block;clear:both;position:relative;white-space:nowrap}.timesheet .data li:hover .bubble{opacity:1}.timesheet .data li .date{color:#b5b5b5;font-size:14px}.timesheet .data li .label{font-weight:lighter;font-size:14px;padding-left:5px;line-height:21px;color:#979796;white-space:nowrap}.timesheet .data li .bubble{width:24px;height:7px;display:block;float:left;position:relative;top:7px;border-radius:4px;margin:0 10px 0 0;opacity:0.7}#timesheet-alternative{background-color:RGBA(247, 247, 247, 1);border-radius:5px}#timesheet-alternative section{color:RGBA(63, 68, 72, 1);border-left:1px dashed RGBA(63, 68, 72, 0.2)}#timesheet-alternative section:first-child{border-left:1px dashed transparent}#timesheet-alternative .date{display:none}#timesheet-alternative .bubble{margin-right:7px}#timesheet-alternative .label{padding-left:0px;color:RGBA(48, 48, 48, 1)}
+/*# sourceMappingURL=timesheet.min.css.map */
diff --git a/scripts/timesheet.min.js b/scripts/timesheet.min.js
new file mode 100644
index 0000000..2e3963b
--- /dev/null
+++ b/scripts/timesheet.min.js
@@ -0,0 +1 @@
+!function(){"use strict";var Timesheet=function(container,min,max,data){this.data=[],this.year={min:min,max:max},this.parse(data||[]),"undefined"!=typeof document&&(this.container="string"==typeof container?document.querySelector("#"+container):container,this.drawSections(),this.insertData())};Timesheet.prototype.insertData=function(){for(var html=[],widthMonth=this.container.querySelector(".scale section").offsetWidth,n=0,m=this.data.length;m>n;n++){var cur=this.data[n],bubble=this.createBubble(widthMonth,this.year.min,cur.start,cur.end),line=['<span style="margin-left: '+bubble.getStartOffset()+"px; width: "+bubble.getWidth()+'px;" class="bubble bubble-'+(cur.type||"default")+'" data-duration="'+(cur.end?Math.round((cur.end-cur.start)/1e3/60/60/24/39):"")+'"></span>','<span class="label">'+cur.label+"</span>", '<span class="date"> ('+bubble.getDateLabel()+")</span> "].join("");html.push("<li>"+line+"</li>")}this.container.innerHTML+='<ul class="data">'+html.join("")+"</ul>"},Timesheet.prototype.drawSections=function(){for(var html=[],c=this.year.min;c<=this.year.max;c++)html.push("<section>"+c+"</section>");this.container.className="timesheet color-scheme-default",this.container.innerHTML='<div class="scale">'+html.join("")+"</div>"},Timesheet.prototype.parseDate=function(date){return-1===date.indexOf("/")?(date=new Date(parseInt(date,10),0,1),date.hasMonth=!1):(date=date.split("/"),date=new Date(parseInt(date[1],10),parseInt(date[0],10)-1,1),date.hasMonth=!0),date},Timesheet.prototype.parse=function(data){for(var n=0,m=data.length;m>n;n++){var beg=this.parseDate(data[n][0]),end=4===data[n].length?this.parseDate(data[n][1]):null,lbl=4===data[n].length?data[n][2]:data[n][1],cat=4===data[n].length?data[n][3]:3===data[n].length?data[n][2]:"default";beg.getFullYear()<this.year.min&&(this.year.min=beg.getFullYear()),end&&end.getFullYear()>this.year.max?this.year.max=end.getFullYear():beg.getFullYear()>this.year.max&&(this.year.max=beg.getFullYear()),this.data.push({start:beg,end:end,label:lbl,type:cat})}},Timesheet.prototype.createBubble=function(wMonth,min,start,end){return new Bubble(wMonth,min,start,end)};var Bubble=function(wMonth,min,start,end){this.min=min,this.start=start,this.end=end,this.widthMonth=wMonth};Bubble.prototype.formatMonth=function(num){return num=parseInt(num,10),num>=10?num:"0"+num},Bubble.prototype.getStartOffset=function(){return this.widthMonth/12*(12*(this.start.getFullYear()-this.min)+this.start.getMonth())},Bubble.prototype.getFullYears=function(){return(this.end&&this.end.getFullYear()||this.start.getFullYear())-this.start.getFullYear()},Bubble.prototype.getMonths=function(){var fullYears=this.getFullYears(),months=0;return this.end?this.end.hasMonth?(months+=this.end.getMonth()+1,months+=12-(this.start.hasMonth?this.start.getMonth():0),months+=12*(fullYears-1)):(months+=12-(this.start.hasMonth?this.start.getMonth():0),months+=12*(fullYears-1>0?fullYears-1:0)):months+=this.start.hasMonth?1:12,months},Bubble.prototype.getWidth=function(){return this.widthMonth/12*this.getMonths()},Bubble.prototype.getDateLabel=function(){return[(this.start.hasMonth?this.formatMonth(this.start.getMonth()+1)+"/":"")+this.start.getFullYear(),this.end?"-"+((this.end.hasMonth?this.formatMonth(this.end.getMonth()+1)+"/":"")+this.end.getFullYear()):""].join("")},window.Timesheet=Timesheet}();
diff --git a/scripts/timesheet.py b/scripts/timesheet.py
new file mode 100755
index 0000000..a508fec
--- /dev/null
+++ b/scripts/timesheet.py
@@ -0,0 +1,64 @@
+#! /usr/bin/env python3
+#===============================
+#
+# timesheet
+#
+# This schedule is based on
+# https://github.com/sbstjn/timesheet.js.git
+#
+# 2021/02/08 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+#===============================
+import schedule
+import datetime
+
+class timesheet(schedule.schedule):
+ def print(self):
+ color = ['lorem', 'ipsum', 'dolor', 'default']
+ txt_b = """
+<html>
+ <link rel="stylesheet" type="text/css" href="../scripts/timesheet.min.css">
+ <script type="text/javascript" src="../scripts/timesheet.min.js"></script>
+ <h1>PeriPeri Schedule</h1>
+ <div id="timesheet"></div>
+ <script>
+"""
+ txt_e = """
+ </script>
+</html>
+"""
+ txt = "new Timesheet('timesheet', "
+ date_s = datetime.datetime(9999, 12, 31, 10, 0, 0)
+ date_e = datetime.datetime(1000, 1, 1, 10, 0, 0)
+
+ # check earliest/latest date
+ for lst in self.list:
+ ds = datetime.datetime.strptime(lst[0], "%m/%Y")
+ de = datetime.datetime.strptime(lst[1], "%m/%Y")
+ if ds < date_s:
+ date_s = ds
+ if (de > date_e):
+ date_e = de
+
+ txt += "{}, {}, [".format(date_s.strftime("%Y"),
+ date_e.strftime("%Y"))
+
+ c = 0
+ for lst in self.list:
+ txt += "['{}', '{}', '{}', '{}'],".\
+ format(lst[0], lst[1], lst[2], color[c])
+ c += 1
+ if (c >= len(color)):
+ c = 0
+ txt += "]);"
+
+ print(txt_b)
+ print(txt)
+ print(txt_e)
+
+#====================================
+#
+# As command
+#
+#====================================
+if __name__=='__main__':
+ timesheet().print()