SAAS-290: Hosted SaaS widgets + javascript code generation
-working code
This commit is contained in:
parent
27d40ef4df
commit
1b0b124247
3 changed files with 46 additions and 19 deletions
|
@ -54,6 +54,8 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
'label' => 'Javascript Code:',
|
'label' => 'Javascript Code:',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'readonly' => true,
|
'readonly' => true,
|
||||||
|
'style' => 'font-family: Consolas, "Liberation Mono", Courier,
|
||||||
|
monospace;',
|
||||||
'class' => 'input_text_area',
|
'class' => 'input_text_area',
|
||||||
'value' => self::getWidgetCode(), //$_SERVER["SERVER_NAME"],
|
'value' => self::getWidgetCode(), //$_SERVER["SERVER_NAME"],
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
|
@ -107,26 +109,35 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
|
|
||||||
private static function getWidgetCode() {
|
private static function getWidgetCode() {
|
||||||
|
|
||||||
|
$host = $_SERVER['SERVER_NAME'];
|
||||||
$code = <<<CODE
|
$code = <<<CODE
|
||||||
$("#headerLiveHolder").airtimeLiveInfo({
|
<script src="http://$host/widgets/js/jquery-1.6.1.min.js" type="text/javascript"></script>
|
||||||
sourceDomain: "http://{$_SERVER['SERVER_NAME']}",
|
<script src="http://$host/widgets/js/jquery-ui-1.8.10.custom.min.js" type="text/javascript"></script>
|
||||||
text: {onAirNow:"On Air Now", offline:"Offline", current:"Current", next:"Next"},
|
<script src="http://$host/widgets/js/jquery.showinfo.js" type="text/javascript"></script>
|
||||||
updatePeriod: 20 //seconds
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#onAirToday").airtimeShowSchedule({
|
<div id="headerLiveHolder" style="border: 1px solid #999999; padding: 10px;"></div>
|
||||||
sourceDomain: "http://{$_SERVER['SERVER_NAME']}",
|
<div id="onAirToday"></div>
|
||||||
text: {onAirToday:"On air today"},
|
<div id="scheduleTabs"></div>
|
||||||
updatePeriod: 5, //seconds
|
|
||||||
showLimit: 10
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#scheduleTabs").airtimeWeekSchedule({
|
<script type="text/javascript">
|
||||||
sourceDomain:"http://{$_SERVER['SERVER_NAME']}",
|
$(document).ready(function() {
|
||||||
dowText:{monday:"Monday", tuesday:"Tuesday", wednesday:"Wednesday", thursday:"Thursday", friday:"Friday", saturday:"Saturday", sunday:"Sunday"},
|
$("#headerLiveHolder").airtimeLiveInfo({
|
||||||
miscText:{time:"Time", programName:"Program Name", details:"Details", readMore:"Read More"},
|
sourceDomain: "http://$host",
|
||||||
updatePeriod: 600 //seconds
|
updatePeriod: 20 //seconds
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#onAirToday").airtimeShowSchedule({
|
||||||
|
sourceDomain: "http://$host",
|
||||||
|
updatePeriod: 5, //seconds
|
||||||
|
showLimit: 10
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#scheduleTabs").airtimeWeekSchedule({
|
||||||
|
sourceDomain:"http://$host",
|
||||||
|
updatePeriod: 600 //seconds
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
CODE;
|
CODE;
|
||||||
|
|
||||||
return $code;
|
return $code;
|
||||||
|
|
|
@ -50,10 +50,10 @@
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</dd>
|
</dd>
|
||||||
<dt id="widgetCode-label" class="block-display">
|
<dt id="widgetCode-label" style="display:none;" class="block-display">
|
||||||
<label class="optional" for="widgetCode"><?php echo $this->element->getElement('widgetCode')->getLabel() ?></label>
|
<label class="optional" for="widgetCode"><?php echo $this->element->getElement('widgetCode')->getLabel() ?></label>
|
||||||
</dt>
|
</dt>
|
||||||
<dd id="widgetCode-element" class="block-display clearfix">
|
<dd id="widgetCode-element" style="display:none;" class="block-display clearfix">
|
||||||
<?php echo $this->element->getElement('widgetCode') ?>
|
<?php echo $this->element->getElement('widgetCode') ?>
|
||||||
<?php if($this->element->getElement('widgetCode')->hasErrors()) : ?>
|
<?php if($this->element->getElement('widgetCode')->hasErrors()) : ?>
|
||||||
<ul class='errors'>
|
<ul class='errors'>
|
||||||
|
|
|
@ -81,6 +81,21 @@ function setMsAuthenticationFieldsReadonly(ele) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setCollapsibleWidgetJsCode() {
|
||||||
|
$('#thirdPartyApi-element input').click(function() {
|
||||||
|
if ($(this).first().attr("value") == '1') {
|
||||||
|
//show js textarea
|
||||||
|
$('#widgetCode-label').show("fast");
|
||||||
|
$('#widgetCode-element').show("fast");
|
||||||
|
} else {
|
||||||
|
//hide js textarea
|
||||||
|
$('#widgetCode-label').hide("fast");
|
||||||
|
$('#widgetCode-element').hide("fast");
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('.collapsible-header').live('click',function() {
|
$('.collapsible-header').live('click',function() {
|
||||||
|
@ -95,4 +110,5 @@ $(document).ready(function() {
|
||||||
setSystemFromEmailReadonly();
|
setSystemFromEmailReadonly();
|
||||||
setConfigureMailServerListener();
|
setConfigureMailServerListener();
|
||||||
setEnableSystemEmailsListener();
|
setEnableSystemEmailsListener();
|
||||||
|
setCollapsibleWidgetJsCode();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue