[pLog-CVS] plog_devel/templates/admin editpost.template,1.6,1.7 header.template,1.17,1.18 newpost.te
Brought to you by:
jondaley
From: <phu...@us...> - 2003-10-07 19:46:28
|
Update of /cvsroot/plog/plog_devel/templates/admin In directory sc8-pr-cvs1:/tmp/cvs-serv26244/templates/admin Modified Files: editpost.template header.template newpost.template Log Message: added support for changing the date of posts. also, the main page now fetches all the posts until the current moment, so that future posts are not shown in the main page when they should not. Index: editpost.template =================================================================== RCS file: /cvsroot/plog/plog_devel/templates/admin/editpost.template,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** editpost.template 5 Aug 2003 09:28:58 -0000 1.6 --- editpost.template 7 Oct 2003 19:46:22 -0000 1.7 *************** *** 1,4 **** --- 1,9 ---- {include file="admin/header.template"} + <script type="text/javascript"> + // init the array with the days of the month for every month + var days = new Array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ); + </script> + <div id="subnav"> <ul> *************** *** 7,10 **** --- 12,18 ---- <br/></div> + {$postDay}-{$postMonth}-{$postYear}<br/> + {$postHour}:{$postMinutes} + <div id="container"> <h3>{$locale->tr("edit_post")}</h3> *************** *** 17,20 **** --- 25,62 ---- {$locale->tr("topic")}: <br/><input type="text" name="postTopic" style="width:100%" value="{$post->getTopic()}"/><br/> <br/>{$locale->tr("text")}: <br/><textarea rows="15" style="width:100%" name="postText">{$post->getText()}</textarea><br/> + + <!-- select fields for the date --> + {assign var=postDate value=$post->getDateObject()} + Date: + <select name="postDay"> + </select> / + + <select name="postMonth" onchange="changeList(this);"> + {foreach name=monthLoop from=$months item=monthName} + {* this is smarty magic... don't like it too much but couldn't find a better way to do it :P *} + <option value="{counter}" {if $smarty.foreach.monthLoop.iteration == $postMonth } selected="selected" {/if}>{$monthName}</option> + {/foreach} + </select> / + + <select name="postYear"> + {foreach from=$years item=year} + <option value="{$year}" {if $year == $postYear } selected="selected" {/if}>{$year}</option> + {/foreach} + </select> Time: + + <select name="postHour"> + {foreach from=$hours item=hour} + <option value="{$hour}" {if $hour == $postHour } selected="selected" {/if}>{$hour}</option> + {/foreach} + </select>: + + <select name="postMinutes"> + {foreach from=$minutes item=minute} + <option value="{$minute}" {if $minute == $postMinutes } selected="selected" {/if}>{$minute}</option> + {/foreach} + </select> + <!-- end of the stuff for the date --> + <br/> + {$locale->tr("category")}: <select name="postCategory"> {foreach from=$categories item=category} *************** *** 34,36 **** --- 76,82 ---- </form> </div> + <script type="text/javascript"> + changeList(document.forms['editPost'].postMonth); + document.forms['editPost'].postDay.selectedIndex = {$postDay}-1; + </script> {include file="admin/footer.template"} Index: header.template =================================================================== RCS file: /cvsroot/plog/plog_devel/templates/admin/header.template,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** header.template 12 Sep 2003 14:42:58 -0000 1.17 --- header.template 7 Oct 2003 19:46:23 -0000 1.18 *************** *** 15,21 **** {literal} <!-- ! function help_window(helpurl) { HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400'); } // --> {/literal} --- 15,44 ---- {literal} <!-- ! function help_window(helpurl) ! { HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400'); } + + function emptyList( box ) + { + while ( box.options.length ) box.options[0] = null; + } + + function fillList( box, numElems ) + { + for ( i = 1; i <= numElems; i++ ) { + option = new Option( i, i ); + box.options[box.length] = option; + } + + box.selectedIndex=0; + } + + function changeList( box ) + { + daysMonth = days[box.options[box.selectedIndex].value-1]; + emptyList( box.form.postDay ); + fillList( box.form.postDay, daysMonth ); + } // --> {/literal} Index: newpost.template =================================================================== RCS file: /cvsroot/plog/plog_devel/templates/admin/newpost.template,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** newpost.template 5 Aug 2003 09:28:58 -0000 1.9 --- newpost.template 7 Oct 2003 19:46:23 -0000 1.10 *************** *** 1,3 **** --- 1,13 ---- {include file="admin/header.template"} + <script type="text/javascript"> + + // init the array with the days of the month for every month + var days = new Array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ); + + var todayDay = {$today->getDay()}; + var todayMonth = {$today->getMonth()}; + var todayYear = {$today->getYear()}; + + </script> <div id="subnav"> *************** *** 7,10 **** --- 17,25 ---- <br/></div> + {if $previewMode} + {$postDay}-{$postMonth}-{$postYear}<br/> + {$postHour}:{$postMinutes} + {/if} + <div id="container"> <h3>{$locale->tr("new_post")}</h3> *************** *** 17,20 **** --- 32,79 ---- {$locale->tr("topic")}:<br/><input type="text" name="postTopic" style="width:100%" value="{if $previewMode} {$postTopic} {/if}"/><br/> <br/>{$locale->tr("text")}: <br/><textarea rows="15" name="postText" style="width:100%">{if $previewMode} {$postText} {/if}</textarea><br/> + + <!-- select fields for the date --> + Date: + <select name="postDay"> + </select> / + <select name="postMonth" onchange="changeList(this);"> + {foreach name=monthLoop from=$months item=monthName} + {* this is smarty magic... don't like it too much but couldn't find a better way to do it :P *} + {if $previewMode} + <option value="{counter}" {if $smarty.foreach.monthLoop.iteration == $postMonth } selected="selected" {/if}>{$monthName}</option> + {else} + <option value="{counter}" {if $smarty.foreach.monthLoop.iteration == $today->getMonth() } selected="selected" {/if}>{$monthName}</option> + {/if} + {/foreach} + </select> / + <select name="postYear"> + {foreach from=$years item=year} + {if $previewMode} + <option value="{$year}" {if $year == $postYear } selected="selected" {/if}>{$year}</option> + {else} + <option value="{$year}" {if $year == $today->getYear() } selected="selected" {/if}>{$year}</option> + {/if} + {/foreach} + </select> Time: + <select name="postHour"> + {foreach from=$hours item=hour} + {if $previewMode} + <option value="{$hour}" {if $hour == $postHour } selected="selected" {/if}>{$hour}</option> + {else} + <option value="{$hour}" {if $hour == $today->getHour() } selected="selected" {/if}>{$hour}</option> + {/if} + {/foreach} + </select>: + <select name="postMinutes"> + {foreach from=$minutes item=minute} + {if $previewMode} + <option value="{$minute}" {if $minute == $postMinutes } selected="selected" {/if}>{$minute}</option> + {else} + <option value="{$minute}" {if $minute == $today->getMinutes() } selected="selected" {/if}>{$minute}</option> + {/if} + {/foreach} + </select> + <!-- end of the stuff for the date --> + <br/> {$locale->tr("category")}: <select name="postCategory"> {foreach from=$categories item=category} *************** *** 33,35 **** --- 92,102 ---- </form> </div> + <script type="text/javascript"> + changeList(document.forms['newPost'].postMonth); + {if $previewMode } + document.forms['newPost'].postDay.selectedIndex = {$postDay}-1; + {else} + document.forms['newPost'].postDay.selectedIndex = {$today->getDay()}-1; + {/if} + </script> {include file="admin/footer.template"} |