Search:
Template:MindTouch > ToBeDeveloped > Task/To Do Lists > Template:TaskList3Page

Template:TaskList3Page

    Table of contents
    No headers
    // + PARAMETERS
    var par = {
         action: String.tolower( __request.args.action ?? args.action ?? 'load'),
         task_index: args.index,
         task_api: args.page_api
        };
    
    // + CONSTANTS
    var PG_STYLE= "background-color: green; width: [pgtext]; text-align: center; color: black;";
    var CTOR_TASK_EDIT = "when(@message.name == 'edit_view')  $('#[tag_id]').hide(); when(@message.name == 'default_view')  $('#[tag_id]').show();";
    var CTOR_TASK_NO_EDIT = "when(@message.name == 'edit_view')  $('#[tag_id]').show(); when(@message.name == 'default_view')  $('#[tag_id]').hide();";
    
    // + VARS
    var today;
    if (Date.IsValid(Date.Now))
        let today = Date.Format(Date.changetimezone(Date.now, user.timezone), "dd/MM/yyyy");
     else
        let today = Date.Format('01/08/2009', 'dd/MM/yyyy');
    
    var tasks;
    var ctask;
    var pgtext_style;
    
    // + INTERFACE
    var p = wiki.getpage(Num.Int(par.task_api));
    let tasks = json.parse(p.properties["tasks"].text ?? "") ?? [];
    //let tasks = [ item .. { index: __index } foreach var item in tasks ];
    //let ctask = tasks[par.task_index];
    let ctask = tasks[par.task_index];
    
    <table id='tlptasklist' width='100%'>
     <tr id='task_edit' class='tr_task_edit'>
      <td>
        <a href='#' id='dummy_9' class='edit_task' ctor=(String.Replace(CTOR_TASK_EDIT,'[tag_id]','dummy_9'))> "Editar Tarea"</a>
        String.nbsp;String.nbsp;String.nbsp;String.nbsp;
        <a href='#' id='dummy_11' class='to_project' ctor=(String.Replace(CTOR_TASK_EDIT,'[tag_id]','dummy_11'))> ("Ir al proyecto: "..p.path)</a>
        <div style='display: none' id='dummy_10' ctor=(String.Replace(CTOR_TASK_NO_EDIT,'[tag_id]','dummy_10'))><B>"Puedes modificar los datos de la tarea a continuación:"</B></div>
      </td>
     </tr>
    
     <tr id='dummy_1' ctor=(String.Replace(CTOR_TASK_EDIT,'[tag_id]','dummy_1'))>
      <td>
      <div class='taskcontainer'>
       <table id='taskview' width='100%'>
         <tr> 
          <td width='10%'><B>"Responsable/s: "</B></td>
          <td>(ctask.manager)</td>
         </tr>
         <tr> 
          <td><B>"Usuario/s: "</B></td>
          <td>(ctask.username)</td> 
         </tr>
         <tr> 
          <td><B>"Tarea: "</B></td>
          <td>(ctask.title)</td>
         </tr>
         <tr> 
          <td><B>"Fecha Inicio: "</B></td>
          <td>(ctask.startdate)</td>
         </tr>
         <tr> 
          <td><B>"Fecha Fin: "</B></td>
          <td>(ctask.enddate)</td>
         </tr>
         <tr> 
          <td><B>"Prioridad: "</B></td>
          <td>(ctask.priority)</td>
         </tr>
         <tr> 
          if (ctask.progress== '') { let pgtext_style = String.Replace(PG_STYLE,"[pgtext]","0%"); }
                         else { let pgtext_style = String.Replace(PG_STYLE,"[pgtext]",ctask.progress); }
          <td><B>"Progreso: "</B></td>
           <td>(<div id="showbar" style="font-size:8pt;padding:2px;border:solid black 1px; width: 60px; text-align: left;">
                                        <div id="progress1" style=(pgtext_style)>(ctask.progress)</div>
                                      </div>)</td>
         </tr>
         <tr> 
          <td><B>"Estado: "</B></td>
            <td>
              if (ctask.status=='D') { 'ESTA TAREA HA SIDO BORRADA!!!' } 
                 else { if (ctask.status=='A') { 'ABIERTA' }
                 else { if (ctask.status=='C') { 'CONGELADA' }
                 else { if (ctask.status=='T') { 'TERMINADA' }
                 else {ctask.status; } 
                      }
                      }
                      }
            </td>
         </tr>
       </table>
       </div>
      </td>
     </tr>
    </table>
    
    
    if (par.action=='load') { 
    
    // + INPUT FORM
    TaskList3Form{ default_date: today, on_reload_func_name: "TaskPageWireControls", task_form_id: "tlp", parent_args: json.emit(par) };
    
    // global script code
    <script type="text/jem">"
    function TaskPageWireControls() {
         Deki.$('#tlptasklist a.edit_task').bind('click', function() {
            tlpEditTask({ index: '"..par.task_index.."', row_index: 'task_edit', page: '"..Site.Api.."/pages/"..par.task_api.."' }, function() {@message({ name: 'default_view' })}); 
            @message({ name: 'edit_view' }); 
            return false;
        });
         Deki.$('#tlptasklist a.to_project').bind('click', function() {
            location.href = '"..Site.Uri.."/"..p.path.."';
            return false;
        });
    
    }
    TaskPageWireControls();
    "</script>
    <HTML>
    <HEAD>
     <STYLE TYPE='text/css'>"
     div.taskcontainer {
        background-color: #EEEEEE;
        border-top: 1px solid #777777;
        border-bottom: 1px solid #777777;
      }
    
     tr.tr_task_edit a {
    	color: #000;
    	text-decoration: none;
    	padding: 3px 3px 3px 21px;
    	font-size: 11px;
     }
    
     a.edit_task {
    	background: url(/skins/common/icons/silk/page_white_edit.png) no-repeat center left;
      }
    
     a.to_project {
    	background: url(/@api/deki/files/812/=left_small.png) no-repeat center left;
      }
    "</STYLE>
    </HEAD>
    </HTML>
     }
    

    Files (0)

     

    Comments (0)

    You must login to post a comment.