Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by demo25 on Dec 01, 2009 04:48
open dhtmlx forum
dhtml scheduler

I create a scheduler with two units view each containing of people and I like that each person can only modify the event that you create.
Answer posted by Alex (support) on Dec 01, 2009 05:18
This approach is used in the samples in scheduler package: dhtmlxScheduler/samples/02_customization/shared_events 
Answer posted by demo25 on Dec 01, 2009 05:25
I want to pass in parametre the section_id. How ?

scheduler.load("common/events.php?uid="+scheduler.uid());
Answer posted by demo25 on Dec 01, 2009 06:09
I want to retrieve the section_id of a unit view in the function unit for make a condition "if".
Answer posted by Alex (support) on Dec 01, 2009 06:27

The question isn't clear enough. Please provide more details.

 

Answer posted by demo25 on Dec 01, 2009 06:40
In my BDD, i save a section_id of my unit view in the table events.

Event_id , Start_date , end_date ,     details     , section_id
    1        00/00/0000  00/00/0000      sdfsd           1

I want in the fonction init() for the page index.php retrieve the section_id of every event to make it a condition.

if(section_id == .....){
.............
}

Thank you
Answer posted by Alex (support) on Dec 01, 2009 06:44

You can try to use onEventLoading event: http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxscheduler:event_oneventloading

scheduler.attachEvent("onEventLoading", function(event_object){
    var section_id = event_object.section_id;
    /*your code here*/
    return true
});

Answer posted by demo25 on Dec 01, 2009 07:44
scheduler.attachEvent("onEventLoading", function(event)
{
      var section_id = event.secton_id;
                                    
    if(section_id == identifiant)
     {
               return scheduler.config.icons_select=["icon_details","icon_edit","icon_delete"];
      }
      else
      {
                 return scheduler.config.icons_select=["icon_details","icon_edit"];
       }
});

This code doesn't works.  I want for the event published by one persons (section_id) and the user connect (identifiant) display 3 icons (details,edit,delete).
Example:

section_id = 1 and identifiant = 1 ======>  scheduler.config.icons_select=["icon_details","icon_edit","icon_delete"];
section_id = 1 and identifiant = 2 ======>  scheduler.config.icons_select=["icon_details","icon_edit"];

Do you speak french?


Answer posted by Alex (support) on Dec 01, 2009 08:27

There is no public method to do that.

You can try to apply the following approach:

var setter = scheduler.select;

scheduler.select=function(id){

    var event = scheduler.getEvent(id);

    var section_id = event.secton_id;
   
    if(section_id == identifiant) scheduler.config.icons_select=["icon_details","icon_edit","icon_delete"];
    else scheduler.config.icons_select=["icon_details","icon_edit"];

    setter.apply(this,arguments);

}

Answer posted by demo25 on Dec 02, 2009 06:42
This approch doesn't works.

scheduler.attachEvent("onEventLoading",function(ev){
    var Obj = eval (ev);
     if(Obj['section_id'] == identifiant)
      {
                scheduler.config.icons_select=["icon_details","icon_edit","icon_delete"];  
       }
        else
        {
               scheduler.config.icons_select=["icon_details","icon_edit"];
   
         }
        
I use this approach but it displays for all events regardless of the identifier : scheduler.config.icons_select=["icon_details","icon_edit","icon_delete"];
Answer posted by Alex (support) on Dec 02, 2009 07:32

There was a typo in the code snippet that we provided before. 

Here should be

var section_id = event.section_id;

instead of var section_id = event.secton_id;

Answer posted on Dec 03, 2009 01:55
this approach works:

var setter = scheduler.select;

                    scheduler.select=function(id){

                    var event = scheduler.getEvent(id);

                    var Obj = eval(event);
                  
                   
                    if(Obj['section_id'] == identifiant)
                    {   
                        scheduler.config.icons_select=["icon_details","icon_edit","icon_delete"];
                    }   
                    else
                    {   
                        scheduler.config.icons_select=["icon_details"];
                    }   

                    setter.apply(this,arguments);

                    }
But i want to desactivate the button save an delete for the user.
Answer posted by Alex (support) on Dec 03, 2009 02:25

The latest scheduler version supports read-only details form:

scheduler.config.readonly_form = true;

Answer posted on Dec 03, 2009 02:33
My version supported only scheduler.readonly.
Will I have the latest version.
Answer posted on Dec 03, 2009 03:03
I'm download the latest version but scheduler.config.readonly_form = true; doesn't works the form is always modifiable
Answer posted by Alex (support) on Dec 03, 2009 04:35
Please, check the sample in the scheduler package dhtmlxScheduler/samples/03_extensions/12_readonly_form.html