From 5750f383435d3e28745e89b2d4210e24ff47ec53 Mon Sep 17 00:00:00 2001 From: naomiaro Date: Tue, 19 Oct 2010 04:58:48 -0400 Subject: [PATCH] fixing gui so playlists can again be scheduled, removed. --- backend/Schedule.php | 3 ++- htmlUI/templates/popup/SCHEDULER.addItem.tpl | 6 +++--- htmlUI/templates/popup/SCHEDULER.removeItem.tpl | 2 +- htmlUI/templates/scheduler/day.tpl | 4 ++-- htmlUI/templates/scheduler/day_additem.tpl | 4 ++-- htmlUI/templates/scheduler/removeitem.tpl | 2 +- htmlUI/templates/script/contextmenu.js.tpl | 4 ++-- htmlUI/ui_browser.php | 5 +++-- htmlUI/ui_scheduler.class.php | 11 +++-------- 9 files changed, 19 insertions(+), 22 deletions(-) diff --git a/backend/Schedule.php b/backend/Schedule.php index 73fc6b258..54162a0b8 100644 --- a/backend/Schedule.php +++ b/backend/Schedule.php @@ -127,7 +127,7 @@ class ScheduleGroup { ." clip_length, cue_in, cue_out, fade_in, fade_out)" ." VALUES ($id, $p_playlistId, TIMESTAMP '$itemStartTime', " ." (TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength')," - ." {$this->groupId}, {$row['file_id']}, '$trackLength', '{$row['cuein']}'," + ." '{$this->groupId}', '{$row['file_id']}', '$trackLength', '{$row['cuein']}'," ." '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')"; $result = $CC_DBC->query($sql); if (PEAR::isError($result)) { @@ -168,6 +168,7 @@ class ScheduleGroup { } $sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"] ." WHERE group_id = ".$this->groupId; + return $CC_DBC->query($sql); } diff --git a/htmlUI/templates/popup/SCHEDULER.addItem.tpl b/htmlUI/templates/popup/SCHEDULER.addItem.tpl index f1e2579eb..641765eea 100644 --- a/htmlUI/templates/popup/SCHEDULER.addItem.tpl +++ b/htmlUI/templates/popup/SCHEDULER.addItem.tpl @@ -88,9 +88,9 @@ function SCHEDULE_snap2Next() var duration = SCHEDULE_timeToMilliseconds(SCHEDULE_selectedDuration()); // Get the date of the "next item" (time is set to midnight). - var beginDate = new Date({$SCHEDULER->scheduleNext.year}, - {$SCHEDULER->scheduleNext.month}, - {$SCHEDULER->scheduleNext.day}); + var beginDate = new Date("{$SCHEDULER->scheduleNext.year}", + "{$SCHEDULER->scheduleNext.month}", + "{$SCHEDULER->scheduleNext.day}"); //debugBeginDate = ""+beginDate; // Calculate the final time by starting with the "next item" date at midnight, diff --git a/htmlUI/templates/popup/SCHEDULER.removeItem.tpl b/htmlUI/templates/popup/SCHEDULER.removeItem.tpl index 3193ef6cb..06e205198 100644 --- a/htmlUI/templates/popup/SCHEDULER.removeItem.tpl +++ b/htmlUI/templates/popup/SCHEDULER.removeItem.tpl @@ -1,7 +1,7 @@ {include file="popup/header.tpl"}
-{tra str='Are you sure to remove playlist "$1"?' 1=$playlistName} +{tra str='Are you sure you want to remove "$1"?' 1=$playlistName}

diff --git a/htmlUI/templates/scheduler/day.tpl b/htmlUI/templates/scheduler/day.tpl index 33ed850a3..e1b1e9376 100644 --- a/htmlUI/templates/scheduler/day.tpl +++ b/htmlUI/templates/scheduler/day.tpl @@ -36,7 +36,7 @@ {foreach from=$_entrys[$_hour].end item="i"} {if $i.startsyesterday}
- +   {$i.title} ##yesterday## {$i.start} - {$i.end} @@ -50,7 +50,7 @@ {if $_entrys[$_hour].start} {foreach from=$_entrys[$_hour].start item="i"}
- +   {$i.title} diff --git a/htmlUI/templates/scheduler/day_additem.tpl b/htmlUI/templates/scheduler/day_additem.tpl index e05459f59..3c31f29f9 100644 --- a/htmlUI/templates/scheduler/day_additem.tpl +++ b/htmlUI/templates/scheduler/day_additem.tpl @@ -1,8 +1,8 @@ style="cursor: pointer" {if $_endH == $_hour} - onClick="return contextmenu('year={$SCHEDULER->curr.year}&month={$SCHEDULER->curr.month}&day={$SCHEDULER->curr.day}&hour={getHour time=$i.end}&minute={getMinute time=$i.end}&second={getSecond time=$i.end plus=1}', 'SCHEDULER.addItem')" + onClick="return contextmenu('&year={$SCHEDULER->curr.year}&month={$SCHEDULER->curr.month}&day={$SCHEDULER->curr.day}&hour={getHour time=$i.end}&minute={getMinute time=$i.end}&second={getSecond time=$i.end plus=1}', null, 'SCHEDULER.addItem')" {else} - onClick="return contextmenu('year={$SCHEDULER->curr.year}&month={$SCHEDULER->curr.month}&day={$SCHEDULER->curr.day}&hour={$_hour}&minute=0&second=0', 'SCHEDULER.addItem')" + onClick="return contextmenu('&year={$SCHEDULER->curr.year}&month={$SCHEDULER->curr.month}&day={$SCHEDULER->curr.day}&hour={$_hour}&minute=0&second=0', null, 'SCHEDULER.addItem')" {/if} diff --git a/htmlUI/templates/scheduler/removeitem.tpl b/htmlUI/templates/scheduler/removeitem.tpl index 1e5cac9ac..e9d699428 100644 --- a/htmlUI/templates/scheduler/removeitem.tpl +++ b/htmlUI/templates/scheduler/removeitem.tpl @@ -1,2 +1,2 @@ style="cursor: pointer" -onClick="return contextmenu('scheduleId={$i.scheduleid}&playlistId={$i.id}', 'SCHEDULER.removeItem')" +onClick="return contextmenu('&scheduleId={$i.scheduleid}&playlistId={$i.id}', null, 'SCHEDULER.removeItem')" diff --git a/htmlUI/templates/script/contextmenu.js.tpl b/htmlUI/templates/script/contextmenu.js.tpl index 7b8be1fd0..489ca9b63 100644 --- a/htmlUI/templates/script/contextmenu.js.tpl +++ b/htmlUI/templates/script/contextmenu.js.tpl @@ -95,11 +95,11 @@ function contextmenu(param, type) { case "SCHEDULER.addItem": //contextmenuHtml = contextmenuHtml + "
  •  ##Insert playlist here## 
  • "; - contextmenuHtml = contextmenuHtml + "
  •  ##Insert playlist here## 
  • "; + contextmenuHtml = contextmenuHtml + "
  •  ##Insert playlist here## 
  • "; break; case "SCHEDULER.removeItem": - contextmenuHtml = contextmenuHtml + "
  •  ##Remove playlist## 
  • "; + contextmenuHtml = contextmenuHtml + "
  •  ##Remove playlist## 
  • "; break; case "SCHEDULER.addPL": diff --git a/htmlUI/ui_browser.php b/htmlUI/ui_browser.php index fcd881e4a..b0e17d0e6 100644 --- a/htmlUI/ui_browser.php +++ b/htmlUI/ui_browser.php @@ -154,12 +154,13 @@ if (isset($_REQUEST['popup']) && is_array($_REQUEST['popup'])){ break; case "SCHEDULER.addItem": - $uiHandler->SCHEDULER->setScheduleAtTime($_REQUEST); + $uiHandler->SCHEDULER->setScheduleAtTime($_REQUEST); $Smarty->display('popup/SCHEDULER.addItem.tpl'); break; case "SCHEDULER.removeItem": - $Smarty->assign('playlistName', $uiBrowser->getMetadataValue($_REQUEST['playlistId'], UI_MDATA_KEY_TITLE)); + $info = $uiBrowser->getPLMetaInfo($_REQUEST['playlistId']); + $Smarty->assign('playlistName', $info['title']); $Smarty->display('popup/SCHEDULER.removeItem.tpl'); break; diff --git a/htmlUI/ui_scheduler.class.php b/htmlUI/ui_scheduler.class.php index f52e607d2..7b2f4d5f6 100644 --- a/htmlUI/ui_scheduler.class.php +++ b/htmlUI/ui_scheduler.class.php @@ -209,6 +209,7 @@ class uiScheduler extends uiCalendar { // $hour = $arr['hour']; // $minute = $arr['minute']; // $second = $arr['second']; + extract($arr); if (isset($today)) { @@ -565,13 +566,8 @@ class uiScheduler extends uiCalendar { public function getPlaylistToSchedule($id) { if ($id) { - $this->Base->SCRATCHPAD->addItem($id); - $this->availablePlaylists[] = array( - 'gunid' => BasicStor::GunidFromId($id), - 'id' => $id, - 'title' => $this->Base->getMetadataValue($id, UI_MDATA_KEY_TITLE), - 'duration' => $this->Base->getMetadataValue($id, UI_MDATA_KEY_DURATION), - ); + $this->Base->SCRATCHPAD->addItem($id, 'playlist'); + $this->availablePlaylists[] = $this->Base->getPLMetaInfo($id); return TRUE; } else { return $this->copyPlaylistFromScratchpad(); @@ -1063,7 +1059,6 @@ class uiScheduler extends uiCalendar { $item = new ScheduleGroup(); $groupId = $item->add($datetime, null, $playlistId); - //$_SESSION["debug"] = $groupId; return $groupId; }