using zend form for validation of adding shows, still needs some UI tweaks for showing/hiding options
This commit is contained in:
parent
5490c9935a
commit
8dbc07e352
9 changed files with 211 additions and 179 deletions
|
@ -53,7 +53,6 @@
|
||||||
<actionMethod actionName="index"/>
|
<actionMethod actionName="index"/>
|
||||||
<actionMethod actionName="eventFeed"/>
|
<actionMethod actionName="eventFeed"/>
|
||||||
<actionMethod actionName="addShowDialog"/>
|
<actionMethod actionName="addShowDialog"/>
|
||||||
<actionMethod actionName="addShow"/>
|
|
||||||
</controllerFile>
|
</controllerFile>
|
||||||
</controllersDirectory>
|
</controllersDirectory>
|
||||||
<formsDirectory>
|
<formsDirectory>
|
||||||
|
@ -62,6 +61,7 @@
|
||||||
<formFile formName="AdvancedSearch"/>
|
<formFile formName="AdvancedSearch"/>
|
||||||
<formFile formName="AdvancedSearchRow"/>
|
<formFile formName="AdvancedSearchRow"/>
|
||||||
<formFile formName="EditAudioMD"/>
|
<formFile formName="EditAudioMD"/>
|
||||||
|
<formFile formName="AddShow"/>
|
||||||
</formsDirectory>
|
</formsDirectory>
|
||||||
<layoutsDirectory enabled="false"/>
|
<layoutsDirectory enabled="false"/>
|
||||||
<modelsDirectory/>
|
<modelsDirectory/>
|
||||||
|
@ -167,9 +167,6 @@
|
||||||
<viewControllerScriptsDirectory forControllerName="Schedule">
|
<viewControllerScriptsDirectory forControllerName="Schedule">
|
||||||
<viewScriptFile forActionName="addShowDialog"/>
|
<viewScriptFile forActionName="addShowDialog"/>
|
||||||
</viewControllerScriptsDirectory>
|
</viewControllerScriptsDirectory>
|
||||||
<viewControllerScriptsDirectory forControllerName="Schedule">
|
|
||||||
<viewScriptFile forActionName="addShow"/>
|
|
||||||
</viewControllerScriptsDirectory>
|
|
||||||
</viewScriptsDirectory>
|
</viewScriptsDirectory>
|
||||||
<viewHelpersDirectory/>
|
<viewHelpersDirectory/>
|
||||||
<viewFiltersDirectory enabled="false"/>
|
<viewFiltersDirectory enabled="false"/>
|
||||||
|
|
|
@ -18,17 +18,6 @@ class IndexController extends Zend_Controller_Action
|
||||||
$this->_helper->layout->setLayout('layout');
|
$this->_helper->layout->setLayout('layout');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newfieldAction()
|
|
||||||
{
|
|
||||||
// action body
|
|
||||||
}
|
|
||||||
|
|
||||||
public function displayAction()
|
|
||||||
{
|
|
||||||
// action body
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$form = new Application_Form_PlaylistMetadata();
|
$form = new Application_Form_PlaylistMetadata();
|
||||||
|
|
||||||
if ($this->getRequest()->isPost()) {
|
if ($request->isPost()) {
|
||||||
if ($form->isValid($request->getPost())) {
|
if ($form->isValid($request->getPost())) {
|
||||||
|
|
||||||
$formdata = $form->getValues();
|
$formdata = $form->getValues();
|
||||||
|
|
|
@ -40,16 +40,28 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function addShowDialogAction()
|
public function addShowDialogAction()
|
||||||
{
|
{
|
||||||
$user = new User();
|
$request = $this->getRequest();
|
||||||
|
$form = new Application_Form_AddShow();
|
||||||
$this->view->hosts = $user->getHosts();
|
|
||||||
|
if ($request->isPost()) {
|
||||||
|
if ($form->isValid($request->getPost())) {
|
||||||
|
|
||||||
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
|
||||||
|
$show = new Show($userInfo->type);
|
||||||
|
$show->addShow($form->getValues());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->view->form = $form->__toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addShowAction()
|
function addShow()
|
||||||
{
|
{
|
||||||
//name, description, hosts, allDay, repeats,
|
//name, description, hosts, allDay, repeats,
|
||||||
//start_time, duration, start_date, end_date, dofw
|
//start_time, duration, start_date, end_date, dofw
|
||||||
|
|
||||||
|
/*
|
||||||
$name = $this->_getParam('name', 'Default Name');
|
$name = $this->_getParam('name', 'Default Name');
|
||||||
$description = $this->_getParam('description', '');
|
$description = $this->_getParam('description', '');
|
||||||
$hosts = $this->_getParam('hosts');
|
$hosts = $this->_getParam('hosts');
|
||||||
|
@ -65,11 +77,12 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$endDate = $startDate;
|
$endDate = $startDate;
|
||||||
|
|
||||||
$repeats = $repeats ? 1 : 0;
|
$repeats = $repeats ? 1 : 0;
|
||||||
|
*/
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
|
||||||
|
|
||||||
$show = new Show($userInfo->type);
|
//$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$show->addShow($name, $startDate, $endDate, $startTime, $duration, $repeats, $dofw, $description);
|
|
||||||
|
//$show = new Show($userInfo->type);
|
||||||
|
//$show->addShow($name, $startDate, $endDate, $startTime, $duration, $repeats, $dofw, $description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
126
application/forms/AddShow.php
Normal file
126
application/forms/AddShow.php
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Form_AddShow extends Zend_Form
|
||||||
|
{
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
// Add name element
|
||||||
|
$this->addElement('text', 'name', array(
|
||||||
|
'label' => 'Name:',
|
||||||
|
'required' => true,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'validators' => array('NotEmpty')
|
||||||
|
));
|
||||||
|
|
||||||
|
// Add the description element
|
||||||
|
$this->addElement('textarea', 'description', array(
|
||||||
|
'label' => 'Description:',
|
||||||
|
'required' => false,
|
||||||
|
));
|
||||||
|
|
||||||
|
// Add start date element
|
||||||
|
$this->addElement('text', 'start_date', array(
|
||||||
|
'label' => 'Date Start:',
|
||||||
|
'required' => true,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'validators' => array(
|
||||||
|
'NotEmpty',
|
||||||
|
array('date', false, array('YYYY-MM-DD'))
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Add end date element
|
||||||
|
$this->addElement('text', 'end_date', array(
|
||||||
|
'label' => 'Date End:',
|
||||||
|
'required' => false,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'validators' => array(
|
||||||
|
'NotEmpty',
|
||||||
|
array('date', false, array('YYYY-MM-DD'))
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->addElement(
|
||||||
|
'select',
|
||||||
|
'start_time',
|
||||||
|
array(
|
||||||
|
'label' => 'Start Time:',
|
||||||
|
'required' => true,
|
||||||
|
'multiOptions' => array(
|
||||||
|
"00:00" => "00:00",
|
||||||
|
"00:30" => "00:30",
|
||||||
|
"01:00" => "01:00",
|
||||||
|
"01:30" => "01:30",
|
||||||
|
"02:00" => "02:00",
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->addElement(
|
||||||
|
'select',
|
||||||
|
'duration',
|
||||||
|
array(
|
||||||
|
'label' => 'Duration:',
|
||||||
|
'required' => true,
|
||||||
|
'multiOptions' => array(
|
||||||
|
"00:30" => "00:30",
|
||||||
|
"01:00" => "01:00",
|
||||||
|
"01:30" => "01:30",
|
||||||
|
"02:00" => "02:00",
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->addElement(
|
||||||
|
'multiCheckbox',
|
||||||
|
'day_check',
|
||||||
|
array(
|
||||||
|
'label' => 'Select Days:',
|
||||||
|
'required' => false,
|
||||||
|
'multiOptions' => array(
|
||||||
|
"0" => "Sun",
|
||||||
|
"1" => "Mon",
|
||||||
|
"2" => "Tue",
|
||||||
|
"3" => "Wed",
|
||||||
|
"4" => "Thu",
|
||||||
|
"5" => "Fri",
|
||||||
|
"6" => "Sat",
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->addElement('checkbox', 'all_day', array(
|
||||||
|
'label' => 'all day',
|
||||||
|
'required' => false,
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->addElement('checkbox', 'repeats', array(
|
||||||
|
'label' => 'repeats',
|
||||||
|
'required' => false,
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->addElement('checkbox', 'no_end', array(
|
||||||
|
'label' => 'no end',
|
||||||
|
'required' => false,
|
||||||
|
));
|
||||||
|
|
||||||
|
$user = new User();
|
||||||
|
$options = array();
|
||||||
|
$hosts = $user->getHosts();
|
||||||
|
|
||||||
|
foreach ($hosts as $host) {
|
||||||
|
$options[$host['id']] = $host['login'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addElement(
|
||||||
|
'multiselect',
|
||||||
|
'hosts',
|
||||||
|
array(
|
||||||
|
'label' => 'Hosts:',
|
||||||
|
'required' => true,
|
||||||
|
'multiOptions' => $options
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -35,23 +35,37 @@ class Show {
|
||||||
return $event;
|
return $event;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addShow($name, $startDate, $endDate, $startTime, $duration, $repeats, $days, $description) {
|
public function addShow($data) {
|
||||||
|
|
||||||
$con = Propel::getConnection("campcaster");
|
$con = Propel::getConnection("campcaster");
|
||||||
|
|
||||||
$sql = "SELECT time '{$startTime}' + INTERVAL '{$duration} hour' ";
|
$sql = "SELECT time '{$data['start_time']}' + INTERVAL '{$data['duration']} hour' ";
|
||||||
$r = $con->query($sql);
|
$r = $con->query($sql);
|
||||||
$endTime = $r->fetchColumn(0);
|
$endTime = $r->fetchColumn(0);
|
||||||
|
|
||||||
$sql = "SELECT nextval('schedule_group_id_seq')";
|
$sql = "SELECT nextval('show_group_id_seq')";
|
||||||
$r = $con->query($sql);
|
$r = $con->query($sql);
|
||||||
$showId = $r->fetchColumn(0);
|
$showId = $r->fetchColumn(0);
|
||||||
|
|
||||||
$sql = "SELECT EXTRACT(DOW FROM TIMESTAMP '{$startDate} {$startTime}')";
|
$sql = "SELECT EXTRACT(DOW FROM TIMESTAMP '{$data['start_date']} {$data['start_time']}')";
|
||||||
$r = $con->query($sql);
|
$r = $con->query($sql);
|
||||||
$startDow = $r->fetchColumn(0);
|
$startDow = $r->fetchColumn(0);
|
||||||
|
|
||||||
foreach ($days as $day) {
|
if($data['no_end']) {
|
||||||
|
$endDate = NULL;
|
||||||
|
}
|
||||||
|
else if($data['repeats']) {
|
||||||
|
$endDate = $data['end_date'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$endDate = $data['start_date'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($data['day_check'] === null) {
|
||||||
|
$data['day_check'] = array($startDow);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($data['day_check'] as $day) {
|
||||||
|
|
||||||
if($startDow !== $day){
|
if($startDow !== $day){
|
||||||
|
|
||||||
|
@ -60,23 +74,23 @@ class Show {
|
||||||
else
|
else
|
||||||
$daysAdd = $day - $startDow;
|
$daysAdd = $day - $startDow;
|
||||||
|
|
||||||
$sql = "SELECT date '{$startDate}' + INTERVAL '{$daysAdd} day' ";
|
$sql = "SELECT date '{$data['start_date']}' + INTERVAL '{$daysAdd} day' ";
|
||||||
$r = $con->query($sql);
|
$r = $con->query($sql);
|
||||||
$start = $r->fetchColumn(0);
|
$start = $r->fetchColumn(0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$start = $startDate;
|
$start = $data['start_date'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$show = new CcShow();
|
$show = new CcShow();
|
||||||
$show->setDbName($name);
|
$show->setDbName($data['name']);
|
||||||
$show->setDbFirstShow($start);
|
$show->setDbFirstShow($start);
|
||||||
$show->setDbLastShow($endDate);
|
$show->setDbLastShow($endDate);
|
||||||
$show->setDbStartTime($startTime);
|
$show->setDbStartTime($data['start_time']);
|
||||||
$show->setDbEndTime($endTime);
|
$show->setDbEndTime($endTime);
|
||||||
$show->setDbRepeats($repeats);
|
$show->setDbRepeats($data['repeats']);
|
||||||
$show->setDbDay($day);
|
$show->setDbDay($day);
|
||||||
$show->setDbDescription($description);
|
$show->setDbDescription($data['description']);
|
||||||
$show->setDbShowId($showId);
|
$show->setDbShowId($showId);
|
||||||
$show->save();
|
$show->save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,3 +13,7 @@
|
||||||
),
|
),
|
||||||
'default',
|
'default',
|
||||||
true) ?>"> Edit Playlist</a></div>
|
true) ?>"> Edit Playlist</a></div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
echo $this->form;
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
<br /><br /><center>View script for controller <b>Schedule</b> and script/action name <b>addShow</b></center>
|
|
|
@ -5,25 +5,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//dateText mm-dd-yy
|
//dateText mm-dd-yy
|
||||||
|
|
||||||
function checkDayOfWeek(date) {
|
|
||||||
var day;
|
|
||||||
|
|
||||||
day = date.getDay();
|
|
||||||
$("#schedule_dialog_day_check").find('input[value="'+day+'"]').attr("checked", "true");
|
|
||||||
}
|
|
||||||
|
|
||||||
function startDpSelect(dateText, inst) {
|
function startDpSelect(dateText, inst) {
|
||||||
var time, date;
|
var time, date;
|
||||||
|
|
||||||
time = dateText.split("-");
|
time = dateText.split("-");
|
||||||
date = new Date(time[0], time[1] - 1, time[2]);
|
date = new Date(time[0], time[1] - 1, time[2]);
|
||||||
|
|
||||||
//checkDayOfWeek(date);
|
$("#end_date").datepicker("option", "minDate", date);
|
||||||
|
|
||||||
$("#schedule_add_event_dialog")
|
|
||||||
.find("input#schedule_dialog_end_date_input")
|
|
||||||
.datepicker("option", "minDate", date);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function endDpSelect(dateText, inst) {
|
function endDpSelect(dateText, inst) {
|
||||||
|
@ -32,159 +20,61 @@ function endDpSelect(dateText, inst) {
|
||||||
time = dateText.split("-");
|
time = dateText.split("-");
|
||||||
date = new Date(time[0], time[1] - 1, time[2]);
|
date = new Date(time[0], time[1] - 1, time[2]);
|
||||||
|
|
||||||
$("#schedule_add_event_dialog")
|
$("#start_date").datepicker( "option", "maxDate", date);
|
||||||
.find("input#schedule_dialog_start_date_input")
|
|
||||||
.datepicker( "option", "maxDate", date);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDateInput(name, label) {
|
function createDateInput(el, onSelect) {
|
||||||
var d_input, t_input, dp, div, dl, label, format, newDate;
|
var date;
|
||||||
|
|
||||||
label = $('<label>'+label+':</label>');
|
el.datepicker({
|
||||||
d_input = $('<input id="schedule_dialog_'+ name+ '_date_input" type="text" size="8"/>')
|
|
||||||
.datepicker({
|
|
||||||
minDate: new Date(),
|
minDate: new Date(),
|
||||||
onSelect: window[name+"DpSelect"],
|
onSelect: onSelect,
|
||||||
dateFormat: 'yy-mm-dd'
|
dateFormat: 'yy-mm-dd'
|
||||||
});
|
});
|
||||||
|
|
||||||
//format = $.datepicker.regional[''].dateFormat;
|
date = $.datepicker.formatDate("yy-mm-dd", new Date());
|
||||||
newDate = $.datepicker.formatDate("yy-mm-dd", new Date());
|
el.val(date);
|
||||||
d_input.val(newDate);
|
|
||||||
|
|
||||||
div = $('<div/>')
|
|
||||||
.append(label)
|
|
||||||
.append(d_input);
|
|
||||||
|
|
||||||
return div;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitShow() {
|
function submitShow() {
|
||||||
var name, description, hosts, all_day, repeats,
|
|
||||||
start_time, duration, start_date, end_date, dofw;
|
|
||||||
|
|
||||||
name = $("#schedule_dialog_name").val();
|
var formData, dialog;
|
||||||
description = $("#schedule_dialog_description").val();
|
|
||||||
hosts = $("#schedule_dialog_hosts").val();
|
|
||||||
all_day = $("#schedule_dialog_all_day").attr("checked");
|
|
||||||
repeats = $("#schedule_dialog_repeats").attr("checked");
|
|
||||||
start_time = $("#schedule_dialog_start_time").val();
|
|
||||||
duration = $("#schedule_dialog_duration").val();
|
|
||||||
start_date = $("#schedule_dialog_start_date_input").val();
|
|
||||||
end_date = $("#schedule_dialog_end_date_input").val();
|
|
||||||
dofw = $("#schedule_dialog_day_check").find(":checked").map(function(){
|
|
||||||
return $(this).val();
|
|
||||||
}).get();
|
|
||||||
|
|
||||||
if(dofw.length === 0) {
|
formData = $("#schedule_add_event_dialog").find("form").serializeArray();
|
||||||
var time, date;
|
dialog = $(this);
|
||||||
|
|
||||||
time = start_date.split("-");
|
$.post("/Schedule/add-show-dialog/format/json",
|
||||||
date = new Date(time[0], time[1] - 1, time[2]);
|
formData,
|
||||||
dofw.push(date.getDay());
|
|
||||||
}
|
|
||||||
|
|
||||||
$.post("/Schedule/add-show/format/json",
|
|
||||||
{ name: name, description: description, hosts: hosts, all_day: all_day, repeats: repeats,
|
|
||||||
start_time: start_time, duration: duration, start_date: start_date, end_date: end_date, dofw: dofw },
|
|
||||||
function(data){
|
function(data){
|
||||||
$('#schedule_calendar').fullCalendar( 'refetchEvents' );
|
if(data.form) {
|
||||||
|
$("#schedule_add_event_dialog").find("form").remove();
|
||||||
|
$("#schedule_add_event_dialog").append(data.form);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||||
|
dialog.remove();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(this).remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeDialog(event, ui) {
|
function closeDialog(event, ui) {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeShowDialog(json) {
|
function makeShowDialog(html) {
|
||||||
|
|
||||||
var dialog, div, dl, time_div, host_div,
|
var dialog;
|
||||||
label, input, textarea, repeats, all_day, day_checkbox, host_select;
|
|
||||||
|
|
||||||
//main jqueryUI dialog
|
//main jqueryUI dialog
|
||||||
dialog = $('<div id="schedule_add_event_dialog" />');
|
dialog = $('<div id="schedule_add_event_dialog" />');
|
||||||
|
|
||||||
div_left = $('<div/>')
|
dialog.append(html);
|
||||||
.width(300);
|
|
||||||
div_middle = $('<div/>')
|
|
||||||
.width(250);
|
|
||||||
div_right = $('<div/>')
|
|
||||||
.width(350);
|
|
||||||
|
|
||||||
dialog.append(div_left);
|
var start = dialog.find("#start_date");
|
||||||
dialog.append(div_middle);
|
var end = dialog.find("#end_date");
|
||||||
dialog.append(div_right);
|
|
||||||
|
|
||||||
dialog.find("div")
|
createDateInput(start, startDpSelect);
|
||||||
.css("float", "left");
|
createDateInput(end, endDpSelect);
|
||||||
|
|
||||||
dl = $('<dl />');
|
|
||||||
|
|
||||||
label = $('<span>Name: </span>');
|
|
||||||
input = $('<input id="schedule_dialog_name" type="text" />');
|
|
||||||
|
|
||||||
dl.append(label);
|
|
||||||
dl.append(input);
|
|
||||||
|
|
||||||
label = $('<span>Description: </span>');
|
|
||||||
textarea = $('<textarea id="schedule_dialog_description" rows="2" cols="20"/>');
|
|
||||||
|
|
||||||
dl.append(label);
|
|
||||||
dl.append(textarea);
|
|
||||||
|
|
||||||
dl.find("span").wrap('<dt/>');
|
|
||||||
dl.find("input, textarea").wrap('<dd/>');
|
|
||||||
div_left.append(dl);
|
|
||||||
|
|
||||||
repeats = $('<input id="schedule_dialog_repeats" type="checkbox">repeats</input>').click(function(){
|
|
||||||
$("#schedule_dialog_day_check").toggle();
|
|
||||||
$("#schedule_dialog_end_date_input").parent().toggle();
|
|
||||||
|
|
||||||
});
|
|
||||||
all_day = $('<input id="schedule_dialog_all_day" type="checkbox">all day</input>').click(function(){
|
|
||||||
|
|
||||||
});
|
|
||||||
div_middle.append(all_day)
|
|
||||||
.append(repeats);
|
|
||||||
|
|
||||||
day_checkbox = $('<div id="schedule_dialog_day_check"/>').hide();
|
|
||||||
|
|
||||||
$.datepicker.regional[''].dayNamesMin.map(function(day, i){
|
|
||||||
day_checkbox.append($('<input value="'+i+'" type="checkbox">'+day+'</input>'));
|
|
||||||
});
|
|
||||||
|
|
||||||
div_right.append(day_checkbox);
|
|
||||||
|
|
||||||
div_middle.append(createDateInput("start", "Date Start"))
|
|
||||||
.append(createDateInput("end", "Date End").hide());
|
|
||||||
|
|
||||||
dl = $('<dl />');
|
|
||||||
|
|
||||||
label = $('<span>Hosts: </span>');
|
|
||||||
host_select = $('<select id="schedule_dialog_hosts" multiple="multiple" size="4" />');
|
|
||||||
json.hosts.map(function(host){
|
|
||||||
host_select.append($('<option value="'+host.id+'">'+host.login+'</option>'));
|
|
||||||
});
|
|
||||||
|
|
||||||
dl.append(label);
|
|
||||||
dl.append(host_select);
|
|
||||||
dl.find("span").wrap('<dt/>');
|
|
||||||
dl.find("select").wrap('<dd/>');
|
|
||||||
div_left.append(dl);
|
|
||||||
|
|
||||||
label = $('<span>Start Time: </span>');
|
|
||||||
input = $('<input id="schedule_dialog_start_time" type="text" />');
|
|
||||||
|
|
||||||
div_middle.append(label);
|
|
||||||
div_middle.append(input);
|
|
||||||
|
|
||||||
label = $('<span>Duration: </span>');
|
|
||||||
input = $('<input id="schedule_dialog_duration" type="text" />');
|
|
||||||
|
|
||||||
div_middle.append(label);
|
|
||||||
div_middle.append(input);
|
|
||||||
|
|
||||||
dialog.dialog({
|
dialog.dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
|
@ -285,8 +175,8 @@ $(document).ready(function() {
|
||||||
|
|
||||||
url = '/Schedule/add-show-dialog/format/json';
|
url = '/Schedule/add-show-dialog/format/json';
|
||||||
|
|
||||||
$.post(url, function(json){
|
$.get(url, function(json){
|
||||||
var dialog = makeShowDialog(json);
|
var dialog = makeShowDialog(json.form);
|
||||||
dialog.dialog('open');
|
dialog.dialog('open');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue