adding a label to the form fields (Datatables column headers)

This commit is contained in:
Naomi 2013-08-07 17:55:18 -04:00
parent aaf2e5c2f6
commit 27b079ace9
11 changed files with 202 additions and 83 deletions

View file

@ -193,11 +193,7 @@ class Application_Form_EditHistoryItem extends Zend_Form
$label = $item[self::ITEM_ID_SUFFIX];
$id = self::ID_PREFIX.$label;
$el = new $formElType[self::ITEM_CLASS]($id);
//cleaning up presentation of tag name for labels.
$label = implode(" ", explode("_", $label));
$label = ucwords($label);
$el->setLabel(_($label));
$el->setLabel($item["label"]);
if (isset($formElType["attrs"])) {

View file

@ -41,6 +41,7 @@ class CcPlayoutHistoryTemplateFieldTableMap extends TableMap {
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('TEMPLATE_ID', 'DbTemplateId', 'INTEGER', 'cc_playout_history_template', 'ID', true, null, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 128, null);
$this->addColumn('LABEL', 'DbLabel', 'VARCHAR', true, 128, null);
$this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 128, null);
$this->addColumn('IS_FILE_MD', 'DbIsFileMD', 'BOOLEAN', true, null, false);
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', true, null, null);

View file

@ -42,6 +42,12 @@ abstract class BaseCcPlayoutHistoryTemplateField extends BaseObject implements
*/
protected $name;
/**
* The value for the label field.
* @var string
*/
protected $label;
/**
* The value for the type field.
* @var string
@ -131,6 +137,16 @@ abstract class BaseCcPlayoutHistoryTemplateField extends BaseObject implements
return $this->name;
}
/**
* Get the [label] column value.
*
* @return string
*/
public function getDbLabel()
{
return $this->label;
}
/**
* Get the [type] column value.
*
@ -225,6 +241,26 @@ abstract class BaseCcPlayoutHistoryTemplateField extends BaseObject implements
return $this;
} // setDbName()
/**
* Set the value of [label] column.
*
* @param string $v new value
* @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
*/
public function setDbLabel($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->label !== $v) {
$this->label = $v;
$this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::LABEL;
}
return $this;
} // setDbLabel()
/**
* Set the value of [type] column.
*
@ -324,9 +360,10 @@ abstract class BaseCcPlayoutHistoryTemplateField extends BaseObject implements
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->template_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
$this->name = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->type = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->is_file_md = ($row[$startcol + 4] !== null) ? (boolean) $row[$startcol + 4] : null;
$this->position = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
$this->label = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->type = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
$this->is_file_md = ($row[$startcol + 5] !== null) ? (boolean) $row[$startcol + 5] : null;
$this->position = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
$this->resetModified();
$this->setNew(false);
@ -335,7 +372,7 @@ abstract class BaseCcPlayoutHistoryTemplateField extends BaseObject implements
$this->ensureConsistency();
}
return $startcol + 6; // 6 = CcPlayoutHistoryTemplateFieldPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateFieldPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 7; // 7 = CcPlayoutHistoryTemplateFieldPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateFieldPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcPlayoutHistoryTemplateField object", $e);
@ -672,12 +709,15 @@ abstract class BaseCcPlayoutHistoryTemplateField extends BaseObject implements
return $this->getDbName();
break;
case 3:
return $this->getDbType();
return $this->getDbLabel();
break;
case 4:
return $this->getDbIsFileMD();
return $this->getDbType();
break;
case 5:
return $this->getDbIsFileMD();
break;
case 6:
return $this->getDbPosition();
break;
default:
@ -707,9 +747,10 @@ abstract class BaseCcPlayoutHistoryTemplateField extends BaseObject implements
$keys[0] => $this->getDbId(),
$keys[1] => $this->getDbTemplateId(),
$keys[2] => $this->getDbName(),
$keys[3] => $this->getDbType(),
$keys[4] => $this->getDbIsFileMD(),
$keys[5] => $this->getDbPosition(),
$keys[3] => $this->getDbLabel(),
$keys[4] => $this->getDbType(),
$keys[5] => $this->getDbIsFileMD(),
$keys[6] => $this->getDbPosition(),
);
if ($includeForeignObjects) {
if (null !== $this->aCcPlayoutHistoryTemplate) {
@ -756,12 +797,15 @@ abstract class BaseCcPlayoutHistoryTemplateField extends BaseObject implements
$this->setDbName($value);
break;
case 3:
$this->setDbType($value);
$this->setDbLabel($value);
break;
case 4:
$this->setDbIsFileMD($value);
$this->setDbType($value);
break;
case 5:
$this->setDbIsFileMD($value);
break;
case 6:
$this->setDbPosition($value);
break;
} // switch()
@ -791,9 +835,10 @@ abstract class BaseCcPlayoutHistoryTemplateField extends BaseObject implements
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setDbTemplateId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDbName($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDbType($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setDbIsFileMD($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setDbPosition($arr[$keys[5]]);
if (array_key_exists($keys[3], $arr)) $this->setDbLabel($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setDbType($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setDbIsFileMD($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setDbPosition($arr[$keys[6]]);
}
/**
@ -808,6 +853,7 @@ abstract class BaseCcPlayoutHistoryTemplateField extends BaseObject implements
if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::ID)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $this->id);
if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $this->template_id);
if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::NAME)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::NAME, $this->name);
if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::LABEL)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::LABEL, $this->label);
if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::TYPE)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::TYPE, $this->type);
if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD, $this->is_file_md);
if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::POSITION)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::POSITION, $this->position);
@ -874,6 +920,7 @@ abstract class BaseCcPlayoutHistoryTemplateField extends BaseObject implements
{
$copyObj->setDbTemplateId($this->template_id);
$copyObj->setDbName($this->name);
$copyObj->setDbLabel($this->label);
$copyObj->setDbType($this->type);
$copyObj->setDbIsFileMD($this->is_file_md);
$copyObj->setDbPosition($this->position);
@ -977,6 +1024,7 @@ abstract class BaseCcPlayoutHistoryTemplateField extends BaseObject implements
$this->id = null;
$this->template_id = null;
$this->name = null;
$this->label = null;
$this->type = null;
$this->is_file_md = null;
$this->position = null;

View file

@ -26,7 +26,7 @@ abstract class BaseCcPlayoutHistoryTemplateFieldPeer {
const TM_CLASS = 'CcPlayoutHistoryTemplateFieldTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 6;
const NUM_COLUMNS = 7;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@ -40,6 +40,9 @@ abstract class BaseCcPlayoutHistoryTemplateFieldPeer {
/** the column name for the NAME field */
const NAME = 'cc_playout_history_template_field.NAME';
/** the column name for the LABEL field */
const LABEL = 'cc_playout_history_template_field.LABEL';
/** the column name for the TYPE field */
const TYPE = 'cc_playout_history_template_field.TYPE';
@ -65,12 +68,12 @@ abstract class BaseCcPlayoutHistoryTemplateFieldPeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTemplateId', 'DbName', 'DbType', 'DbIsFileMD', 'DbPosition', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTemplateId', 'dbName', 'dbType', 'dbIsFileMD', 'dbPosition', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::TEMPLATE_ID, self::NAME, self::TYPE, self::IS_FILE_MD, self::POSITION, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TEMPLATE_ID', 'NAME', 'TYPE', 'IS_FILE_MD', 'POSITION', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'template_id', 'name', 'type', 'is_file_md', 'position', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTemplateId', 'DbName', 'DbLabel', 'DbType', 'DbIsFileMD', 'DbPosition', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTemplateId', 'dbName', 'dbLabel', 'dbType', 'dbIsFileMD', 'dbPosition', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::TEMPLATE_ID, self::NAME, self::LABEL, self::TYPE, self::IS_FILE_MD, self::POSITION, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TEMPLATE_ID', 'NAME', 'LABEL', 'TYPE', 'IS_FILE_MD', 'POSITION', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'template_id', 'name', 'label', 'type', 'is_file_md', 'position', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
);
/**
@ -80,12 +83,12 @@ abstract class BaseCcPlayoutHistoryTemplateFieldPeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbTemplateId' => 1, 'DbName' => 2, 'DbType' => 3, 'DbIsFileMD' => 4, 'DbPosition' => 5, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTemplateId' => 1, 'dbName' => 2, 'dbType' => 3, 'dbIsFileMD' => 4, 'dbPosition' => 5, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TEMPLATE_ID => 1, self::NAME => 2, self::TYPE => 3, self::IS_FILE_MD => 4, self::POSITION => 5, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TEMPLATE_ID' => 1, 'NAME' => 2, 'TYPE' => 3, 'IS_FILE_MD' => 4, 'POSITION' => 5, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'template_id' => 1, 'name' => 2, 'type' => 3, 'is_file_md' => 4, 'position' => 5, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbTemplateId' => 1, 'DbName' => 2, 'DbLabel' => 3, 'DbType' => 4, 'DbIsFileMD' => 5, 'DbPosition' => 6, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTemplateId' => 1, 'dbName' => 2, 'dbLabel' => 3, 'dbType' => 4, 'dbIsFileMD' => 5, 'dbPosition' => 6, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TEMPLATE_ID => 1, self::NAME => 2, self::LABEL => 3, self::TYPE => 4, self::IS_FILE_MD => 5, self::POSITION => 6, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TEMPLATE_ID' => 1, 'NAME' => 2, 'LABEL' => 3, 'TYPE' => 4, 'IS_FILE_MD' => 5, 'POSITION' => 6, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'template_id' => 1, 'name' => 2, 'label' => 3, 'type' => 4, 'is_file_md' => 5, 'position' => 6, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
);
/**
@ -160,6 +163,7 @@ abstract class BaseCcPlayoutHistoryTemplateFieldPeer {
$criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::ID);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::NAME);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::LABEL);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::TYPE);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::POSITION);
@ -167,6 +171,7 @@ abstract class BaseCcPlayoutHistoryTemplateFieldPeer {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.TEMPLATE_ID');
$criteria->addSelectColumn($alias . '.NAME');
$criteria->addSelectColumn($alias . '.LABEL');
$criteria->addSelectColumn($alias . '.TYPE');
$criteria->addSelectColumn($alias . '.IS_FILE_MD');
$criteria->addSelectColumn($alias . '.POSITION');

View file

@ -9,6 +9,7 @@
* @method CcPlayoutHistoryTemplateFieldQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcPlayoutHistoryTemplateFieldQuery orderByDbTemplateId($order = Criteria::ASC) Order by the template_id column
* @method CcPlayoutHistoryTemplateFieldQuery orderByDbName($order = Criteria::ASC) Order by the name column
* @method CcPlayoutHistoryTemplateFieldQuery orderByDbLabel($order = Criteria::ASC) Order by the label column
* @method CcPlayoutHistoryTemplateFieldQuery orderByDbType($order = Criteria::ASC) Order by the type column
* @method CcPlayoutHistoryTemplateFieldQuery orderByDbIsFileMD($order = Criteria::ASC) Order by the is_file_md column
* @method CcPlayoutHistoryTemplateFieldQuery orderByDbPosition($order = Criteria::ASC) Order by the position column
@ -16,6 +17,7 @@
* @method CcPlayoutHistoryTemplateFieldQuery groupByDbId() Group by the id column
* @method CcPlayoutHistoryTemplateFieldQuery groupByDbTemplateId() Group by the template_id column
* @method CcPlayoutHistoryTemplateFieldQuery groupByDbName() Group by the name column
* @method CcPlayoutHistoryTemplateFieldQuery groupByDbLabel() Group by the label column
* @method CcPlayoutHistoryTemplateFieldQuery groupByDbType() Group by the type column
* @method CcPlayoutHistoryTemplateFieldQuery groupByDbIsFileMD() Group by the is_file_md column
* @method CcPlayoutHistoryTemplateFieldQuery groupByDbPosition() Group by the position column
@ -34,6 +36,7 @@
* @method CcPlayoutHistoryTemplateField findOneByDbId(int $id) Return the first CcPlayoutHistoryTemplateField filtered by the id column
* @method CcPlayoutHistoryTemplateField findOneByDbTemplateId(int $template_id) Return the first CcPlayoutHistoryTemplateField filtered by the template_id column
* @method CcPlayoutHistoryTemplateField findOneByDbName(string $name) Return the first CcPlayoutHistoryTemplateField filtered by the name column
* @method CcPlayoutHistoryTemplateField findOneByDbLabel(string $label) Return the first CcPlayoutHistoryTemplateField filtered by the label column
* @method CcPlayoutHistoryTemplateField findOneByDbType(string $type) Return the first CcPlayoutHistoryTemplateField filtered by the type column
* @method CcPlayoutHistoryTemplateField findOneByDbIsFileMD(boolean $is_file_md) Return the first CcPlayoutHistoryTemplateField filtered by the is_file_md column
* @method CcPlayoutHistoryTemplateField findOneByDbPosition(int $position) Return the first CcPlayoutHistoryTemplateField filtered by the position column
@ -41,6 +44,7 @@
* @method array findByDbId(int $id) Return CcPlayoutHistoryTemplateField objects filtered by the id column
* @method array findByDbTemplateId(int $template_id) Return CcPlayoutHistoryTemplateField objects filtered by the template_id column
* @method array findByDbName(string $name) Return CcPlayoutHistoryTemplateField objects filtered by the name column
* @method array findByDbLabel(string $label) Return CcPlayoutHistoryTemplateField objects filtered by the label column
* @method array findByDbType(string $type) Return CcPlayoutHistoryTemplateField objects filtered by the type column
* @method array findByDbIsFileMD(boolean $is_file_md) Return CcPlayoutHistoryTemplateField objects filtered by the is_file_md column
* @method array findByDbPosition(int $position) Return CcPlayoutHistoryTemplateField objects filtered by the position column
@ -223,6 +227,28 @@ abstract class BaseCcPlayoutHistoryTemplateFieldQuery extends ModelCriteria
return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::NAME, $dbName, $comparison);
}
/**
* Filter the query on the label column
*
* @param string $dbLabel 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 CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
*/
public function filterByDbLabel($dbLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($dbLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbLabel)) {
$dbLabel = str_replace('*', '%', $dbLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::LABEL, $dbLabel, $comparison);
}
/**
* Filter the query on the type column
*

View file

@ -791,20 +791,20 @@ class Application_Service_HistoryService
public function getFileMetadataTypes() {
$fileMD = array(
array("name"=> MDATA_KEY_TITLE, "type"=> TEMPLATE_STRING, "sql"),
array("name"=> MDATA_KEY_CREATOR, "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_SOURCE, "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_DURATION, "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_GENRE, "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_MOOD, "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_LABEL, "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_COMPOSER, "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_ISRC, "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_COPYRIGHT, "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_YEAR, "type"=> TEMPLATE_INT),
array("name"=> MDATA_KEY_TRACKNUMBER, "type"=> TEMPLATE_INT),
array("name"=> MDATA_KEY_CONDUCTOR, "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_LANGUAGE, "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_TITLE, "label"=> _("Title"), "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_CREATOR, "label"=> _("Creator"), "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_SOURCE, "label"=> _("Album"), "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_DURATION, "label"=> _("Length"), "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_GENRE, "label"=> _("Genre"), "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_MOOD, "label"=> _("Mood"), "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_LABEL, "label"=> _("Label"), "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_COMPOSER, "label"=> _("Composer"), "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_ISRC, "label"=> _("ISRC"), "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_COPYRIGHT, "label"=> _("Copyright"), "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_YEAR, "label"=> _("Year"), "type"=> TEMPLATE_INT),
array("name"=> MDATA_KEY_TRACKNUMBER, "label"=> _("Track"), "type"=> TEMPLATE_INT),
array("name"=> MDATA_KEY_CONDUCTOR, "label"=> _("Conductor"), "type"=> TEMPLATE_STRING),
array("name"=> MDATA_KEY_LANGUAGE, "label"=> _("Language"), "type"=> TEMPLATE_STRING),
);
return $fileMD;
@ -829,10 +829,10 @@ class Application_Service_HistoryService
$template = array();
$fields = array();
$fields[] = array("name" => "starts", "type" => TEMPLATE_DATETIME, "isFileMd" => false);
$fields[] = array("name" => "ends", "type" => TEMPLATE_DATETIME, "isFileMd" => false);
$fields[] = array("name" => MDATA_KEY_TITLE, "type" => TEMPLATE_STRING, "isFileMd" => true); //these fields can be populated from an associated file.
$fields[] = array("name" => MDATA_KEY_CREATOR, "type" => TEMPLATE_STRING, "isFileMd" => true);
$fields[] = array("name" => "starts", "label"=> _("Start Time"),"type" => TEMPLATE_DATETIME, "isFileMd" => false);
$fields[] = array("name" => "ends", "label"=> _("End Time"), "type" => TEMPLATE_DATETIME, "isFileMd" => false);
$fields[] = array("name" => MDATA_KEY_TITLE, "label"=> _("Title"), "type" => TEMPLATE_STRING, "isFileMd" => true); //these fields can be populated from an associated file.
$fields[] = array("name" => MDATA_KEY_CREATOR, "label"=> _("Creator"), "type" => TEMPLATE_STRING, "isFileMd" => true);
$template["name"] = "Log Sheet ".date("Y-m-d H:i:s")." Template";
$template["fields"] = $fields;
@ -848,12 +848,12 @@ class Application_Service_HistoryService
$template = array();
$fields = array();
$fields[] = array("name" => MDATA_KEY_TITLE, "type" => TEMPLATE_STRING, "isFileMd" => true);
$fields[] = array("name" => MDATA_KEY_CREATOR, "type" => TEMPLATE_STRING, "isFileMd" => true);
$fields[] = array("name" => "played", "type" => TEMPLATE_INT, "isFileMd" => false);
$fields[] = array("name" => MDATA_KEY_DURATION, "type" => TEMPLATE_STRING, "isFileMd" => true);
$fields[] = array("name" => MDATA_KEY_COMPOSER, "type" => TEMPLATE_STRING, "isFileMd" => true);
$fields[] = array("name" => MDATA_KEY_COPYRIGHT, "type" => TEMPLATE_STRING, "isFileMd" => true);
$fields[] = array("name" => MDATA_KEY_TITLE, "label"=> _("Title"), "type" => TEMPLATE_STRING, "isFileMd" => true);
$fields[] = array("name" => MDATA_KEY_CREATOR, "label"=> _("Creator"), "type" => TEMPLATE_STRING, "isFileMd" => true);
$fields[] = array("name" => "played", "label"=> _("Played"), "type" => TEMPLATE_INT, "isFileMd" => false);
$fields[] = array("name" => MDATA_KEY_DURATION, "label"=> _("Length"), "type" => TEMPLATE_STRING, "isFileMd" => true);
$fields[] = array("name" => MDATA_KEY_COMPOSER, "label"=> _("Composer"), "type" => TEMPLATE_STRING, "isFileMd" => true);
$fields[] = array("name" => MDATA_KEY_COPYRIGHT, "label"=> _("Copyright"), "type" => TEMPLATE_STRING, "isFileMd" => true);
$template["name"] = "File Summary ".date("Y-m-d H:i:s")." Template";
$template["fields"] = $fields;
@ -883,7 +883,8 @@ class Application_Service_HistoryService
foreach ($config as $item) {
$fields[] = array(
"name" => $item->getDbName(),
"name" => $item->getDbName(),
"label" => $item->getDbLabel(),
"type" => $item->getDbType(),
"isFileMd" => $item->getDbIsFileMD(),
"id" => $item->getDbId()
@ -958,10 +959,11 @@ class Application_Service_HistoryService
foreach ($template["fields"] as $index=>$field) {
$label = $field["label"];
$key = $field["name"];
$columns[] = array(
"sTitle"=> $key,
"sTitle"=> $label,
"mDataProp"=> $key,
"sClass"=> "his_{$key}"
);
@ -1110,6 +1112,7 @@ class Application_Service_HistoryService
$templateField = new CcPlayoutHistoryTemplateField();
$templateField->setDbName($field["name"]);
$templateField->setDbLabel($field["label"]);
$templateField->setDbType($field["type"]);
$templateField->setDbIsFileMD($isMd);
$templateField->setDbPosition($index);
@ -1156,6 +1159,7 @@ class Application_Service_HistoryService
$templateField = new CcPlayoutHistoryTemplateField();
$templateField->setDbName($field["name"]);
$templateField->setDbType($field["type"]);
$templateField->setDbLabel($field["label"]);
$templateField->setDbIsFileMD($isMd);
$templateField->setDbPosition($index);

View file

@ -12,8 +12,13 @@
<ul class="template_item_list">
<?php foreach ($this->template_fields as $field): ?>
<li id="<?php echo "field_".$i?>" data-id="<?php echo isset($field["id"]) ? $field["id"] : ""; ?>" data-name="<?php echo $field["name"]?>" data-type="<?php echo $field["type"]?>" data-filemd="<?php echo var_export($field["isFileMd"], true)?>">
<span><?php echo $field["name"]?></span>
<li id="<?php echo "field_".$i?>"
data-id="<?php echo isset($field["id"]) ? $field["id"] : ""; ?>"
data-name="<?php echo $field["name"]?>"
data-label="<?php echo $field["label"]?>"
data-type="<?php echo $field["type"]?>"
data-filemd="<?php echo var_export($field["isFileMd"], true)?>">
<span><?php echo $field["label"]?></span>
<span><?php echo $field["type"]?></span>
<?php if(!in_array($field["name"], $this->required_fields)): ?>
<span class="template_item_remove">Remove</span>
@ -27,7 +32,12 @@
<ul class="template_file_md">
<?php foreach ($this->fileMD as $md): ?>
<li id="<?php echo "md_".$md["name"]?>" data-name="<?php echo $md["name"]?>" data-type="<?php echo $md["type"]?>"><?php echo $md["name"] ?></li>
<li id="<?php echo "md_".$md["name"]?>"
data-name="<?php echo $md["name"]?>"
data-type="<?php echo $md["type"]?>"
data-label="<?php echo $md["label"]?>">
<?php echo $md["label"] ?>
</li>
<?php endforeach; ?>
</ul>

View file

@ -3,6 +3,9 @@
<div>
<div>Edit Log Sheet Template</div>
<ul id="template_list">
<?php if (count($this->template_list) == 0): ?>
<li>No Log Sheet Templates</li>
<?php endif; ?>
<?php foreach ($this->template_list as $id=>$name): ?>
<?php if (count($this->template_list) == 0): ?>
<li>No Log Sheet Templates</li>

View file

@ -506,6 +506,7 @@
<column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
<column name="template_id" phpName="DbTemplateId" type="INTEGER" required="true" />
<column name="name" phpName="DbName" type="VARCHAR" size="128" required="true" />
<column name="label" phpName="DbLabel" type="VARCHAR" size="128" required="true" />
<column name="type" phpName="DbType" type="VARCHAR" size="128" required="true" />
<column name="is_file_md" phpName="DbIsFileMD" type="BOOLEAN" required="true" defaultValue="false"/>
<column name="position" phpName="DbPosition" type="INTEGER" required="true" />

View file

@ -824,6 +824,7 @@ CREATE TABLE "cc_playout_history_template_field"
"id" serial NOT NULL,
"template_id" INTEGER NOT NULL,
"name" VARCHAR(128) NOT NULL,
"label" VARCHAR(128) NOT NULL,
"type" VARCHAR(128) NOT NULL,
"is_file_md" BOOLEAN default 'f' NOT NULL,
"position" INTEGER NOT NULL,

View file

@ -9,34 +9,43 @@ var AIRTIME = (function(AIRTIME) {
}
mod = AIRTIME.itemTemplate;
function createTemplateLi(name, type, filemd, required) {
//config: name, type, filemd, required
function createTemplateLi(config) {
var templateRequired =
"<li id='<%= id %>' data-name='<%= name %>' data-type='<%= type %>' data-filemd='<%= filemd %>'>" +
"<span><%= name %></span>" +
"<li " +
"data-name='<%= name %>' " +
"data-type='<%= type %>' " +
"data-filemd='<%= filemd %>'" +
"data-label='<%= label %>'" +
">" +
"<span><%= label %></span>" +
"<span><%= type %></span>" +
"</li>";
var templateOptional =
"<li id='<%= id %>' data-name='<%= name %>' data-type='<%= type %>' data-filemd='<%= filemd %>'>" +
"<span><%= name %></span>" +
"<li " +
"data-name='<%= name %>' " +
"data-type='<%= type %>' " +
"data-filemd='<%= filemd %>'" +
"data-label='<%= label %>'" +
">" +
"<span><%= label %></span>" +
"<span><%= type %></span>" +
"<span class='template_item_remove'>Remove</span>" +
"</li>";
var template = (required) === true ? templateRequired : templateOptional;
var template = _.template(template);
var count = $templateList.find("li").length;
var id = "field_"+count;
var $li = $(template({id: id, name: name, type: type, filemd: filemd}));
var template = (config.required) === true ? templateRequired : templateOptional;
template = _.template(template);
var $li = $(template(config));
return $li;
}
function addField(name, type, filemd, required) {
function addField(config) {
$templateList.append(createTemplateLi(name, type, filemd, required));
$templateList.append(createTemplateLi(config));
}
function getFieldData($el) {
@ -44,8 +53,8 @@ var AIRTIME = (function(AIRTIME) {
return {
name: $el.data("name"),
type: $el.data("type"),
isFileMd: $el.data("filemd"),
id: $el.data("id")
label: $el.data("label"),
isFileMd: $el.data("filemd")
};
}
@ -59,10 +68,15 @@ var AIRTIME = (function(AIRTIME) {
$fileMDList.on("dblclick", "li", function(){
var $li = $(this);
var name = $li.data("name");
var type = $li.data("type");
var config = {
name: $li.data("name"),
type: $li.data("type"),
label: $li.data("label"),
filemd: true,
required: false
};
$templateList.append(createTemplateLi(name, type, true, false));
addField(config);
});
$templateList.sortable();
@ -72,12 +86,22 @@ var AIRTIME = (function(AIRTIME) {
});
$templateDiv.on("click", ".template_item_add button", function() {
var $div = $(this).parents("div.template_item_add");
var $div = $(this).parents("div.template_item_add"),
label = $div.find("input").val(),
name;
var name = $div.find("input").val();
var type = $div.find("select").val();
name = label.replace(" ", "");
name = name.toLowerCase();
addField(name, type, false, false);
var config = {
name: name,
label: label,
type: $div.find("select").val(),
filemd: false,
required: false
};
addField(config);
});
function updateTemplate(template_id, isDefault) {