Merge branch 'master' of dev.sourcefabric.org:campcaster
|
@ -91,6 +91,11 @@
|
||||||
<formFile formName="ScheduleShow"/>
|
<formFile formName="ScheduleShow"/>
|
||||||
<formFile formName="AddUser"/>
|
<formFile formName="AddUser"/>
|
||||||
<formFile formName="AdvancedSearchGroup"/>
|
<formFile formName="AdvancedSearchGroup"/>
|
||||||
|
<formFile formName="AddShowWhen"/>
|
||||||
|
<formFile formName="AddShowWho"/>
|
||||||
|
<formFile formName="AddShowStyle"/>
|
||||||
|
<formFile formName="AddShowWhat"/>
|
||||||
|
<formFile formName="AddShowRepeats"/>
|
||||||
</formsDirectory>
|
</formsDirectory>
|
||||||
<layoutsDirectory enabled="false"/>
|
<layoutsDirectory enabled="false"/>
|
||||||
<modelsDirectory>
|
<modelsDirectory>
|
||||||
|
|
20
application/configs/airtime-conf.php
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
// This file generated by Propel 1.5.2 convert-conf target
|
||||||
|
// from XML runtime conf file /home/naomi/dev-campcaster/campcaster/build/runtime-conf.xml
|
||||||
|
$conf = array (
|
||||||
|
'datasources' =>
|
||||||
|
array (
|
||||||
|
'airtime' =>
|
||||||
|
array (
|
||||||
|
'adapter' => 'pgsql',
|
||||||
|
'connection' =>
|
||||||
|
array (
|
||||||
|
'dsn' => 'pgsql:host=localhost;port=5432;dbname=airtime;user=airtime;password=airtime',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'default' => 'airtime',
|
||||||
|
),
|
||||||
|
'generator_version' => '1.5.2',
|
||||||
|
);
|
||||||
|
$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-airtime-conf.php');
|
||||||
|
return $conf;
|
116
application/configs/classmap-airtime-conf.php
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
<?php
|
||||||
|
// This file generated by Propel 1.5.2 convert-conf target
|
||||||
|
return array (
|
||||||
|
'CcAccessTableMap' => 'airtime/map/CcAccessTableMap.php',
|
||||||
|
'CcAccessPeer' => 'airtime/CcAccessPeer.php',
|
||||||
|
'CcAccess' => 'airtime/CcAccess.php',
|
||||||
|
'CcAccessQuery' => 'airtime/CcAccessQuery.php',
|
||||||
|
'BaseCcAccessPeer' => 'airtime/om/BaseCcAccessPeer.php',
|
||||||
|
'BaseCcAccess' => 'airtime/om/BaseCcAccess.php',
|
||||||
|
'BaseCcAccessQuery' => 'airtime/om/BaseCcAccessQuery.php',
|
||||||
|
'CcBackupTableMap' => 'airtime/map/CcBackupTableMap.php',
|
||||||
|
'CcBackupPeer' => 'airtime/CcBackupPeer.php',
|
||||||
|
'CcBackup' => 'airtime/CcBackup.php',
|
||||||
|
'CcBackupQuery' => 'airtime/CcBackupQuery.php',
|
||||||
|
'BaseCcBackupPeer' => 'airtime/om/BaseCcBackupPeer.php',
|
||||||
|
'BaseCcBackup' => 'airtime/om/BaseCcBackup.php',
|
||||||
|
'BaseCcBackupQuery' => 'airtime/om/BaseCcBackupQuery.php',
|
||||||
|
'CcFilesTableMap' => 'airtime/map/CcFilesTableMap.php',
|
||||||
|
'CcFilesPeer' => 'airtime/CcFilesPeer.php',
|
||||||
|
'CcFiles' => 'airtime/CcFiles.php',
|
||||||
|
'CcFilesQuery' => 'airtime/CcFilesQuery.php',
|
||||||
|
'BaseCcFilesPeer' => 'airtime/om/BaseCcFilesPeer.php',
|
||||||
|
'BaseCcFiles' => 'airtime/om/BaseCcFiles.php',
|
||||||
|
'BaseCcFilesQuery' => 'airtime/om/BaseCcFilesQuery.php',
|
||||||
|
'CcPermsTableMap' => 'airtime/map/CcPermsTableMap.php',
|
||||||
|
'CcPermsPeer' => 'airtime/CcPermsPeer.php',
|
||||||
|
'CcPerms' => 'airtime/CcPerms.php',
|
||||||
|
'CcPermsQuery' => 'airtime/CcPermsQuery.php',
|
||||||
|
'BaseCcPermsPeer' => 'airtime/om/BaseCcPermsPeer.php',
|
||||||
|
'BaseCcPerms' => 'airtime/om/BaseCcPerms.php',
|
||||||
|
'BaseCcPermsQuery' => 'airtime/om/BaseCcPermsQuery.php',
|
||||||
|
'CcShowTableMap' => 'airtime/map/CcShowTableMap.php',
|
||||||
|
'CcShowPeer' => 'airtime/CcShowPeer.php',
|
||||||
|
'CcShow' => 'airtime/CcShow.php',
|
||||||
|
'CcShowQuery' => 'airtime/CcShowQuery.php',
|
||||||
|
'BaseCcShowPeer' => 'airtime/om/BaseCcShowPeer.php',
|
||||||
|
'BaseCcShow' => 'airtime/om/BaseCcShow.php',
|
||||||
|
'BaseCcShowQuery' => 'airtime/om/BaseCcShowQuery.php',
|
||||||
|
'CcShowDaysTableMap' => 'airtime/map/CcShowDaysTableMap.php',
|
||||||
|
'CcShowDaysPeer' => 'airtime/CcShowDaysPeer.php',
|
||||||
|
'CcShowDays' => 'airtime/CcShowDays.php',
|
||||||
|
'CcShowDaysQuery' => 'airtime/CcShowDaysQuery.php',
|
||||||
|
'BaseCcShowDaysPeer' => 'airtime/om/BaseCcShowDaysPeer.php',
|
||||||
|
'BaseCcShowDays' => 'airtime/om/BaseCcShowDays.php',
|
||||||
|
'BaseCcShowDaysQuery' => 'airtime/om/BaseCcShowDaysQuery.php',
|
||||||
|
'CcShowHostsTableMap' => 'airtime/map/CcShowHostsTableMap.php',
|
||||||
|
'CcShowHostsPeer' => 'airtime/CcShowHostsPeer.php',
|
||||||
|
'CcShowHosts' => 'airtime/CcShowHosts.php',
|
||||||
|
'CcShowHostsQuery' => 'airtime/CcShowHostsQuery.php',
|
||||||
|
'BaseCcShowHostsPeer' => 'airtime/om/BaseCcShowHostsPeer.php',
|
||||||
|
'BaseCcShowHosts' => 'airtime/om/BaseCcShowHosts.php',
|
||||||
|
'BaseCcShowHostsQuery' => 'airtime/om/BaseCcShowHostsQuery.php',
|
||||||
|
'CcShowScheduleTableMap' => 'airtime/map/CcShowScheduleTableMap.php',
|
||||||
|
'CcShowSchedulePeer' => 'airtime/CcShowSchedulePeer.php',
|
||||||
|
'CcShowSchedule' => 'airtime/CcShowSchedule.php',
|
||||||
|
'CcShowScheduleQuery' => 'airtime/CcShowScheduleQuery.php',
|
||||||
|
'BaseCcShowSchedulePeer' => 'airtime/om/BaseCcShowSchedulePeer.php',
|
||||||
|
'BaseCcShowSchedule' => 'airtime/om/BaseCcShowSchedule.php',
|
||||||
|
'BaseCcShowScheduleQuery' => 'airtime/om/BaseCcShowScheduleQuery.php',
|
||||||
|
'CcPlaylistTableMap' => 'airtime/map/CcPlaylistTableMap.php',
|
||||||
|
'CcPlaylistPeer' => 'airtime/CcPlaylistPeer.php',
|
||||||
|
'CcPlaylist' => 'airtime/CcPlaylist.php',
|
||||||
|
'CcPlaylistQuery' => 'airtime/CcPlaylistQuery.php',
|
||||||
|
'BaseCcPlaylistPeer' => 'airtime/om/BaseCcPlaylistPeer.php',
|
||||||
|
'BaseCcPlaylist' => 'airtime/om/BaseCcPlaylist.php',
|
||||||
|
'BaseCcPlaylistQuery' => 'airtime/om/BaseCcPlaylistQuery.php',
|
||||||
|
'CcPlaylistcontentsTableMap' => 'airtime/map/CcPlaylistcontentsTableMap.php',
|
||||||
|
'CcPlaylistcontentsPeer' => 'airtime/CcPlaylistcontentsPeer.php',
|
||||||
|
'CcPlaylistcontents' => 'airtime/CcPlaylistcontents.php',
|
||||||
|
'CcPlaylistcontentsQuery' => 'airtime/CcPlaylistcontentsQuery.php',
|
||||||
|
'BaseCcPlaylistcontentsPeer' => 'airtime/om/BaseCcPlaylistcontentsPeer.php',
|
||||||
|
'BaseCcPlaylistcontents' => 'airtime/om/BaseCcPlaylistcontents.php',
|
||||||
|
'BaseCcPlaylistcontentsQuery' => 'airtime/om/BaseCcPlaylistcontentsQuery.php',
|
||||||
|
'CcPrefTableMap' => 'airtime/map/CcPrefTableMap.php',
|
||||||
|
'CcPrefPeer' => 'airtime/CcPrefPeer.php',
|
||||||
|
'CcPref' => 'airtime/CcPref.php',
|
||||||
|
'CcPrefQuery' => 'airtime/CcPrefQuery.php',
|
||||||
|
'BaseCcPrefPeer' => 'airtime/om/BaseCcPrefPeer.php',
|
||||||
|
'BaseCcPref' => 'airtime/om/BaseCcPref.php',
|
||||||
|
'BaseCcPrefQuery' => 'airtime/om/BaseCcPrefQuery.php',
|
||||||
|
'CcScheduleTableMap' => 'airtime/map/CcScheduleTableMap.php',
|
||||||
|
'CcSchedulePeer' => 'airtime/CcSchedulePeer.php',
|
||||||
|
'CcSchedule' => 'airtime/CcSchedule.php',
|
||||||
|
'CcScheduleQuery' => 'airtime/CcScheduleQuery.php',
|
||||||
|
'BaseCcSchedulePeer' => 'airtime/om/BaseCcSchedulePeer.php',
|
||||||
|
'BaseCcSchedule' => 'airtime/om/BaseCcSchedule.php',
|
||||||
|
'BaseCcScheduleQuery' => 'airtime/om/BaseCcScheduleQuery.php',
|
||||||
|
'CcSessTableMap' => 'airtime/map/CcSessTableMap.php',
|
||||||
|
'CcSessPeer' => 'airtime/CcSessPeer.php',
|
||||||
|
'CcSess' => 'airtime/CcSess.php',
|
||||||
|
'CcSessQuery' => 'airtime/CcSessQuery.php',
|
||||||
|
'BaseCcSessPeer' => 'airtime/om/BaseCcSessPeer.php',
|
||||||
|
'BaseCcSess' => 'airtime/om/BaseCcSess.php',
|
||||||
|
'BaseCcSessQuery' => 'airtime/om/BaseCcSessQuery.php',
|
||||||
|
'CcSmembTableMap' => 'airtime/map/CcSmembTableMap.php',
|
||||||
|
'CcSmembPeer' => 'airtime/CcSmembPeer.php',
|
||||||
|
'CcSmemb' => 'airtime/CcSmemb.php',
|
||||||
|
'CcSmembQuery' => 'airtime/CcSmembQuery.php',
|
||||||
|
'BaseCcSmembPeer' => 'airtime/om/BaseCcSmembPeer.php',
|
||||||
|
'BaseCcSmemb' => 'airtime/om/BaseCcSmemb.php',
|
||||||
|
'BaseCcSmembQuery' => 'airtime/om/BaseCcSmembQuery.php',
|
||||||
|
'CcSubjsTableMap' => 'airtime/map/CcSubjsTableMap.php',
|
||||||
|
'CcSubjsPeer' => 'airtime/CcSubjsPeer.php',
|
||||||
|
'CcSubjs' => 'airtime/CcSubjs.php',
|
||||||
|
'CcSubjsQuery' => 'airtime/CcSubjsQuery.php',
|
||||||
|
'BaseCcSubjsPeer' => 'airtime/om/BaseCcSubjsPeer.php',
|
||||||
|
'BaseCcSubjs' => 'airtime/om/BaseCcSubjs.php',
|
||||||
|
'BaseCcSubjsQuery' => 'airtime/om/BaseCcSubjsQuery.php',
|
||||||
|
'CcTransTableMap' => 'airtime/map/CcTransTableMap.php',
|
||||||
|
'CcTransPeer' => 'airtime/CcTransPeer.php',
|
||||||
|
'CcTrans' => 'airtime/CcTrans.php',
|
||||||
|
'CcTransQuery' => 'airtime/CcTransQuery.php',
|
||||||
|
'BaseCcTransPeer' => 'airtime/om/BaseCcTransPeer.php',
|
||||||
|
'BaseCcTrans' => 'airtime/om/BaseCcTrans.php',
|
||||||
|
'BaseCcTransQuery' => 'airtime/om/BaseCcTransQuery.php',
|
||||||
|
);
|
|
@ -34,11 +34,14 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$this->view->headScript()->appendFile('/js/fullcalendar/fullcalendar.min.js','text/javascript');
|
$this->view->headScript()->appendFile('/js/fullcalendar/fullcalendar.min.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile('/js/contextmenu/jquery.contextMenu.js','text/javascript');
|
$this->view->headScript()->appendFile('/js/contextmenu/jquery.contextMenu.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile('/js/qtip/jquery.qtip-1.0.0.min.js','text/javascript');
|
$this->view->headScript()->appendFile('/js/qtip/jquery.qtip-1.0.0.min.js','text/javascript');
|
||||||
|
$this->view->headScript()->appendFile('/js/colorpicker/js/colorpicker.js','text/javascript');
|
||||||
|
|
||||||
|
|
||||||
$this->view->headScript()->appendFile('/js/airtime/schedule/schedule.js','text/javascript');
|
$this->view->headScript()->appendFile('/js/airtime/schedule/schedule.js','text/javascript');
|
||||||
|
|
||||||
$this->view->headLink()->appendStylesheet('/css/jquery.contextMenu.css');
|
$this->view->headLink()->appendStylesheet('/css/jquery.contextMenu.css');
|
||||||
$this->view->headLink()->appendStylesheet('/css/fullcalendar.css');
|
$this->view->headLink()->appendStylesheet('/css/fullcalendar.css');
|
||||||
|
$this->view->headLink()->appendStylesheet('/css/colorpicker/css/colorpicker.css');
|
||||||
$this->view->headLink()->appendStylesheet('/css/schedule.css');
|
$this->view->headLink()->appendStylesheet('/css/schedule.css');
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,25 +77,44 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
public function addShowDialogAction()
|
public function addShowDialogAction()
|
||||||
{
|
{
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$form = new Application_Form_AddShow();
|
$formWhat = new Application_Form_AddShowWhat();
|
||||||
|
$formWhat->removeDecorator('DtDdWrapper');
|
||||||
|
$formWho = new Application_Form_AddShowWho();
|
||||||
|
$formWho->removeDecorator('DtDdWrapper');
|
||||||
|
$formWhen = new Application_Form_AddShowWhen();
|
||||||
|
$formWhen->removeDecorator('DtDdWrapper');
|
||||||
|
$formRepeats = new Application_Form_AddShowRepeats();
|
||||||
|
$formRepeats->removeDecorator('DtDdWrapper');
|
||||||
|
$formStyle = new Application_Form_AddShowStyle();
|
||||||
|
$formStyle->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
|
$this->view->what = $formWhat;
|
||||||
|
$this->view->when = $formWhen;
|
||||||
|
$this->view->repeats = $formRepeats;
|
||||||
|
$this->view->who = $formWho;
|
||||||
|
$this->view->style = $formStyle;
|
||||||
|
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
if ($form->isValid($request->getPost())) {
|
|
||||||
|
$data = $request->getPost();
|
||||||
|
|
||||||
|
if ($formStyle->isValid($data) && $formWhen->isValid($data) && $formWho->isValid($data) && $formStyle->isValid($data)) {
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
|
||||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||||
$overlap = $show->addShow($form->getValues());
|
$overlap = $show->addShow($data);
|
||||||
|
|
||||||
if(isset($overlap)) {
|
if(isset($overlap)) {
|
||||||
$this->view->overlap = $overlap;
|
$this->view->overlap = $overlap;
|
||||||
$this->view->form = $form->__toString();
|
$this->view->form = $this->view->render('schedule/add-show-dialog.phtml');
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->view->form = $form->__toString();
|
|
||||||
|
$this->view->content = $this->view->render('schedule/add-show-dialog.phtml');
|
||||||
$this->view->hosts = User::getHosts();
|
$this->view->hosts = User::getHosts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,118 +0,0 @@
|
||||||
<?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 start time element
|
|
||||||
$this->addElement('text', 'start_time', array(
|
|
||||||
'label' => 'Start Time:',
|
|
||||||
'required' => true,
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
'NotEmpty',
|
|
||||||
array('date', false, array('HH:mm'))
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add duration element
|
|
||||||
$this->addElement('text', 'duration', array(
|
|
||||||
'label' => 'Duration:',
|
|
||||||
'required' => true,
|
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
'NotEmpty',
|
|
||||||
array('date', false, array('HH:mm'))
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add repeats element
|
|
||||||
$this->addElement('checkbox', 'repeats', array(
|
|
||||||
'label' => 'repeats',
|
|
||||||
'required' => false,
|
|
||||||
));
|
|
||||||
|
|
||||||
$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",
|
|
||||||
),
|
|
||||||
));
|
|
||||||
|
|
||||||
// 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('checkbox', 'no_end', array(
|
|
||||||
'label' => 'no end',
|
|
||||||
'required' => false,
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add end date element
|
|
||||||
$this->addElement('text', 'hosts_autocomplete', array(
|
|
||||||
'label' => 'Type a Host:',
|
|
||||||
'required' => false
|
|
||||||
));
|
|
||||||
|
|
||||||
$options = array();
|
|
||||||
$hosts = User::getHosts();
|
|
||||||
|
|
||||||
foreach ($hosts as $host) {
|
|
||||||
$options[$host['id']] = $host['login'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$hosts = new Zend_Form_Element_MultiCheckbox('hosts');
|
|
||||||
$hosts->setLabel('Hosts:')
|
|
||||||
->setMultiOptions($options)
|
|
||||||
->setRequired(true);
|
|
||||||
|
|
||||||
$this->addElement($hosts);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
46
application/forms/AddShowRepeats.php
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
||||||
|
{
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
// Add days checkboxes
|
||||||
|
$this->addElement(
|
||||||
|
'multiCheckbox',
|
||||||
|
'add_show_day_check',
|
||||||
|
array(
|
||||||
|
'label' => 'Select Days:',
|
||||||
|
'required' => false,
|
||||||
|
'multiOptions' => array(
|
||||||
|
"0" => "Sun",
|
||||||
|
"1" => "Mon",
|
||||||
|
"2" => "Tue",
|
||||||
|
"3" => "Wed",
|
||||||
|
"4" => "Thu",
|
||||||
|
"5" => "Fri",
|
||||||
|
"6" => "Sat",
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
// Add end date element
|
||||||
|
$this->addElement('text', 'add_show_end_date', array(
|
||||||
|
'label' => 'Date End:',
|
||||||
|
'required' => false,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'validators' => array(
|
||||||
|
'NotEmpty',
|
||||||
|
array('date', false, array('YYYY-MM-DD'))
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Add no end element
|
||||||
|
$this->addElement('checkbox', 'add_show_no_end', array(
|
||||||
|
'label' => 'no end',
|
||||||
|
'required' => false,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
23
application/forms/AddShowStyle.php
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
||||||
|
{
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
// Add show background-color input
|
||||||
|
$this->addElement('text', 'add_show_background_color', array(
|
||||||
|
'label' => 'Background Colour:',
|
||||||
|
'filters' => array('StringTrim')
|
||||||
|
));
|
||||||
|
|
||||||
|
// Add show color input
|
||||||
|
$this->addElement('text', 'add_show_color', array(
|
||||||
|
'label' => 'Text Colour',
|
||||||
|
'filters' => array('StringTrim')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
26
application/forms/AddShowWhat.php
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||||
|
{
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
// Add name element
|
||||||
|
$this->addElement('text', 'add_show_name', array(
|
||||||
|
'label' => 'Name:',
|
||||||
|
'required' => true,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'validators' => array('NotEmpty')
|
||||||
|
));
|
||||||
|
|
||||||
|
// Add the description element
|
||||||
|
$this->addElement('textarea', 'add_show_description', array(
|
||||||
|
'label' => 'Description:',
|
||||||
|
'required' => false,
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
51
application/forms/AddShowWhen.php
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
|
{
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
// Add start date element
|
||||||
|
$this->addElement('text', 'add_show_start_date', array(
|
||||||
|
'label' => 'Date Start:',
|
||||||
|
'required' => true,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'validators' => array(
|
||||||
|
'NotEmpty',
|
||||||
|
array('date', false, array('YYYY-MM-DD'))
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Add start time element
|
||||||
|
$this->addElement('text', 'add_show_start_time', array(
|
||||||
|
'label' => 'Start Time:',
|
||||||
|
'required' => true,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'validators' => array(
|
||||||
|
'NotEmpty',
|
||||||
|
array('date', false, array('HH:mm'))
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Add duration element
|
||||||
|
$this->addElement('text', 'add_show_duration', array(
|
||||||
|
'label' => 'Duration:',
|
||||||
|
'required' => true,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'validators' => array(
|
||||||
|
'NotEmpty',
|
||||||
|
array('date', false, array('HH:mm'))
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Add repeats element
|
||||||
|
$this->addElement('checkbox', 'add_show_repeats', array(
|
||||||
|
'label' => 'repeats',
|
||||||
|
'required' => false,
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
32
application/forms/AddShowWho.php
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Form_AddShowWho extends Zend_Form_SubForm
|
||||||
|
{
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
// Add hosts autocomplete
|
||||||
|
$this->addElement('text', 'add_show_hosts_autocomplete', array(
|
||||||
|
'label' => 'Type a Host:',
|
||||||
|
'required' => false
|
||||||
|
));
|
||||||
|
|
||||||
|
$options = array();
|
||||||
|
$hosts = User::getHosts();
|
||||||
|
|
||||||
|
foreach ($hosts as $host) {
|
||||||
|
$options[$host['id']] = $host['login'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add hosts selection
|
||||||
|
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
|
||||||
|
$hosts->setLabel('Hosts:')
|
||||||
|
->setMultiOptions($options)
|
||||||
|
->setRequired(true);
|
||||||
|
|
||||||
|
$this->addElement($hosts);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -16,48 +16,50 @@ class Show {
|
||||||
|
|
||||||
$con = Propel::getConnection(CcShowPeer::DATABASE_NAME);
|
$con = Propel::getConnection(CcShowPeer::DATABASE_NAME);
|
||||||
|
|
||||||
$sql = "SELECT time '{$data['start_time']}' + INTERVAL '{$data['duration']} hour' ";
|
$sql = "SELECT time '{$data['add_show_start_time']}' + INTERVAL '{$data['add_show_duration']} hour' ";
|
||||||
$r = $con->query($sql);
|
$r = $con->query($sql);
|
||||||
$endTime = $r->fetchColumn(0);
|
$endTime = $r->fetchColumn(0);
|
||||||
|
|
||||||
$sql = "SELECT EXTRACT(DOW FROM TIMESTAMP '{$data['start_date']} {$data['start_time']}')";
|
$sql = "SELECT EXTRACT(DOW FROM TIMESTAMP '{$data['add_show_start_date']} {$data['add_show_start_time']}')";
|
||||||
$r = $con->query($sql);
|
$r = $con->query($sql);
|
||||||
$startDow = $r->fetchColumn(0);
|
$startDow = $r->fetchColumn(0);
|
||||||
|
|
||||||
if($data['no_end']) {
|
if($data['add_show_no_end']) {
|
||||||
$endDate = NULL;
|
$endDate = NULL;
|
||||||
$data['repeats'] = 1;
|
$data['add_show_repeats'] = 1;
|
||||||
}
|
}
|
||||||
else if($data['repeats']) {
|
else if($data['add_show_repeats']) {
|
||||||
$sql = "SELECT date '{$data['end_date']}' + INTERVAL '1 day' ";
|
$sql = "SELECT date '{$data['add_show_end_date']}' + INTERVAL '1 day' ";
|
||||||
$r = $con->query($sql);
|
$r = $con->query($sql);
|
||||||
$endDate = $r->fetchColumn(0);
|
$endDate = $r->fetchColumn(0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$sql = "SELECT date '{$data['start_date']}' + INTERVAL '1 day' ";
|
$sql = "SELECT date '{$data['add_show_start_date']}' + INTERVAL '1 day' ";
|
||||||
$r = $con->query($sql);
|
$r = $con->query($sql);
|
||||||
$endDate = $r->fetchColumn(0);
|
$endDate = $r->fetchColumn(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($data['day_check'] === null) {
|
if(!isset($data['add_show_day_check'])) {
|
||||||
$data['day_check'] = array($startDow);
|
$data['add_show_day_check'] = array($startDow);
|
||||||
}
|
}
|
||||||
|
|
||||||
$overlap = $this->getShows($data['start_date'], $endDate, $data['day_check'], $data['start_time'], $endTime);
|
$overlap = $this->getShows($data['add_show_start_date'], $endDate, $data['add_show_day_check'], $data['add_show_start_time'], $endTime);
|
||||||
|
|
||||||
if(count($overlap) > 0) {
|
if(count($overlap) > 0) {
|
||||||
return $overlap;
|
return $overlap;
|
||||||
}
|
}
|
||||||
|
|
||||||
$show = new CcShow();
|
$show = new CcShow();
|
||||||
$show->setDbName($data['name']);
|
$show->setDbName($data['add_show_name']);
|
||||||
$show->setDbRepeats($data['repeats']);
|
$show->setDbRepeats($data['add_show_repeats']);
|
||||||
$show->setDbDescription($data['description']);
|
$show->setDbDescription($data['add_show_description']);
|
||||||
|
$show->setDbColor($data['add_show_color']);
|
||||||
|
$show->setDbBackgroundColor($data['add_show_background_color']);
|
||||||
$show->save();
|
$show->save();
|
||||||
|
|
||||||
$showId = $show->getDbId();
|
$showId = $show->getDbId();
|
||||||
|
|
||||||
foreach ($data['day_check'] as $day) {
|
foreach ($data['add_show_day_check'] as $day) {
|
||||||
|
|
||||||
if($startDow !== $day){
|
if($startDow !== $day){
|
||||||
|
|
||||||
|
@ -66,25 +68,25 @@ class Show {
|
||||||
else
|
else
|
||||||
$daysAdd = $day - $startDow;
|
$daysAdd = $day - $startDow;
|
||||||
|
|
||||||
$sql = "SELECT date '{$data['start_date']}' + INTERVAL '{$daysAdd} day' ";
|
$sql = "SELECT date '{$data['add_show_start_date']}' + INTERVAL '{$daysAdd} day' ";
|
||||||
$r = $con->query($sql);
|
$r = $con->query($sql);
|
||||||
$start = $r->fetchColumn(0);
|
$start = $r->fetchColumn(0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$start = $data['start_date'];
|
$start = $data['add_show_start_date'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$showDay = new CcShowDays();
|
$showDay = new CcShowDays();
|
||||||
$showDay->setDbFirstShow($start);
|
$showDay->setDbFirstShow($start);
|
||||||
$showDay->setDbLastShow($endDate);
|
$showDay->setDbLastShow($endDate);
|
||||||
$showDay->setDbStartTime($data['start_time']);
|
$showDay->setDbStartTime($data['add_show_start_time']);
|
||||||
$showDay->setDbEndTime($endTime);
|
$showDay->setDbEndTime($endTime);
|
||||||
$showDay->setDbDay($day);
|
$showDay->setDbDay($day);
|
||||||
$showDay->setDbShowId($showId);
|
$showDay->setDbShowId($showId);
|
||||||
$showDay->save();
|
$showDay->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($data['hosts'] as $host) {
|
foreach ($data['add_show_hosts'] as $host) {
|
||||||
$showHost = new CcShowHosts();
|
$showHost = new CcShowHosts();
|
||||||
$showHost->setDbShow($showId);
|
$showHost->setDbShow($showId);
|
||||||
$showHost->setDbHost($host);
|
$showHost->setDbHost($host);
|
||||||
|
@ -460,7 +462,7 @@ class Show {
|
||||||
|
|
||||||
$sql;
|
$sql;
|
||||||
|
|
||||||
$sql_gen = "SELECT cc_show_days.id AS day_id, name, repeats, description,
|
$sql_gen = "SELECT cc_show_days.id AS day_id, name, repeats, description, color, background_color,
|
||||||
first_show, last_show, start_time, end_time, day, show_id
|
first_show, last_show, start_time, end_time, day, show_id
|
||||||
FROM (cc_show LEFT JOIN cc_show_days ON cc_show.id = cc_show_days.show_id)";
|
FROM (cc_show LEFT JOIN cc_show_days ON cc_show.id = cc_show_days.show_id)";
|
||||||
|
|
||||||
|
@ -604,7 +606,9 @@ class Show {
|
||||||
"start" => $start_ts,
|
"start" => $start_ts,
|
||||||
"end" => $end_ts,
|
"end" => $end_ts,
|
||||||
"allDay" => false,
|
"allDay" => false,
|
||||||
"description" => $show["description"]
|
"description" => $show["description"],
|
||||||
|
"color" => $show["color"],
|
||||||
|
"backgroundColor" => $show["background_color"]
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($options as $key=>$value) {
|
foreach($options as $key=>$value) {
|
||||||
|
|
|
@ -42,6 +42,8 @@ class CcShowTableMap extends TableMap {
|
||||||
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
|
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
|
||||||
$this->addColumn('REPEATS', 'DbRepeats', 'TINYINT', true, null, null);
|
$this->addColumn('REPEATS', 'DbRepeats', 'TINYINT', true, null, null);
|
||||||
$this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null);
|
$this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null);
|
||||||
|
$this->addColumn('COLOR', 'DbColor', 'VARCHAR', false, 6, null);
|
||||||
|
$this->addColumn('BACKGROUND_COLOR', 'DbBackgroundColor', 'VARCHAR', false, 6, null);
|
||||||
// validators
|
// validators
|
||||||
} // initialize()
|
} // initialize()
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,18 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
||||||
*/
|
*/
|
||||||
protected $description;
|
protected $description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the color field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the background_color field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $background_color;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array CcShowDays[] Collection to store aggregation of CcShowDays objects.
|
* @var array CcShowDays[] Collection to store aggregation of CcShowDays objects.
|
||||||
*/
|
*/
|
||||||
|
@ -139,6 +151,26 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
||||||
return $this->description;
|
return $this->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [color] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDbColor()
|
||||||
|
{
|
||||||
|
return $this->color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [background_color] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDbBackgroundColor()
|
||||||
|
{
|
||||||
|
return $this->background_color;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [id] column.
|
* Set the value of [id] column.
|
||||||
*
|
*
|
||||||
|
@ -219,6 +251,46 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
||||||
return $this;
|
return $this;
|
||||||
} // setDbDescription()
|
} // setDbDescription()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [color] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return CcShow The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setDbColor($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->color !== $v) {
|
||||||
|
$this->color = $v;
|
||||||
|
$this->modifiedColumns[] = CcShowPeer::COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setDbColor()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [background_color] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return CcShow The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setDbBackgroundColor($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->background_color !== $v) {
|
||||||
|
$this->background_color = $v;
|
||||||
|
$this->modifiedColumns[] = CcShowPeer::BACKGROUND_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setDbBackgroundColor()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the columns in this object are only set to default values.
|
* Indicates whether the columns in this object are only set to default values.
|
||||||
*
|
*
|
||||||
|
@ -259,6 +331,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
||||||
$this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
|
$this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
|
||||||
$this->repeats = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
|
$this->repeats = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
|
||||||
$this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
|
$this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
|
||||||
|
$this->color = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
|
||||||
|
$this->background_color = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
|
@ -267,7 +341,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
||||||
$this->ensureConsistency();
|
$this->ensureConsistency();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $startcol + 4; // 4 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS).
|
return $startcol + 6; // 6 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating CcShow object", $e);
|
throw new PropelException("Error populating CcShow object", $e);
|
||||||
|
@ -632,6 +706,12 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
||||||
case 3:
|
case 3:
|
||||||
return $this->getDbDescription();
|
return $this->getDbDescription();
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
return $this->getDbColor();
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
return $this->getDbBackgroundColor();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
break;
|
break;
|
||||||
|
@ -659,6 +739,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
||||||
$keys[1] => $this->getDbName(),
|
$keys[1] => $this->getDbName(),
|
||||||
$keys[2] => $this->getDbRepeats(),
|
$keys[2] => $this->getDbRepeats(),
|
||||||
$keys[3] => $this->getDbDescription(),
|
$keys[3] => $this->getDbDescription(),
|
||||||
|
$keys[4] => $this->getDbColor(),
|
||||||
|
$keys[5] => $this->getDbBackgroundColor(),
|
||||||
);
|
);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -702,6 +784,12 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
||||||
case 3:
|
case 3:
|
||||||
$this->setDbDescription($value);
|
$this->setDbDescription($value);
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
$this->setDbColor($value);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
$this->setDbBackgroundColor($value);
|
||||||
|
break;
|
||||||
} // switch()
|
} // switch()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,6 +818,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
||||||
if (array_key_exists($keys[1], $arr)) $this->setDbName($arr[$keys[1]]);
|
if (array_key_exists($keys[1], $arr)) $this->setDbName($arr[$keys[1]]);
|
||||||
if (array_key_exists($keys[2], $arr)) $this->setDbRepeats($arr[$keys[2]]);
|
if (array_key_exists($keys[2], $arr)) $this->setDbRepeats($arr[$keys[2]]);
|
||||||
if (array_key_exists($keys[3], $arr)) $this->setDbDescription($arr[$keys[3]]);
|
if (array_key_exists($keys[3], $arr)) $this->setDbDescription($arr[$keys[3]]);
|
||||||
|
if (array_key_exists($keys[4], $arr)) $this->setDbColor($arr[$keys[4]]);
|
||||||
|
if (array_key_exists($keys[5], $arr)) $this->setDbBackgroundColor($arr[$keys[5]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -745,6 +835,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
||||||
if ($this->isColumnModified(CcShowPeer::NAME)) $criteria->add(CcShowPeer::NAME, $this->name);
|
if ($this->isColumnModified(CcShowPeer::NAME)) $criteria->add(CcShowPeer::NAME, $this->name);
|
||||||
if ($this->isColumnModified(CcShowPeer::REPEATS)) $criteria->add(CcShowPeer::REPEATS, $this->repeats);
|
if ($this->isColumnModified(CcShowPeer::REPEATS)) $criteria->add(CcShowPeer::REPEATS, $this->repeats);
|
||||||
if ($this->isColumnModified(CcShowPeer::DESCRIPTION)) $criteria->add(CcShowPeer::DESCRIPTION, $this->description);
|
if ($this->isColumnModified(CcShowPeer::DESCRIPTION)) $criteria->add(CcShowPeer::DESCRIPTION, $this->description);
|
||||||
|
if ($this->isColumnModified(CcShowPeer::COLOR)) $criteria->add(CcShowPeer::COLOR, $this->color);
|
||||||
|
if ($this->isColumnModified(CcShowPeer::BACKGROUND_COLOR)) $criteria->add(CcShowPeer::BACKGROUND_COLOR, $this->background_color);
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
|
@ -809,6 +901,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
||||||
$copyObj->setDbName($this->name);
|
$copyObj->setDbName($this->name);
|
||||||
$copyObj->setDbRepeats($this->repeats);
|
$copyObj->setDbRepeats($this->repeats);
|
||||||
$copyObj->setDbDescription($this->description);
|
$copyObj->setDbDescription($this->description);
|
||||||
|
$copyObj->setDbColor($this->color);
|
||||||
|
$copyObj->setDbBackgroundColor($this->background_color);
|
||||||
|
|
||||||
if ($deepCopy) {
|
if ($deepCopy) {
|
||||||
// important: temporarily setNew(false) because this affects the behavior of
|
// important: temporarily setNew(false) because this affects the behavior of
|
||||||
|
@ -1239,6 +1333,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
||||||
$this->name = null;
|
$this->name = null;
|
||||||
$this->repeats = null;
|
$this->repeats = null;
|
||||||
$this->description = null;
|
$this->description = null;
|
||||||
|
$this->color = null;
|
||||||
|
$this->background_color = null;
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
$this->alreadyInValidation = false;
|
$this->alreadyInValidation = false;
|
||||||
$this->clearAllReferences();
|
$this->clearAllReferences();
|
||||||
|
|
|
@ -26,7 +26,7 @@ abstract class BaseCcShowPeer {
|
||||||
const TM_CLASS = 'CcShowTableMap';
|
const TM_CLASS = 'CcShowTableMap';
|
||||||
|
|
||||||
/** The total number of columns. */
|
/** The total number of columns. */
|
||||||
const NUM_COLUMNS = 4;
|
const NUM_COLUMNS = 6;
|
||||||
|
|
||||||
/** The number of lazy-loaded columns. */
|
/** The number of lazy-loaded columns. */
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
@ -43,6 +43,12 @@ abstract class BaseCcShowPeer {
|
||||||
/** the column name for the DESCRIPTION field */
|
/** the column name for the DESCRIPTION field */
|
||||||
const DESCRIPTION = 'cc_show.DESCRIPTION';
|
const DESCRIPTION = 'cc_show.DESCRIPTION';
|
||||||
|
|
||||||
|
/** the column name for the COLOR field */
|
||||||
|
const COLOR = 'cc_show.COLOR';
|
||||||
|
|
||||||
|
/** the column name for the BACKGROUND_COLOR field */
|
||||||
|
const BACKGROUND_COLOR = 'cc_show.BACKGROUND_COLOR';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An identiy map to hold any loaded instances of CcShow objects.
|
* An identiy map to hold any loaded instances of CcShow objects.
|
||||||
* This must be public so that other peer classes can access this when hydrating from JOIN
|
* This must be public so that other peer classes can access this when hydrating from JOIN
|
||||||
|
@ -59,12 +65,12 @@ abstract class BaseCcShowPeer {
|
||||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
private static $fieldNames = array (
|
private static $fieldNames = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbRepeats', 'DbDescription', ),
|
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbRepeats', 'DbDescription', 'DbColor', 'DbBackgroundColor', ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbRepeats', 'dbDescription', ),
|
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbRepeats', 'dbDescription', 'dbColor', 'dbBackgroundColor', ),
|
||||||
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::REPEATS, self::DESCRIPTION, ),
|
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::REPEATS, self::DESCRIPTION, self::COLOR, self::BACKGROUND_COLOR, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'REPEATS', 'DESCRIPTION', ),
|
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'REPEATS', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'repeats', 'description', ),
|
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'repeats', 'description', 'color', 'background_color', ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,12 +80,12 @@ abstract class BaseCcShowPeer {
|
||||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
private static $fieldKeys = array (
|
private static $fieldKeys = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbRepeats' => 2, 'DbDescription' => 3, ),
|
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbRepeats' => 2, 'DbDescription' => 3, 'DbColor' => 4, 'DbBackgroundColor' => 5, ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbRepeats' => 2, 'dbDescription' => 3, ),
|
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbRepeats' => 2, 'dbDescription' => 3, 'dbColor' => 4, 'dbBackgroundColor' => 5, ),
|
||||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::REPEATS => 2, self::DESCRIPTION => 3, ),
|
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::REPEATS => 2, self::DESCRIPTION => 3, self::COLOR => 4, self::BACKGROUND_COLOR => 5, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'REPEATS' => 2, 'DESCRIPTION' => 3, ),
|
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'REPEATS' => 2, 'DESCRIPTION' => 3, 'COLOR' => 4, 'BACKGROUND_COLOR' => 5, ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'repeats' => 2, 'description' => 3, ),
|
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'repeats' => 2, 'description' => 3, 'color' => 4, 'background_color' => 5, ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,11 +161,15 @@ abstract class BaseCcShowPeer {
|
||||||
$criteria->addSelectColumn(CcShowPeer::NAME);
|
$criteria->addSelectColumn(CcShowPeer::NAME);
|
||||||
$criteria->addSelectColumn(CcShowPeer::REPEATS);
|
$criteria->addSelectColumn(CcShowPeer::REPEATS);
|
||||||
$criteria->addSelectColumn(CcShowPeer::DESCRIPTION);
|
$criteria->addSelectColumn(CcShowPeer::DESCRIPTION);
|
||||||
|
$criteria->addSelectColumn(CcShowPeer::COLOR);
|
||||||
|
$criteria->addSelectColumn(CcShowPeer::BACKGROUND_COLOR);
|
||||||
} else {
|
} else {
|
||||||
$criteria->addSelectColumn($alias . '.ID');
|
$criteria->addSelectColumn($alias . '.ID');
|
||||||
$criteria->addSelectColumn($alias . '.NAME');
|
$criteria->addSelectColumn($alias . '.NAME');
|
||||||
$criteria->addSelectColumn($alias . '.REPEATS');
|
$criteria->addSelectColumn($alias . '.REPEATS');
|
||||||
$criteria->addSelectColumn($alias . '.DESCRIPTION');
|
$criteria->addSelectColumn($alias . '.DESCRIPTION');
|
||||||
|
$criteria->addSelectColumn($alias . '.COLOR');
|
||||||
|
$criteria->addSelectColumn($alias . '.BACKGROUND_COLOR');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,15 @@
|
||||||
* @method CcShowQuery orderByDbName($order = Criteria::ASC) Order by the name column
|
* @method CcShowQuery orderByDbName($order = Criteria::ASC) Order by the name column
|
||||||
* @method CcShowQuery orderByDbRepeats($order = Criteria::ASC) Order by the repeats column
|
* @method CcShowQuery orderByDbRepeats($order = Criteria::ASC) Order by the repeats column
|
||||||
* @method CcShowQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
|
* @method CcShowQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
|
||||||
|
* @method CcShowQuery orderByDbColor($order = Criteria::ASC) Order by the color column
|
||||||
|
* @method CcShowQuery orderByDbBackgroundColor($order = Criteria::ASC) Order by the background_color column
|
||||||
*
|
*
|
||||||
* @method CcShowQuery groupByDbId() Group by the id column
|
* @method CcShowQuery groupByDbId() Group by the id column
|
||||||
* @method CcShowQuery groupByDbName() Group by the name column
|
* @method CcShowQuery groupByDbName() Group by the name column
|
||||||
* @method CcShowQuery groupByDbRepeats() Group by the repeats column
|
* @method CcShowQuery groupByDbRepeats() Group by the repeats column
|
||||||
* @method CcShowQuery groupByDbDescription() Group by the description column
|
* @method CcShowQuery groupByDbDescription() Group by the description column
|
||||||
|
* @method CcShowQuery groupByDbColor() Group by the color column
|
||||||
|
* @method CcShowQuery groupByDbBackgroundColor() Group by the background_color column
|
||||||
*
|
*
|
||||||
* @method CcShowQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
* @method CcShowQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
* @method CcShowQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
* @method CcShowQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
@ -39,11 +43,15 @@
|
||||||
* @method CcShow findOneByDbName(string $name) Return the first CcShow filtered by the name column
|
* @method CcShow findOneByDbName(string $name) Return the first CcShow filtered by the name column
|
||||||
* @method CcShow findOneByDbRepeats(int $repeats) Return the first CcShow filtered by the repeats column
|
* @method CcShow findOneByDbRepeats(int $repeats) Return the first CcShow filtered by the repeats column
|
||||||
* @method CcShow findOneByDbDescription(string $description) Return the first CcShow filtered by the description column
|
* @method CcShow findOneByDbDescription(string $description) Return the first CcShow filtered by the description column
|
||||||
|
* @method CcShow findOneByDbColor(string $color) Return the first CcShow filtered by the color column
|
||||||
|
* @method CcShow findOneByDbBackgroundColor(string $background_color) Return the first CcShow filtered by the background_color column
|
||||||
*
|
*
|
||||||
* @method array findByDbId(int $id) Return CcShow objects filtered by the id column
|
* @method array findByDbId(int $id) Return CcShow objects filtered by the id column
|
||||||
* @method array findByDbName(string $name) Return CcShow objects filtered by the name column
|
* @method array findByDbName(string $name) Return CcShow objects filtered by the name column
|
||||||
* @method array findByDbRepeats(int $repeats) Return CcShow objects filtered by the repeats column
|
* @method array findByDbRepeats(int $repeats) Return CcShow objects filtered by the repeats column
|
||||||
* @method array findByDbDescription(string $description) Return CcShow objects filtered by the description column
|
* @method array findByDbDescription(string $description) Return CcShow objects filtered by the description column
|
||||||
|
* @method array findByDbColor(string $color) Return CcShow objects filtered by the color column
|
||||||
|
* @method array findByDbBackgroundColor(string $background_color) Return CcShow objects filtered by the background_color column
|
||||||
*
|
*
|
||||||
* @package propel.generator.airtime.om
|
* @package propel.generator.airtime.om
|
||||||
*/
|
*/
|
||||||
|
@ -245,6 +253,50 @@ abstract class BaseCcShowQuery extends ModelCriteria
|
||||||
return $this->addUsingAlias(CcShowPeer::DESCRIPTION, $dbDescription, $comparison);
|
return $this->addUsingAlias(CcShowPeer::DESCRIPTION, $dbDescription, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the color column
|
||||||
|
*
|
||||||
|
* @param string $dbColor The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CcShowQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByDbColor($dbColor = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($dbColor)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $dbColor)) {
|
||||||
|
$dbColor = str_replace('*', '%', $dbColor);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->addUsingAlias(CcShowPeer::COLOR, $dbColor, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the background_color column
|
||||||
|
*
|
||||||
|
* @param string $dbBackgroundColor The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CcShowQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByDbBackgroundColor($dbBackgroundColor = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($dbBackgroundColor)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $dbBackgroundColor)) {
|
||||||
|
$dbBackgroundColor = str_replace('*', '%', $dbBackgroundColor);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->addUsingAlias(CcShowPeer::BACKGROUND_COLOR, $dbBackgroundColor, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related CcShowDays object
|
* Filter the query by a related CcShowDays object
|
||||||
*
|
*
|
||||||
|
|
|
@ -1 +1,24 @@
|
||||||
<br /><br /><center>View script for controller <b>Schedule</b> and script/action name <b>addShowDialog</b></center>
|
<form>
|
||||||
|
<div id="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#schedule-show-what"><span>What</span></a></li>
|
||||||
|
<li><a href="#schedule-show-when"><span>When</span></a></li>
|
||||||
|
<li><a href="#schedule-show-who"><span>Who</span></a></li>
|
||||||
|
<li><a href="#schedule-show-style"><span>Style</span></a></li>
|
||||||
|
</ul>
|
||||||
|
<div id="schedule-show-what">
|
||||||
|
<?php echo $this->what ?>
|
||||||
|
</div>
|
||||||
|
<div id="schedule-show-when">
|
||||||
|
<div id="show_overlap_error"/>
|
||||||
|
<?php echo $this->when ?>
|
||||||
|
<?php echo $this->repeats ?>
|
||||||
|
</div>
|
||||||
|
<div id="schedule-show-who">
|
||||||
|
<?php echo $this->who ?>
|
||||||
|
</div>
|
||||||
|
<div id="schedule-show-style">
|
||||||
|
<?php echo $this->style ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
|
@ -126,6 +126,8 @@
|
||||||
<column name="name" phpName="DbName" type="VARCHAR" size="255" required="true" defaultValue=""/>
|
<column name="name" phpName="DbName" type="VARCHAR" size="255" required="true" defaultValue=""/>
|
||||||
<column name="repeats" phpName="DbRepeats" type="TINYINT" required="true"/>
|
<column name="repeats" phpName="DbRepeats" type="TINYINT" required="true"/>
|
||||||
<column name="description" phpName="DbDescription" type="VARCHAR" size="512" required="false"/>
|
<column name="description" phpName="DbDescription" type="VARCHAR" size="512" required="false"/>
|
||||||
|
<column name="color" phpName="DbColor" type="VARCHAR" size="6" required="false"/>
|
||||||
|
<column name="background_color" phpName="DbBackgroundColor" type="VARCHAR" size="6" required="false"/>
|
||||||
</table>
|
</table>
|
||||||
<table name="cc_show_days" phpName="CcShowDays">
|
<table name="cc_show_days" phpName="CcShowDays">
|
||||||
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
|
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
|
||||||
|
|
|
@ -164,6 +164,8 @@ CREATE TABLE "cc_show"
|
||||||
"name" VARCHAR(255) default '' NOT NULL,
|
"name" VARCHAR(255) default '' NOT NULL,
|
||||||
"repeats" INT2 NOT NULL,
|
"repeats" INT2 NOT NULL,
|
||||||
"description" VARCHAR(512),
|
"description" VARCHAR(512),
|
||||||
|
"color" VARCHAR(6),
|
||||||
|
"background_color" VARCHAR(6),
|
||||||
PRIMARY KEY ("id")
|
PRIMARY KEY ("id")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
162
public/css/colorpicker/css/colorpicker.css
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
.colorpicker {
|
||||||
|
width: 356px;
|
||||||
|
height: 176px;
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute;
|
||||||
|
background: url(../images/colorpicker_background.png);
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
display: none;
|
||||||
|
z-index: 1003; /* so it can display above the jQuery dialog*/
|
||||||
|
}
|
||||||
|
.colorpicker_color {
|
||||||
|
width: 150px;
|
||||||
|
height: 150px;
|
||||||
|
left: 14px;
|
||||||
|
top: 13px;
|
||||||
|
position: absolute;
|
||||||
|
background: #f00;
|
||||||
|
overflow: hidden;
|
||||||
|
cursor: crosshair;
|
||||||
|
}
|
||||||
|
.colorpicker_color div {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 150px;
|
||||||
|
height: 150px;
|
||||||
|
background: url(../images/colorpicker_overlay.png);
|
||||||
|
}
|
||||||
|
.colorpicker_color div div {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 11px;
|
||||||
|
height: 11px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: url(../images/colorpicker_select.gif);
|
||||||
|
margin: -5px 0 0 -5px;
|
||||||
|
}
|
||||||
|
.colorpicker_hue {
|
||||||
|
position: absolute;
|
||||||
|
top: 13px;
|
||||||
|
left: 171px;
|
||||||
|
width: 35px;
|
||||||
|
height: 150px;
|
||||||
|
cursor: n-resize;
|
||||||
|
}
|
||||||
|
.colorpicker_hue div {
|
||||||
|
position: absolute;
|
||||||
|
width: 35px;
|
||||||
|
height: 9px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: url(../images/colorpicker_indic.gif) left top;
|
||||||
|
margin: -4px 0 0 0;
|
||||||
|
left: 0px;
|
||||||
|
}
|
||||||
|
.colorpicker_new_color {
|
||||||
|
position: absolute;
|
||||||
|
width: 60px;
|
||||||
|
height: 30px;
|
||||||
|
left: 213px;
|
||||||
|
top: 13px;
|
||||||
|
background: #f00;
|
||||||
|
}
|
||||||
|
.colorpicker_current_color {
|
||||||
|
position: absolute;
|
||||||
|
width: 60px;
|
||||||
|
height: 30px;
|
||||||
|
left: 283px;
|
||||||
|
top: 13px;
|
||||||
|
background: #f00;
|
||||||
|
}
|
||||||
|
.colorpicker input {
|
||||||
|
background-color: transparent;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
position: absolute;
|
||||||
|
font-size: 10px;
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
color: #898989;
|
||||||
|
top: 4px;
|
||||||
|
right: 11px;
|
||||||
|
text-align: right;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
height: 11px;
|
||||||
|
}
|
||||||
|
.colorpicker_hex {
|
||||||
|
position: absolute;
|
||||||
|
width: 72px;
|
||||||
|
height: 22px;
|
||||||
|
background: url(../images/colorpicker_hex.png) top;
|
||||||
|
left: 212px;
|
||||||
|
top: 142px;
|
||||||
|
}
|
||||||
|
.colorpicker_hex input {
|
||||||
|
right: 6px;
|
||||||
|
}
|
||||||
|
.colorpicker_field {
|
||||||
|
height: 22px;
|
||||||
|
width: 62px;
|
||||||
|
background-position: top;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
.colorpicker_field span {
|
||||||
|
position: absolute;
|
||||||
|
width: 12px;
|
||||||
|
height: 22px;
|
||||||
|
overflow: hidden;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
cursor: n-resize;
|
||||||
|
}
|
||||||
|
.colorpicker_rgb_r {
|
||||||
|
background-image: url(../images/colorpicker_rgb_r.png);
|
||||||
|
top: 52px;
|
||||||
|
left: 212px;
|
||||||
|
}
|
||||||
|
.colorpicker_rgb_g {
|
||||||
|
background-image: url(../images/colorpicker_rgb_g.png);
|
||||||
|
top: 82px;
|
||||||
|
left: 212px;
|
||||||
|
}
|
||||||
|
.colorpicker_rgb_b {
|
||||||
|
background-image: url(../images/colorpicker_rgb_b.png);
|
||||||
|
top: 112px;
|
||||||
|
left: 212px;
|
||||||
|
}
|
||||||
|
.colorpicker_hsb_h {
|
||||||
|
background-image: url(../images/colorpicker_hsb_h.png);
|
||||||
|
top: 52px;
|
||||||
|
left: 282px;
|
||||||
|
}
|
||||||
|
.colorpicker_hsb_s {
|
||||||
|
background-image: url(../images/colorpicker_hsb_s.png);
|
||||||
|
top: 82px;
|
||||||
|
left: 282px;
|
||||||
|
}
|
||||||
|
.colorpicker_hsb_b {
|
||||||
|
background-image: url(../images/colorpicker_hsb_b.png);
|
||||||
|
top: 112px;
|
||||||
|
left: 282px;
|
||||||
|
}
|
||||||
|
.colorpicker_submit {
|
||||||
|
position: absolute;
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
background: url(../images/colorpicker_submit.png) top;
|
||||||
|
left: 322px;
|
||||||
|
top: 142px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.colorpicker_focus {
|
||||||
|
background-position: center;
|
||||||
|
}
|
||||||
|
.colorpicker_hex.colorpicker_focus {
|
||||||
|
background-position: bottom;
|
||||||
|
}
|
||||||
|
.colorpicker_submit.colorpicker_focus {
|
||||||
|
background-position: bottom;
|
||||||
|
}
|
||||||
|
.colorpicker_slider {
|
||||||
|
background-position: bottom;
|
||||||
|
}
|
BIN
public/css/colorpicker/images/Thumbs.db
Normal file
BIN
public/css/colorpicker/images/blank.gif
Normal file
After Width: | Height: | Size: 49 B |
BIN
public/css/colorpicker/images/colorpicker_background.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
public/css/colorpicker/images/colorpicker_hex.png
Normal file
After Width: | Height: | Size: 532 B |
BIN
public/css/colorpicker/images/colorpicker_hsb_b.png
Normal file
After Width: | Height: | Size: 970 B |
BIN
public/css/colorpicker/images/colorpicker_hsb_h.png
Normal file
After Width: | Height: | Size: 1,012 B |
BIN
public/css/colorpicker/images/colorpicker_hsb_s.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
public/css/colorpicker/images/colorpicker_indic.gif
Normal file
After Width: | Height: | Size: 86 B |
BIN
public/css/colorpicker/images/colorpicker_overlay.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
public/css/colorpicker/images/colorpicker_rgb_b.png
Normal file
After Width: | Height: | Size: 970 B |
BIN
public/css/colorpicker/images/colorpicker_rgb_g.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
public/css/colorpicker/images/colorpicker_rgb_r.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
public/css/colorpicker/images/colorpicker_select.gif
Normal file
After Width: | Height: | Size: 78 B |
BIN
public/css/colorpicker/images/colorpicker_submit.png
Normal file
After Width: | Height: | Size: 984 B |
BIN
public/css/colorpicker/images/custom_background.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
public/css/colorpicker/images/custom_hex.png
Normal file
After Width: | Height: | Size: 562 B |
BIN
public/css/colorpicker/images/custom_hsb_b.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
public/css/colorpicker/images/custom_hsb_h.png
Normal file
After Width: | Height: | Size: 970 B |
BIN
public/css/colorpicker/images/custom_hsb_s.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
public/css/colorpicker/images/custom_indic.gif
Normal file
After Width: | Height: | Size: 86 B |
BIN
public/css/colorpicker/images/custom_rgb_b.png
Normal file
After Width: | Height: | Size: 1,008 B |
BIN
public/css/colorpicker/images/custom_rgb_g.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
public/css/colorpicker/images/custom_rgb_r.png
Normal file
After Width: | Height: | Size: 1,018 B |
BIN
public/css/colorpicker/images/custom_submit.png
Normal file
After Width: | Height: | Size: 997 B |
BIN
public/css/colorpicker/images/select.png
Normal file
After Width: | Height: | Size: 506 B |
BIN
public/css/colorpicker/images/select2.png
Normal file
After Width: | Height: | Size: 518 B |
BIN
public/css/colorpicker/images/slider.png
Normal file
After Width: | Height: | Size: 315 B |
|
@ -104,3 +104,20 @@ div.ui-datepicker {
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add show Dialog----------------------------------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#add_show_name {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#add_show_description {
|
||||||
|
width: 400px;
|
||||||
|
height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,20 +59,14 @@ function submitShow() {
|
||||||
$.post("/Schedule/add-show-dialog/format/json",
|
$.post("/Schedule/add-show-dialog/format/json",
|
||||||
formData,
|
formData,
|
||||||
function(data){
|
function(data){
|
||||||
if(data.form) {
|
if(data.content) {
|
||||||
|
|
||||||
dialog.find("form").remove();
|
dialog.find("form").remove();
|
||||||
dialog.find("#show_overlap_error").remove();
|
makeShowDialog(dialog, data);
|
||||||
dialog.append(data.form);
|
|
||||||
|
|
||||||
var start = dialog.find("#start_date");
|
|
||||||
var end = dialog.find("#end_date");
|
|
||||||
|
|
||||||
createDateInput(start, startDpSelect);
|
|
||||||
createDateInput(end, endDpSelect);
|
|
||||||
|
|
||||||
if(data.overlap) {
|
if(data.overlap) {
|
||||||
var div, table, tr, days;
|
var div, table, tr, days;
|
||||||
div = $('<div id="show_overlap_error"/>');
|
div = dialog.find("#show_overlap_error");
|
||||||
table = $('<table/>');
|
table = $('<table/>');
|
||||||
days = $.datepicker.regional[''].dayNamesShort;
|
days = $.datepicker.regional[''].dayNamesShort;
|
||||||
|
|
||||||
|
@ -111,17 +105,13 @@ function autoSelect(event, ui) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeShowDialog(json) {
|
function makeShowDialog(dialog, json) {
|
||||||
|
|
||||||
var dialog;
|
|
||||||
|
|
||||||
//main jqueryUI dialog
|
dialog.append(json.content);
|
||||||
dialog = $('<div id="schedule_add_event_dialog" />');
|
dialog.find("#tabs").tabs();
|
||||||
|
|
||||||
dialog.append(json.form);
|
var start = dialog.find("#add_show_start_date");
|
||||||
|
var end = dialog.find("#add_show_end_date");
|
||||||
var start = dialog.find("#start_date");
|
|
||||||
var end = dialog.find("#end_date");
|
|
||||||
|
|
||||||
createDateInput(start, startDpSelect);
|
createDateInput(start, startDpSelect);
|
||||||
createDateInput(end, endDpSelect);
|
createDateInput(end, endDpSelect);
|
||||||
|
@ -130,20 +120,19 @@ function makeShowDialog(json) {
|
||||||
return {value: el.id, label: el.login};
|
return {value: el.id, label: el.login};
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.find("#hosts_autocomplete").autocomplete({
|
dialog.find("#add_show_hosts_autocomplete").autocomplete({
|
||||||
source: auto,
|
source: auto,
|
||||||
select: autoSelect
|
select: autoSelect
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dialog.find("#schedule-show-style input").ColorPicker({
|
||||||
dialog.dialog({
|
onSubmit: function(hsb, hex, rgb, el) {
|
||||||
autoOpen: false,
|
$(el).val(hex);
|
||||||
title: 'Add Show',
|
$(el).ColorPickerHide();
|
||||||
width: 950,
|
},
|
||||||
height: 400,
|
onBeforeShow: function () {
|
||||||
modal: true,
|
$(this).ColorPickerSetColor(this.value);
|
||||||
close: closeDialog,
|
}
|
||||||
buttons: { "Cancel": closeDialog, "Ok": submitShow}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return dialog;
|
return dialog;
|
||||||
|
@ -155,7 +144,22 @@ function openShowDialog() {
|
||||||
url = '/Schedule/add-show-dialog/format/json';
|
url = '/Schedule/add-show-dialog/format/json';
|
||||||
|
|
||||||
$.get(url, function(json){
|
$.get(url, function(json){
|
||||||
var dialog = makeShowDialog(json);
|
|
||||||
|
var dialog;
|
||||||
|
|
||||||
|
//main jqueryUI dialog
|
||||||
|
dialog = $('<div id="schedule_add_event_dialog" />');
|
||||||
|
makeShowDialog(dialog, json);
|
||||||
|
|
||||||
|
dialog.dialog({
|
||||||
|
autoOpen: false,
|
||||||
|
title: 'Add Show',
|
||||||
|
width: 1100,
|
||||||
|
height: 500,
|
||||||
|
modal: true,
|
||||||
|
close: closeDialog,
|
||||||
|
buttons: { "Cancel": closeDialog, "Ok": submitShow}
|
||||||
|
});
|
||||||
|
|
||||||
dialog.dialog('open');
|
dialog.dialog('open');
|
||||||
});
|
});
|
||||||
|
@ -373,12 +377,19 @@ function eventRender(event, element, view) {
|
||||||
|
|
||||||
$(element).find(".fc-event-title").after(div);
|
$(element).find(".fc-event-title").after(div);
|
||||||
|
|
||||||
$(element)
|
|
||||||
.css({'border-color': 'red'})
|
|
||||||
.find(".fc-event-time, a")
|
|
||||||
.css({'background-color': 'red', 'border-color': 'red', 'color': 'white'});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(event.backgroundColor !== "") {
|
||||||
|
$(element)
|
||||||
|
.css({'border-color': '#'+event.backgroundColor})
|
||||||
|
.find(".fc-event-time, a")
|
||||||
|
.css({'background-color': '#'+event.backgroundColor, 'border-color': '#'+event.backgroundColor});
|
||||||
|
}
|
||||||
|
if(event.color !== "") {
|
||||||
|
$(element)
|
||||||
|
.find(".fc-event-time, a")
|
||||||
|
.css({'color': '#'+event.color});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function eventAfterRender( event, element, view ) {
|
function eventAfterRender( event, element, view ) {
|
||||||
|
|
484
public/js/colorpicker/js/colorpicker.js
Normal file
|
@ -0,0 +1,484 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Color picker
|
||||||
|
* Author: Stefan Petre www.eyecon.ro
|
||||||
|
*
|
||||||
|
* Dual licensed under the MIT and GPL licenses
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
(function ($) {
|
||||||
|
var ColorPicker = function () {
|
||||||
|
var
|
||||||
|
ids = {},
|
||||||
|
inAction,
|
||||||
|
charMin = 65,
|
||||||
|
visible,
|
||||||
|
tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
|
||||||
|
defaults = {
|
||||||
|
eventName: 'click',
|
||||||
|
onShow: function () {},
|
||||||
|
onBeforeShow: function(){},
|
||||||
|
onHide: function () {},
|
||||||
|
onChange: function () {},
|
||||||
|
onSubmit: function () {},
|
||||||
|
color: 'ff0000',
|
||||||
|
livePreview: true,
|
||||||
|
flat: false
|
||||||
|
},
|
||||||
|
fillRGBFields = function (hsb, cal) {
|
||||||
|
var rgb = HSBToRGB(hsb);
|
||||||
|
$(cal).data('colorpicker').fields
|
||||||
|
.eq(1).val(rgb.r).end()
|
||||||
|
.eq(2).val(rgb.g).end()
|
||||||
|
.eq(3).val(rgb.b).end();
|
||||||
|
},
|
||||||
|
fillHSBFields = function (hsb, cal) {
|
||||||
|
$(cal).data('colorpicker').fields
|
||||||
|
.eq(4).val(hsb.h).end()
|
||||||
|
.eq(5).val(hsb.s).end()
|
||||||
|
.eq(6).val(hsb.b).end();
|
||||||
|
},
|
||||||
|
fillHexFields = function (hsb, cal) {
|
||||||
|
$(cal).data('colorpicker').fields
|
||||||
|
.eq(0).val(HSBToHex(hsb)).end();
|
||||||
|
},
|
||||||
|
setSelector = function (hsb, cal) {
|
||||||
|
$(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
|
||||||
|
$(cal).data('colorpicker').selectorIndic.css({
|
||||||
|
left: parseInt(150 * hsb.s/100, 10),
|
||||||
|
top: parseInt(150 * (100-hsb.b)/100, 10)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setHue = function (hsb, cal) {
|
||||||
|
$(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
|
||||||
|
},
|
||||||
|
setCurrentColor = function (hsb, cal) {
|
||||||
|
$(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
|
||||||
|
},
|
||||||
|
setNewColor = function (hsb, cal) {
|
||||||
|
$(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
|
||||||
|
},
|
||||||
|
keyDown = function (ev) {
|
||||||
|
var pressedKey = ev.charCode || ev.keyCode || -1;
|
||||||
|
if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var cal = $(this).parent().parent();
|
||||||
|
if (cal.data('colorpicker').livePreview === true) {
|
||||||
|
change.apply(this);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
change = function (ev) {
|
||||||
|
var cal = $(this).parent().parent(), col;
|
||||||
|
if (this.parentNode.className.indexOf('_hex') > 0) {
|
||||||
|
cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
|
||||||
|
} else if (this.parentNode.className.indexOf('_hsb') > 0) {
|
||||||
|
cal.data('colorpicker').color = col = fixHSB({
|
||||||
|
h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
|
||||||
|
s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
|
||||||
|
b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
|
||||||
|
r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
|
||||||
|
g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
|
||||||
|
b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
if (ev) {
|
||||||
|
fillRGBFields(col, cal.get(0));
|
||||||
|
fillHexFields(col, cal.get(0));
|
||||||
|
fillHSBFields(col, cal.get(0));
|
||||||
|
}
|
||||||
|
setSelector(col, cal.get(0));
|
||||||
|
setHue(col, cal.get(0));
|
||||||
|
setNewColor(col, cal.get(0));
|
||||||
|
cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
|
||||||
|
},
|
||||||
|
blur = function (ev) {
|
||||||
|
var cal = $(this).parent().parent();
|
||||||
|
cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
|
||||||
|
},
|
||||||
|
focus = function () {
|
||||||
|
charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
|
||||||
|
$(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
|
||||||
|
$(this).parent().addClass('colorpicker_focus');
|
||||||
|
},
|
||||||
|
downIncrement = function (ev) {
|
||||||
|
var field = $(this).parent().find('input').focus();
|
||||||
|
var current = {
|
||||||
|
el: $(this).parent().addClass('colorpicker_slider'),
|
||||||
|
max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
|
||||||
|
y: ev.pageY,
|
||||||
|
field: field,
|
||||||
|
val: parseInt(field.val(), 10),
|
||||||
|
preview: $(this).parent().parent().data('colorpicker').livePreview
|
||||||
|
};
|
||||||
|
$(document).bind('mouseup', current, upIncrement);
|
||||||
|
$(document).bind('mousemove', current, moveIncrement);
|
||||||
|
},
|
||||||
|
moveIncrement = function (ev) {
|
||||||
|
ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
|
||||||
|
if (ev.data.preview) {
|
||||||
|
change.apply(ev.data.field.get(0), [true]);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
upIncrement = function (ev) {
|
||||||
|
change.apply(ev.data.field.get(0), [true]);
|
||||||
|
ev.data.el.removeClass('colorpicker_slider').find('input').focus();
|
||||||
|
$(document).unbind('mouseup', upIncrement);
|
||||||
|
$(document).unbind('mousemove', moveIncrement);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
downHue = function (ev) {
|
||||||
|
var current = {
|
||||||
|
cal: $(this).parent(),
|
||||||
|
y: $(this).offset().top
|
||||||
|
};
|
||||||
|
current.preview = current.cal.data('colorpicker').livePreview;
|
||||||
|
$(document).bind('mouseup', current, upHue);
|
||||||
|
$(document).bind('mousemove', current, moveHue);
|
||||||
|
},
|
||||||
|
moveHue = function (ev) {
|
||||||
|
change.apply(
|
||||||
|
ev.data.cal.data('colorpicker')
|
||||||
|
.fields
|
||||||
|
.eq(4)
|
||||||
|
.val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
|
||||||
|
.get(0),
|
||||||
|
[ev.data.preview]
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
upHue = function (ev) {
|
||||||
|
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||||
|
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||||
|
$(document).unbind('mouseup', upHue);
|
||||||
|
$(document).unbind('mousemove', moveHue);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
downSelector = function (ev) {
|
||||||
|
var current = {
|
||||||
|
cal: $(this).parent(),
|
||||||
|
pos: $(this).offset()
|
||||||
|
};
|
||||||
|
current.preview = current.cal.data('colorpicker').livePreview;
|
||||||
|
$(document).bind('mouseup', current, upSelector);
|
||||||
|
$(document).bind('mousemove', current, moveSelector);
|
||||||
|
},
|
||||||
|
moveSelector = function (ev) {
|
||||||
|
change.apply(
|
||||||
|
ev.data.cal.data('colorpicker')
|
||||||
|
.fields
|
||||||
|
.eq(6)
|
||||||
|
.val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
|
||||||
|
.end()
|
||||||
|
.eq(5)
|
||||||
|
.val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
|
||||||
|
.get(0),
|
||||||
|
[ev.data.preview]
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
upSelector = function (ev) {
|
||||||
|
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||||
|
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
|
||||||
|
$(document).unbind('mouseup', upSelector);
|
||||||
|
$(document).unbind('mousemove', moveSelector);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
enterSubmit = function (ev) {
|
||||||
|
$(this).addClass('colorpicker_focus');
|
||||||
|
},
|
||||||
|
leaveSubmit = function (ev) {
|
||||||
|
$(this).removeClass('colorpicker_focus');
|
||||||
|
},
|
||||||
|
clickSubmit = function (ev) {
|
||||||
|
var cal = $(this).parent();
|
||||||
|
var col = cal.data('colorpicker').color;
|
||||||
|
cal.data('colorpicker').origColor = col;
|
||||||
|
setCurrentColor(col, cal.get(0));
|
||||||
|
cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
|
||||||
|
},
|
||||||
|
show = function (ev) {
|
||||||
|
var cal = $('#' + $(this).data('colorpickerId'));
|
||||||
|
cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
|
||||||
|
var pos = $(this).offset();
|
||||||
|
var viewPort = getViewport();
|
||||||
|
var top = pos.top + this.offsetHeight;
|
||||||
|
var left = pos.left;
|
||||||
|
if (top + 176 > viewPort.t + viewPort.h) {
|
||||||
|
top -= this.offsetHeight + 176;
|
||||||
|
}
|
||||||
|
if (left + 356 > viewPort.l + viewPort.w) {
|
||||||
|
left -= 356;
|
||||||
|
}
|
||||||
|
cal.css({left: left + 'px', top: top + 'px'});
|
||||||
|
if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
|
||||||
|
cal.show();
|
||||||
|
}
|
||||||
|
$(document).bind('mousedown', {cal: cal}, hide);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
hide = function (ev) {
|
||||||
|
if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
|
||||||
|
if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
|
||||||
|
ev.data.cal.hide();
|
||||||
|
}
|
||||||
|
$(document).unbind('mousedown', hide);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isChildOf = function(parentEl, el, container) {
|
||||||
|
if (parentEl == el) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (parentEl.contains) {
|
||||||
|
return parentEl.contains(el);
|
||||||
|
}
|
||||||
|
if ( parentEl.compareDocumentPosition ) {
|
||||||
|
return !!(parentEl.compareDocumentPosition(el) & 16);
|
||||||
|
}
|
||||||
|
var prEl = el.parentNode;
|
||||||
|
while(prEl && prEl != container) {
|
||||||
|
if (prEl == parentEl)
|
||||||
|
return true;
|
||||||
|
prEl = prEl.parentNode;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
getViewport = function () {
|
||||||
|
var m = document.compatMode == 'CSS1Compat';
|
||||||
|
return {
|
||||||
|
l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
|
||||||
|
t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
|
||||||
|
w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
|
||||||
|
h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
|
||||||
|
};
|
||||||
|
},
|
||||||
|
fixHSB = function (hsb) {
|
||||||
|
return {
|
||||||
|
h: Math.min(360, Math.max(0, hsb.h)),
|
||||||
|
s: Math.min(100, Math.max(0, hsb.s)),
|
||||||
|
b: Math.min(100, Math.max(0, hsb.b))
|
||||||
|
};
|
||||||
|
},
|
||||||
|
fixRGB = function (rgb) {
|
||||||
|
return {
|
||||||
|
r: Math.min(255, Math.max(0, rgb.r)),
|
||||||
|
g: Math.min(255, Math.max(0, rgb.g)),
|
||||||
|
b: Math.min(255, Math.max(0, rgb.b))
|
||||||
|
};
|
||||||
|
},
|
||||||
|
fixHex = function (hex) {
|
||||||
|
var len = 6 - hex.length;
|
||||||
|
if (len > 0) {
|
||||||
|
var o = [];
|
||||||
|
for (var i=0; i<len; i++) {
|
||||||
|
o.push('0');
|
||||||
|
}
|
||||||
|
o.push(hex);
|
||||||
|
hex = o.join('');
|
||||||
|
}
|
||||||
|
return hex;
|
||||||
|
},
|
||||||
|
HexToRGB = function (hex) {
|
||||||
|
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
|
||||||
|
return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
|
||||||
|
},
|
||||||
|
HexToHSB = function (hex) {
|
||||||
|
return RGBToHSB(HexToRGB(hex));
|
||||||
|
},
|
||||||
|
RGBToHSB = function (rgb) {
|
||||||
|
var hsb = {
|
||||||
|
h: 0,
|
||||||
|
s: 0,
|
||||||
|
b: 0
|
||||||
|
};
|
||||||
|
var min = Math.min(rgb.r, rgb.g, rgb.b);
|
||||||
|
var max = Math.max(rgb.r, rgb.g, rgb.b);
|
||||||
|
var delta = max - min;
|
||||||
|
hsb.b = max;
|
||||||
|
if (max != 0) {
|
||||||
|
|
||||||
|
}
|
||||||
|
hsb.s = max != 0 ? 255 * delta / max : 0;
|
||||||
|
if (hsb.s != 0) {
|
||||||
|
if (rgb.r == max) {
|
||||||
|
hsb.h = (rgb.g - rgb.b) / delta;
|
||||||
|
} else if (rgb.g == max) {
|
||||||
|
hsb.h = 2 + (rgb.b - rgb.r) / delta;
|
||||||
|
} else {
|
||||||
|
hsb.h = 4 + (rgb.r - rgb.g) / delta;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hsb.h = -1;
|
||||||
|
}
|
||||||
|
hsb.h *= 60;
|
||||||
|
if (hsb.h < 0) {
|
||||||
|
hsb.h += 360;
|
||||||
|
}
|
||||||
|
hsb.s *= 100/255;
|
||||||
|
hsb.b *= 100/255;
|
||||||
|
return hsb;
|
||||||
|
},
|
||||||
|
HSBToRGB = function (hsb) {
|
||||||
|
var rgb = {};
|
||||||
|
var h = Math.round(hsb.h);
|
||||||
|
var s = Math.round(hsb.s*255/100);
|
||||||
|
var v = Math.round(hsb.b*255/100);
|
||||||
|
if(s == 0) {
|
||||||
|
rgb.r = rgb.g = rgb.b = v;
|
||||||
|
} else {
|
||||||
|
var t1 = v;
|
||||||
|
var t2 = (255-s)*v/255;
|
||||||
|
var t3 = (t1-t2)*(h%60)/60;
|
||||||
|
if(h==360) h = 0;
|
||||||
|
if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
|
||||||
|
else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
|
||||||
|
else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
|
||||||
|
else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
|
||||||
|
else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
|
||||||
|
else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
|
||||||
|
else {rgb.r=0; rgb.g=0; rgb.b=0}
|
||||||
|
}
|
||||||
|
return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
|
||||||
|
},
|
||||||
|
RGBToHex = function (rgb) {
|
||||||
|
var hex = [
|
||||||
|
rgb.r.toString(16),
|
||||||
|
rgb.g.toString(16),
|
||||||
|
rgb.b.toString(16)
|
||||||
|
];
|
||||||
|
$.each(hex, function (nr, val) {
|
||||||
|
if (val.length == 1) {
|
||||||
|
hex[nr] = '0' + val;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return hex.join('');
|
||||||
|
},
|
||||||
|
HSBToHex = function (hsb) {
|
||||||
|
return RGBToHex(HSBToRGB(hsb));
|
||||||
|
},
|
||||||
|
restoreOriginal = function () {
|
||||||
|
var cal = $(this).parent();
|
||||||
|
var col = cal.data('colorpicker').origColor;
|
||||||
|
cal.data('colorpicker').color = col;
|
||||||
|
fillRGBFields(col, cal.get(0));
|
||||||
|
fillHexFields(col, cal.get(0));
|
||||||
|
fillHSBFields(col, cal.get(0));
|
||||||
|
setSelector(col, cal.get(0));
|
||||||
|
setHue(col, cal.get(0));
|
||||||
|
setNewColor(col, cal.get(0));
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
init: function (opt) {
|
||||||
|
opt = $.extend({}, defaults, opt||{});
|
||||||
|
if (typeof opt.color == 'string') {
|
||||||
|
opt.color = HexToHSB(opt.color);
|
||||||
|
} else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
|
||||||
|
opt.color = RGBToHSB(opt.color);
|
||||||
|
} else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
|
||||||
|
opt.color = fixHSB(opt.color);
|
||||||
|
} else {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return this.each(function () {
|
||||||
|
if (!$(this).data('colorpickerId')) {
|
||||||
|
var options = $.extend({}, opt);
|
||||||
|
options.origColor = opt.color;
|
||||||
|
var id = 'collorpicker_' + parseInt(Math.random() * 1000);
|
||||||
|
$(this).data('colorpickerId', id);
|
||||||
|
var cal = $(tpl).attr('id', id);
|
||||||
|
if (options.flat) {
|
||||||
|
cal.appendTo(this).show();
|
||||||
|
} else {
|
||||||
|
cal.appendTo(document.body);
|
||||||
|
}
|
||||||
|
options.fields = cal
|
||||||
|
.find('input')
|
||||||
|
.bind('keyup', keyDown)
|
||||||
|
.bind('change', change)
|
||||||
|
.bind('blur', blur)
|
||||||
|
.bind('focus', focus);
|
||||||
|
cal
|
||||||
|
.find('span').bind('mousedown', downIncrement).end()
|
||||||
|
.find('>div.colorpicker_current_color').bind('click', restoreOriginal);
|
||||||
|
options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
|
||||||
|
options.selectorIndic = options.selector.find('div div');
|
||||||
|
options.el = this;
|
||||||
|
options.hue = cal.find('div.colorpicker_hue div');
|
||||||
|
cal.find('div.colorpicker_hue').bind('mousedown', downHue);
|
||||||
|
options.newColor = cal.find('div.colorpicker_new_color');
|
||||||
|
options.currentColor = cal.find('div.colorpicker_current_color');
|
||||||
|
cal.data('colorpicker', options);
|
||||||
|
cal.find('div.colorpicker_submit')
|
||||||
|
.bind('mouseenter', enterSubmit)
|
||||||
|
.bind('mouseleave', leaveSubmit)
|
||||||
|
.bind('click', clickSubmit);
|
||||||
|
fillRGBFields(options.color, cal.get(0));
|
||||||
|
fillHSBFields(options.color, cal.get(0));
|
||||||
|
fillHexFields(options.color, cal.get(0));
|
||||||
|
setHue(options.color, cal.get(0));
|
||||||
|
setSelector(options.color, cal.get(0));
|
||||||
|
setCurrentColor(options.color, cal.get(0));
|
||||||
|
setNewColor(options.color, cal.get(0));
|
||||||
|
if (options.flat) {
|
||||||
|
cal.css({
|
||||||
|
position: 'relative',
|
||||||
|
display: 'block'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$(this).bind(options.eventName, show);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
showPicker: function() {
|
||||||
|
return this.each( function () {
|
||||||
|
if ($(this).data('colorpickerId')) {
|
||||||
|
show.apply(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
hidePicker: function() {
|
||||||
|
return this.each( function () {
|
||||||
|
if ($(this).data('colorpickerId')) {
|
||||||
|
$('#' + $(this).data('colorpickerId')).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setColor: function(col) {
|
||||||
|
if (typeof col == 'string') {
|
||||||
|
col = HexToHSB(col);
|
||||||
|
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
|
||||||
|
col = RGBToHSB(col);
|
||||||
|
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
|
||||||
|
col = fixHSB(col);
|
||||||
|
} else {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return this.each(function(){
|
||||||
|
if ($(this).data('colorpickerId')) {
|
||||||
|
var cal = $('#' + $(this).data('colorpickerId'));
|
||||||
|
cal.data('colorpicker').color = col;
|
||||||
|
cal.data('colorpicker').origColor = col;
|
||||||
|
fillRGBFields(col, cal.get(0));
|
||||||
|
fillHSBFields(col, cal.get(0));
|
||||||
|
fillHexFields(col, cal.get(0));
|
||||||
|
setHue(col, cal.get(0));
|
||||||
|
setSelector(col, cal.get(0));
|
||||||
|
setCurrentColor(col, cal.get(0));
|
||||||
|
setNewColor(col, cal.get(0));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}();
|
||||||
|
$.fn.extend({
|
||||||
|
ColorPicker: ColorPicker.init,
|
||||||
|
ColorPickerHide: ColorPicker.hidePicker,
|
||||||
|
ColorPickerShow: ColorPicker.showPicker,
|
||||||
|
ColorPickerSetColor: ColorPicker.setColor
|
||||||
|
});
|
||||||
|
})(jQuery)
|