<!--// 플래너를 위해 아래 부분 추가 --- -->
<?php
$get_plan_sdate = Context::get('plan_sdate');	  // XE변수 넘겨받기 위해서.
$oDocVar = &$GLOBALS['oContext']->context->oDocument->variables;
if($oDocVar['plan_sdate'] == null && $get_plan_sdate)
	$oDocVar['plan_sdate'] = $get_plan_sdate;
$plan_bgcolor = $oDocVar['plan_bgcolor'];
$plan_check = $oDocVar['plan_check'];
$plan_period = $oDocVar['plan_period'];
$plan_value = $oDocVar['plan_value'];
$plan_time = $oDocVar['plan_time'];
if($plan_bgcolor == null) $plan_bgcolor = 0;
if($plan_period == null) $plan_period = 0;
if($plan_value == null) $plan_value = 0;

$xetoday = time() + zgap();
$year = intval(date("Y",$xetoday));  // 당일년도
$month = intval(date("n",$xetoday));  // 당일월
$day = intval(date("j",$xetoday));  // 당일일
if($get_plan_sdate)
{
	$pDay = $get_plan_sdate % 100;
	$pMonth = (int)($get_plan_sdate % 1000) / 100;
	$pYear = (int)($get_plan_sdate / 1000);
} else
{
	$pDay = $day;
	$pMonth = $month;
	$pYear = $year;
}

// image 추가 삭제 가능, 순서 상관없음.
$Acheckimg = array('','accept.png','cancel.png','stop.png','plus.png',
	'flag_red.png','flag_blue.png','flag_green.png','flag_orange.png',
	'flag_yellow.png','flag_black.png', 'sm.gif', 'sm_a1.gif', 'sm_a2.gif',
	'sm_approve.gif', 'sm_big2.gif','sm_big.gif');
// 배경색상 추가 삭제 가능, 순서 상관없음.
$Abgcolor = array(
	'lightBlue', 'lightsteelblue', 'lightskyblue', 'deepskyblue',
	'turquoise', 'lightgreen', 'greenyellow',
	'lime', 'limegreen', 'lightseagreen',
	'lightcyan', '#80ffff', 'aqua',
	'#fafad2', 'khaki', 'gold', 'orange', 'lightsalmon',
	'mistyrose', 'lightpink', 'lightcoral', 'tomato',
	'chocolate', 'violet', 'magenta',
	'lavender','silver',
	);
?>
<?php Context::loadJavascriptPlugin('ui.colorpicker');  ?>
<?php Context::loadJavascriptPlugin('ui.datepicker');   ?>
<script type="text/javascript">
(function($){
    $(function(){
    var option = { changeMonth:true, changeYear:true, gotoCurrent: false, yearRange:'-100:+10', onSelect:function(){ $(this).prev('input[type="hidden"]').val(this.value.replace(/-/g,""))}};
        $.extend(option,$.datepicker.regional['ko']);
        $("#date_plan_edate").datepicker(option);
    $("#date_plan_sdate").datepicker(option);
    });
})(jQuery);
</script>

<!--// 플래너를 위해 윗부분 추가 --- -->

<!--#include("_header.html")-->

<!--// 플래너를 위해 아래 부분 추가 --- -->
<style> 
.calendar_container { margin:0 0 20px 0; width:100%; height:auto; vertical-align:top; clear:both; *zoom:1; } 
.calendar_container:after { calendar_box:""; clear:both; display:block; } 
.calendar_box { float:left; width:185px; height:auto; text-align:center;border:1px solid #dddddd; margin-right:10px; padding:5px; } 
.calendar_box ul { width:100%; display:block; list-style-type:none; margin:0; padding:0; } 
.calendar_box li { width:25px; display:block; float:left; } 
.stoday { font-weight:bold; background-color:yellow; color:black;} 
.calendar_text { text-align:center; font-size:12px; } 
.ssunday { color:red; } 
.snday { color:blue; } 
.calendar_title { margin:0px; text-align:center; font-size:12px; background-color:#999999; color:#ffffff; } 
.clear { clear:both; } 
.time_table { width:640px; display:block; float:left; margin:0; padding:0; font-size:8pt;} 
</style> 

<?php 
function fn_smallcalendar_ymd($pYear, $pMonth, $pDay){ 
    $year = date("Y",mktime(0,0,0,$pMonth,1,$pYear)); 
    $month = date("n",mktime(0,0,0,$pMonth,1,$pYear)); 
    if ($pDay != 0){ 
    $day = date("d",mktime(0,0,0,$pMonth,$pDay,$pYear)); 
    } 
 
    $day_max = date("t",mktime(0,0,0,$month,1,$year)); 
    $week_start = date("w",mktime(0,0,0,$month,1,$year)); 
    $i = 0; 
    $j = 0; 
    $html = "<div class='calendar_box'>\n<div class='calendar_title stoday'>".sprintf("%d-%02d-%02d",$year,$month,$day)."</div>\n<ul>"; 
    while ($j<$day_max){ 
        if ($i<$week_start) { 
            $html .= "<li class='calendar_text'>*</li>"; 
        } else { 
            if ($i%7==0){ 
                $html .= "</ul><ul>\n"; 
                $font_color = " ssunday"; 
            } 
            else if ($i%7==6) $font_color = ""; 
            else $font_color = ""; 
            if ($month==$pMonth and $day == ($j+1)) $font_weight = " stoday"; 
            else $font_weight = ""; 
            $html .= "<li class='calendar_text$font_color$font_weight'>" . ($j+1) . "</li>"; 
            $j ++; 
        } 
        $i ++; 
    } 
    while ($i%7!==0){ 
        $html .= "<li class='calendar_text'>*</li>"; 
        $i ++; 
    } 
     $html .= "</ul>\n</div>\n"; 
    return $html; 
} 
?> 


<div class="calendar_container"> 
    <?php echo fn_smallcalendar_ymd($pYear,$pMonth-1, 0);?> 
    <?php echo fn_smallcalendar_ymd($pYear,$pMonth, $pDay);?> 
    <?php echo fn_smallcalendar_ymd($pYear,$pMonth+1, 0);?> 
</div> 
<div class="clear">&nbsp;</div> 
<!--// 플래너를 위해 윗부분 추가 --- -->

<form name="splannerform" action="./" method="post" onsubmit="jQuery(this).find('input').each(function(){if(this.title==this.value)this.value='';});return procFilter(this, window.insert)" id="fo_write" class="boardWrite">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="content" value="{$oDocument->getContentText()}" />
<input type="hidden" name="document_srl" value="{$document_srl}" />

	<div class="boardWriteHeader">
	
		<!--@if($module_info->use_category=="Y")-->
		<select name="category_srl" class="category">
			<option value="">{$lang->category}</option>
			<!--@foreach($category_list as $val)-->
			<option <!--@if(!$val->grant)-->disabled="disabled"<!--@endif--> value="{$val->category_srl}" <!--@if($val->grant&&$val->selected||$val->category_srl==$oDocument->get('category_srl'))-->selected="selected"<!--@endif-->>
				{str_repeat("&nbsp;&nbsp;",$val->depth)} {$val->title} ({$val->document_count})
			</option>
			<!--@endforeach-->
		</select>
		<!--@endif-->
		
		<!--@if($oDocument->getTitleText())-->
		<input type="text" name="title" id="postTitle" class="inputText" value="{htmlspecialchars($oDocument->getTitleText())}" />
		<!--@else-->
		<input type="text" name="title" id="postTitle" class="inputText" value="{$lang->title}" title="{$lang->title}" onfocus="if(this.value==this.title) this.value='';" />
		<!--@endif-->
	
        <!--@if($is_logged)-->
        <span class="buttonOfficial"><button type="button" onclick="doDocumentLoad(this); return false;">{$lang->cmd_load}</button></span>
        <!--@endif-->
		
	</div>

	<!--// plan start -->
    <table cellspacing="0" summary="" class="extraVarsList">
        <col width="64" /> <col />
        <tr>
        <th scope="row">{$lang->plan_sdate} *</th>
        <td><input type="hidden" name="plan_sdate" value="{$oDocument->getPlanSdate()}" /><input type="text" id="date_plan_sdate" value="{zdate($oDocument->getPlanSdate(),'Y-m-d')}" readonly="readonly" class="date" />
<p><font color=red ><b>반드시 입력 하십시요.</b></font></p></td>
    </tr>
        <tr>
        <th scope="row">{$lang->plan_edate} </th>
        <td><input type="hidden" name="plan_edate" value="" /><input type="text" id="date_plan_edate" value="{zdate($oDocument->getPlanEdate(),'Y-m-d')}" readonly="readonly" class="date" />
<p>참고: 당일로 종료되는 일정은 넣지 않아도 됩니다.</p></td>
    </tr>
        <tr>
        <th scope="row">{$lang->plan_bgcolor} </th>
        <td>
			<p>참 고: 일정배경에 하이라이트 표시</p>
<?php
			if($plan_bgcolor == null)
			{
				 $plan_bgcolor = $Abgcolor[rand(0,count($Abgcolor)-1)];
			}
			$i = 0;
			foreach($Abgcolor as $var)
			{
				echo "<span style='background-color:".$var."; white-space:wrap;'>";
				echo "<input type='radio' name='plan_bgcolor' value='".$var."' ";
				if($var == $plan_bgcolor)
					echo "checked";
				echo ">";
				echo "&nbsp;&nbsp;</span>\n";
				$i++;
				if(($i % 15) == 0) echo "<p></p>";	// line 변경
			}
?>
	    </td>
    </tr>
        <tr>
        <th scope="row">{$lang->plan_check} </th>
        <td>
		<p>참고: 일정앞에 아이콘 표시.(일정확인, 중요도 분류등의 용도로 사용. 기본값=null)<br />
<?php
			foreach($Acheckimg as $var)
			{
				echo "<input type='radio' name='plan_check' value='".$var."'";
				if($var == $plan_check)
					echo "checked";
				echo ">";
				if($var == '')
					echo "&nbsp;&nbsp;\n";
				else
				echo "<img src=modules/sboard/skins/xe_splanner/images/icon/".$var.">\n";
			}
?>
			</p></td>
    </tr>
        <tr>
        <th scope="row">{$lang->plan_period} </th>
        <td><select width='100' style="width: 100px" name="plan_period" class="select" onChange="redirect(this.options.selectedIndex)">
<?php
		$Aperiod = &$GLOBALS['oContext']->context->oDocument->Aperiod;
		foreach($Aperiod as $k => $v)
		{
			if($k == $plan_period)
				echo "<option value=".$k." selected='selected'>".$v."</option>\n";
			else
				echo "<option value=".$k.">".$v."</option>\n";
		}
?>
		</select><p>반복주기 선택</p>
		</td>
    </tr>
        <tr>
        <th scope="row">{$lang->plan_value} </th>
        <td><select width='100' style="width: 100px" name="plan_value" class="select">
			<option value=""  selected="selected"></option>
		</select>
		</td>
    </tr>
        <tr>
        <th scope="row">{$lang->plan_time} </th>
		<td>
		<input type="text" name="plan_time" style="width: 50px" value="{$oDocument->getPlanTime()}" readonly="readonly" />
		{$lang->unit_hour}<select style="width: 50px" name="plan_thour" class="select" onChange="sethour(this.options.selectedIndex)">
			<option value=""  selected="selected"></option>
			<?php
				for($i=0;$i<24;$i++) { 
					echo sprintf("<option>%02d</option>",$i);
				}
			?>
		</select>
		{$lang->unit_min}<select style="width: 50px" name="plan_tmin" class="select" onChange="setmin(this.options.selectedIndex)">
			<option value=""  selected="selected"></option>
			<?php
				for($i=0;$i<12;$i++) { 
					$m = $i * 5;
					echo sprintf("<option>%02d</option>",$m);
				}
			?>
		</select>
		</td>
    </tr>

    </table>
	<!--// plan end -->

    <div class="editor">{$oDocument->getEditor()}</div>

    <div class="tag">
        <input type="text" name="tags" value="{htmlspecialchars($oDocument->get('tags'))}" class="inputText" title="Tag" />
		<p>{$lang->about_tag}</p>
    </div>

	<div class="editorOption">
		<!--@if(!$is_logged)-->
		   <input type="text" name="nick_name" class="inputText userName" value="{$lang->writer}" title="{$lang->writer}" onfocus="if(this.value==this.title)this.value='';return false;" />
		   <input type="password" name="password" class="inputText userPw" value="{$lang->password}" title="{$lang->password}"  onfocus="if(this.value==this.title)this.value='';return false;" />
		   <input type="text" name="email_address" class="inputText emailAddress" value="{$lang->email_address}" title="{$lang->email_address}"  onfocus="if(this.value==this.title)this.value='';return false;" />
		   <input type="text" name="homepage" class="inputText homePage" value="{$lang->homepage}" title="{$lang->homepage}"  onfocus="if(this.value==this.title)this.value='';return false;" />
		<!--@end-->
		
        <!--@if($grant->manager)-->
        {@ $_color = array('555555','222288','226622','2266EE','8866CC','88AA66','EE2222','EE6622','EEAA22','EEEE22') }
        <select name="title_color" id="title_color" <!--@if($oDocument->get('title_color'))-->style="color:#{$oDocument->get('title_color')};"<!--@end--> onchange="this.style.color=this.options[this.selectedIndex].style.color;">
                <option value="" style="color:#CCCCCC;">{$lang->title_color}</option>
                <!--@foreach($_color as $_col)-->
                <option value="{$_col}" style="color:#{$_col}" <!--@if($oDocument->get('title_color')==$_col)-->selected="selected"<!--@end-->>{$lang->title_color}</option>
                <!--@endforeach-->
            </select>
            <input type="checkbox" name="title_bold" id="title_bold" value="Y" <!--@if($oDocument->get('title_bold')=='Y')-->checked="checked"<!--@end--> />
            <label for="title_bold">{$lang->title_bold}</label>
            <input type="checkbox" name="is_notice" value="Y" <!--@if($oDocument->isNotice())-->checked="checked"<!--@end--> id="is_notice" />
            <label for="is_notice">{$lang->notice}</label>
            <input type="checkbox" name="lock_comment" value="Y" <!--@if($oDocument->isLocked())-->checked="checked"<!--@end--> id="lock_comment" />
            <label for="lock_comment">{$lang->lock_comment}</label>
        <!--@endif-->
        <!--@if($module_info->secret=="Y")-->
            <input type="checkbox" name="is_secret" value="Y" <!--@if($oDocument->isSecret())-->checked="checked"<!--@end--> id="is_secret" />
            <label for="is_secret">{$lang->secret}</label>
        <!--@end-->
            <input type="checkbox" name="allow_comment" value="Y" <!--@if($oDocument->allowComment())-->checked="checked"<!--@end--> id="allow_comment" />
            <label for="allow_comment">{$lang->allow_comment}</label>
            <input type="checkbox" name="allow_trackback" value="Y" <!--@if($oDocument->allowTrackback())-->checked="checked"<!--@end--> id="allow_trackback" />
            <label for="allow_trackback">{$lang->allow_trackback}</label>
        <!--@if($is_logged)-->
            <input type="checkbox" name="notify_message" value="Y" <!--@if($oDocument->useNotify())-->checked="checked"<!--@end--> id="notify_message" />
            <label for="notify_message">{$lang->notify}</label>
        <!--@end-->
    </div>

	<div class="boardNavigation">
		<span class="buttonOfficial"><input type="submit" value="{$lang->cmd_registration}" accesskey="s" /></span>
		<span class="buttonOfficial"><button type="button" onclick="doDocumentSave(this);">{$lang->cmd_temp_save}</button></span>
		<span class="buttonOfficial"><button type="button" onclick="doDocumentLoad(this);">{$lang->cmd_load}</button></span>
	</div>

    </form>
<script type="text/javascript">
var week=new Array( '일', '월', '화', '수', '목', '금', '토')
var temp=document.splannerform.plan_value
function redirect(x){
    for (m=temp.options.length-1;m>0;m--)
        temp.options[m]=null
    if(x < 0 || x > 11) x = 0;
    if(x==0 || x==10 || x==11)
    {
        temp.options[0]=new Option("",0);
    } else if(x==9)
    {
        for (i=0;i<31;i++){
            temp.options[i]=new Option(i+1 + " 일",i+1);
        }
    } else
    {
        for (i=0;i<7;i++){
            temp.options[i]=new Option(week[i]+" 요일",i);
        }
    }
    temp.options[0].selected=true
}
redirect(<?php echo "$plan_period"; ?>)

temp.options[0].selected=false;
temp.options[<?php if($plan_period == 9) echo "$plan_value-1"; else echo "$plan_value"; ?>].selected=true

var time=document.splannerform.plan_time
var htime='';
var mtime='';
function sethour(x){
	x = x - 1;
	if(x < 10) htime = "0"+x;
	else htime = x;
	time.value = htime + ":" + mtime;
}
function setmin(x){
	x = (x - 1) * 5;
	if(x < 10) mtime = "0"+x;
	else mtime = x;
	time.value = htime + ":" + mtime;
}

</script>
<!--#include("_footer.html")-->
