LightBox questions

Hi,

I’m currently struggling with 2 issues regarding the lightbox.

I want to make a completely invisible field. I plan on having multiple schedules, and thus the “events” table has a schedule_id field.
I would like to mask this from the user, so they wont need to change it at all.
The user would visit a url like /schedule/admin/1 1 being the id of the schedule.

My current schedule looks like this:
i.imgur.com/q8rSYLG.png

I managed to make the input field hidden, however the section is still there, and is out of place. Is it somehow possible to hide the entire thing?

My next problem is to automatically have a default value for the field (namely the schedule id).
I have attempted with the following code:

scheduler.attachEvent("onLightbox", function(){ var section = scheduler.formSection("Schedule Id"); section.control.hidden = true; section.hidden = true; section.control.value = "1"; });
The above code seems to hide the input field, but the value does not work at all, neither is the entire “section” hidden.

A part from this the lightbox wont open when you click a event at all.

When I removed all the server backend, it seemed to open though.

My view file:

[code]<script src=’<?=base_url().'template/dhtmlxScheduler_v4.2.0'?>/dhtmlxscheduler.js’ type=“text/javascript” charset=“utf-8”>

/dhtmlxscheduler.css'> html, body{ } .one_line{ white-space:nowrap; overflow:hidden; padding-top:5px; padding-left:5px; text-align:left !important; }

Scheduler Plan & manage tasks

    <div class="portlet light">
        <div class="portlet-body">
            <div id="scheduler_here" class="dhx_cal_container"  style='width:100%; height:100%;'>
                <div class="dhx_cal_navline">
                    <div class="dhx_cal_prev_button">&nbsp;</div>
                    <div class="dhx_cal_next_button">&nbsp;</div>
                    <div class="dhx_cal_today_button"></div>
                    <div class="dhx_cal_date"></div>
                    <div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
                    <div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
                    <div class="dhx_cal_tab" name="timeline_tab" style="right:280px;"></div>
                    <div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
                </div>
                <div class="dhx_cal_header">
                </div>
                <div class="dhx_cal_data">
                </div>
            </div>
        </div>
    </div>
</div>
[/code]

And my server file:

[code]<?php if ( ! defined(‘BASEPATH’)) exit(‘No direct script access allowed’);

require_once("./dhtmlx/connector/scheduler_connector.php");
require_once("./dhtmlx/connector/db_phpci.php");
DataProcessor::$action_param =“dhx_editor_status”;

class ScheduleServer extends CI_Controller {

public function __construct()
{
    parent::__construct();
}

public function index()
{
    //$this->admin();
}

public function data()
{
    $this->load->database();
    $id = $this->uri->segment(3);
    $connector = new SchedulerConnector($this->db, "PHPCI");
    $connector->filter("schedule_id", $id);
    $connector->configure(
        "tasks",
        "id",
        "start_date, end_date, subject, description, location, status, assignee_id"
    );
    $connector->event->attach("beforeInsert",beforeInsert);
    $connector->render();
}

public function beforeInsert($action){

// var_dump($this->uri->segment[3]);
}

public function beforeRender($action){
    if ($action->get_id() == 10)
        //marks an event if its id is 10
        $action->set_userdata("color", "pink");
}

public function beforeProcessing($action){
    //validation before saving
    if ($action->get_value("event_name") == ""){
        $action->invalid();//calls $action->invalid() if data fails validation
        $action->set_response_attribute("details", "Empty data not allowed");
    }
}

}[/code]

Creating an event works just fine, but for some reason it the lightbox doesn’t show when I click/double click a event.

Hello,
you don’t need hidden input for this. When event is changed, scheduler will send all values to the server, not only ones listed in the lightbox, so if you want some property not to be shown in the lightbox - you simply not add a control for it.

The default values can be set directly to an event object using onEventCreated api eventscheduler.attachEvent("onEventCreated", function(id,e){ var event = scheduler.getEvent(id); event.schedule_id = 1; return true; });

docs.dhtmlx.com/scheduler/api__s … event.html

Thanks a lot for your input Aliaksandr.

Do you have any idea why my lightbox might not be showing when trying to edit events? :confused:

Hi,
if you capture onBeforeLightbox event - make sure to return ‘true’ from the handler, otherwise it will prevent lightbox from showing.
docs.dhtmlx.com/scheduler/api__s … event.html

Another possible reason is the js error during initialization of the lightbox, please check the browser console for error message. This may happen if you specify controls which are not defined on the page. E.g. if you specify ‘radio’ control without adding ext/dhtmlxscheduler_editors.js in which the radio control is defined