changing to context menu single edit/delete.

This commit is contained in:
Naomi Aro 2013-08-19 23:19:13 -04:00
parent 9b45b9dc72
commit 09693ef174
11 changed files with 609 additions and 311 deletions

View File

@ -53,7 +53,7 @@ class LibraryController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/observer/observer.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/observer/observer.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/config.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/config.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/curves.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/curves.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
@ -68,9 +68,9 @@ class LibraryController extends Zend_Controller_Action
//arbitrary attributes need to be allowed to set an id for the templates. //arbitrary attributes need to be allowed to set an id for the templates.
$this->view->headScript()->setAllowArbitraryAttributes(true); $this->view->headScript()->setAllowArbitraryAttributes(true);
//$this->view->headScript()->appendScript(file_get_contents(APPLICATION_PATH.'/../public/js/waveformplaylist/templates/bottombar.tpl'), //$this->view->headScript()->appendScript(file_get_contents(APPLICATION_PATH.'/../public/js/waveformplaylist/templates/bottombar.tpl'),
// 'text/template', array('id' => 'tpl_playlist_cues', 'noescape' => true)); // 'text/template', array('id' => 'tpl_playlist_cues', 'noescape' => true));
$this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
try { try {
@ -179,9 +179,7 @@ class LibraryController extends Zend_Controller_Action
$type = $this->_getParam('type'); $type = $this->_getParam('type');
//playlist||timeline //playlist||timeline
$screen = $this->_getParam('screen'); $screen = $this->_getParam('screen');
$baseUrl = Application_Common_OsPath::getBaseDir();
$menu = array(); $menu = array();
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
@ -250,7 +248,7 @@ class LibraryController extends Zend_Controller_Action
} elseif ($type == "stream") { } elseif ($type == "stream") {
$webstream = CcWebstreamQuery::create()->findPK($id); $webstream = CcWebstreamQuery::create()->findPK($id);
$obj = new Application_Model_Webstream($webstream); $obj = new Application_Model_Webstream($webstream);
$menu["play"]["mime"] = $webstream->getDbMime(); $menu["play"]["mime"] = $webstream->getDbMime();
if (isset($obj_sess->id) && $screen == "playlist") { if (isset($obj_sess->id) && $screen == "playlist") {
@ -373,15 +371,15 @@ class LibraryController extends Zend_Controller_Action
$this->view->message = $message; $this->view->message = $message;
} }
} }
// duplicate playlist // duplicate playlist
public function duplicateAction(){ public function duplicateAction(){
$params = $this->getRequest()->getParams(); $params = $this->getRequest()->getParams();
$id = $params['id']; $id = $params['id'];
$originalPl = new Application_Model_Playlist($id); $originalPl = new Application_Model_Playlist($id);
$newPl = new Application_Model_Playlist(); $newPl = new Application_Model_Playlist();
$contents = $originalPl->getContents(); $contents = $originalPl->getContents();
foreach ($contents as &$c) { foreach ($contents as &$c) {
if ($c['type'] == '0') { if ($c['type'] == '0') {
@ -393,15 +391,15 @@ class LibraryController extends Zend_Controller_Action
} }
$c[0] = $c['item_id']; $c[0] = $c['item_id'];
} }
$newPl->addAudioClips($contents, null, 'before'); $newPl->addAudioClips($contents, null, 'before');
$newPl->setCreator(Application_Model_User::getCurrentUser()->getId()); $newPl->setCreator(Application_Model_User::getCurrentUser()->getId());
$newPl->setDescription($originalPl->getDescription()); $newPl->setDescription($originalPl->getDescription());
list($plFadeIn, ) = $originalPl->getFadeInfo(0); list($plFadeIn, ) = $originalPl->getFadeInfo(0);
list(, $plFadeOut) = $originalPl->getFadeInfo($originalPl->getSize()-1); list(, $plFadeOut) = $originalPl->getFadeInfo($originalPl->getSize()-1);
$newPl->setfades($plFadeIn, $plFadeOut); $newPl->setfades($plFadeIn, $plFadeOut);
$newPl->setName(sprintf(_("Copy of %s"), $originalPl->getName())); $newPl->setName(sprintf(_("Copy of %s"), $originalPl->getName()));
} }
@ -549,7 +547,7 @@ class LibraryController extends Zend_Controller_Action
$id = $this->_getParam('id'); $id = $this->_getParam('id');
Application_Model_Soundcloud::uploadSoundcloud($id); Application_Model_Soundcloud::uploadSoundcloud($id);
// we should die with ui info // we should die with ui info
$this->_helper->json->sendJson(null); $this->_helper->json->sendJson(null);
} }
public function getUploadToSoundcloudStatusAction() public function getUploadToSoundcloudStatusAction()

View File

@ -8,6 +8,7 @@ class PlayouthistoryController extends Zend_Controller_Action
$ajaxContext $ajaxContext
->addActionContext('file-history-feed', 'json') ->addActionContext('file-history-feed', 'json')
->addActionContext('item-history-feed', 'json') ->addActionContext('item-history-feed', 'json')
->addActionContext('context-menu', 'json')
->addActionContext('edit-file-item', 'json') ->addActionContext('edit-file-item', 'json')
->addActionContext('create-list-item', 'json') ->addActionContext('create-list-item', 'json')
->addActionContext('edit-list-item', 'json') ->addActionContext('edit-list-item', 'json')
@ -67,7 +68,9 @@ class PlayouthistoryController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'js/datatables/plugin/TableTools-2.1.5/css/TableTools.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'js/datatables/plugin/TableTools-2.1.5/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/playouthistory.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/playouthistory.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery-ui-timepicker-addon.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery-ui-timepicker-addon.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
//set datatables columns for display of data. //set datatables columns for display of data.
@ -80,6 +83,28 @@ class PlayouthistoryController extends Zend_Controller_Action
$this->view->headScript()->appendScript($script); $this->view->headScript()->appendScript($script);
} }
public function contextMenuAction()
{
$baseUrl = Application_Common_OsPath::getBaseDir();
$id = $this->_getParam('id');
$menu = array();
$menu["edit"] = array(
"name"=> _("Edit"),
"icon" => "edit",
"url" => $baseUrl."playouthistory/edit-list-item/id/{$id}"
);
$menu["del"] = array(
"name"=> _("Delete"),
"icon" => "delete",
"url" => $baseUrl."playouthistory/delete-list-item/id/{$id}"
);
$this->view->items = $menu;
}
public function fileHistoryFeedAction() public function fileHistoryFeedAction()
{ {
try { try {
@ -228,6 +253,7 @@ class PlayouthistoryController extends Zend_Controller_Action
$baseUrl = Application_Common_OsPath::getBaseDir(); $baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/template.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/template.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
$historyService = new Application_Service_HistoryService(); $historyService = new Application_Service_HistoryService();
$this->view->template_list = $historyService->getListItemTemplates(); $this->view->template_list = $historyService->getListItemTemplates();
@ -241,6 +267,7 @@ class PlayouthistoryController extends Zend_Controller_Action
$baseUrl = Application_Common_OsPath::getBaseDir(); $baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/configuretemplate.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/configuretemplate.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
try { try {

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,3 @@
<div id="configure_item_template" class="ui-widget ui-widget-content block-shadow alpha-block padded"> <div id="configure_item_template" class="ui-widget ui-widget-content block-shadow alpha-block padded-strong">
<?php echo $this->render('playouthistory/template-contents.phtml'); ?> <?php echo $this->render('playouthistory/template-contents.phtml'); ?>
</div> </div>

View File

@ -7,7 +7,6 @@
<li><a href="#his-tabs-2"><?php echo _("File Summary"); ?></a></li> <li><a href="#his-tabs-2"><?php echo _("File Summary"); ?></a></li>
</ul> </ul>
<div id="his-tabs-1"> <div id="his-tabs-1">
<div id="his_create"><?php echo _("Create Entry"); ?></div>
<table id="history_table_list" cellpadding="0" cellspacing="0" class="datatable"></table> <table id="history_table_list" cellpadding="0" cellspacing="0" class="datatable"></table>
</div> </div>
<div id="his-tabs-2"> <div id="his-tabs-2">

View File

@ -1,57 +1,70 @@
<div> <?php if ($this->template_type == Application_Service_HistoryService::TEMPLATE_TYPE_FILE): ?>
<?php if (!in_array($this->template_id, $this->configured)): ?> <h4>Creating File Summary Template</h4>
<button id="template_set_default" data-template="<?php echo $this->template_id; ?>">Set Default Template</button> <?php else: ?>
<?php endif; ?> <h4>Creating Log Sheet Template</h4>
<button id="template_item_save" data-template="<?php echo $this->template_id; ?>">Save</button> <?php endif; ?>
</div>
<div><label>Name<input id="template_name" type="text" value="<?php echo $this->template_name; ?>"></label></div> <div class="template_name_wrap">
<label>
Name
<input id="template_name" type="text" value="<?php echo $this->template_name; ?>">
</label>
</div>
<?php $i = 0; ?> <?php $i = 0; ?>
<ul class="template_item_list"> <ul class="template_item_list">
<?php foreach ($this->template_fields as $field): ?> <?php foreach ($this->template_fields as $field): ?>
<li id="<?php echo "field_".$i?>" <li id="<?php echo "field_".$i?>"
data-id="<?php echo isset($field["id"]) ? $field["id"] : ""; ?>" data-id="<?php echo isset($field["id"]) ? $field["id"] : ""; ?>"
data-name="<?php echo $field["name"]?>" data-name="<?php echo $field["name"]?>"
data-label="<?php echo $field["label"]?>" data-label="<?php echo $field["label"]?>"
data-type="<?php echo $field["type"]?>" data-type="<?php echo $field["type"]?>"
data-filemd="<?php echo var_export($field["isFileMd"], true)?>"> data-filemd="<?php echo var_export($field["isFileMd"], true)?>">
<span><?php echo $field["label"]?></span> <span><?php echo $field["label"]?></span>
<span><?php echo $field["type"]?></span> <span><?php echo $field["type"]?></span>
<?php if(!in_array($field["name"], $this->required_fields)): ?> <?php if(!in_array($field["name"], $this->required_fields)): ?>
<span class="template_item_remove">Remove</span> <span class="template_item_remove">
<i class="icon icon-trash"></i>
</span>
<?php endif; ?> <?php endif; ?>
</li> </li>
<?php $i++; ?> <?php $i++; ?>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<p>Add more elements:</p>
<ul class="template_file_md"> <ul class="template_file_md">
<?php foreach ($this->fileMD as $md): ?> <?php foreach ($this->fileMD as $md): ?>
<li id="<?php echo "md_".$md["name"]?>" <li id="<?php echo "md_".$md["name"]?>"
data-name="<?php echo $md["name"]?>" data-name="<?php echo $md["name"]?>"
data-type="<?php echo $md["type"]?>" data-type="<?php echo $md["type"]?>"
data-label="<?php echo $md["label"]?>"> data-label="<?php echo $md["label"]?>">
<?php echo $md["label"] ?> <?php echo $md["label"] ?>
<a class="field_add" href="#"><i class="icon icon-plus"></i></a>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php if ($this->template_type !== Application_Service_HistoryService::TEMPLATE_TYPE_FILE): ?> <?php if ($this->template_type !== Application_Service_HistoryService::TEMPLATE_TYPE_FILE): ?>
<div class="template_item_add"> <div class="template_item_add">
<div>Add New Field</div> <input type="text" placeholder="Add New Field">
<div> <select>
<input type="text"> <?php foreach ($this->fields as $field): ?>
<select> <option value="<?php echo $field; ?>"><?php echo $field; ?></option>
<?php foreach ($this->fields as $field): ?> <?php endforeach; ?>
<option value="<?php echo $field; ?>"><?php echo $field; ?></option> </select>
<?php endforeach; ?> <button class="btn"><i class="icon-white icon-plus"></i> Add</button>
</select> </div>
<button>Add</button>
</div>
<?php endif; ?> <?php endif; ?>
<div>
<?php if (!in_array($this->template_id, $this->configured)): ?>
<button id="template_set_default" data-template="<?php echo $this->template_id; ?>" class="btn">Set Default Template</button>
<?php endif; ?>
<button id="template_item_save" data-template="<?php echo $this->template_id; ?>" class="btn">Save</button>
</div> </div>

View File

@ -1,7 +1,7 @@
<div id="history_template" class="ui-widget ui-widget-content block-shadow alpha-block padded"> <div id="history_template" class="ui-widget ui-widget-content block-shadow alpha-block padded-strong">
<div> <div>
<div>Edit Log Sheet Template</div> <div><h4>Log Sheet Templates</h4></div>
<ul id="template_list"> <ul id="template_list">
<?php if (count($this->template_list) == 0): ?> <?php if (count($this->template_list) == 0): ?>
<li>No Log Sheet Templates</li> <li>No Log Sheet Templates</li>
@ -12,19 +12,30 @@
<?php endif; ?> <?php endif; ?>
<?php if (in_array($id, $this->configured)): ?> <?php if (in_array($id, $this->configured)): ?>
<li data-template="<?php echo $id; ?>" data-name="<?php echo $name; ?>" class="template_configured"> <li data-template="<?php echo $id; ?>" data-name="<?php echo $name; ?>" class="template_configured">
<a class="template_name" href="<?php echo $this->baseUrl("Playouthistory/configure-template/id/{$id}"); ?>"><?php echo $name; ?></a> <a class="template_name" href="<?php echo $this->baseUrl("Playouthistory/configure-template/id/{$id}"); ?>">
<?php echo $name; ?>
</a>
<i class="icon icon-ok"></i>
<?php else: ?> <?php else: ?>
<li data-template="<?php echo $id; ?>" data-name="<?php echo $name; ?>"> <li data-template="<?php echo $id; ?>" data-name="<?php echo $name; ?>">
<a class="template_name" href="<?php echo $this->baseUrl("Playouthistory/configure-template/id/{$id}"); ?>"><?php echo $name; ?></a> <a class="template_name" href="<?php echo $this->baseUrl("Playouthistory/configure-template/id/{$id}"); ?>">
<a class="template_default" href="<?php echo $this->baseUrl("Playouthistory/set-template-default/id/{$id}"); ?>">Set Default</a> <?php echo $name; ?>
<a class="template_remove" href="<?php echo $this->baseUrl("Playouthistory/delete-template/id/{$id}"); ?>">Remove</a> </a>
<?php endif; ?> <a class="template_remove" href="<?php echo $this->baseUrl("Playouthistory/delete-template/id/{$id}"); ?>">
<i class="icon icon-trash"></i>
</a>
<a class="template_default" href="<?php echo $this->baseUrl("Playouthistory/set-template-default/id/{$id}"); ?>">
Set Default
</a>
<?php endif; ?>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<button id="new_item_template" class="btn">New Log Sheet Template</button>
</div> </div>
<br><br>
<div> <div>
<div>Edit File Summary Template</div> <div><h4>File Summary Templates</h4></div>
<ul id="template_file"> <ul id="template_file">
<?php if (count($this->template_file) == 0): ?> <?php if (count($this->template_file) == 0): ?>
<li>No File Summary Templates</li> <li>No File Summary Templates</li>
@ -32,17 +43,25 @@
<?php foreach ($this->template_file as $id=>$name): ?> <?php foreach ($this->template_file as $id=>$name): ?>
<?php if (in_array($id, $this->configured)): ?> <?php if (in_array($id, $this->configured)): ?>
<li data-template="<?php echo $id; ?>" data-name="<?php echo $name; ?>" class="template_configured"> <li data-template="<?php echo $id; ?>" data-name="<?php echo $name; ?>" class="template_configured">
<a class="template_name" href="<?php echo $this->baseUrl("Playouthistory/configure-template/id/{$id}"); ?>"><?php echo $name; ?></a> <a class="template_name" href="<?php echo $this->baseUrl("Playouthistory/configure-template/id/{$id}"); ?>">
<?php echo $name; ?>
</a>
<i class="icon icon-ok"></i>
<?php else: ?> <?php else: ?>
<li data-template="<?php echo $id; ?>" data-name="<?php echo $name; ?>"> <li data-template="<?php echo $id; ?>" data-name="<?php echo $name; ?>">
<a class="template_name" href="<?php echo $this->baseUrl("Playouthistory/configure-template/id/{$id}"); ?>"><?php echo $name; ?></a> <a class="template_name" href="<?php echo $this->baseUrl("Playouthistory/configure-template/id/{$id}"); ?>">
<a class="template_default" href="<?php echo $this->baseUrl("Playouthistory/set-template-default/id/{$id}"); ?>">Set Default</a> <?php echo $name; ?>
<a class="template_remove" href="<?php echo $this->baseUrl("Playouthistory/delete-template/id/{$id}"); ?>">Remove</a> </a>
<?php endif; ?> <a class="template_remove" href="<?php echo $this->baseUrl("Playouthistory/delete-template/id/{$id}"); ?>">
<i class="icon icon-trash"></i>
</a>
<a class="template_default" href="<?php echo $this->baseUrl("Playouthistory/set-template-default/id/{$id}"); ?>">
Set Default
</a>
<?php endif; ?>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<button id="new_file_template" class="btn">New File Summary Template</button>
</div> </div>
<button id="new_item_template" class="btn">New Log Sheet Template</button>
<button id="new_file_template" class="btn">New File Summary Template</button>
</div> </div>

View File

@ -0,0 +1,120 @@
#history_template h4, #configure_item_template h4 { font-size: 14px; margin-top: 0px; }
#history_template ul, #configure_item_template ul { list-style: none; padding-left: 0px; }
#history_template li, #configure_item_template li {
clear: both;
background: #AAAAAA;
margin: 2px 0 4px 0;
padding: 4px 8px 4px 8px;
position: relative;
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border: 1px solid #9F9F9F;
min-height: 15px;
}
#history_template li a, #configure_item_template li a {
text-decoration: none;
}
#history_template li a:hover, #configure_item_template li a:hover {
text-decoration: underline;
}
#history_template li .template_name {
float: left;
}
#history_template li.template_configured {
background: #9A9A9A;
border: 1px solid #858585;
}
#history_template .template_remove, #history_template .template_default {
float: right;
margin-left: 10px;
}
#history_template .template_default {
margin-left: 20px;
}
#history_template .icon-ok {
right: 10px;
margin-left: 10px;
position: absolute;
}
#configure_item_template li span {
cursor: move;
padding-left: 6px;
}
#configure_item_template li .template_item_remove, #configure_item_template li .field_add {
cursor: pointer;
float: right;
margin-left: 20px;
}
#configure_item_template li .template_item_remove:hover, #configure_item_template li .field_add:hover {
opacity:0.7;
filter:alpha(opacity=70);
}
#configure_item_template #template_name {
min-width: 230px;
float: right;
}
#configure_item_template .template_name_wrap {
display: inline-block;
}
#configure_item_template label {
vertical-align: middle;
}
#configure_item_template .template_item_add {
margin-bottom: 10px;
}
#configure_item_template .template_item_add .btn {
padding: 2px 14px 1px;
}
#configure_item_template .template_item_list li {
background-image: url('../css/images/drag.png');
background-repeat: no-repeat;
background-position: 4px 5px;
}
/* Bootstrap calendar
.bootstrap-datetimepicker-widget ul {
padding-left: 0px !important;
}
.bootstrap-datetimepicker-widget td, .bootstrap-datetimepicker-widget th {
-webkit-border-radius: 2px !important;
-moz-border-radius: 2px !important;
border-radius: 2px !important;
}
*/
/* Edit History Record */
.ui-dialog form.ui-widget-content dd {
margin-left: 0px;
margin-bottom: 10px;
}
.ui-dialog form.ui-widget-content dt {
margin-bottom: 2px;
}
.ui-dialog form.ui-widget-content dd input {
width: 190px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

View File

@ -32,7 +32,7 @@ var AIRTIME = (function(AIRTIME) {
">" + ">" +
"<span><%= label %></span>" + "<span><%= label %></span>" +
"<span><%= type %></span>" + "<span><%= type %></span>" +
"<span class='template_item_remove'>Remove</span>" + "<span class='template_item_remove'><i class='icon icon-trash'></i></span>" +
"</li>"; "</li>";
var template = (config.required) === true ? templateRequired : templateOptional; var template = (config.required) === true ? templateRequired : templateOptional;
@ -65,9 +65,9 @@ var AIRTIME = (function(AIRTIME) {
$templateList = $(".template_item_list"); $templateList = $(".template_item_list");
$fileMDList = $(".template_file_md"); $fileMDList = $(".template_file_md");
$fileMDList.on("dblclick", "li", function(){ $fileMDList.on("click", "i.icon-plus", function(){
var $li = $(this); var $li = $(this).parents("li");
var config = { var config = {
name: $li.data("name"), name: $li.data("name"),
type: $li.data("type"), type: $li.data("type"),

View File

@ -93,6 +93,36 @@ var AIRTIME = (function(AIRTIME) {
} ); } );
} }
function createToolbarButtons ($el) {
var $menu = $("<div class='btn-toolbar' />");
$menu.append("<div class='btn-group'>" +
"<button class='btn btn-small dropdown-toggle' data-toggle='dropdown'>" +
$.i18n._("Select")+" <span class='caret'></span>" +
"</button>" +
"<ul class='dropdown-menu'>" +
"<li id='sb-select-page'><a href='#'>"+$.i18n._("Select this page")+"</a></li>" +
"<li id='sb-dselect-page'><a href='#'>"+$.i18n._("Deselect this page")+"</a></li>" +
"<li id='sb-dselect-all'><a href='#'>"+$.i18n._("Deselect all")+"</a></li>" +
"</ul>" +
"</div>");
$menu.append("<div class='btn-group'>" +
"<button class='btn btn-small' id='his_create'>" +
"<i class='icon-white icon-plus'></i>" +
$.i18n._("Create Entry") +
"</button>" +
"</div>");
$menu.append("<div class='btn-group'>" +
"<button class='btn btn-small' id='his_trash'>" +
"<i class='icon-white icon-trash'></i>" +
"</button>" +
"</div>");
$el.append($menu);
}
function aggregateHistoryTable() { function aggregateHistoryTable() {
var oTable, var oTable,
$historyTableDiv = $historyContentDiv.find("#history_table_aggregate"), $historyTableDiv = $historyContentDiv.find("#history_table_aggregate"),
@ -134,6 +164,7 @@ var AIRTIME = (function(AIRTIME) {
function itemHistoryTable() { function itemHistoryTable() {
var oTable, var oTable,
$historyTableDiv = $historyContentDiv.find("#history_table_list"), $historyTableDiv = $historyContentDiv.find("#history_table_list"),
$toolbar,
columns, columns,
fnRowCallback, fnRowCallback,
booleans = {}, booleans = {},
@ -157,9 +188,13 @@ var AIRTIME = (function(AIRTIME) {
b, b,
text, text,
$nRow = $(nRow); $nRow = $(nRow);
// add checkbox
$nRow.find('td.his_checkbox').html("<input type='checkbox' name='cb_"+aData.history_id+"'>");
nRow.setAttribute('url-edit', editUrl); nRow.setAttribute('his-id', aData.history_id);
nRow.setAttribute('url-delete', deleteUrl); //nRow.setAttribute('url-edit', editUrl);
//nRow.setAttribute('url-delete', deleteUrl);
for (b in booleans) { for (b in booleans) {
@ -189,6 +224,9 @@ var AIRTIME = (function(AIRTIME) {
"oTableTools": oTableTools "oTableTools": oTableTools
}); });
oTable.fnSetFilteringDelay(350); oTable.fnSetFilteringDelay(350);
$toolbar = $historyTableDiv.parents(".dataTables_wrapper").find(".fg-toolbar:first");
createToolbarButtons($toolbar);
return oTable; return oTable;
} }
@ -313,6 +351,7 @@ var AIRTIME = (function(AIRTIME) {
} }
} }
/*
$historyContentDiv.on("click", "#history_table_list tr", function(ev) { $historyContentDiv.on("click", "#history_table_list tr", function(ev) {
openRow(oTableItem, this); openRow(oTableItem, this);
}); });
@ -320,6 +359,7 @@ var AIRTIME = (function(AIRTIME) {
$historyContentDiv.on("click", "#history_table_aggregate tr", function(ev) { $historyContentDiv.on("click", "#history_table_aggregate tr", function(ev) {
openRow(oTableAgg, this); openRow(oTableAgg, this);
}); });
*/
$("#his_create").click(function(e) { $("#his_create").click(function(e) {
var url = baseUrl+"playouthistory/edit-list-item/format/json" ; var url = baseUrl+"playouthistory/edit-list-item/format/json" ;
@ -434,6 +474,72 @@ var AIRTIME = (function(AIRTIME) {
$historyContentDiv.find("#his-tabs").tabs(); $historyContentDiv.find("#his-tabs").tabs();
// begin context menu initialization.
$.contextMenu({
selector: '#history_table_list td:not(.library_checkbox)',
trigger: "left",
ignoreRightClick: true,
build: function($el, e) {
var items,
callback,
$tr,
id;
$tr = $el.parents("tr");
id = $tr.get(0).getAttribute("his-id");
function processMenuItems(oItems) {
// define an edit callback.
if (oItems.edit !== undefined) {
callback = function() {
$.post(oItems.edit.url, {format: "json"}, function(json) {
makeHistoryDialog(json.dialog);
}, "json");
};
oItems.edit.callback = callback;
}
// define a delete callback.
if (oItems.del !== undefined) {
callback = function() {
var c = confirm("Delete this entry?");
if (c) {
$.post(oItems.del.url, {format: "json"}, function(json) {
oTableItem.fnDraw();
});
}
};
oItems.del.callback = callback;
}
items = oItems;
}
request = $.ajax({
url: baseUrl+"playouthistory/context-menu",
type: "GET",
data: {id : id, format: "json"},
dataType: "json",
async: false,
success: function(json){
processMenuItems(json.items);
}
});
return {
items: items
};
}
});
}; };
return AIRTIME; return AIRTIME;