Feng Forum

Other Topics => Development => Community Contributions => : fernandog June 23, 2010, 05:54:35 PM

: How to display direct link to task (resolved)
: fernandog 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

:
<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



: Re: How to display direct link to task (resolved)
: Murz 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():
:
<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
: Re: How to display direct link to task (resolved)
: fernandog 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):
:
<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>
: Re: How to display direct link to task (resolved)
: icfw 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
: Re: How to display direct link to task (resolved)
: cabeza June 24, 2010, 02:12:17 PM
I consider it very useful.
Will do my best for 1.7.1

Thanks for sharing.
: Re: How to display direct link to task (resolved)
: icfw June 25, 2010, 11:19:14 AM
Dear Admin,

thank you.

.Mirsad
: Re: How to display direct link to task (resolved)
: allenlook 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!
: Re: How to display direct link to task (resolved)
: Murz July 01, 2010, 03:44:02 AM
Will be good to add in 1.7.1 version multibrowser code, because this works only in Internet Explorer.
For Firefox there are another code:
http://www.logiclabz.com/javascript/copy-to-clipboard-with-javascript-on-mozilla-firefox-and-ie.aspx

And here are more examples:
http://stackoverflow.com/questions/400212/how-to-copy-to-clipboard-in-javascript
http://www.dynamic-tools.net/toolbox/copyToClipboard/
http://davidwalsh.name/clipboard
: tadalafil better than viagra
: Baveskara September 17, 2022, 03:27:36 PM
Eur J Obst Gyn Repro Biol 102 188 194 clomid and alcohol (http://clomid.one) Furthermore, LEM4 interacts with and stabilizes both Aurora A and ER?±, promotes Aurora A mediated phosphorylation of ER?± Ser167, leading to increase in ER?± DNA binding and transactivation activity