Author Topic: How to display direct link to task (resolved)  (Read 6770 times)

fernandog

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
How to display direct link to task (resolved)
« on: June 23, 2010, 05:54:35 PM »
Hi there,

In case anyone would find this useful, this code displays the direct URL to the task in view, and a "copy" link which copies the path to the clipboard so it can be shared with other users (ie, pasted into an email)

Simply paste this code anywhere in application/views/task/task_list.php

Code: [Select]
<b>Task URL:</b>

<br>
<SCRIPT LANGUAGE="JavaScript">

function ClipBoard()
{
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("RemoveFormat");
Copied.execCommand("Copy");
}

</SCRIPT>
<SPAN ID="copytext">
http://localhost/fengoffice/index.php?c=task&a=view_task&id=<?php echo ($task_list->getId()) ?>
</SPAN>
<TEXTAREA ID="holdtext" STYLE="display:none;">
</TEXTAREA>
<a href="#" onClick="ClipBoard();">(copy)</a>

Substitute "http://localhost/fengoffice" for the path you use to get to FengOffice




Murz

  • Full Member
  • ***
  • Posts: 147
    • View Profile
Re: How to display direct link to task (resolved)
« Reply #1 on: June 24, 2010, 03:14:30 AM »
Thank's! But this script works only in IE, don't work with Firefox :(
And for get correct url you must use fengoffice function getUrl():
Code: [Select]
<SCRIPT LANGUAGE="JavaScript">

function ClipBoard()
{
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("RemoveFormat");
Copied.execCommand("Copy");
}
</SCRIPT>
<SPAN ID="copytext"><?=$object->getViewUrl()?></SPAN>
<TEXTAREA ID="holdtext" STYLE="display:none;"></TEXTAREA>
<a href="#" onClick="ClipBoard();">(copy)</a>

But I place it in application/views/co/view.php that shows on task page.

In which place of task_list.php you recommend to place your code?

P.S. Another method that work in firefox is described here: https://developer.mozilla.org/en/using_the_clipboard

fernandog

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: How to display direct link to task (resolved)
« Reply #2 on: June 24, 2010, 09:34:42 AM »
Ahh, thanks for pointing that out Murz.

I created a table and put the task Start/due dates on one side, and the URl on the other, right on top of the description, like this (See screenshot):
Code: [Select]
<table width=80%>
<tr>
<td>
<?php if ($task_list->getStartDate() instanceof DateTimeValue) { ?>
<?php if ($task_list->getStartDate()->getYear() > DateTimeValueLib::now()->getYear()) { ?>
 <div class="startDate"><b><?php echo lang('start date'?>: </b><?php echo format_date($task_list->getStartDate(), null0?></div>
<?php } else { ?>
 <div class="startDate"><b><?php echo lang('start date'?>: </b><?php echo format_descriptive_date($task_list->getStartDate(), 0?></div>
<?php // if ?>
<?php // if ?>

<?php if ($task_list->getDueDate() instanceof DateTimeValue) { ?>
<?php if ($task_list->getDueDate()->getYear() > DateTimeValueLib::now()->getYear()) { ?>
 <div class="dueDate"><b><?php echo lang('due date'?>: </b><?php echo format_date($task_list->getDueDate(), null0?></div>
<?php } else { ?>
 <div class="dueDate"><b><?php echo lang('due date'?>: </b><?php echo format_descriptive_date($task_list->getDueDate(), 0?></div>
<?php // if ?>
<?php // if ?>

</td>
<td>


<b>Task URL:</b>

<br>
<SCRIPT LANGUAGE="JavaScript">

function ClipBoard()
{
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("RemoveFormat");
Copied.execCommand("Copy");
}

</SCRIPT>
<SPAN ID="copytext">
<?php echo($object->getViewUrl()) ?>
</SPAN>
<TEXTAREA ID="holdtext" STYLE="display:none;">
</TEXTAREA>
<a href="#" onClick="ClipBoard();">(copy)</a>


</td></tr></table>
<br>
« Last Edit: June 24, 2010, 02:43:52 PM by fernandog »

icfw

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: How to display direct link to task (resolved)
« Reply #3 on: June 24, 2010, 01:45:57 PM »
Dear Admin,

is there a way to finalize this code and incorporate it in the next releases of Feng Office?

Thanks.
.Mirsad

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: How to display direct link to task (resolved)
« Reply #4 on: June 24, 2010, 02:12:17 PM »
I consider it very useful.
Will do my best for 1.7.1

Thanks for sharing.

icfw

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: How to display direct link to task (resolved)
« Reply #5 on: June 25, 2010, 11:19:14 AM »
Dear Admin,

thank you.

.Mirsad

allenlook

  • Volunteer Moderator
  • Sr. Member
  • ****
  • Posts: 312
    • MSN Messenger - sii_lookal@hotmail.com
    • View Profile
    • SI Group, Inc.
Re: How to display direct link to task (resolved)
« Reply #6 on: June 28, 2010, 10:28:40 AM »
This would be exceptionally useful for the Gantt chart view - each task can have a URL associated with it, and it would be great to be able to click on a task and jump to it!
I am a volunteer moderator.  Any statements, opinions or observations I contribute are solely mine and are not necessarily shared by the makers of Feng Office.

Murz

  • Full Member
  • ***
  • Posts: 147
    • View Profile
Re: How to display direct link to task (resolved)
« Reply #7 on: July 01, 2010, 03:44:02 AM »