type ahead search in scheduling playlists dialog.

This commit is contained in:
naomiaro 2011-01-10 15:26:11 -05:00
parent 8b2b2d934c
commit aee0b09749
5 changed files with 40 additions and 37 deletions

View File

@ -155,7 +155,7 @@ class Playlist {
{
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
$sql = "SELECT sub.login, plt.length, pl.state, pl.description, pl.name, pl.id
$sql = "SELECT sub.login, plt.length, pl.state, pl.creator, pl.description, pl.name, pl.id
FROM cc_playlist AS pl LEFT JOIN cc_playlisttimes AS plt USING(id) LEFT JOIN cc_subjs AS sub ON pl.editedby = sub.id
WHERE plt.length <= '{$p_length}' ";
@ -167,7 +167,7 @@ class Playlist {
{
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
$sql = "SELECT sub.login, plt.length, pl.state, pl.description, pl.name, pl.id
$sql = "SELECT sub.login, plt.length, pl.state, pl.creator, pl.description, pl.name, pl.id
FROM cc_playlist AS pl LEFT JOIN cc_playlisttimes AS plt USING(id) LEFT JOIN cc_subjs AS sub ON pl.editedby = sub.id
WHERE plt.length <= '{$p_length}' ";
@ -175,7 +175,7 @@ class Playlist {
if(!is_null($search)) {
$keywords = explode(" ", $search);
$categories = array("pl.description", "pl.name", "pl.creator");
$categories = array("pl.description", "pl.name", "pl.creator", "sub.login");
for($group_id=1; $group_id <= count($keywords); $group_id++) {

View File

@ -1,8 +1,11 @@
<li class="ui-widget-content">
<li id="sp_<?php echo $this->id ?>" class="ui-widget-content">
<div><?php echo $this->name ?></div>
<div><?php echo $this->description ?></div>
<div><?php echo $this->length ?></div>
<?php if($this->state === "edited") : ?>
<div>edited by: <?php echo $this->login ?></div>
<?php endif ?>
<div>
<span>Creator: <?php echo $this->creator ?></span>
<?php if($this->state === "edited") : ?>
<span>Editing: <?php echo $this->login ?></span>
<?php endif ?>
</div>
</li>

View File

@ -5,5 +5,5 @@
echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists);
?>
</ul>
<ul id="schedule_playlist_chosen"></ul>
<ul id="schedule_playlist_chosen">No Playlists</ul>
</div>

View File

@ -41,7 +41,7 @@ function deletePlaylist(json) {
function addLibraryItemEvents() {
$('#library_display tr[id ^= "au"]')
.draggable({
helper: 'clone'
helper: 'clone'
});
$('#library_display tr:not(:first-child)')

View File

@ -104,33 +104,6 @@ function closeDialog(event, ui) {
$(this).remove();
}
function schedulePlaylist() {
var li, pl_id, url, event, start, dialog;
dialog = $(this);
li = $("#schedule_playlist_dialog").find(".ui-state-active");
if(li.length === 0) {
dialog.remove();
return;
}
pl_id = li.data('pl_id');
event = li.parent().data('event');
start_date = makeTimeStamp(event.start);
url = '/Schedule/schedule-show/format/json';
$.post(url,
{plId: pl_id, start: start_date, showId: event.id},
function(json){
dialog.remove();
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
});
}
function autoSelect(event, ui) {
$("#hosts-"+ui.item.value).attr("checked", "checked");
@ -203,6 +176,30 @@ function makeScheduleDialog(dialog, show) {
});
});
dialog.find('#schedule_playlist_choice li')
.draggable({
helper: 'clone'
});
dialog.find("#schedule_playlist_chosen")
.droppable({
drop: function(event, ui) {
var li, pl_id, url, start_date;
pl_id = $(ui.helper).attr("id").split("_").pop();
start_date = makeTimeStamp(show.start);
url = '/Schedule/schedule-show/format/json';
/*$.post(url,
{plId: pl_id, start: start_date, showId: show.id},
function(json){
var x;
}); */
}
});
}
function openScheduleDialog(show, time) {
@ -223,7 +220,10 @@ function openScheduleDialog(show, time) {
width: 950,
height: 400,
close: closeDialog,
buttons: { "Cancel": closeDialog, "Ok": schedulePlaylist}
buttons: {"Ok": function() {
dialog.remove();
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
}}
});
dialog.dialog('open');