[evolvis-commits] r17717: //Backup commit

papel at evolvis.org papel at evolvis.org
Thu Nov 17 14:06:02 CET 2011


Author: papel
Date: 2011-11-17 14:06:02 +0100 (Thu, 17 Nov 2011)
New Revision: 17717

Added:
   branches/papel-51/common/pm/ProjectController.class.php
   branches/papel-51/common/pm/ProjectModel.class.php
   branches/papel-51/www/pm/include/ProjectView.class.php
   branches/papel-51/www/pm/pm_task.php
   branches/papel-51/www/pm/templates/
   branches/papel-51/www/pm/templates/detail_template.php
   branches/papel-51/www/pm/templates/time_tracking.php
Modified:
   branches/papel-51/common/include/datepick.php
   branches/papel-51/www/include/html.php
   branches/papel-51/www/pm/task.php
Log:
//Backup commit

Modified: branches/papel-51/common/include/datepick.php
===================================================================
--- branches/papel-51/common/include/datepick.php	2011-11-09 15:12:25 UTC (rev 17716)
+++ branches/papel-51/common/include/datepick.php	2011-11-17 13:06:02 UTC (rev 17717)
@@ -2,7 +2,7 @@
 /**
  * Date operations for FusionForge
  *
- * Copyright © 2010
+ * Copyright © 2010, 2011
  *	Thorsten “mirabilos” Glaser <t.glaser at tarent.de>
  * All rights reserved.
  *
@@ -20,8 +20,146 @@
  * You should have received a copy of the GNU General Public License along
  * with FusionForge; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *-
+ * API documentation:
+ *
+ * datepick_prepare(); // before emitting the Theme header
+ * datepick_emit('fieldname'[, 'value', usetime?, 'type', attrs()]);
+ * // type: default (prefs), locdef (locale), or a specific one
+ * $timet = datepick_parse(getStringFromRequest('fieldname'));
+ * $value = datepick_format($timet[, usetime?, 'type']);
+ * // these two convert back and forth between time_t and string
  */
 
+/*-
+ * list of acceptable datepicker locales;
+ * must be defined in gforge/www/js/datepicker.js
+ */
+$datepick_locales = array(
+	'locdef' => _('Locale dependent default'),
+	'american' => _('American (m/d/y, English labels, 12 hour clock, week starts on Sunday)'),
+	'dmy' => _('Day.Month.Year with English labels'),
+	'mdy' => _('Month/Day/Year with English labels'),
+	'ymd' => _('Year-Month-Day with English labels'),
+	'dmy_es' => _('Day.Month.Year with Spanish labels'),
+	'mdy_es' => _('Month/Day/Year with Spanish labels'),
+	'ymd_es' => _('Year-Month-Day with Spanish labels'),
+	'dmy_de' => _('Day.Month.Year with German labels'),
+	'mdy_de' => _('Month/Day/Year with German labels'),
+	'ymd_de' => _('Year-Month-Day with German labels'),
+	'dmy_fr' => _('Day.Month.Year with French labels'),
+	'mdy_fr' => _('Month/Day/Year with French labels'),
+	'ymd_fr' => _('Year-Month-Day with French labels'),
+	'dmy_it' => _('Day.Month.Year with Italian labels'),
+	'mdy_it' => _('Month/Day/Year with Italian labels'),
+	'ymd_it' => _('Year-Month-Day with Italian labels'),
+	'dmy_nl' => _('Day.Month.Year with Dutch labels'),
+	'mdy_nl' => _('Month/Day/Year with Dutch labels'),
+	'ymd_nl' => _('Year-Month-Day with Dutch labels'),
+	'dmy_pl' => _('Day.Month.Year with Polish labels'),
+	'mdy_pl' => _('Month/Day/Year with Polish labels'),
+	'ymd_pl' => _('Year-Month-Day with Polish labels'),
+	'dmy_pt' => _('Day.Month.Year with Portuguese labels'),
+	'mdy_pt' => _('Month/Day/Year with Portuguese labels'),
+	'ymd_pt' => _('Year-Month-Day with Portuguese labels'),
+	'dmy_ro' => _('Day.Month.Year with Romanian labels'),
+	'mdy_ro' => _('Month/Day/Year with Romanian labels'),
+	'ymd_ro' => _('Year-Month-Day with Romanian labels'),
+	'dmy_bg' => _('Day.Month.Year with Bulgarian labels'),
+	'mdy_bg' => _('Month/Day/Year with Bulgarian labels'),
+	'ymd_bg' => _('Year-Month-Day with Bulgarian labels'),
+	'dmy_ru' => _('Day.Month.Year with Russian labels'),
+	'mdy_ru' => _('Month/Day/Year with Russian labels'),
+	'ymd_ru' => _('Year-Month-Day with Russian labels'),
+	'dmy_hu' => _('Day.Month.Year with Hungarian labels'),
+	'mdy_hu' => _('Month/Day/Year with Hungarian labels'),
+	'ymd_hu' => _('Year-Month-Day with Hungarian labels'),
+	'dmy_no' => _('Day.Month.Year with Norwegian labels'),
+	'mdy_no' => _('Month/Day/Year with Norwegian labels'),
+	'ymd_no' => _('Year-Month-Day with Norwegian labels'),
+    );
+
+/* must match definitions in datepicker.js for reverse */
+$datepick_locales_fmtstr = array(
+	'american' => '%m/%d/%Y',
+	'dmy' => '%d.%m.%Y',
+	'mdy' => '%m/%d/%Y',
+	'ymd' => '%Y-%m-%d',
+	'dmy_es' => '%d.%m.%Y',
+	'mdy_es' => '%m/%d/%Y',
+	'ymd_es' => '%Y-%m-%d',
+	'dmy_de' => '%d.%m.%Y',
+	'mdy_de' => '%m/%d/%Y',
+	'ymd_de' => '%Y-%m-%d',
+	'dmy_fr' => '%d.%m.%Y',
+	'mdy_fr' => '%m/%d/%Y',
+	'ymd_fr' => '%Y-%m-%d',
+	'dmy_it' => '%d.%m.%Y',
+	'mdy_it' => '%m/%d/%Y',
+	'ymd_it' => '%Y-%m-%d',
+	'dmy_nl' => '%d.%m.%Y',
+	'mdy_nl' => '%m/%d/%Y',
+	'ymd_nl' => '%Y-%m-%d',
+	'dmy_pl' => '%d.%m.%Y',
+	'mdy_pl' => '%m/%d/%Y',
+	'ymd_pl' => '%Y-%m-%d',
+	'dmy_pt' => '%d.%m.%Y',
+	'mdy_pt' => '%m/%d/%Y',
+	'ymd_pt' => '%Y-%m-%d',
+	'dmy_ro' => '%d.%m.%Y',
+	'mdy_ro' => '%m/%d/%Y',
+	'ymd_ro' => '%Y-%m-%d',
+	'dmy_bg' => '%d.%m.%Y',
+	'mdy_bg' => '%m/%d/%Y',
+	'ymd_bg' => '%Y-%m-%d',
+	'dmy_ru' => '%d.%m.%Y',
+	'mdy_ru' => '%m/%d/%Y',
+	'ymd_ru' => '%Y-%m-%d',
+	'dmy_hu' => '%d.%m.%Y',
+	'mdy_hu' => '%m/%d/%Y',
+	'ymd_hu' => '%Y-%m-%d',
+	'dmy_no' => '%d.%m.%Y',
+	'mdy_no' => '%m/%d/%Y',
+	'ymd_no' => '%Y-%m-%d',
+    );
+
+
+/* emit appropriate header lines for using DatePicker */
+function datepick_prepare() {
+	global $HTML;
+
+	$HTML->js_once('prototype.js');
+	$HTML->css_once('datepicker.css');
+	$HTML->js_once('prototype-base-extensions.js');
+	$HTML->js_once('prototype-date-extensions.js');
+	$HTML->js_once('datepicker.js');
+
+	$HTML->footer_hooks[] = 'datepick__footer_hook';
+}
+$datepick_used = array();
+
+/* emit a datepick input field */
+function datepick_emit($fieldname, $fieldvalue='', $usetime=false,
+    $type='default', $attrs=array()) {
+	/* 'default' locale: look at user prefs, fallback to 'locdef' */
+	/* 'locdef' locale: look at gettext, fallback to 'american' */
+	$type = datepick__type($type);
+
+	$attrs['class'] = trim(util_ifsetor($attrs['class'], "") . ' ' .
+	    ($usetime ? 'datetime_' : 'date_') . $type);
+
+	echo '<input type="text" name="' . $fieldname .
+	    '" value="' . $fieldvalue . '" ';
+	foreach ($attrs as $k => $v) {
+		echo $k . '="' . $v . '" ';
+	}
+	echo '/>';
+
+	global $datepick_used;
+	$datepick_used[($usetime ? 'datetime_' : 'date_') . $type] =
+	    array('type' => $type, 'usetime' => $usetime);
+}
+
 /* parse y-m-d or d.m.y or m/d/y format into time_t (int) */
 function datepick_parse($text) {
 	$text = trim($text);
@@ -48,4 +186,71 @@
 	return strtotime($y."-".$m."-".$d);
 }
 
+/* convert time_t into value suitable for emitting a datepicker */
+function datepick_format($timet, $usetime=false, $type='default') {
+	global $datepick_locales_fmtstr;
+
+	$fmtstr = $datepick_locales_fmtstr[datepick__type($type)];
+	if ($usetime)
+		$fmtstr .= ' %H:%M';
+	return (strftime($fmtstr, $timet));
+}
+
+
+/* internal function */
+function datepick__footer_hook($ignored) {
+	global $datepick_used;
+
+	if (!$datepick_used)
+		return;
+
+	echo '
+<script type="text/javascript"><!-- <![CDATA[
+	function createPickers() {';
+
+	foreach ($datepick_used as $k => $v) {
+		echo '
+		$(document.body).select(' . "'input." . $k . "').each(
+			function(e) {
+				new Control.DatePicker(e, {
+					'locale': '" . $v['type'] . "'";
+		if ($v['usetime']) {
+			echo ",
+					'timePicker': true";
+		}
+		echo ",
+					'icon': '/images/office-calendar.png'
+				    });
+			}
+		    );";
+	}
+	echo '
+	}
+	Event.observe(window, "load", createPickers);
+//]]> --></script>';
+}
+
+/* internal function: convert $type to JS type */
+function datepick__type($type='default') {
+	global $datepick_locales, $G_SESSION;
+
+	if ($type == 'default' && isset($G_SESSION) && $G_SESSION) {
+		$v = $G_SESSION->getPreference('datepick_format');
+		if (isset($v))
+			$type = $v;
+	}
+	if (!isset($datepick_locales[$type])) {
+		$type = 'locdef';
+	}
+
+	if ($type == 'locdef') {
+		$type = _('locale-dependent-default-datepick-format');
+	}
+	if (!isset($datepick_locales[$type]) || $type == 'locdef') {
+		$type = 'american';
+	}
+
+	return ($type);
+}
+
 ?>
\ No newline at end of file

Added: branches/papel-51/common/pm/ProjectController.class.php
===================================================================
--- branches/papel-51/common/pm/ProjectController.class.php	                        (rev 0)
+++ branches/papel-51/common/pm/ProjectController.class.php	2011-11-17 13:06:02 UTC (rev 17717)
@@ -0,0 +1,202 @@
+<?php
+/**
+ * FusionForge : Project Management Facility
+ *
+ * Copyright 1999/2000, Sourceforge.net Tim Perdue
+ * Copyright 2002 GForge, LLC, Tim Perdue
+ * Copyright 2010, FusionForge Team
+ * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011 Patrick Apel - tarent solutions GmbH
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+require_once $gfwww.'pm/include/ProjectView.class.php';
+
+if (getStringFromRequest('commentsort') == 'anti') {
+       $sort_comments_chronologically = false;
+} else {
+       $sort_comments_chronologically = true;
+}
+
+$report=new Report();
+if ($report->isError()) {
+	exit_error('Error',$report->getErrorMessage());
+}
+
+$week = getStringFromRequest('week');
+$project_task_id = getStringFromRequest('project_task_id');
+
+if (getStringFromRequest('submit')) {
+	$report_date = getStringFromRequest('report_date');
+	$time_code = getStringFromRequest('time_code');
+	$old_time_code = getStringFromRequest('old_time_code');
+	$hours = getStringFromRequest('hours');
+
+	if (getStringFromRequest('add')) {
+		$days_adjust = getIntFromRequest('days_adjust');
+
+		if ($project_task_id && $week && $time_code && $hours) {
+			/* && $days_adjust has always a valid number. No need to prove. */
+
+			$report_date=($week + ($days_adjust*REPORT_DAY_SPAN))+(12*60*60);
+			$res = db_query_params('INSERT INTO rep_time_tracking (user_id,week,report_date,project_task_id,time_code,hours) VALUES ($1,$2,$3,$4,$5,$6)',
+					       array(user_getid(),
+						     $week,
+						     $report_date,
+						     $project_task_id,
+						     $time_code,
+						     $hours));
+			if (!$res || db_affected_rows($res) < 1) {
+				exit_error('Error',db_error());
+			} else {
+				$feedback.=_('Successfully Added');
+				echo '<span class="submitSuccessInformation">'._('Successfully Added').'</span>';
+
+			}
+		} else {
+			$feedback = _('All Fields Are Required.');
+			echo '<span class="submitErrorInformation">'._('All Fields Are Required.').'</span>';
+		}
+	}
+}
+
+if (getStringFromRequest('CopySubproject')) {
+	$copy_group_project_id = getIntFromRequest('copy_group_project_id');
+	$summary = getStringFromRequest('summary');
+	$details = getStringFromRequest('details');
+	$status_id = 1; //always open for new copied tasks.
+	$category_id = getIntFromRequest('category_id');
+	$priority = getIntFromRequest('priority');
+	$percent_complete = getIntFromRequest('percent_complete');
+	$hours = getIntFromRequest('hours');
+	$duration = getIntFromRequest('duration');
+	$parent_id = getIntFromRequest('parent_id');
+
+	$result = db_query_params ('INSERT INTO project_task (group_project_id,created_by,summary,details,status_id,category_id,priority,percent_complete,hours,duration,parent_id) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)',
+				   array($copy_group_project_id, user_getid(),
+					 $summary, $details, $status_id,
+					 $category_id, $priority,
+					 $percent_complete, $hours, $duration, $parent_id));
+	if (!$result || db_affected_rows($result) < 1) {
+		$this->setError( 'ProjectTask::create() Posting Failed '.db_error().$sql );
+		db_rollback();
+		return false; //no return here. Needs a walkaround
+	} else {
+		echo '<span class="submitSuccessInformation">'._('Successfully Copied').'</span>'; //should be in the view. Only Source Code in here
+	}
+}
+
+/* This file gets includes from pm_task.php. The pm_tasks.php constructs the object ProjectController
+ * and can overgive the variables created in this file ProjectController.class.php to the ProjectController object */
+
+class ProjectController{
+	
+	var $url;
+	
+	var $pageView;
+	
+	var $projectGroupHTML;
+	
+	var $projectTask;
+	
+	var $boolManager = false;
+	
+	var $templateFile = 'detail_template';
+	
+	var $HTML;
+	
+	private function setUri($uri) {
+		$this->uri = $uri;
+	}
+	
+	public function getUri() {
+		return $this->uri;
+	}
+	
+	private function setPageView($pageView) {
+		$this->pageView = $pageView;
+	}
+	
+	public function getPageView() {
+		return $this->pageView;
+	}
+	
+	private function setProjectGroupHTML($pg) {
+		$this->projectGroupHTML = $pg;
+	}
+	
+	public function getProjectGroupHTML() {
+		return $this->projectGroupHTML;
+	}
+	
+	private function setProjectTask($pt) {
+		$this->projectTask = $pt;
+	}
+	
+	public function getProjectTask() {
+		return $this->projectTask;
+	}
+	
+	private function setManager($boolManager) {
+		$this->boolManager = $boolManager;
+	}
+	
+	public function isManager() {
+		return $this->boolManager;
+	}
+	
+	private function setHTML($HTML) {
+		$this->HTML = $HTML;
+	}
+	
+	public function getHTML() {
+		return $this->HTML;
+	}
+	
+	function __construct($uri, $pg, $pt, $pageView, $boolManager, $HTML) {
+		$this->setUri($uri);
+		$this->setProjectGroupHTML($pg);
+		$this->setProjectTask($pt);
+		$this->setPageView($pageView);
+		$this->setManager($boolManager);
+		$this->setHTML($HTML);
+	}
+	
+	function display() {
+		$pmView = new ProjectView($this->getUri(), $this->getProjectGroupHTML(), 
+			$this->getProjectTask(), $this->getPageView(), $this->isManager(), $this->getHTML());
+			
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			$pmView->setTemplateFile('detail_template');
+			break;
+			case 'detailtask':
+			$pmView->setTemplateFile('detail_template');
+			break;
+			case 'postaddtask':
+			$pmView->setTemplateFile('detail_template');
+			break;
+			default:
+			$pmView->setTemplateFile('detail_template');
+			break;
+		}
+		
+		return $pmView->loadTemplate();
+	}
+}
+?>
\ No newline at end of file

Added: branches/papel-51/common/pm/ProjectModel.class.php
===================================================================
--- branches/papel-51/common/pm/ProjectModel.class.php	                        (rev 0)
+++ branches/papel-51/common/pm/ProjectModel.class.php	2011-11-17 13:06:02 UTC (rev 17717)
@@ -0,0 +1,32 @@
+<?php
+/**
+ * FusionForge : Project Management Facility
+ *
+ * Copyright 1999/2000, Sourceforge.net Tim Perdue
+ * Copyright 2002 GForge, LLC, Tim Perdue
+ * Copyright 2010, FusionForge Team
+ * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+ 
+
+class ProjectModel {
+	
+}
+
+?>

Modified: branches/papel-51/www/include/html.php
===================================================================
--- branches/papel-51/www/include/html.php	2011-11-09 15:12:25 UTC (rev 17716)
+++ branches/papel-51/www/include/html.php	2011-11-17 13:06:02 UTC (rev 17717)
@@ -620,7 +620,7 @@
 function html_build_checkbox($name, $value, $checked) {
 	return '<input type="checkbox" name="'.$name.'"'
 		.' value="'.$value.'"'
-		.($checked ? 'checked="checked"' : '').'>';
+		.($checked ? 'checked="checked"' : '').' />';
 }
 
 
@@ -864,6 +864,61 @@
 	return $hashstr;
 }
 
+
+/**
+ *	html_build_textbox() - Render textbox control
+ *
+ *	@param name - name of control
+ *	@param value - value of control
+ *	@return html code for textbox control
+ */
+function html_build_textbox($name, $value) {
+	return '<input type="text" name="'.$name.'" value="'.$value.'" />';
+}
+
+/**
+ *	html_build_hiddenbox() - Render hiddenbox control
+ *
+ *	@param name - name of control
+ *	@param value - value of control
+ *	@return html code for hiddenbox control
+ */
+function html_build_hiddenBox($name, $value) {
+	return '<input type="hidden" name="'.$name.'" value="'.$value.'" />';
+}
+
+/**
+ *	html_build_form_start_tag() - Render form start tag control. The variables $encrypt and 
+ *	$acceptCharset have already the default value that will be used if the attributes are not added
+ *  for the form. The attributes will be added by default if not overwritten.
+ *
+ *	@param action - uri to the webpage or file that handels the request
+ *	@param id - id of the form
+ *	@param name - name of form
+ *	@param accept - accepted data of the form
+ *	@param method - method of the form
+ *	@param enctype - enctype of the form. Default type already included
+ *	@param acceptCharset - accepted charset of the form. Default type already included
+ *	@return html code for start tag control
+ */
+function html_build_form_start_tag($action, $id=null, $name=null, $accept=null, $method='post', $enctype='application/x-www-form-urlencoded', $acceptCharset='UNKNOWN') {
+	
+	$form = '<form '; 
+	if(!empty($id)) {
+		$form .='id="'.$id.'" ';
+	}
+	if(!empty($name)) {
+		$form .='name="'.$name.'" ';
+	}
+	if(!empty($accept)) {
+		$form .='accept="'.$accept.'" ';
+	}
+	$form .= 'action="'.$action.'" method="'.$method.'" ';
+	
+	return $form;
+}
+
+
 // Local Variables:
 // mode: php
 // c-file-style: "bsd"

Added: branches/papel-51/www/pm/include/ProjectView.class.php
===================================================================
--- branches/papel-51/www/pm/include/ProjectView.class.php	                        (rev 0)
+++ branches/papel-51/www/pm/include/ProjectView.class.php	2011-11-17 13:06:02 UTC (rev 17717)
@@ -0,0 +1,399 @@
+<?php
+/**
+ * FusionForge : Project Management Facility
+ *
+ * http://fusionforge.org
+ *
+ * Copyright (C) 2011 Patrick Apel - tarent solutions GmbH
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or postmodtaskify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more detailtasks.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/* Loads the template and includes the data from the controller and postmodtaskel into the template */
+
+// require_once $gfwww.'include/html.php';
+require_once $gfcommon.'include/datepick.php';
+
+class ProjectView {
+	
+	var $url;
+	
+	var $pageView;
+	
+	var $projectGroupHTML;
+	
+	var $projectTask;
+	
+	var $tplDir;
+	
+	var $templateFile;
+	
+	var $boolManager = false;
+	
+	var $HTML;
+	
+	private function setUri($uri) {
+		$this->uri = $uri;
+	}
+	
+	public function getUri() {
+		return $this->uri;
+	}
+	
+	private function setPageView($pageView) {
+		$this->pageView = $pageView;
+	}
+	
+	public function getPageView() {
+		return $this->pageView;
+	}
+	
+	private function setProjectGroupHTML($pg) {
+		$this->projectGroupHTML = $pg;
+	}
+	
+	public function getProjectGroupHTML() {
+		return $this->projectGroupHTML;
+	}
+	
+	private function setProjectTask($pt) {
+		$this->projectTask = $pt;
+	}
+	
+	public function getProjectTask() {
+		return $this->projectTask;
+	}
+	
+	public function setTemplateFile($templateFile = 'detailtask_template') {
+		$this->templateFile = $templateFile;
+	}
+	
+	private function getTemplateFile() {
+		return $this->templateFile;
+	}
+	
+	private function setTemplateDir($tplDir) {
+		$this->tplDir = $tplDir;
+	}
+	
+	private function getTemplateDir() {
+		return $this->tplDir;
+	}
+	
+	private function setManager($boolManager) {
+		$this->boolManager = $boolManager;
+	}
+	
+	public function isManager() {
+		return $this->boolManager;
+	}
+	
+	private function setHTML($HTML) {
+		$this->HTML = $HTML;
+	}
+	
+	public function getHTML() {
+		return $this->HTML;
+	}
+
+	function __construct($uri, $pg, $pt, $pageView, $boolManager, $HTML) {
+		$this->setUri($uri);
+		$this->setProjectGroupHTML($pg);
+		$this->setProjectTask($pt);
+		$this->setPageView($pageView);
+		
+		$this->setManager($boolManager);
+		$this->setHTML($HTML);
+		
+		global $gfwww;
+		$this->setTemplateDir($gfwww.'pm/templates/');
+	}
+	
+	public function isThirdDetailColumnLayer() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return true;
+			case 'detailtask':
+			return true;
+			case 'postaddtask':
+			return false;
+		}
+	}
+	
+	public function showStartForm() {
+		switch($this->getPageView()) {
+			case 'postmodtask':	
+			return  html_build_form_start_tag($this->getUri(),'modtaskform');
+			case 'detailtask':
+			return '';
+			case 'postaddtask':
+			return '';
+		}
+	}
+	
+	public function showEndForm() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return '</form>';
+			case 'detailtask':
+			return '';
+			case 'postaddtask':
+			return '';
+		}
+	}
+	
+	public function showHiddenBox() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			$nameFunc = array('func' => 'postpostmodtasktask', 'project_task_id' => $this->getProjectTask()->getID()); 
+			break;
+			case 'detailtask':
+			$nameFunc = null;
+			break;
+			case 'postaddtask':
+			$nameFunc = null;
+			break;
+		}
+		
+		if(!empty($nameFunc))	{
+			$hiddenBoxes = '';
+			for($i = 0; $i < count($nameFunc); $i++) {
+				$hiddenBoxes .= html_build_hiddenBox(key($nameFunc[$i]), $nameFunc[$i]);
+			}
+			return $hiddenBoxes;
+		} else {
+			return '';
+		}
+	}
+	
+	public function showTaskId() {
+		return $this->getProjectTask()->getID();
+	}
+	
+	public function showSummary() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return html_build_textbox('summary', $this->getProjectTask()->getSummary());
+			case 'detailtask':
+			return $this->getProjectTask()->getSummary();
+			case 'postaddtask':
+			return;
+		}
+	}
+	
+	public function showPercentComplete() {		
+		switch($this->getPageView()) {
+			case 'postmodtask': 
+			return $this->getProjectGroupHTML()->percentCompleteBox('percent_complete',$this->getProjectTask()->getPercentComplete()); 
+			case 'detailtask': 
+			return $this->getProjectTask()->getPercentComplete();
+			case 'postaddtask':
+			return '';
+		}
+	}
+	
+	public function showStatus() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return $this->getProjectGroupHTML()->statusBox('status_id', $this->getProjectTask()->getStatusID(), false);
+			case 'detailtask':
+			return $this->getProjectTask()->getStatusName();
+			case 'postaddtask':
+			return '';
+		}
+	}
+	
+	public function showPriority() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return build_priority_select_box('priority',$this->getProjectTask()->getPriority());
+			case 'detailtask':
+			return $this->getProjectTask()->getPriority();
+			case 'postaddtask':
+			return;
+		} 
+	}
+	
+	//needs to be redesigned in html.php?
+	public function showAssignedTo() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return;
+			case 'detailtask':
+			return;
+			case 'postaddtask':
+			return;
+		}
+	}
+	
+	public function showStartDate() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return datepick_emit('start_dt', datepick_format($this->getProjectTask()->getStartDate(), true), true);
+			case 'detailtask':
+			return datepick_format($this->getProjectTask()->getStartDate());
+			case 'postaddtask':
+			return;
+		}
+	}
+	
+	public function showEndDate() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return datepick_emit('end_dt', datepick_format($this->getProjectTask()->getEndDate(),true), true);
+			case 'detailtask':
+			return datepick_format($this->getProjectTask()->getEndDate());
+			case 'postaddtask':
+			return;
+		}
+	}
+	
+	//later
+	public function showCalendar() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return;
+			case 'detailtask':
+			return;
+			case 'postaddtask':
+			return;
+		}
+	}
+	
+	public function showEstimatedHours() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return html_build_textbox('hours', $this->getProjectTask()->getHours());
+			case 'detailtask':
+			return $this->getProjectTask()->getHours();
+			case 'postaddtask':
+			return;
+		}
+	}
+	
+	public function showSubmittedBy() {
+		return $this->getProjectTask()->getSubmittedRealName() . ' ('.$this->getProjectTask()->getSubmittedUnixName().')';
+	}
+	
+	public function showPermaLink() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return;
+			case 'detailtask':
+			return;
+			case 'postaddtask':
+			return;
+		}
+	}
+	
+	public function showTaskdetailtaskInfo() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return;
+			case 'detailtask':
+			return;
+			case 'postaddtask':
+			return;
+		}
+	}
+	
+	public function showSubproject() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return $this->getProjectGroupHTML()->groupProjectBox('new_group_project_id', $this->getProjectTask()->getProjectGroup()->getID(), false);
+			case 'detailtask':
+			return $this->getProjectTask()->getProjectGroup()->getName();
+			case 'postaddtask':
+			return '';
+		}
+	}
+	
+	/**
+	 * Field only available for managers
+	 */
+	public function showCopyTaskFunc() {
+		/*
+			<strong><?php echo _('Copy to another Subproject'); ?>:</strong><br />
+			<?php echo $pg->groupProjectBox('copy_group_project_id',$group_project_id,false); ?> 
+			<?php echo '<input type="submit" name="CopySubproject" value="'._('Copy').'" onclick="document.forms[0].func.value = \'copytask\';" />'; ?>  
+		 */
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return;
+			case 'detailtask':
+			return;
+			case 'postaddtask':
+			return;
+		}
+	}
+	
+	public function showSubscribeLink() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return;
+			case 'detailtask':
+			return '';
+			case 'postaddtask':
+			return '';
+		} 
+	}
+	
+	public function showDeleteLink() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return;
+			case 'detailtask':
+			return;
+			case 'postaddtask':
+			return;
+		}
+	}
+	
+	public function showCategory() {
+		switch($this->getPageView()) {
+			case 'postmodtask':
+			return $this->getProjectGroupHTML()->categoryBox('category_id',$this->getProjectTask()->getCategoryID());
+			case 'detailtask':
+			return $this->getProjectTask()->getCategoryName();
+			case 'postaddtask':
+			return;
+		}
+	}
+	
+	public function loadTemplate() {
+
+         $file = $this->getTemplateDir().$this->getTemplateFile(). '.php';
+         
+         $exists = file_exists($file);  
+   
+         if ($exists){  
+
+             ob_start();  
+             include $file;  
+             $output = ob_get_contents();  
+             ob_end_clean();  
+               
+               
+             // Output zurückgeben.  
+             return $output;
+         } else {
+         	echo 'Error';
+         }   
+	}
+}
+
+
+?>

Added: branches/papel-51/www/pm/pm_task.php
===================================================================
--- branches/papel-51/www/pm/pm_task.php	                        (rev 0)
+++ branches/papel-51/www/pm/pm_task.php	2011-11-17 13:06:02 UTC (rev 17717)
@@ -0,0 +1,72 @@
+<?php
+/**
+ * FusionForge : Project Management Facility
+ *
+ * Copyright 1999/2000, Sourceforge.net Tim Perdue
+ * Copyright 2002 GForge, LLC, Tim Perdue
+ * Copyright 2010, FusionForge Team
+ * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011 Patrick Apel - tarent solutions GmbH
+ * 
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+//require_once('../env.inc.php'); //Page gets included from task.php. The files are available in task.php
+//require_once $gfcommon.'include/pre.php'; //Page gets included from task.php. The files are available in task.php
+require_once $gfwww.'include/note.php'; //Used by add_task.php and mod_task.php AND NOT by detail_task.php
+require_once $gfcommon.'reporting/report_utils.php';
+require_once $gfcommon.'reporting/Report.class.php';
+
+require_once $gfcommon.'pm/ProjectController.class.php';
+require_once $gfcommon.'pm/ProjectModel.class.php';
+
+pm_header(array('title'=>_('Modify Task'),'pagename'=>'pm_modtask','group_project_id'=>$group_project_id));
+
+echo notepad_func(); //Needed in mod_task.php and add_task.php but NOT IN detail_task.php
+session_require_login(); //Needed for?
+
+		
+$boolManager = false;		
+if (forge_check_perm ('pm', $pg->getID(), 'manager')) {
+	$boolManager = true;
+}
+
+/*
+ Method forge_check_perm and objects $pg and $pt provided by task.php
+ */
+
+$uri = getStringFromServer('PHP_SELF');
+$pageView = getStringFromRequest('func');
+if($pageView == 'detailtask' && $boolManager == true) {
+	$pageView = 'postmodtask';
+}
+
+
+$pmController = new ProjectController($uri, $pg, $pt, $pageView, $boolManager, $HTML);
+echo $pmController->display();
+
+/* Implements the theme and includes the pm_controller.php that implements the view in this file */
+
+if (forge_get_config('pm_timetracking')) {
+	include $gfwww.'templates/time_tracking.php';
+}	
+
+
+pm_footer(array());
+
+?>

Modified: branches/papel-51/www/pm/task.php
===================================================================
--- branches/papel-51/www/pm/task.php	2011-11-09 15:12:25 UTC (rev 17716)
+++ branches/papel-51/www/pm/task.php	2011-11-17 13:06:02 UTC (rev 17717)
@@ -450,11 +450,15 @@
 		} elseif ($pt->isError()) {
 			exit_error($pt->getErrorMessage(),'pm');
 		}
+		
+		/*
 		if (forge_check_perm ('pm', $pg->getID(), 'manager')) {
 			include $gfwww.'pm/mod_task.php';
 		} else {
 			include $gfwww.'pm/detail_task.php';
-		}
+		}*/
+		
+		include $gfwww.'pm/pm_task.php';
 		break;
 	}
 

Added: branches/papel-51/www/pm/templates/detail_template.php
===================================================================
--- branches/papel-51/www/pm/templates/detail_template.php	                        (rev 0)
+++ branches/papel-51/www/pm/templates/detail_template.php	2011-11-17 13:06:02 UTC (rev 17717)
@@ -0,0 +1,56 @@
+<?php echo $this->showStartForm(); ?>
+<?php echo $this->getHTML()->boxTop(_('Details'), 'details', false, 'toplev_about'); ?>
+<div>
+	<div><?php echo _('Percent Complete'); ?></div>
+	<div><?php echo $this->showPercentComplete(); ?></div>
+	<div><?php echo _('Status'); ?></div>
+	<div><?php echo $this->showStatus(); ?></div>
+	<div><?php echo _('Priority'); ?></div>
+	<div><?php echo $this->showPriority(); ?></div>
+	<div><?php echo _('Assigned to'); ?></div>
+	<div><?php echo $this->showAssignedTo(); ?></div>
+</div>
+
+<div>
+	<div><?php echo _('Start Date'); ?></div>
+	<div><?php echo $this->showStartDate(); ?></div>
+	<div><?php echo _('End Date'); ?></div>
+	<div><?php echo $this->showEndDate(); ?></div>
+	<div><?php echo _('View Calendar'); ?></div>
+	<div><?php echo $this->showCalendar(); ?></div>
+	<div><?php echo _('Estimated Hours'); ?></div>
+	<div><?php echo $this->showEstimatedHours()?></div>
+</div>
+
+<?php if($this->isThirdDetailColumnLayer()) {?>
+	<div>
+		<div><?php echo _('Submitted by'); ?></div>
+		<div><?php echo $this->showSubmittedBy(); ?></div>
+		<div><?php echo _('Permalink'); ?></div>
+		<div><?php echo $this->showPermaLink(); ?></div>
+		<div><?php echo _('Task Detail Information'); ?></div>
+		<div><?php echo $this->showTaskdetailtaskInfo(); ?></div>
+		<div><?php echo _('Subproject'); ?></div>
+		<div><?php echo $this->showSubproject(); ?></div>
+	
+		<div><?php echo $this->showSubscribeLink(); ?></div>
+	
+		<?php if($this->getPageView()=='postmodtask') {?>
+			<div><?php echo _('Copy to another Subproject'); ?></div>
+			<div><?php echo $this->showCopyTaskFunc(); ?></div>
+		<?php }?>
+	</div>
+<?php }?>
+<?php echo $this->getHTML()->boxBottom(); ?>
+
+
+
+<?php echo $this->getHTML()->boxTop(_('Description'), 'description', false, 'toplev_about'); ?>
+<div></div>
+<?php echo $this->getHTML()->boxBottom(); ?>
+
+
+<?php echo $this->getHTML()->boxTop(_('Details'), 'details', false, 'toplev_about'); ?>
+<div></div>
+<?php echo $this->getHTML()->boxBottom(); ?>
+<?php echo $this->showEndForm(); ?>
\ No newline at end of file

Added: branches/papel-51/www/pm/templates/time_tracking.php
===================================================================
--- branches/papel-51/www/pm/templates/time_tracking.php	                        (rev 0)
+++ branches/papel-51/www/pm/templates/time_tracking.php	2011-11-17 13:06:02 UTC (rev 17717)
@@ -0,0 +1,108 @@
+<h3><?php echo _('Time tracking'); ?></h3>
+
+<?php
+$title_arr = array();
+$title_arr[]=_('Week');
+$title_arr[]=_('Day');
+$title_arr[]=_('Estimated Hours');
+$title_arr[]=_('Category');
+$title_arr[]=_('User');
+$title_arr[]=' ';
+
+$xi = 0;
+
+$report=new Report();
+if ($report->isError()) {
+	exit_error($report->getErrorMessage(),'pm');
+}
+
+echo '<form action="/reporting/timeadd.php" method="post">
+	<input type="hidden" name="project_task_id" value="'.$project_task_id.'" />
+	<input type="hidden" name="submit" value="1" />';
+echo $HTML->listTableTop ($title_arr);
+	echo '<form action='.'"'
+	.getStringFromServer('PHP_SELF')."?func=detailtask&project_task_id=$project_task_id&group_id=$group_id&group_project_id=$group_project_id".'"'.
+	' method="post" />
+	<input type="hidden" name="project_task_id" value="'.$project_task_id.'">
+	<input type="hidden" name="submit" value="1" />
+	<tr '.$HTML->boxGetAltRowStyle(@$xi++).'>
+		<td style="text-align:center">'. report_weeks_box($report, 'week') .'</td>
+		<td style="text-align:center">'. report_day_adjust_box($report, 'days_adjust') .'</td>
+		<td style="text-align:center"><input type="text" name="hours" value="" size="3" maxlength="3" /></td>
+		<td style="text-align:center">'.report_time_category_box('time_code',false).'</td>
+		<td> </td>
+		<td style="text-align:center"><input type="submit" name="add" value="'._('Add').'" /><input type="submit" name="cancel" value="'._('Cancel').'" /></td>
+	</tr>';
+	
+//setenv("TZ=" . $user_timezone); //restore the user's timezone
+	
+//
+//	Display Time Recorded for this task
+//
+
+
+$res=db_query_params ('SELECT users.realname, rep_time_tracking.report_date, rep_time_tracking.hours, rep_time_category.category_name
+	FROM users,rep_time_tracking,rep_time_category
+	WHERE 
+	users.user_id=rep_time_tracking.user_id
+	AND rep_time_tracking.time_code=rep_time_category.time_code
+	AND rep_time_tracking.project_task_id=$1',
+			array($project_task_id));
+$total_hours =0;
+for ($i=0; $i<db_numrows($res); $i++) {
+
+	echo '
+	<tr '.$HTML->boxGetAltRowStyle($xi++).'>
+	<td> </td>
+	<td>'.date(_('Y-m-d H:i'),db_result($res,$i,'report_date')).'</td>
+	<td>'.db_result($res,$i,'hours').'</td>
+	<td>'.db_result($res,$i,'category_name').'</td>
+	<td>'.db_result($res,$i,'realname').'</td>
+	<td> </td></tr>';
+	$total_hours += db_result($res,$i,'hours');
+	
+}
+
+echo '
+<tr '.$HTML->boxGetAltRowStyle($xi++).'>
+<td><strong>'._('Total').':</strong></td>
+<td> </td>
+<td>'.$total_hours.'</td>
+<td> </td>
+<td> </td>
+<td> </td>
+</tr>
+<tr>
+<td> </td>
+<td> </td>
+<td> </td>
+<td> </td>
+<td> </td>
+</tr>';
+$total_hours += db_result($res,$i,'hours');
+
+echo'<tr><td><h3>'._('Time tracking list').'</h3></td>
+		 <td> </td>
+		 <td> </td>
+		 <td> </td>
+		 <td> </td>
+		 <td> </td>
+
+<form action="/reporting/timeadd.php" method="post" />
+	<input type="hidden" name="project_task_id" value="'.$project_task_id.'">
+	<input type="hidden" name="submit" value="1" />
+	<tr '.$HTML->boxGetAltRowStyle(@$xi++).'>
+		<td style="text-align:center">'. report_weeks_box($report, 'week') .'</td>
+		<td style="text-align:center;"><input type="submit" name="showTasks" value="'._('Edit').'" /></td>
+		<td style="text-align:center;visibility:hidden">'
+		. report_day_adjust_box($report, 'days_adjust').'
+		<input type="text" name="hours" value="" size="3" maxlength="3" />
+		</td>
+		<td style="text-align:center;visibility:hidden">'.report_time_category_box('time_code',false).'</td>
+		<td> </td>
+		<td style="text-align:center"> </td>
+</tr></form>';
+
+echo $HTML->listTableBottom();
+echo "</form>\n";
+?>
\ No newline at end of file



More information about the evolvis-commits mailing list