Recent Topics

1 Dec 07, 2005 15:26    

This hack will add a button to the edit post page, and when clicked will set the new issue_date and issue_time of the post to the current date and time.

On line 225 in _item.form.php you should see this:

$Form->date( 'item_issue_date', $edited_Item->get('issue_date'), T_('Issue date') );
		$Form->time( 'item_issue_time', $edited_Item->get('issue_date'), '' );[/php]

Change that to [php]		$Form->date( 'item_issue_date', $edited_Item->get('issue_date'), T_('Issue date') );
		$Form->time( 'item_issue_time', $edited_Item->get('issue_date'), '' )
		?>
<script language="javascript">
function SetPostDateAsNow() {
	//Source: http://wsabstract.com/script/cut165.shtml
	var mydate=new Date();
	var year=mydate.getYear();
	if (year < 1000)
	year+=1900;
	var day=mydate.getDay();
	var month=mydate.getMonth()+1;
	if (month<10)
	month="0"+month;
	var daym=mydate.getDate();
	if (daym<10)
	daym="0"+daym;
	
	document.getElementById('item_issue_date').value = year+"-"+month+"-"+daym;
	var hours = mydate.getHours();
	var minutes = mydate.getMinutes();
	var seconds = mydate.getSeconds();
	if (seconds<10)
		seconds="0"+seconds;
	document.getElementById('item_issue_time').value = hours+":"+minutes+":"+seconds;
}
</script>
&nbsp;&nbsp;<input type="button" value="Now" class="ActionButton" onclick="SetPostDateAsNow()" title="You can thank balupton for this one." />
<?php

2 Jan 14, 2006 16:07

I've added it to our todo list, waiting for what François thinks about it.

I'd say that it would be nice, but on the other hand you can already get the current date from the calendar popup and another button would clutter the interface more.

Perhaps the calendar popup should just be extended to have "Now" besides "Today" and then updates the time field also.

3 Mar 25, 2006 18:03

Hi - where do I find this file to add this hack to buyforless.com ? Thanks


Form is loading...