Hello, I’m trying to configure a custom view for my scheduler. I made 2 custom fields from the Joomla’s backend; one for “location” type select with one option, and one for “section” type select with one option. Here’s my code for the scheduler_include.html.
<script>
function init() {
scheduler.config.lightbox.sections=[
{ name: "Text", height:40, type:"textarea", focus:true},
{ name: "location", height:30, type:"select", options:[
{ key: "", label: "Empty" },
{ key: "fairview", label: "Fairview" },
{ key: "halifax", label: "Halifax" },
{ key: "spryfield", label: "Spryfield" }
},
{ name: "section", height:20, type:"select", options:[
{ key: "", label: "Empty" },
{ key: "front", label: "Front" },
{ key: "back", label: "Back" }
}
]
}
</script>
My problem is the scheduler isn’t loading the code from scheduler_include.html. Did I make a mistake anywhere in my script?
I see the problem now.
In the source code of the scheduler in my joomla site, I found out that the scheduler loads the script from scheduler_include.html before the scheduler calls on another init() which loads the configuration which was set from the admin backend, therefore overwriting my custom configuration.
Is there any workarounds for this?
radyno
May 10, 2012, 8:19am
#3
Hi,
you may customize scheduler code:
implement configuring in scheduler_include.html outside function:
<script>
scheduler.config.lightbox.sections=[
{ name: "Text", height:40, type:"textarea", focus:true},
{ name: "location", height:30, type:"select", options:[
{ key: "", label: "Empty" },
{ key: "fairview", label: "Fairview" },
{ key: "halifax", label: "Halifax" },
{ key: "spryfield", label: "Spryfield" }
},
{ name: "section", height:20, type:"select", options:[
{ key: "", label: "Empty" },
{ key: "front", label: "Front" },
{ key: "back", label: "Back" }
}
]
</script>
open file wp-content/plugins/event-calendar-scheduler/codebase/dhtmlxSchedulerConfigurator.php, find lines:
$scheduler .= "\n".$settings['customfieldsNames']."\n";
$scheduler .= $settings['customfields']."\n";
$scheduler .= (isset($settings['customfieldsTemplate']) ? $settings['customfieldsTemplate'] : '')."\n";
cut them and paste after the follow line:
$scheduler .= "var default_mode = '{$defaultmode}';\n";
$scheduler .= "\n".$settings['customfieldsNames']."\n";
$scheduler .= $settings['customfields']."\n";
$scheduler .= (isset($settings['customfieldsTemplate']) ? $settings['customfieldsTemplate'] : '')."\n";
Now your code will be executed after default options are configured.
craigc
May 11, 2012, 12:34pm
#4
Thank you! That was the solution I was looking for.