Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by johnny on Oct 04, 2009 18:13
open dhtmlx forum
xdhtml scheduler not loading mssql

i have xdhtml setup with an mssql database. it writes new data into the database, and submits changes, but on refresh, nothing shows. its not loading no matter what i do, but loads xmls.

php/event.php:
<?php
    include ('../../../codebase/connector/scheduler_connector.php');
    include ('../../../codebase/connector/db_mssql.php');
    
    
    $res = mssql_connect('****','***', '***');
    mssql_select_db('aworkingdatabase');
    
    $scheduler = new schedulerConnector($res, "MSSQL");

    $scheduler->enable_log("log.txt",true);
    $scheduler->render_table("events","event_id","start_date,end_date,event_name,details");
?>

and the main file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title></title>
</head>
    <script src="../../codebase/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" href="../../codebase/dhtmlxscheduler.css" type="text/css" title="no title" charset="utf-8">

    
<style type="text/css" media="screen">
    html, body{
        margin:0px;
        padding:0px;
        height:100%;
        overflow:hidden;
    }    
</style>

<script type="text/javascript" charset="utf-8">
    function init() {
        
        scheduler.config.xml_date="%Y-%m-%d %H:%i";
        scheduler.config.lightbox.sections=[    
            {name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
            {name:"location", height:43, type:"textarea", map_to:"details" },
            {name:"time", height:72, type:"time", map_to:"auto"}
        ]
        scheduler.config.first_hour=4;
        scheduler.locale.labels.section_location="Location";
        //scheduler.config.details_on_create=true;
        //scheduler.config.details_on_dblclick=true;


    
        scheduler.init('scheduler_here',null,"month");
        scheduler.load("php/events.php?uid="+scheduler.uid());
        
        var dp = new dataProcessor("php/events.php");
        dp.init(scheduler);

    }
</script>

<body onload="init();">
    <div id="scheduler_here" class="dhx_cal_container" style='width:100%; height:100%;'>
        <div class="dhx_cal_navline">
            <div class="dhx_cal_prev_button"> </div>
            <div class="dhx_cal_next_button"> </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="month_tab" style="right:76px;"></div>
        </div>
        <div class="dhx_cal_header">
        </div>
        <div class="dhx_cal_data">
        </div>        
    </div>
</body>

and the log:


====================================
Log started, 04/10/2009 09:10:58
====================================

SELECT event_id,start_date,end_date,event_name,details FROM events

Done in 0.0010170936584473s



====================================
Log started, 04/10/2009 09:10:03
====================================

DataProcessor object initialized
1254705178022_start_date => 2009-10-1 00:00
1254705178022_end_date => 2009-10-1 00:05
1254705178022_text => New event
1254705178022_id => 1254705178022
1254705178022_details =>
1254705178022_!nativeeditor_status => inserted
ids => 1254705178022

Row data [1254705178022]
start_date => 2009-10-1 00:00
end_date => 2009-10-1 00:05
event_name => New event
id => 1254705178022
details =>
!nativeeditor_status => inserted

INSERT INTO events(start_date,end_date,event_name,details) VALUES ('2009-10-1 00:00','2009-10-1 00:05','New event','');SELECT @@IDENTITY AS dhx_id

mysql_free_result(): supplied resource is not a valid MySQL result resource at C:\Inetpub\wwwroot\calendar\codebase\connector\db_mssql.php line 15

Edit operation finished
0 => action:inserted; sid:1254705178022; tid:34;

Done in 0.0017879009246826s



====================================
Log started, 04/10/2009 09:10:03
====================================

SELECT event_id,start_date,end_date,event_name,details FROM events

Done in 0.0011329650878906s

Answer posted by Stanislav (support) on Oct 05, 2009 01:58
>>  $scheduler = new schedulerConnector($res, "MSSQL");
Must be 
       $scheduler = new SchedulerConnector($res, "MSSQL");

Also there was small problem with mssql connector, you can update existing php file with the attached one, but those problems are minor and not related to the main problem in your case. 

Please provide an XML snippet, which is generated during data loading ( result of events.php call ) 
Attachments (1)
db_mssql.zip917.00 B
Answer posted by raagi on Oct 15, 2009 06:31
Hi,

I am facing the exact same problem. I havent been able to get the events onto the calendar, though they get saved to the database in MSSQL.

Here is a snippet of the XML data which i get back. Please see this issue.

Regards
Raagi
Attachments (1)
events.xml1.60 Kb
Answer posted by Stanislav (support) on Oct 15, 2009 07:24
You are using non-default format for dates , so scheduler need to have next line before loading 

scheduler.config.xml_date = "%M %d %Y %H:%i%A";

Also, the existing version has a known issue with parsing "AM|PM" in dates. You need to update js file to latest build ( http://dhtmlx.com/docs/products/kb/index.shtml?cat=recent&q=12216
Answer posted by Raagi on Oct 21, 2009 01:26
I  followed  the instructions you showed. I changed the date format  to    scheduler.config.xml_date = "%M %d %Y %H:%i%A";    and also replaced the js file but still facing the same problem.
Any further help from your side is awaited...
Answer posted by Support on Oct 22, 2009 09:34
Please try to use the attached version of js file instead of the original one. 
Attachments (1)