The ‘event preview’ template can be found at [url]Formatting Labels, Dates, Styles Scheduler Docs, but I want to add my custom field to there for recurring event enable version. If I use that template for creating recurring event, the start time and end time in ‘event preview’ are not displayed correctly. I can not manage how to deal with event_length and the start time in order to get the end time of an event.
Can I have the template for an event in the ‘event preview’ screen for recurring version? Thanks!!!
You should define scheduler.templates.selected_event based on template described in our docs, then call the lines that I mentioned above. Let me know if you need a demo.
I suppose it will do nothing in both database and display on the web. In fact, it did not insert into database but it still display on the web. Any suggestion so that it will automatically not display the event on the web without refreshing the page manually?
May I have a demo, for example, adding a location field in the recurring event.
I have used a dull method to do that(copy and paste), no need to prepare a demo for me now. Thanks.
Sorry, I have a follow up question. Now, I show all the events which related to the user. Meanwhile, the events could be edited only if the event is created by the current user.
I validate the user by checking the session userid with a column named “user_create” in database.
[code]function check_authority($action){
global $scheduler;
$status = $action->get_status();
// check the event is created by the user so that the user can update or delete.
if ( $status == “delete” || $status == “update”){
$uid = $_SESSION[‘uid’];
$event_id =$action->get_value(“event_id”);
$result1 = mysql_query(“SELECT * FROM event WHERE (event_id = '” . $event_id . “') and (user_create = '” . $uid . “')”);
if (mysql_num_rows($result1) == 0){
$action->set_response_attribute(“details”,“authority”);
$action->invalid();
}
}
If I tried to delete a event which is not authorized to do, it triggered the onDBError function and back to a blank selected event page. However, when I back to list view, the selected item is disappeared unless I reload the page (The affected event remains there after reload).
it triggered the onDBError function and back to a blank selected event page. However, when I back to list view, the selected item is disappeared unless I reload the page
You removed the event on client and did not send the request to the server. So, the behavior is correct.
Please explain in detail what you want to achieve. It is not clear.
The event “Testing 1234” is an event which is created by someone else. Therefore, suppose the user does not have the right to edit this. Since this is a meeting event, the current involved in this event so it will be displayed.
However, the user still can go into event detail page and press edit button to go to edit page. For example, change the title to be “Testing 12345678” and press save button.
Then I reload the whole page and the event will display correctly on the list view again.
Since my application is designed to run in the mobile application. The user cannot refresh the page. So it will cause a problem for the user. I would like to know how can it displays correctly without refreshing the page.
I hope it can display the detail after popup the alert instead of a blank detail page. And when the user click back button, the event will still on the list and displayed correctly.
I believe that after the user . it sets $action to be “invalid” during the checking in check_authority function before “update” on the server side. And it triggered the onDBError event handler as well as popup the alert. But I am frustrated why the event is still disappear after these procedures.
I am not good at coding, hope u can give any advice. Thanks a lot.
Attached the snippet coding for easier reference. client-side
[code]function check_authority($action){
global $scheduler;
$status = $action->get_status();
// check the event is created by the user so that the user can update or delete.
if ( $status == “delete” || $status == “update”){
$uid = $_SESSION[‘uid’];
$event_id =$action->get_value(“event_id”);
$result3 = mysql_query(“SELECT * FROM event WHERE (event_id = '” .$scheduler->sql->escape($action->get_id()). “') and (user_create = '” . $uid . “')”);
if (mysql_num_rows($result3) == 0){
$action->set_response_attribute(“details”,“authority”);
$action->invalid();
}
}
$mainSQL = "SELECT * FROM event WHERE user_involve = ".$_SESSION[‘uid’];
$scheduler->event->attach(“beforeProcessing”, “check_authority”);
$scheduler->event->attach(“beforeProcessing”,“insert”);
$scheduler->event->attach(“beforeProcessing”,“update”);
$scheduler->event->attach(“beforeProcessing”,“delete”);
$scheduler->render_table($mainSQL, “event_id”, “start_date,end_date,text,eventType,invitee,allDay,rec_type,event_pid,event_length,details,location,user_create,user_involve,flag,color,event_fid,event_id,x,y”);
[/code]
doesn’t readonly property for events solve the problem ? In my opinion, it would be better if “delete” and “edit” buttons were not shown for the events created by other users.
If for some reasons you want to show “edit” button for a non-authorized user, you can set a validation rule for text field. There you can check whether the user is logged in. The validation rule should return true or false value. For example
scheduler.config.form_rules.text = function(value,obj){
if(checkUser())
return true
dhx.alert("this action is not authorized!");
return false;
}