Forum OpenACS Development: OpenACS + Voo2do

Request notifications

Collapse
Posted by Cesareo Garci­a Rodicio on
Hi!

Voo2do (http://www.voo2do.com/) is an advanced (and very simple) task manager. It has an API (voo2do.com/help/api) to use through other systems. I'm using voo2do since some months ago to control tasks and hours. I also used OACS logger, it's great but with a team, not for only one person.

Also, I use OACS calendar as day-calendar. So I did some glue to put in my day-cal-view my task-list from voodo and a form to add a new task. I did:

-An adp page to include whatever package (I use it in OACS Calendar cal-day-view)
-A TCL page to do programming things (call API and stuff like that)

but, I have some things to solve:
-Control User/Password. Now I have it only for my user. I have to solve how to pass user/passwd for every user
-Control last call to API, now, I have to use Back Key.

I'm trying to solve this, perhaps next month, but I'd like to show this code because it has been very useful to me.

-----------------Code------------------
-------------view-voo2do-tasks.adp-----


  <div class="cal-month-title-text" style="font-size: 80%">
    Tareas Pendientes
  </div>

  <div class="cal-day-table">
    <multiple name="lista_tareas">
      <div class="cal-day-row">
    <div class="cal-day-hour">
      <if @lista_tareas.pretty_deadline@ not nil>
        <span class="cal-text-grey-sml"> @lista_tareas.pretty_deadline@</span>
      </if>
      <else>
        <span class="cal-text-grey-sml">No date</span>
      </else>

      @lista_tareas.task@ <span class="cal-text-grey-sml">
        <if @lista_tareas.working_time@ not nil><b> @lista_tareas.working_time@</b> </if>
        <else><b>0</b>
        </else>
        / @lista_tareas.total_time@ (<a href="http://voo2do.com/api/saveTask?userId=@userID@&loginHash=@loginHash@&completed=1&taskId=@lista_tareas.id@&taskDesc=@lista_tareas.task@&projName=@lista_tareas.projName@&estOrig=@lista_tareas.total_time@&elapsed=@lista_tareas.total_time@&deadline=@lista_tareas.deadline@&priority=@lista_tareas.priority@">Fin</a>)</span>
    </div>
      </div>
    </multiple>

  </div>

  <div class="cal-month-title-text" style="font-size: 80%">
    Nueva Tarea
  </div>

  <div class="cal-day-table">
    <formtemplate id="ejemplo_form"></formtemplate>
  </div>

-------------view-voo2do-tasks.tcl-----

#Get XML data and if there is an error, put an Error Task in xml variable

set xml [ns_httpget "http://voo2do.com/api/getLoginHash?email=YOUREMAIL&password=YOURPASSWD"]

set doc [dom parse $xml]
set root [$doc documentElement]
set node [$root selectNodes /response/login]
set userID [$node getAttribute userId]
set loginHash [$node getAttribute loginHash]

set xml [ns_httpget "http://voo2do.com/api/getIncompleteTasks?userId=$userID&loginHash=$loginHash"]

if {$xml == ""} {
    set xml "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<response method=\"getIncompleteTasks\">
<task estCurr=\"1.0000\" priority=\"4.0000\" dtcreated=\"2006-09-07 19:05:33.837469\" taskdesc=\"Error en la conexion\" taskId=\"00\" estOrig=\"1.0000\" collabId=\"\" userId=\"33\" deadline=\"\" active=\"1\" elapsed=\"1.0000\" projId=\"4\" projName=\"Formacin\" viewId=\"\" completed=\"\"/>
</response>
"
}

#Parse XML Data of getIncompleteTask Voo2do Method

set doc [dom parse $xml]
set root [$doc documentElement]
set node [$root selectNodes /response/task]

#Multirow create of data. I trim 0s and . (point) to show clearly data

template::multirow create lista_tareas "id" "task" "priority" "total_time" "working_time" "projName" "deadline" "pretty_deadline"

foreach i $node {

    template::multirow append \
    lista_tareas [$i getAttribute taskId] \
    [$i getAttribute taskdesc] \
    [$i getAttribute priority] \
    [string trimright [$i getAttribute estCurr]  "0."] \
    [string trimright [$i getAttribute elapsed] "0."] \
    [$i getAttribute projName] \
        [lc_time_fmt [$i getAttribute deadline] "%m/%d/%Y"] \
    [lc_time_fmt [$i getAttribute deadline] "%d %b"]
}

############# Defining form to Add New Task #########################

#Get Project names

set xml [ns_httpget "http://voo2do.com/api/getProjects?userId=$userID&loginHash=$loginHash"]
set doc [dom parse $xml]
set root [$doc documentElement]
set node [$root selectNodes /response/project]

#Creating Project Names options
set project_names [list]

foreach project  $node  {
    set pr [$project getAttribute projName]
    lappend project_names [ list $pr $pr ]
}

#Creating estimation options
set estimations { "0.5" "1" "1.5" "2" "3" "4" }
set estimation_options [list]
foreach p $estimations {
    lappend estimation_options [list  $p $p ]
}

#Creating priorities options
set priorities { "1" "2" "3" }
set priority_options [list]
foreach p $priorities {
    lappend priority_options [list  $p $p ]
}

# Define Task Add form
ad_form -name ejemplo_form  -method GET -action "http://voo2do.com/api/saveTask" -form  {

    {userId:text(hidden) {value "$userID"} }
    {loginHash:text(hidden) {value "$loginHash"}  }

    {taskdesc:text(text)
        {label "Tarea"}
        {html {size 35} maxlength 255}
    }

    {projName:text(select)
        {label "Proyecto"}
        {options $project_names}
    }

    {priority:text(select)
        {label "Prioridad"}
        {options $priority_options}
    }
    {estOrig:text(select)
        {label "Estimacion"}
        {options $estimation_options}
    }
    {deadline:date(text)
    {label "Plazo"}
    {html {id sel1}     }
    {help_text "Format MM/DD/YYYY"}
    {after_html {<input type='reset' value=' ... ' onclick=\"return showCalendar('sel1');\"> }
    }
    }
}

#regexp {([0-9]+)-([0-9][0-9])-([0-9][0-9])} $deadline match year month day
#set deadline ""
#append deadline $month "/" $day "/" $year

ad_form -extend -name ejemplo_form  -form {

    {submit:text(submit)
    {label "Crear"}
    }
}

Collapse
2: Re: Res: OpenACS + Voo2do (response to 1)
Posted by Cesareo Garci­a Rodicio on
I've added some features:

- highlight dates that passed headlines
- voo2do user control

All this development is on two files: view-voo2do-tasks.adp and view-voo2do-tasks.tcl