Commit 192ce529 authored by sylvieg's avatar sylvieg

[MOD]calendar: status can be optional + status can be displayed or not in...

[MOD]calendar: status can be optional + status can be displayed or not in calendar view mode + sttaus can be displayed or not in popup + fix default status
parent 256da7d6
......@@ -475,6 +475,7 @@ CREATE TABLE tiki_calendars (
custompriorities enum('n','y') NOT NULL default 'n',
customparticipants enum('n','y') NOT NULL default 'n',
customsubscription enum('n','y') NOT NULL default 'n',
customstatus enum('n','y') NOT NULL default 'y',
created int(14) NOT NULL default '0',
lastmodif int(14) NOT NULL default '0',
personal enum ('n', 'y') NOT NULL default 'n',
......
......@@ -111,3 +111,7 @@ CREATE TABLE tiki_webservice_template (
last_modif INT,
PRIMARY KEY( service, template )
) ENGINE=MyISAM ;
#2008-09-22 sylvieg
UPDATE tiki_calendar_options set optionName='defaulteventstatus' where optionName='customeventstatus';
ALTER table tiki_calendars ADD COLUMN customstatus enum('n','y') NOT NULL default 'y';
......@@ -58,6 +58,7 @@
<a title="{tr}Edit{/tr}" class="link" href="tiki-admin_calendars.php?offset={$offset}&amp;sort_mode={$sort_mode}&amp;calendarId={$id}">{icon _id='page_edit'}</a>
<a title="{tr}View Calendar{/tr}" class="link" href="tiki-calendar.php?calIds[]={$id}">{icon _id=magnifier.png alt="{tr}View{/tr}"}</a>
<a title="{tr}Delete{/tr}" class="link" href="tiki-admin_calendars.php?offset={$offset}&amp;sort_mode={$sort_mode}&amp;drop={$id}" title="{tr}Delete{/tr}">{icon _id='cross' alt='{tr}Delete{/tr}'}</a>
<a title="{tr}Add Event{/tr}" class="link" href="tiki-calendar_edit_item.php?calendarId={$id}">{icon _id='add' alt="{tr}Add Event{/tr}"}</a>
</td>
</tr>
{/foreach}
......@@ -162,8 +163,15 @@
<tr class="formcolor"><td>{tr}Custom background color{/tr}:</td><td>
<input type="text" name="options[custombgcolor]" value="{$custombgcolor}" size="6" />
</td></tr>
<tr class="formcolor"><td>{tr}Default event status{/tr}:</td><td>
{html_options name='options[customeventstatus]' options=$eventstatus selected=$customeventstatus}
<tr class="formcolor"><td>{tr}Status{/tr}</td><td>
<select name="customstatus">
<option value='y' {if $info.customstatus ne 'n'}selected="selected"{/if}>{tr}Yes{/tr}</option>
<option value='n' {if $info.customstatus eq 'n'}selected="selected"{/if}>{tr}No{/tr}</option>
</select><br />
{tr}Default event status{/tr}:
{html_options name='options[defaulteventstatus]' options=$eventstatus selected=$defaulteventstatus}<br />
{tr}Show in popup box{/tr}<input type="checkbox" name="show[status]" value="on"{if $info.show_status eq 'y'} checked="checked"{/if} />
{tr}Show in calendar view{/tr}<input type="checkbox" name="show[status_calview]" value="on"{if $info.show_status_calview ne 'n'} checked="checked"{/if} />
</td></tr>
<tr class="formcolor"><td>&nbsp;</td><td><input type="submit" name="save" value="{tr}Save{/tr}" /></td></tr>
</table>
......
......@@ -26,5 +26,8 @@
{if $show_description eq 'y'}
{if $cellname}<br />{/if}{$celldescription}
{/if}
{if $show_status eq 'y'}
<div class="statusbox status{$calitem.status}">{if $calitem.status eq 0}{tr}Tentative{/tr}{elseif $calitem.status eq 1}{tr}Confirmed{/tr}{elseif $calitem.status eq 2}{tr}Cancelled{/tr}{/if}</div>
{/if}
</div>
</div>
......@@ -28,7 +28,7 @@
{assign var=over value=$cell[w][d].items[items].over}
{assign var=calendarId value=$cell[w][d].items[items].calendarId}
<div>
<span class="calprio{$cell[w][d].items[items].prio}" style="padding:0 2px;color:#666;float:left;">{$cell[w][d].items[items].prio}</span><div class="Cal{$cell[w][d].items[items].type} calId{$cell[w][d].items[items].calendarId}"><a style="padding:0 3px;background-color:#{$infocals.$calendarId.custombgcolor};color:#{$infocals.$calendarId.customfgcolor};"
<span class="calprio{$cell[w][d].items[items].prio}" style="padding:0 2px;color:#666;float:left;">{$cell[w][d].items[items].prio}</span><div class="{if $infocals.$calendarId.customstatus ne 'n' and $infocals.$calendarId.show_status_calview ne 'n'}Cal{$cell[w][d].items[items].type} {/if}calId{$cell[w][d].items[items].calendarId}"><a style="padding:0 3px;background-color:#{$infocals.$calendarId.custombgcolor};color:#{$infocals.$calendarId.customfgcolor};"
{if $myurl eq "tiki-action_calendar.php"}
{if $cell[w][d].items[items].modifiable eq "y" || $cell[w][d].items[items].visible eq 'y'}href="{$cell[w][d].items[items].url}"{/if}
{else}
......
......@@ -44,7 +44,7 @@
<td>{tr}Calendar{/tr}</td>
<td>{$listcals.$calendarId.name|escape}
<input type="hidden" name="save[calendarId]" value="{$calendarId}" />
{if !$id}&nbsp;{tr}or{/tr}&nbsp;
{if !$id}<br />{tr}or{/tr}&nbsp;
<input type="submit" name="act" value="{tr}Go to{/tr}" onclick="document.location='{$myurl}?calendarId='+document.getElementById('calid').value;return false;" />
<select name="save[calendarId]" id="calid">
{foreach item=it key=itid from=$listcals}
......@@ -217,11 +217,12 @@
{/if}
</td></tr>
{if $calendar.customstatus ne 'n'}
<tr class="formcolor"><td>{tr}Status{/tr}</td><td>
<div class="statusbox{if $calitem.status eq 0} status0{/if}">
{if $edit}
<input id="status0" type="radio" name="save[status]" value="0"{if $calitem.status eq 0} checked="checked"{/if} />
<input id="status0" type="radio" name="save[status]" value="0"{if (!empty($calitem) and $calitem.status eq 0) or (empty($calitem) and $calendar.defaulteventstatus eq 0)} checked="checked"{/if} />
<label for="status0">{tr}Tentative{/tr}</label>
{else}
{tr}Tentative{/tr}
......@@ -244,6 +245,7 @@
{/if}
</div>
</td></tr>
{/if}
{if $calendar.custompriorities eq 'y'}
<tr class="formcolor"><td>
......
......@@ -45,12 +45,13 @@ if (isset($_REQUEST["save"])) {
$customflags["custompriorities"] = $_REQUEST["custompriorities"];
$customflags["customsubscription"] = isset($_REQUEST["customsubscription"]) ? $_REQUEST["customsubscription"] : 'n';
$customflags["personal"] = $_REQUEST["personal"];
$customflags['customstatus'] = isset($_REQUEST['customstatus']) ? $_REQUEST['customstatus'] : 'y';
$options = $_REQUEST['options'];
if (!preg_match('/^[0-9a-fA-F]{3,6}$/',$options['customfgcolor'])) $options['customfgcolor'] = '000000';
if (!preg_match('/^[0-9a-fA-F]{3,6}$/',$options['custombgcolor'])) $options['custombgcolor'] = 'ffffff';
$options['startday'] = $_REQUEST['startday_Hour']*60*60;
$options['endday'] = $_REQUEST['endday_Hour']*60*60 - 1;
$extra = array('calname','description','location','description','language','category','participants','url');
$extra = array('calname','description','location','description','language','category','participants','url', 'status', 'status_calview');
foreach ($extra as $ex) {
if (isset($_REQUEST['show'][$ex]) and $_REQUEST['show'][$ex] == 'on') {
$options["show_$ex"] = 'y';
......@@ -105,6 +106,7 @@ if ($_REQUEST["calendarId"]) {
$info["customcategories"] = 'n';
$info["custompriorities"] = 'n';
$info["customsubscription"] = 'n';
$info['customstatus'] = 'y';
$info["customurl"] = 'n';
$info["customfgcolor"] = '000000';
$info["custombgcolor"] = 'ffffff';
......@@ -119,7 +121,7 @@ if ($_REQUEST["calendarId"]) {
$info["personal"] = 'n';
$info["startday"] = '25200';
$info["endday"] = '72000';
$info["customeventstatus"] = 0;
$info["defaulteventstatus"] = 0;
if (!empty($_REQUEST['show']) && $_REQUEST['show'] == 'mod') {
$cookietab = '2';
} else {
......@@ -153,13 +155,14 @@ $smarty->assign('personal', $info["personal"]);
$smarty->assign('startday', $info["startday"] < 0 ?0: round($info['startday']/(60*60)));
$smarty->assign('endday', $info["endday"] < 0 ?0: round($info['endday']/(60*60)));
$smarty->assign('hours', array('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24'));
$smarty->assign('customeventstatus', $info["customeventstatus"]);
$smarty->assign('defaulteventstatus', $info['defaulteventstatus']);
$smarty->assign('eventstatus', array(
0 => tra('Tentative'),
1 => tra('Confirmed'),
2 => tra('Cancelled'))
);
$smarty->assign_by_ref('info', $info);
if (!isset($_REQUEST["sort_mode"])) {
$sort_mode = 'name_desc';
......
......@@ -246,13 +246,14 @@ if (isset($_REQUEST["delete"]) and ($_REQUEST["delete"]) and isset($_REQUEST["ca
} else {
$now = $tikilib->now;
}
$calendar = $calendarlib->get_calendar($_REQUEST['calendarId']);
$calitem = array(
'calitemId'=>0,
'user'=>$user,
'name'=>'',
'url'=>'',
'description'=>'',
'status'=>0,
'status'=>$calendar['defaulteventstatus'],
'priority'=>0,
'locationId'=>0,
'categoryId'=>0,
......@@ -262,7 +263,6 @@ if (isset($_REQUEST["delete"]) and ($_REQUEST["delete"]) and isset($_REQUEST["ca
'duration'=>(60*60)
);
$id = 0;
$calendar = $calendarlib->get_calendar($_REQUEST['calendarId']);
$smarty->assign('edit',true);
$hour_minmax = floor(($calendar['startday']-1)/(60*60)).'-'. ceil(($calendar['endday'])/(60*60));
} else {
......@@ -272,8 +272,8 @@ if (isset($_REQUEST["delete"]) and ($_REQUEST["delete"]) and isset($_REQUEST["ca
die;
}
if (!empty($calendar['customeventstatus'])) {
$calitem['status'] = $calendar['customeventstatus'];
if (!empty($calendar['eventstatus'])) {
$calitem['status'] = $calendar['eventstatus'];
}
if ($calendar['customlocations'] == 'y') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment