Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
-
-
Everyone is permitted to copy and distribute verbatim copies
-
of this license document, but changing it is not allowed.
-
-
-
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
-
-
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
-
-
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
-
-
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
-
-
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
-
-
-
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
-
-
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
-
-
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
-
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
-
-
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
-
-
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
-
-
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
-
-
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
-
-
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
-
-
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
-
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
-
-
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
-
-
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
-
-
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
-
-
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
-
-
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
-
-
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
-
-
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
-
-
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
-
-
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
-
-
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
-
-
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
-
-
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
-
-
NO WARRANTY
-
-
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/base_connector.php b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/base_connector.php
new file mode 100644
index 00000000000..aab70e3c6ea
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/base_connector.php
@@ -0,0 +1,706 @@
+start = $start;
+ $this->end = $end;
+ $this->type = "xml";
+ }
+ public function add($add){
+ $this->start.=$add;
+ }
+ public function reset(){
+ $this->start="";
+ $this->end="";
+ }
+ public function set_type($add){
+ $this->type=$add;
+ }
+ public function output($name="", $inline=true){
+ ob_clean();
+ if ($this->type == "xml")
+ header("Content-type: text/xml");
+
+ echo $this->__toString();
+ }
+ public function __toString(){
+ return $this->start.$this->end;
+ }
+}
+
+/*! EventInterface
+ Base class , for iterable collections, which are used in event
+**/
+class EventInterface{
+ protected $request; ////!< DataRequestConfig instance
+ public $rules=array(); //!< array of sorting rules
+
+ /*! constructor
+ creates a new interface based on existing request
+ @param request
+ DataRequestConfig object
+ */
+ public function __construct($request){
+ $this->request = $request;
+ }
+
+ /*! remove all elements from collection
+ */
+ public function clear(){
+ array_splice($rules,0);
+ }
+ /*! get index by name
+
+ @param name
+ name of field
+ @return
+ index of named field
+ */
+ public function index($name){
+ $len = sizeof($this->rules);
+ for ($i=0; $i < $len; $i++) {
+ if ($this->rules[$i]["name"]==$name)
+ return $i;
+ }
+ return false;
+ }
+}
+/*! Wrapper for collection of sorting rules
+**/
+class SortInterface extends EventInterface{
+ /*! constructor
+ creates a new interface based on existing request
+ @param request
+ DataRequestConfig object
+ */
+ public function __construct($request){
+ parent::__construct($request);
+ $this->rules = &$request->get_sort_by_ref();
+ }
+ /*! add new sorting rule
+
+ @param name
+ name of field
+ @param dir
+ direction of sorting
+ */
+ public function add($name,$dir){
+ $this->request->set_sort($name,$dir);
+ }
+ public function store(){
+ $this->request->set_sort_by($this->rules);
+ }
+}
+/*! Wrapper for collection of filtering rules
+**/
+class FilterInterface extends EventInterface{
+ /*! constructor
+ creates a new interface based on existing request
+ @param request
+ DataRequestConfig object
+ */
+ public function __construct($request){
+ $this->request = $request;
+ $this->rules = &$request->get_filters_ref();
+ }
+ /*! add new filatering rule
+
+ @param name
+ name of field
+ @param value
+ value to filter by
+ @param rule
+ filtering rule
+ */
+ public function add($name,$value,$rule){
+ $this->request->set_filter($name,$value,$rule);
+ }
+ public function store(){
+ $this->request->set_filters($this->rules);
+ }
+}
+
+/*! base class for component item representation
+**/
+class DataItem{
+ protected $data; //!< hash of data
+ protected $config;//!< DataConfig instance
+ protected $index;//!< index of element
+ protected $skip;//!< flag , which set if element need to be skiped during rendering
+ /*! constructor
+
+ @param data
+ hash of data
+ @param config
+ DataConfig object
+ @param index
+ index of element
+ */
+ function __construct($data,$config,$index){
+ $this->config=$config;
+ $this->data=$data;
+ $this->index=$index;
+ $this->skip=false;
+ }
+ /*! get named value
+
+ @param name
+ name or alias of field
+ @return
+ value from field with provided name or alias
+ */
+ public function get_value($name){
+ return $this->data[$name];
+ }
+ /*! set named value
+
+ @param name
+ name or alias of field
+ @param value
+ value for field with provided name or alias
+ */
+ public function set_value($name,$value){
+ return $this->data[$name]=$value;
+ }
+ /*! get id of element
+ @return
+ id of element
+ */
+ public function get_id(){
+ $id = $this->config->id["name"];
+ if (array_key_exists($id,$this->data))
+ return $this->data[$id];
+ return false;
+ }
+ /*! change id of element
+
+ @param value
+ new id value
+ */
+ public function set_id($value){
+ $this->data[$this->config->id["name"]]=$value;
+ }
+ /*! get index of element
+
+ @return
+ index of element
+ */
+ public function get_index(){
+ return $this->index;
+ }
+ /*! mark element for skiping ( such element will not be rendered )
+ */
+ public function skip(){
+ $this->skip=true;
+ }
+
+ /*! return self as XML string
+ */
+ public function to_xml(){
+ return $this->to_xml_start().$this->to_xml_end();
+ }
+
+ /*! replace xml unsafe characters
+
+ @param string
+ string to be escaped
+ @return
+ escaped string
+ */
+ protected function xmlentities($string) {
+ return str_replace( array( '&', '"', "'", '<', '>', '’' ), array( '&' , '"', ''' , '<' , '>', ''' ), $string);
+ }
+
+ /*! return starting tag for self as XML string
+ */
+ public function to_xml_start(){
+ $str="config->data); $i++){
+ $name=$this->config->data[$i]["name"];
+ $str.=" ".$name."='".$this->xmlentities($this->data[$name])."'";
+ }
+ return $str.">";
+ }
+ /*! return ending tag for XML string
+ */
+ public function to_xml_end(){
+ return "";
+ }
+}
+
+
+
+
+
+/*! Base connector class
+ This class used as a base for all component specific connectors.
+ Can be used on its own to provide raw data.
+**/
+class Connector {
+ protected $config;//DataConfig instance
+ protected $request;//DataRequestConfig instance
+ protected $names;//!< hash of names for used classes
+ private $encoding="utf-8";//!< assigned encoding (UTF-8 by default)
+ private $editing=false;//!< flag of edit mode ( response for dataprocessor )
+ private $updating=false;//!< flag of update mode ( response for data-update )
+ private $db; //!< db connection resource
+ protected $dload;//!< flag of dyn. loading mode
+ public $access; //!< AccessMaster instance
+
+ public $sql; //DataWrapper instance
+ public $event; //EventMaster instance
+ public $limit=false;
+
+ private $id_seed=0; //!< default value, used to generate auto-IDs
+ protected $live_update = false; // actions table name for autoupdating
+
+ /*! constructor
+
+ Here initilization of all Masters occurs, execution timer initialized
+ @param db
+ db connection resource
+ @param type
+ string , which hold type of database ( MySQL or Postgre ), optional, instead of short DB name, full name of DataWrapper-based class can be provided
+ @param item_type
+ name of class, which will be used for item rendering, optional, DataItem will be used by default
+ @param data_type
+ name of class which will be used for dataprocessor calls handling, optional, DataProcessor class will be used by default.
+ */
+ public function __construct($db,$type=false, $item_type=false, $data_type=false){
+ $this->exec_time=microtime(true);
+
+ if (!$type) $type="MySQL";
+ if (class_exists($type."DBDataWrapper",false)) $type.="DBDataWrapper";
+ if (!$item_type) $item_type="DataItem";
+ if (!$data_type) $data_type="DataProcessor";
+
+ $this->names=array(
+ "db_class"=>$type,
+ "item_class"=>$item_type,
+ "data_class"=>$data_type,
+ );
+
+ $this->config = new DataConfig();
+ $this->request = new DataRequestConfig();
+ $this->event = new EventMaster();
+ $this->access = new AccessMaster();
+
+ if (!class_exists($this->names["db_class"],false))
+ throw new Exception("DB class not found: ".$this->names["db_class"]);
+ $this->sql = new $this->names["db_class"]($db,$this->config);
+
+ $this->db=$db;//saved for options connectors, if any
+
+ EventMaster::trigger_static("connectorCreate",$this);
+ }
+
+ /*! return db connection resource
+ nested class may neeed to access live connection object
+ @return
+ DB connection resource
+ */
+ protected function get_connection(){
+ return $this->db;
+ }
+
+ public function get_config(){
+ return new DataConfig($this->config);
+ }
+
+ public function get_request(){
+ return new DataRequestConfig($this->config);
+ }
+
+
+ /*! config connector based on table
+
+ @param table
+ name of table in DB
+ @param id
+ name of id field
+ @param fields
+ list of fields names
+ @param extra
+ list of extra fields, optional, such fields will not be included in data rendering, but will be accessible in all inner events
+ @param relation_id
+ name of field used to define relations for hierarchical data organization, optional
+ */
+ public function render_table($table,$id="",$fields=false,$extra=false,$relation_id=false){
+ $this->configure($table,$id,$fields,$extra,$relation_id);
+ return $this->render();
+ }
+ public function configure($table,$id="",$fields=false,$extra=false,$relation_id=false){
+ if ($fields === false){
+ //auto-config
+ $info = $this->sql->fields_list($table);
+ $fields = implode(",",$info["fields"]);
+ if ($info["key"])
+ $id = $info["key"];
+ }
+ $this->config->init($id,$fields,$extra,$relation_id);
+ $this->request->set_source($table);
+ }
+
+ protected function uuid(){
+ return time()."x".$this->id_seed++;
+ }
+
+ /*! config connector based on sql
+
+ @param sql
+ sql query used as base of configuration
+ @param id
+ name of id field
+ @param fields
+ list of fields names
+ @param extra
+ list of extra fields, optional, such fields will not be included in data rendering, but will be accessible in all inner events
+ @param relation_id
+ name of field used to define relations for hierarchical data organization, optional
+ */
+ public function render_sql($sql,$id,$fields,$extra=false,$relation_id=false){
+ $this->config->init($id,$fields,$extra,$relation_id);
+ $this->request->parse_sql($sql);
+ return $this->render();
+ }
+
+ /*! render already configured connector
+
+ @param config
+ configuration of data
+ @param request
+ configuraton of request
+ */
+ public function render_connector($config,$request){
+ $this->config->copy($config);
+ $this->request->copy($request);
+ return $this->render();
+ }
+
+ /*! render self
+ process commands, output requested data as XML
+ */
+ public function render(){
+ EventMaster::trigger_static("connectorInit",$this);
+
+ $this->parse_request();
+ if ($this->live_update !== false && $this->updating!==false) {
+ $this->live_update->get_updates();
+ } else {
+ if ($this->editing){
+ $dp = new $this->names["data_class"]($this,$this->config,$this->request);
+ $dp->process($this->config,$this->request);
+ }
+ else {
+ $wrap = new SortInterface($this->request);
+ $this->event->trigger("beforeSort",$wrap);
+ $wrap->store();
+
+ $wrap = new FilterInterface($this->request);
+ $this->event->trigger("beforeFilter",$wrap);
+ $wrap->store();
+
+ $this->output_as_xml( $this->sql->select($this->request) );
+ }
+ }
+ $this->end_run();
+ }
+
+ /*! prevent SQL injection through column names
+ replace dangerous chars in field names
+ @param str
+ incoming field name
+ @return
+ safe field name
+ */
+ protected function safe_field_name($str){
+ return strtok($str, " \n\t;',");
+ }
+
+ /*! limit max count of records
+ connector will ignore any records after outputing max count
+ @param limit
+ max count of records
+ @return
+ none
+ */
+ public function set_limit($limit){
+ $this->limit = $limit;
+ }
+
+ protected function parse_request_mode(){
+ //detect edit mode
+ if (isset($_GET["editing"])){
+ $this->editing=true;
+ } else if (isset($_POST["ids"])){
+ $this->editing=true;
+ LogMaster::log('While there is no edit mode mark, POST parameters similar to edit mode detected. \n Switching to edit mode ( to disable behavior remove POST[ids]');
+ } else if (isset($_GET['dhx_version'])){
+ $this->updating = true;
+ }
+ }
+
+ /*! parse incoming request, detects commands and modes
+ */
+ protected function parse_request(){
+ //set default dyn. loading params, can be reset in child classes
+ if ($this->dload)
+ $this->request->set_limit(0,$this->dload);
+ else if ($this->limit)
+ $this->request->set_limit(0,$this->limit);
+
+ $this->parse_request_mode();
+
+ if ($this->live_update && ($this->updating || $this->editing)){
+ $this->request->set_version($_GET["dhx_version"]);
+ $this->request->set_user($_GET["dhx_user"]);
+ }
+
+ if (isset($_GET["dhx_sort"]))
+ foreach($_GET["dhx_sort"] as $k => $v){
+ $k = $this->safe_field_name($k);
+ $this->request->set_sort($this->resolve_parameter($k),$v);
+ }
+
+ if (isset($_GET["dhx_filter"]))
+ foreach($_GET["dhx_filter"] as $k => $v){
+ $k = $this->safe_field_name($k);
+ $this->request->set_filter($this->resolve_parameter($k),$v);
+ }
+
+
+ }
+
+ /*! convert incoming request name to the actual DB name
+ @param name
+ incoming parameter name
+ @return
+ name of related DB field
+ */
+ protected function resolve_parameter($name){
+ return $name;
+ }
+
+
+ /*! replace xml unsafe characters
+
+ @param string
+ string to be escaped
+ @return
+ escaped string
+ */
+ private function xmlentities($string) {
+ return str_replace( array( '&', '"', "'", '<', '>', '’' ), array( '&' , '"', ''' , '<' , '>', ''' ), $string);
+ }
+
+ /*! render from DB resultset
+ @param res
+ DB resultset
+ process commands, output requested data as XML
+ */
+ protected function render_set($res){
+ $output="";
+ $index=0;
+ $this->event->trigger("beforeRenderSet",$this,$res,$this->config);
+ while ($data=$this->sql->get_next($res)){
+ $data = new $this->names["item_class"]($data,$this->config,$index);
+ if ($data->get_id()===false)
+ $data->set_id($this->uuid());
+ $this->event->trigger("beforeRender",$data);
+ $output.=$data->to_xml();
+ $index++;
+ }
+ return $output;
+ }
+
+ /*! output fetched data as XML
+ @param res
+ DB resultset
+ */
+ protected function output_as_xml($res){
+ $start="encoding."' ?>".$this->xml_start();
+ $end=$this->render_set($res).$this->xml_end();
+
+ $out = new OutputWriter($start, $end);
+ $this->event->trigger("beforeOutput", $this, $out);
+
+ $out->output();
+ }
+
+
+ /*! end processing
+ stop execution timer, kill the process
+ */
+ protected function end_run(){
+ $time=microtime(true)-$this->exec_time;
+ LogMaster::log("Done in {$time}s");
+ flush();
+ die();
+ }
+
+ /*! set xml encoding
+
+ methods sets only attribute in XML, no real encoding conversion occurs
+ @param encoding
+ value which will be used as XML encoding
+ */
+ public function set_encoding($encoding){
+ $this->encoding=$encoding;
+ }
+
+ /*! enable or disable dynamic loading mode
+
+ @param count
+ count of rows loaded from server, actual only for grid-connector, can be skiped in other cases.
+ If value is a false or 0 - dyn. loading will be disabled
+ */
+ public function dynamic_loading($count){
+ $this->dload=$count;
+ }
+
+ /*! enable logging
+
+ @param path
+ path to the log file. If set as false or empty strig - logging will be disabled
+ @param client_log
+ enable output of log data to the client side
+ */
+ public function enable_log($path=true,$client_log=false){
+ LogMaster::enable_log($path,$client_log);
+ }
+
+ /*! provides infor about current processing mode
+ @return
+ true if processing dataprocessor command, false otherwise
+ */
+ public function is_select_mode(){
+ $this->parse_request_mode();
+ return !$this->editing;
+ }
+
+ public function is_first_call(){
+ $this->parse_request_mode();
+ return !($this->editing || $this->updating || $this->request->get_start() || sizeof($this->request->get_filters()) || sizeof($this->request->get_sort_by()));
+
+ }
+
+ /*! renders self as xml, starting part
+ */
+ protected function xml_start(){
+ return "";
+ }
+ /*! renders self as xml, ending part
+ */
+ protected function xml_end(){
+ return "";
+ }
+
+
+ public function insert($data) {
+ $action = new DataAction('inserted', false, $data);
+ $request = new DataRequestConfig();
+ $request->set_source($this->request->get_source());
+
+ $this->config->limit_fields($data);
+ $this->sql->insert($action,$request);
+ $this->config->restore_fields($data);
+
+ return $action->get_new_id();
+ }
+
+ public function delete($id) {
+ $action = new DataAction('deleted', $id, array());
+ $request = new DataRequestConfig();
+ $request->set_source($this->request->get_source());
+
+ $this->sql->delete($action,$request);
+ return $action->get_status();
+}
+
+ public function update($data) {
+ $action = new DataAction('updated', $data[$this->config->id["name"]], $data);
+ $request = new DataRequestConfig();
+ $request->set_source($this->request->get_source());
+
+ $this->config->limit_fields($data);
+ $this->sql->update($action,$request);
+ $this->config->restore_fields($data);
+
+ return $action->get_status();
+ }
+
+ /*! sets actions_table for Optimistic concurrency control mode and start it
+ @param table_name
+ name of database table which will used for saving actions
+ @param url
+ url used for update notifications
+ */
+ public function enable_live_update($table, $url=false){
+ $this->live_update = new DataUpdate($this->sql, $this->config, $this->request, $table,$url);
+ $this->live_update->set_event($this->event,$this->names["item_class"]);
+ $this->event->attach("beforeOutput", Array($this->live_update, "version_output"));
+ $this->event->attach("beforeFiltering", Array($this->live_update, "get_updates"));
+ $this->event->attach("beforeProcessing", Array($this->live_update, "check_collision"));
+ $this->event->attach("afterProcessing", Array($this->live_update, "log_operations"));
+ }
+}
+
+
+/*! wrapper around options collection, used for comboboxes and filters
+**/
+class OptionsConnector extends Connector{
+ protected $init_flag=false;//!< used to prevent rendering while initialization
+ public function __construct($res,$type=false,$item_type=false,$data_type=false){
+ if (!$item_type) $item_type="DataItem";
+ if (!$data_type) $data_type=""; //has not sense, options not editable
+ parent::__construct($res,$type,$item_type,$data_type);
+ }
+ /*! render self
+ process commands, return data as XML, not output data to stdout, ignore parameters in incoming request
+ @return
+ data as XML string
+ */
+ public function render(){
+ if (!$this->init_flag){
+ $this->init_flag=true;
+ return "";
+ }
+ $res = $this->sql->select($this->request);
+ return $this->render_set($res);
+ }
+}
+
+
+
+class DistinctOptionsConnector extends OptionsConnector{
+ /*! render self
+ process commands, return data as XML, not output data to stdout, ignore parameters in incoming request
+ @return
+ data as XML string
+ */
+ public function render(){
+ if (!$this->init_flag){
+ $this->init_flag=true;
+ return "";
+ }
+ $res = $this->sql->get_variants($this->config->text[0]["db_name"],$this->request);
+ return $this->render_set($res);
+ }
+}
+
+?>
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/combo_connector.php b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/combo_connector.php
new file mode 100644
index 00000000000..65e6bfe8564
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/combo_connector.php
@@ -0,0 +1,89 @@
+selected=false;
+ }
+ /*! mark option as selected
+ */
+ function select(){
+ $this->selected=true;
+ }
+ /*! return self as XML string, starting part
+ */
+ function to_xml_start(){
+ if ($this->skip) return "";
+
+ return "";
+ }
+}
+
+/*! Connector for the dhtmlxCombo
+**/
+class ComboConnector extends Connector{
+ private $filter; //!< filtering mask from incoming request
+ private $position; //!< position from incoming request
+
+ /*! constructor
+
+ Here initilization of all Masters occurs, execution timer initialized
+ @param res
+ db connection resource
+ @param type
+ string , which hold type of database ( MySQL or Postgre ), optional, instead of short DB name, full name of DataWrapper-based class can be provided
+ @param item_type
+ name of class, which will be used for item rendering, optional, DataItem will be used by default
+ @param data_type
+ name of class which will be used for dataprocessor calls handling, optional, DataProcessor class will be used by default.
+ */
+ public function __construct($res,$type=false,$item_type=false,$data_type=false){
+ if (!$item_type) $item_type="ComboDataItem";
+ parent::__construct($res,$type,$item_type,$data_type);
+ }
+
+ //parse GET scoope, all operations with incoming request must be done here
+ function parse_request(){
+ parent::parse_request();
+
+ if (isset($_GET["pos"])){
+ if (!$this->dload) //not critical, so just write a log message
+ LogMaster::log("Dyn loading request received, but server side was not configured to process dyn. loading. ");
+ else
+ $this->request->set_limit($_GET["pos"],$this->dload);
+ }
+
+ if (isset($_GET["mask"]))
+ $this->request->set_filter($this->config->text[0]["name"],$_GET["mask"]."%","LIKE");
+
+ LogMaster::log($this->request);
+ }
+
+
+ /*! renders self as xml, starting part
+ */
+ public function xml_start(){
+ if ($this->request->get_start())
+ return "";
+ else
+ return "";
+ }
+
+ /*! renders self as xml, ending part
+ */
+ public function xml_end(){
+ return "";
+ }
+}
+?>
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/connector.js b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/connector.js
new file mode 100644
index 00000000000..f0d03f7a880
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/connector.js
@@ -0,0 +1,141 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+/*
+ dhx_sort[index]=direction
+ dhx_filter[index]=mask
+*/
+if (window.dhtmlXGridObject){
+ dhtmlXGridObject.prototype._init_point_connector=dhtmlXGridObject.prototype._init_point;
+ dhtmlXGridObject.prototype._init_point=function(){
+ var clear_url=function(url){
+ url=url.replace(/(\?|\&)connector[^\f]*/g,"");
+ return url+(url.indexOf("?")!=-1?"&":"?")+"connector=true";
+ }
+ var combine_urls=function(url){
+ return clear_url(url)+(this._connector_sorting||"")+(this._connector_filter||"");
+ }
+ var sorting_url=function(url,ind,dir){
+ this._connector_sorting="&dhx_sort["+ind+"]="+dir;
+ return combine_urls.call(this,url);
+ }
+ var filtering_url=function(url,inds,vals){
+ for (var i=0; idata_mode = $name;
+ $this->data_result=array();
+ }
+ public function getDataResult(){
+ return $this->data_result;
+ }
+
+ public function render(){
+ if (!$this->init_flag){
+ $this->init_flag=true;
+ return "";
+ }
+ return parent::render();
+ }
+
+ protected function output_as_xml($res){
+ if ($this->data_mode){
+ while ($data=$this->sql->get_next($res)){
+ $this->data_result[]=$data[$this->data_mode];
+ }
+ }
+ else
+ return parent::output_as_xml($res);
+ }
+ protected function end_run(){
+ if (!$this->data_mode)
+ parent::end_run();
+ }
+}
+
+class CrossOptionsConnector extends Connector{
+ public $options, $link;
+ private $master_name, $link_name, $master_value;
+
+ public function __construct($res,$type=false,$item_type=false,$data_type=false){
+ $this->options = new OptionsConnector($res,$type,$item_type,$data_type);
+ $this->link = new DelayedConnector($res,$type,$item_type,$data_type);
+
+ EventMaster::attach_static("connectorInit",array($this, "handle"));
+ }
+ public function handle($conn){
+ if ($conn instanceof DelayedConnector) return;
+ if ($conn instanceof OptionsConnector) return;
+
+ $this->master_name = $this->link->get_config()->id["db_name"];
+ $this->link_name = $this->options->get_config()->id["db_name"];
+
+ $this->link->event->attach("beforeFilter",array($this, "get_only_related"));
+
+ if (isset($_GET["dhx_crosslink_".$this->link_name])){
+ $this->get_links($_GET["dhx_crosslink_".$this->link_name]);
+ die();
+ }
+
+ if (!$this->dload){
+ $conn->event->attach("beforeRender", array($this, "getOptions"));
+ $conn->event->attach("beforeRenderSet", array($this, "prepareConfig"));
+ }
+
+
+ $conn->event->attach("afterProcessing", array($this, "afterProcessing"));
+ }
+ public function prepareConfig($conn, $res, $config){
+ $config->add_field($this->link_name);
+ }
+ public function getOptions($data){
+ $this->link->dataMode($this->link_name);
+
+ $this->get_links($data->get_value($this->master_name));
+
+ $data->set_value($this->link_name, implode(",",$this->link->getDataResult()));
+ }
+ public function get_links($id){
+ $this->master_value = $id;
+ $this->link->render();
+ }
+ public function get_only_related($filters){
+ $index = $filters->index($this->master_name);
+ if ($index!==false){
+ $filters->rules[$index]["value"]=$this->master_value;
+ } else
+ $filters->add($this->master_name, $this->master_value, "=");
+ }
+ public function afterProcessing($action){
+ $status = $action->get_status();
+
+ $master_key = $action->get_value($this->master_name);
+ $link_key = $action->get_value($this->link_name);
+ $link_key = explode(',', $link_key);
+
+ if ($status == "inserted")
+ $master_key = $action->get_new_id();
+
+ switch ($status){
+ case "deleted":
+ $this->link->delete($master_key);
+ break;
+ case "updated":
+ $this->link->delete($master_key);
+ case "inserted":
+ for ($i=0; $i < sizeof($link_key); $i++)
+ if ($link_key[$i]!="")
+ $this->link->insert(array(
+ $this->link_name => $link_key[$i],
+ $this->master_name => $master_key
+ ));
+ break;
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/dataprocessor.php b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/dataprocessor.php
new file mode 100644
index 00000000000..551a3ce7cb2
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/dataprocessor.php
@@ -0,0 +1,465 @@
+connector= $connector;
+ $this->config=$config;
+ $this->request=$request;
+ }
+
+ /*! convert incoming data name to valid db name
+ redirect to Connector->name_data by default
+ @param data
+ data name from incoming request
+ @return
+ related db_name
+ */
+ function name_data($data){
+ return $data;
+ }
+ /*! retrieve data from incoming request and normalize it
+
+ @param ids
+ array of extected IDs
+ @return
+ hash of data
+ */
+ function get_post_values($ids){
+ $data=array();
+ for ($i=0; $i < sizeof($ids); $i++)
+ $data[$ids[$i]]=array();
+
+ foreach ($_POST as $key => $value) {
+ $details=explode("_",$key,2);
+ if (sizeof($details)==1) continue;
+
+ $name=$this->name_data($details[1]);
+ $data[$details[0]][$name]=$value;
+ }
+
+ return $data;
+ }
+ /*! process incoming request ( save|update|delete )
+ */
+ function process(){
+ LogMaster::log("DataProcessor object initialized",$_POST);
+
+ $results=array();
+
+ if (!isset($_POST["ids"]))
+ throw new Exception("Incorrect incoming data, ID of incoming records not recognized");
+
+ $ids=explode(",",$_POST["ids"]);
+ $rows_data=$this->get_post_values($ids);
+ $failed=false;
+
+ try{
+ if ($this->connector->sql->is_global_transaction())
+ $this->connector->sql->begin_transaction();
+
+ for ($i=0; $i < sizeof($ids); $i++) {
+ $rid = $ids[$i];
+ LogMaster::log("Row data [{$rid}]",$rows_data[$rid]);
+
+ if (!isset($_POST[$rid."_!nativeeditor_status"]))
+ throw new Exception("Status of record [{$rid}] not found in incoming request");
+ $status = $_POST[$rid."_!nativeeditor_status"];
+
+ $action=new DataAction($status,$rid,$rows_data[$rid]);
+ $results[]=$action;
+ $this->inner_process($action);
+ }
+
+ } catch(Exception $e){
+ $failed=true;
+ }
+
+ if ($this->connector->sql->is_global_transaction()){
+ if (!$failed)
+ for ($i=0; $i < sizeof($results); $i++)
+ if ($results[$i]->get_status()=="error" || $results[$i]->get_status()=="invalid"){
+ $failed=true;
+ break;
+ }
+ if ($failed){
+ for ($i=0; $i < sizeof($results); $i++)
+ $results[$i]->error();
+ $this->connector->sql->rollback_transaction();
+ }
+ else
+ $this->connector->sql->commit_transaction();
+ }
+
+ $this->output_as_xml($results);
+ }
+
+ /*! converts status string to the inner mode name
+
+ @param status
+ external status string
+ @return
+ inner mode name
+ */
+ protected function status_to_mode($status){
+ switch($status){
+ case "updated":
+ return "update";
+ break;
+ case "inserted":
+ return "insert";
+ break;
+ case "deleted":
+ return "delete";
+ break;
+ default:
+ return $status;
+ break;
+ }
+ }
+ /*! process data updated request received
+
+ @param action
+ DataAction object
+ @return
+ DataAction object with details of processing
+ */
+ protected function inner_process($action){
+
+ if ($this->connector->sql->is_record_transaction())
+ $this->connector->sql->begin_transaction();
+
+ try{
+
+ $mode = $this->status_to_mode($action->get_status());
+ if (!$this->connector->access->check($mode)){
+ LogMaster::log("Access control: {$operation} operation blocked");
+ $action->error();
+ } else {
+ $check = $this->connector->event->trigger("beforeProcessing",$action);
+ if (!$action->is_ready())
+ $this->check_exts($action,$mode);
+ $check = $this->connector->event->trigger("afterProcessing",$action);
+ }
+
+ } catch (Exception $e){
+ $action->set_status("error");
+ }
+
+ if ($this->connector->sql->is_record_transaction()){
+ if ($action->get_status()=="error" || $action->get_status()=="invalid")
+ $this->connector->sql->rollback_transaction();
+ else
+ $this->connector->sql->commit_transaction();
+ }
+
+ return $action;
+ }
+ /*! check if some event intercepts processing, send data to DataWrapper in other case
+
+ @param action
+ DataAction object
+ @param mode
+ name of inner mode ( will be used to generate event names )
+ */
+ function check_exts($action,$mode){
+ $old_config = new DataConfig($this->config);
+
+ $this->connector->event->trigger("before".$mode,$action);
+ if ($action->is_ready())
+ LogMaster::log("Event code for ".$mode." processed");
+ else {
+ //check if custom sql defined
+ $sql = $this->connector->sql->get_sql($mode,$action);
+ if ($sql)
+ $this->connector->sql->query($sql);
+ else{
+ $action->sync_config($this->config);
+ $method=array($this->connector->sql,$mode);
+ if (!is_callable($method))
+ throw new Exception("Unknown dataprocessing action: ".$mode);
+ call_user_func($method,$action,$this->request);
+ }
+ }
+ $this->connector->event->trigger("after".$mode,$action);
+
+ $this->config = $old_config;
+ }
+
+ /*! output xml response for dataprocessor
+
+ @param results
+ array of DataAction objects
+ */
+ function output_as_xml($results){
+ LogMaster::log("Edit operation finished",$results);
+ ob_clean();
+ header("Content-type:text/xml");
+ echo "";
+ echo "";
+ for ($i=0; $i < sizeof($results); $i++)
+ echo $results[$i]->to_xml();
+ echo "";
+ }
+
+}
+
+/*! contain all info related to action and controls customizaton
+**/
+class DataAction{
+ private $status; //!< cuurent status of record
+ private $id;//!< id of record
+ private $data;//!< data hash of record
+ private $userdata;//!< hash of extra data , attached to record
+ private $nid;//!< new id value , after operation executed
+ private $output;//!< custom output to client side code
+ private $attrs;//!< hash of custtom attributes
+ private $ready;//!< flag of operation's execution
+ private $addf;//!< array of added fields
+ private $delf;//!< array of deleted fields
+
+
+ /*! constructor
+
+ @param status
+ current operation status
+ @param id
+ record id
+ @param data
+ hash of data
+ */
+ function __construct($status,$id,$data){
+ $this->status=$status;
+ $this->id=$id;
+ $this->data=$data;
+ $this->nid=$id;
+
+ $this->output="";
+ $this->attrs=array();
+ $this->ready=false;
+
+ $this->addf=array();
+ $this->delf=array();
+ }
+
+
+ /*! add custom field and value to DB operation
+
+ @param name
+ name of field which will be added to DB operation
+ @param value
+ value which will be used for related field in DB operation
+ */
+ function add_field($name,$value){
+ LogMaster::log("adding field: ".$name.", with value: ".$value);
+ $this->data[$name]=$value;
+ $this->addf[]=$name;
+ }
+ /*! remove field from DB operation
+
+ @param name
+ name of field which will be removed from DB operation
+ */
+ function remove_field($name){
+ LogMaster::log("removing field: ".$name);
+ $this->delf[]=$name;
+ }
+
+ /*! sync field configuration with external object
+
+ @param slave
+ SQLMaster object
+ @todo
+ check , if all fields removed then cancel action
+ */
+ function sync_config($slave){
+ foreach ($this->addf as $k => $v)
+ $slave->add_field($v);
+ foreach ($this->delf as $k => $v)
+ $slave->remove_field($v);
+ }
+ /*! get value of some record's propery
+
+ @param name
+ name of record's property ( name of db field or alias )
+ @return
+ value of related property
+ */
+ function get_value($name){
+ if (!array_key_exists($name,$this->data)){
+ LogMaster::log("Incorrect field name used: ".$name);
+ LogMaster::log("data",$this->data);
+ return "";
+ }
+ return $this->data[$name];
+ }
+ /*! set value of some record's propery
+
+ @param name
+ name of record's property ( name of db field or alias )
+ @param value
+ value of related property
+ */
+ function set_value($name,$value){
+ LogMaster::log("change value of: ".$name." as: ".$value);
+ $this->data[$name]=$value;
+ }
+ /*! get hash of data properties
+
+ @return
+ hash of data properties
+ */
+ function get_data(){
+ return $this->data;
+ }
+ /*! get some extra info attached to record
+ deprecated, exists just for backward compatibility, you can use set_value instead of it
+ @param name
+ name of userdata property
+ @return
+ value of related userdata property
+ */
+ function get_userdata_value($name){
+ return $this->get_value($name);
+ }
+ /*! set some extra info attached to record
+ deprecated, exists just for backward compatibility, you can use get_value instead of it
+ @param name
+ name of userdata property
+ @param value
+ value of userdata property
+ */
+ function set_userdata_value($name,$value){
+ return $this->set_value($name,$value);
+ }
+ /*! get current status of record
+
+ @return
+ string with status value
+ */
+ function get_status(){
+ return $this->status;
+ }
+ /*! assign new status to the record
+
+ @param status
+ new status value
+ */
+ function set_status($status){
+ $this->status=$status;
+ }
+ /*! get id of current record
+
+ @return
+ id of record
+ */
+ function get_id(){
+ return $this->id;
+ }
+ /*! sets custom response text
+
+ can be accessed through defineAction on client side. Text wrapped in CDATA, so no extra escaping necessary
+ @param text
+ custom response text
+ */
+ function set_response_text($text){
+ $this->set_response_xml("");
+ }
+ /*! sets custom response xml
+
+ can be accessed through defineAction on client side
+ @param text
+ string with XML data
+ */
+ function set_response_xml($text){
+ $this->output=$text;
+ }
+ /*! sets custom response attributes
+
+ can be accessed through defineAction on client side
+ @param name
+ name of custom attribute
+ @param value
+ value of custom attribute
+ */
+ function set_response_attribute($name,$value){
+ $this->attrs[$name]=$value;
+ }
+ /*! check if action finished
+
+ @return
+ true if action finished, false otherwise
+ */
+ function is_ready(){
+ return $this->ready;
+ }
+ /*! return new id value
+
+ equal to original ID normally, after insert operation - value assigned for new DB record
+ @return
+ new id value
+ */
+ function get_new_id(){
+ return $this->nid;
+ }
+
+ /*! set result of operation as error
+ */
+ function error(){
+ $this->status="error";
+ $this->ready=true;
+ }
+ /*! set result of operation as invalid
+ */
+ function invalid(){
+ $this->status="invalid";
+ $this->ready=true;
+ }
+ /*! confirm successful opeation execution
+ @param id
+ new id value, optional
+ */
+ function success($id=false){
+ if ($id!==false)
+ $this->nid = $id;
+ $this->ready=true;
+ }
+ /*! convert DataAction to xml format compatible with client side dataProcessor
+ @return
+ DataAction operation report as XML string
+ */
+ function to_xml(){
+ $str="attrs as $k => $v) {
+ $str.=$k."='".$v."' ";
+ }
+ $str.=">{$this->output}";
+ return $str;
+ }
+ /*! convert self to string ( for logs )
+
+ @return
+ DataAction operation report as plain string
+ */
+ function __toString(){
+ return "action:{$this->status}; sid:{$this->id}; tid:{$this->nid};";
+ }
+
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_common.php b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_common.php
new file mode 100644
index 00000000000..7ef239c0488
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_common.php
@@ -0,0 +1,959 @@
+copy($proto);
+ else{
+ $start=0;
+ $this->filters=array();
+ $this->sort_by=array();
+ }
+ }
+
+ /*! copy parameters of source object into self
+
+ @param proto
+ source object
+ */
+ public function copy($proto){
+ $this->filters =$proto->get_filters();
+ $this->sort_by =$proto->get_sort_by();
+ $this->count =$proto->get_count();
+ $this->start =$proto->get_start();
+ $this->source =$proto->get_source();
+ $this->fieldset =$proto->get_fieldset();
+ $this->relation =$proto->get_relation();
+ $this->user = $proto->user;
+ $this->version = $proto->version;
+ }
+
+ /*! convert self to string ( for logs )
+ @return
+ self as plain string,
+ */
+ public function __toString(){
+ $str="Source:{$this->source}\nFieldset:{$this->fieldset}\nWhere:";
+ for ($i=0; $i < sizeof($this->filters); $i++)
+ $str.=$this->filters[$i]["name"]." ".$this->filters[$i]["operation"]." ".$this->filters[$i]["value"].";";
+ $str.="\nStart:{$this->start}\nCount:{$this->count}\n";
+ for ($i=0; $i < sizeof($this->sort_by); $i++)
+ $str.=$this->sort_by[$i]["name"]."=".$this->sort_by[$i]["direction"].";";
+ $str.="\nRelation:{$this->relation}";
+ return $str;
+ }
+
+ /*! returns set of filtering rules
+ @return
+ set of filtering rules
+ */
+ public function get_filters(){
+ return $this->filters;
+ }
+ public function &get_filters_ref(){
+ return $this->filters;
+ }
+ public function set_filters($data){
+ $this->filters=$data;
+ }
+
+
+ public function get_user(){
+ return $this->user;
+ }
+ public function set_user($user){
+ $this->user = $user;
+ }
+ public function get_version(){
+ return $this->version;
+ }
+ public function set_version($version){
+ $this->version = $version;
+ }
+
+ /*! returns list of used fields
+ @return
+ list of used fields
+ */
+ public function get_fieldset(){
+ return $this->fieldset;
+ }
+ /*! returns name of source table
+ @return
+ name of source table
+ */
+ public function get_source(){
+ return $this->source;
+ }
+ /*! returns set of sorting rules
+ @return
+ set of sorting rules
+ */
+ public function get_sort_by(){
+ return $this->sort_by;
+ }
+ public function &get_sort_by_ref(){
+ return $this->sort_by;
+ }
+ public function set_sort_by($data){
+ $this->sort_by=$data;
+ }
+
+ /*! returns start index
+ @return
+ start index
+ */
+ public function get_start(){
+ return $this->start;
+ }
+ /*! returns count of requested records
+ @return
+ count of requested records
+ */
+ public function get_count(){
+ return $this->count;
+ }
+ /*! returns name of relation id
+ @return
+ relation id name
+ */
+ public function get_relation(){
+ return $this->relation;
+ }
+
+ /*! sets sorting rule
+
+ @param field
+ name of column
+ @param order
+ direction of sorting
+ */
+ public function set_sort($field,$order=false){
+ if (!$field && !$order)
+ $this->sort_by=array();
+ else{
+ $order=strtolower($order)=="asc"?"ASC":"DESC";
+ $this->sort_by[]=array("name"=>$field,"direction" => $order);
+ }
+ }
+ /*! sets filtering rule
+
+ @param field
+ name of column
+ @param value
+ value for filtering
+ @param operation
+ operation for filtering, optional , LIKE by default
+ */
+ public function set_filter($field,$value,$operation=false){
+ array_push($this->filters,array("name"=>$field,"value"=>$value,"operation"=>$operation));
+ }
+
+ /*! sets list of used fields
+
+ @param value
+ list of used fields
+ */
+ public function set_fieldset($value){
+ $this->fieldset=$value;
+ }
+ /*! sets name of source table
+
+ @param value
+ name of source table
+ */
+ public function set_source($value){
+ $this->source=trim($value);
+ if (!$this->source) throw new Exception("Source of data can't be empty");
+ }
+ /*! sets data limits
+
+ @param start
+ start index
+ @param count
+ requested count of data
+ */
+ public function set_limit($start,$count){
+ $this->start=$start;
+ $this->count=$count;
+ }
+ /*! sets name of relation id
+
+ @param value
+ name of relation id field
+ */
+ public function set_relation($value){
+ $this->relation=$value;
+ }
+ /*! parse incoming sql, to fill other properties
+
+ @param sql
+ incoming sql string
+ */
+ public function parse_sql($sql){
+ $sql= preg_replace("/[ \n\t]+limit[\n ,0-9]/i","",$sql);
+
+ $data = preg_split("/[ \n\t]+\\_from\\_/i",$sql,2);
+ if (count($data)!=2)
+ $data = preg_split("/[ \n\t]+from/i",$sql,2);
+ $this->fieldset = preg_replace("/^[\s]*select/i","",$data[0],1);
+
+ $table_data = preg_split("/[ \n\t]+where/i",$data[1],2);
+ if (sizeof($table_data)>1){ //where construction exists
+ $this->set_source($table_data[0]);
+ $where_data = preg_split("/[ \n\t]+order[ ]+by/i",$table_data[1],2);
+ $this->filters[]=$where_data[0];
+ if (sizeof($where_data)==1) return; //end of line detected
+ $data=$where_data[1];
+ } else {
+ $table_data = preg_split("/[ \n\t]+order[ ]+by/i",$table_data[0],2);
+ $this->set_source($table_data[0]);
+ if (sizeof($table_data)==1) return; //end of line detected
+ $data=$table_data[1];
+ }
+
+ if (trim($data)){ //order by construction exists
+ $s_data = preg_split("/\\,/",trim($data));
+ for ($i=0; $i < count($s_data); $i++) {
+ $data=preg_split("/[ ]+/",trim($s_data[$i]),2);
+ $this->set_sort($data[0],$data[1]);
+ }
+
+ }
+ }
+}
+
+/*! manager of data configuration
+**/
+class DataConfig{
+ public $id;////!< name of ID field
+ public $relation_id;//!< name or relation ID field
+ public $text;//!< array of text fields
+ public $data;//!< array of all known fields , fields which exists only in this collection will not be included in dataprocessor's operations
+
+
+ /*! converts self to the string, for logging purposes
+ **/
+ public function __toString(){
+ $str="ID:{$this->id['db_name']}(ID:{$this->id['name']})\n";
+ $str.="Relation ID:{$this->relation_id['db_name']}({$this->relation_id['name']})\n";
+ $str.="Data:";
+ for ($i=0; $itext); $i++)
+ $str.="{$this->text[$i]['db_name']}({$this->text[$i]['name']}),";
+
+ $str.="\nExtra:";
+ for ($i=0; $idata); $i++)
+ $str.="{$this->data[$i]['db_name']}({$this->data[$i]['name']}),";
+
+ return $str;
+ }
+
+ /*! removes un-used fields from configuration
+ @param name
+ name of field , which need to be preserved
+ */
+ public function minimize($name){
+ for ($i=0; $i < sizeof($this->text); $i++){
+ if ($this->text[$i]["name"]==$name){
+ $this->text[$i]["name"]="value";
+ $this->data=array($this->text[$i]);
+ $this->text=array($this->text[$i]);
+ return;
+ }
+ }
+ throw new Exception("Incorrect dataset minimization, master field not found.");
+ }
+
+ public function limit_fields($data){
+ if (isset($this->full_field_list))
+ $this->restore_fields();
+ $this->full_field_list = $this->text;
+ $this->text = array();
+
+ for ($i=0; $i < sizeof($this->full_field_list); $i++) {
+ if (array_key_exists($this->full_field_list[$i]["name"],$data))
+ $this->text[] = $this->full_field_list[$i];
+ }
+ }
+
+ public function restore_fields(){
+ if (isset($this->full_field_list))
+ $this->text = $this->full_field_list;
+ }
+
+ /*! initialize inner state by parsing configuration parameters
+
+ @param id
+ name of id field
+ @param fields
+ name of data field(s)
+ @param extra
+ name of extra field(s)
+ @param relation
+ name of relation field
+
+ */
+ public function init($id,$fields,$extra,$relation){
+ $this->id = $this->parse($id,false);
+ $this->text = $this->parse($fields,true);
+ $this->data = array_merge($this->text,$this->parse($extra,true));
+ $this->relation_id = $this->parse($relation,false);
+ }
+
+ /*! parse configuration string
+
+ @param key
+ key string from configuration
+ @param mode
+ multi names flag
+ @return
+ parsed field name object
+ */
+ private function parse($key,$mode){
+ if ($mode){
+ if (!$key) return array();
+ $key=explode(",",$key);
+ for ($i=0; $i < sizeof($key); $i++)
+ $key[$i]=$this->parse($key[$i],false);
+ return $key;
+ }
+ $key=explode("(",$key);
+ $data=array("db_name"=>trim($key[0]), "name"=>trim($key[0]));
+ if (sizeof($key)>1)
+ $data["name"]=substr(trim($key[1]),0,-1);
+ return $data;
+ }
+
+ /*! constructor
+ init public collectons
+ @param proto
+ DataConfig object used as prototype for new one, optional
+ */
+ public function __construct($proto=false){
+ if ($proto!==false)
+ $this->copy($proto);
+ else {
+ $this->text=array();
+ $this->data=array();
+ $this->id=array("name"=>"dhx_auto_id", "db_name"=>"dhx_auto_id");
+ $this->relation_id=array("name"=>"", "db_name"=>"");
+ }
+ }
+
+ /*! copy properties from source object
+
+ @param proto
+ source object
+ */
+ public function copy($proto){
+ $this->id = $proto->id;
+ $this->relation_id = $proto->relation_id;
+ $this->text = $proto->text;
+ $this->data = $proto->data;
+ }
+
+ /*! returns list of data fields (db_names)
+ @return
+ list of data fields ( ready to be used in SQL query )
+ */
+ public function db_names_list($db){
+ $out=array();
+ if ($this->id["db_name"])
+ array_push($out,$db->escape_name($this->id["db_name"]));
+ if ($this->relation_id["db_name"])
+ array_push($out,$db->escape_name($this->relation_id["db_name"]));
+
+ for ($i=0; $i < sizeof($this->data); $i++){
+ if ($this->data[$i]["db_name"]!=$this->data[$i]["name"])
+ $out[]=$db->escape_name($this->data[$i]["db_name"])." as ".$this->data[$i]["name"];
+ else
+ $out[]=$db->escape_name($this->data[$i]["db_name"]);
+ }
+
+ return $out;
+ }
+
+ /*! add field to dataset config ($text collection)
+
+ added field will be used in all auto-generated queries
+ @param name
+ name of field
+ @param aliase
+ aliase of field, optional
+ */
+ public function add_field($name,$aliase=false){
+ if ($aliase===false) $aliase=$name;
+
+ //adding to list of data-active fields
+ if ($this->id["db_name"]==$name || $this->relation_id["db_name"] == $name){
+ LogMaster::log("Field name already used as ID, be sure that it is really necessary.");
+ }
+ if ($this->is_field($name,$this->text)!=-1)
+ throw new Exception('Data field already registered: '.$name);
+ array_push($this->text,array("db_name"=>$name,"name"=>$aliase));
+
+ //adding to list of all fields as well
+ if ($this->is_field($name,$this->data)==-1)
+ array_push($this->data,array("db_name"=>$name,"name"=>$aliase));
+
+ }
+
+ /*! remove field from dataset config ($text collection)
+
+ removed field will be excluded from all auto-generated queries
+ @param name
+ name of field, or aliase of field
+ */
+ public function remove_field($name){
+ $ind = $this->is_field($name);
+ if ($ind==-1) throw new Exception('There was no such data field registered as: '.$name);
+ array_splice($this->text,$ind,1);
+ //we not deleting field from $data collection, so it will not be included in data operation, but its data still available
+ }
+
+ /*! check if field is a part of dataset
+
+ @param name
+ name of field
+ @param collection
+ collection, against which check will be done, $text collection by default
+ @return
+ returns true if field already a part of dataset, otherwise returns true
+ */
+ private function is_field($name,$collection = false){
+ if (!$collection)
+ $collection=$this->text;
+
+ for ($i=0; $iconfig=$config;
+ $this->connection=$connection;
+ }
+
+ /*! insert record in storage
+
+ @param data
+ DataAction object
+ @param source
+ DataRequestConfig object
+ */
+ abstract function insert($data,$source);
+
+ /*! delete record from storage
+
+ @param data
+ DataAction object
+ @param source
+ DataRequestConfig object
+ */
+ abstract function delete($data,$source);
+
+ /*! update record in storage
+
+ @param data
+ DataAction object
+ @param source
+ DataRequestConfig object
+ */
+ abstract function update($data,$source);
+
+ /*! select record from storage
+
+ @param source
+ DataRequestConfig object
+ */
+ abstract function select($source);
+
+ /*! get size of storage
+
+ @param source
+ DataRequestConfig object
+ */
+ abstract function get_size($source);
+
+ /*! get all variations of field in storage
+
+ @param name
+ name of field
+ @param source
+ DataRequestConfig object
+ */
+ abstract function get_variants($name,$source);
+
+ /*! checks if there is a custom sql string for specified db operation
+
+ @param name
+ name of DB operation
+ @param data
+ hash of data
+ @return
+ sql string
+ */
+ public function get_sql($name,$data){
+ return ""; //custom sql not supported by default
+ }
+
+ /*! begins DB transaction
+ */
+ public function begin_transaction(){
+ throw new Exception("Data wrapper not supports transactions.");
+ }
+ /*! commits DB transaction
+ */
+ public function commit_transaction(){
+ throw new Exception("Data wrapper not supports transactions.");
+ }
+ /*! rollbacks DB transaction
+ */
+ public function rollback_transaction(){
+ throw new Exception("Data wrapper not supports transactions.");
+ }
+}
+
+/*! Common database abstraction class
+ Class provides base set of methods to access and change data in DB, class used as a base for DB-specific wrappers
+**/
+abstract class DBDataWrapper extends DataWrapper{
+ private $transaction = false; //!< type of transaction
+ private $sequence=false;//!< sequence name
+ private $sqls = array();//!< predefined sql actions
+
+
+ /*! assign named sql query
+ @param name
+ name of sql query
+ @param data
+ sql query text
+ */
+ public function attach($name,$data){
+ $name=strtolower($name);
+ $this->sqls[$name]=$data;
+ }
+ /*! replace vars in sql string with actual values
+
+ @param matches
+ array of field name matches
+ @return
+ value for the var name
+ */
+ public function get_sql_callback($matches){
+ return $this->escape($this->temp->get_value($matches[1]));
+ }
+ public function get_sql($name,$data){
+ $name=strtolower($name);
+ if (!array_key_exists($name,$this->sqls)) return "";
+
+
+ $str = $this->sqls[$name];
+ $this->temp = $data; //dirty
+ $str = preg_replace_callback('|\{([^}]+)\}|',array($this,"get_sql_callback"),$str);
+ unset ($this->temp); //dirty
+ return $str;
+ }
+
+ public function insert($data,$source){
+ $sql=$this->insert_query($data,$source);
+ $this->query($sql);
+ $data->success($this->get_new_id());
+ }
+ public function delete($data,$source){
+ $sql=$this->delete_query($data,$source);
+ $this->query($sql);
+ $data->success();
+ }
+ public function update($data,$source){
+ $sql=$this->update_query($data,$source);
+ $this->query($sql);
+ $data->success();
+ }
+ public function select($source){
+ $select=$source->get_fieldset();
+ if (!$select){
+ $select=$this->config->db_names_list($this);
+ $select = implode(",",$select);
+ }
+
+ $where=$this->build_where($source->get_filters(),$source->get_relation());
+ $sort=$this->build_order($source->get_sort_by());
+
+ return $this->query($this->select_query($select,$source->get_source(),$where,$sort,$source->get_start(),$source->get_count()));
+ }
+ public function get_size($source){
+ $count = new DataRequestConfig($source);
+
+ $count->set_fieldset("COUNT(*) as DHX_COUNT ");
+ $count->set_sort(null);
+ $count->set_limit(0,0);
+
+ $res=$this->select($count);
+ $data=$this->get_next($res);
+ if (array_key_exists("DHX_COUNT",$data)) return $data["DHX_COUNT"];
+ else return $data["dhx_count"]; //postgresql
+ }
+ public function get_variants($name,$source){
+ $count = new DataRequestConfig($source);
+ $count->set_fieldset("DISTINCT ".$this->escape_name($name)." as value");
+ $count->set_sort(null);
+ $count->set_limit(0,0);
+
+ return $this->select($count);
+ }
+
+ public function sequence($sec){
+ $this->sequence=$sec;
+ }
+
+
+ /*! create an sql string for filtering rules
+
+ @param rules
+ set of filtering rules
+ @param relation
+ name of relation id field
+ @return
+ sql string with filtering rules
+ */
+ protected function build_where($rules,$relation=false){
+ $sql=array();
+ for ($i=0; $i < sizeof($rules); $i++)
+ if (is_string($rules[$i]))
+ array_push($sql,$rules[$i]);
+ else
+ if ($rules[$i]["value"]!=""){
+ if (!$rules[$i]["operation"])
+ array_push($sql,$this->escape_name($rules[$i]["name"])." LIKE '%".$this->escape($rules[$i]["value"])."%'");
+ else
+ array_push($sql,$this->escape_name($rules[$i]["name"])." ".$rules[$i]["operation"]." '".$this->escape($rules[$i]["value"])."'");
+ }
+ if ($relation!==false)
+ array_push($sql,$this->escape_name($this->config->relation_id["db_name"])." = '".$this->escape($relation)."'");
+ return implode(" AND ",$sql);
+ }
+ /*! convert sorting rules to sql string
+
+ @param by
+ set of sorting rules
+ @return
+ sql string for set of sorting rules
+ */
+ protected function build_order($by){
+ if (!sizeof($by)) return "";
+ $out = array();
+ for ($i=0; $i < sizeof($by); $i++)
+ if ($by[$i]["name"])
+ $out[]=$this->escape_name($by[$i]["name"])." ".$by[$i]["direction"];
+ return implode(",",$out);
+ }
+
+ /*! generates sql code for select operation
+
+ @param select
+ list of fields in select
+ @param from
+ table name
+ @param where
+ list of filtering rules
+ @param sort
+ list of sorting rules
+ @param start
+ start index of fetching
+ @param count
+ count of records to fetch
+ @return
+ sql string for select operation
+ */
+ protected function select_query($select,$from,$where,$sort,$start,$count){
+ $sql="SELECT ".$select." FROM ".$from;
+ if ($where) $sql.=" WHERE ".$where;
+ if ($sort) $sql.=" ORDER BY ".$sort;
+ if ($start || $count) $sql.=" LIMIT ".$start.",".$count;
+ return $sql;
+ }
+ /*! generates update sql
+
+ @param data
+ DataAction object
+ @param request
+ DataRequestConfig object
+ @return
+ sql string, which updates record with provided data
+ */
+ protected function update_query($data,$request){
+ $sql="UPDATE ".$request->get_source()." SET ";
+ $temp=array();
+ for ($i=0; $i < sizeof($this->config->text); $i++) {
+ $step=$this->config->text[$i];
+
+ if ($data->get_value($step["name"])===Null)
+ $step_value ="Null";
+ else
+ $step_value = "'".$this->escape($data->get_value($step["name"]))."'";
+ $temp[$i]= $this->escape_name($step["db_name"])."=". $step_value;
+ }
+ if ($relation = $this->config->relation_id["db_name"]){
+ $temp[]= $this->escape_name($relation)."='".$this->escape($data->get_value($relation))."'";
+ }
+ $sql.=implode(",",$temp)." WHERE ".$this->escape_name($this->config->id["db_name"])."='".$this->escape($data->get_id())."'";
+
+ //if we have limited set - set constraints
+ $where=$this->build_where($request->get_filters(),$request->get_relation());
+ if ($where) $sql.=" AND (".$where.")";
+
+ return $sql;
+ }
+
+ /*! generates delete sql
+
+ @param data
+ DataAction object
+ @param request
+ DataRequestConfig object
+ @return
+ sql string, which delete record
+ */
+ protected function delete_query($data,$request){
+ $sql="DELETE FROM ".$request->get_source();
+ $sql.=" WHERE ".$this->escape_name($this->config->id["db_name"])."='".$this->escape($data->get_id())."'";
+
+ //if we have limited set - set constraints
+ $where=$this->build_where($request->get_filters(),$request->get_relation());
+ if ($where) $sql.=" AND (".$where.")";
+
+ return $sql;
+ }
+
+ /*! generates insert sql
+
+ @param data
+ DataAction object
+ @param request
+ DataRequestConfig object
+ @return
+ sql string, which inserts new record with provided data
+ */
+ protected function insert_query($data,$request){
+ $temp_n=array();
+ $temp_v=array();
+ foreach($this->config->text as $k => $v){
+ $temp_n[$k]=$this->escape_name($v["db_name"]);
+ if ($data->get_value($v["name"])===Null)
+ $temp_v[$k]="Null";
+ else
+ $temp_v[$k]="'".$this->escape($data->get_value($v["name"]))."'";
+ }
+ if ($relation = $this->config->relation_id["db_name"]){
+ $temp_n[]=$this->escape_name($relation);
+ $temp_v[]="'".$this->escape($data->get_value($relation))."'";
+ }
+ if ($this->sequence){
+ $temp_n[]=$this->escape_name($this->config->id["db_name"]);
+ $temp_v[]=$this->sequence;
+ }
+
+ $sql="INSERT INTO ".$request->get_source()."(".implode(",",$temp_n).") VALUES (".implode(",",$temp_v).")";
+
+ return $sql;
+ }
+
+ /*! sets the transaction mode, used by dataprocessor
+
+ @param mode
+ mode name
+ */
+ public function set_transaction_mode($mode){
+ if ($mode!="none" && $mode!="global" && $mode!="record")
+ throw new Exception("Unknown transaction mode");
+ $this->transaction=$mode;
+ }
+ /*! returns true if global transaction mode was specified
+ @return
+ true if global transaction mode was specified
+ */
+ public function is_global_transaction(){
+ return $this->transaction == "global";
+ }
+ /*! returns true if record transaction mode was specified
+ @return
+ true if record transaction mode was specified
+ */
+ public function is_record_transaction(){
+ return $this->transaction == "record";
+ }
+
+
+ public function begin_transaction(){
+ $this->query("BEGIN");
+ }
+ public function commit_transaction(){
+ $this->query("COMMIT");
+ }
+ public function rollback_transaction(){
+ $this->query("ROLLBACK");
+ }
+
+ /*! exec sql string
+
+ @param sql
+ sql string
+ @return
+ sql result set
+ */
+ abstract protected function query($sql);
+ /*! returns next record from result set
+
+ @param res
+ sql result set
+ @return
+ hash of data
+ */
+ abstract public function get_next($res);
+ /*! returns new id value, for newly inserted row
+ @return
+ new id value, for newly inserted row
+ */
+ abstract protected function get_new_id();
+ /*! escape data to prevent sql injections
+ @param data
+ unescaped data
+ @return
+ escaped data
+ */
+ abstract public function escape($data);
+
+ /*! escape field name to prevent sql reserved words conflict
+ @param data
+ unescaped data
+ @return
+ escaped data
+ */
+ public function escape_name($data){
+ return $data;
+ }
+
+ /*! get list of tables in the database
+
+ @return
+ array of table names
+ */
+ public function tables_list() {
+ throw new Exception("Not implemented");
+ }
+
+ /*! returns list of fields for the table in question
+
+ @param table
+ name of table in question
+ @return
+ array of field names
+ */
+ public function fields_list($table) {
+ throw new Exception("Not implemented");
+ }
+
+}
+/*! Implementation of DataWrapper for MySQL
+**/
+class MySQLDBDataWrapper extends DBDataWrapper{
+ protected $last_result;
+ public function query($sql){
+ LogMaster::log($sql);
+ $res=mysql_query($sql,$this->connection);
+ if ($res===false) throw new Exception("MySQL operation failed\n".mysql_error($this->connection));
+ $this->last_result = $res;
+ return $res;
+ }
+
+ public function get_next($res){
+ if (!$res)
+ $res = $this->last_result;
+
+ return mysql_fetch_assoc($res);
+ }
+
+ protected function get_new_id(){
+ return mysql_insert_id($this->connection);
+ }
+
+ public function escape($data){
+ return mysql_real_escape_string($data);
+ }
+
+ public function tables_list() {
+ $result = mysql_query("SHOW TABLES");
+ if ($result===false) throw new Exception("MySQL operation failed\n".mysql_error($this->connection));
+
+ $tables = array();
+ while ($table = mysql_fetch_array($result)) {
+ $tables[] = $table[0];
+ }
+ return $tables;
+ }
+
+ public function fields_list($table) {
+ $result = mysql_query("SHOW COLUMNS FROM `".$table."`");
+ if ($result===false) throw new Exception("MySQL operation failed\n".mysql_error($this->connection));
+
+ $fields = array();
+ $id = "";
+ while ($field = mysql_fetch_assoc($result)) {
+ if ($field['Key'] == "PRI")
+ $id = $field["Field"];
+ else
+ $fields[] = $field["Field"];
+ }
+ return array("fields" => $fields, "key" => $id );
+ }
+
+ /*! escape field name to prevent sql reserved words conflict
+ @param data
+ unescaped data
+ @return
+ escaped data
+ */
+ public function escape_name($data){
+ if ((strpos($data,"`")!==false || intval($data)==$data) || (strpos($data,".")!==false))
+ return $data;
+ return '`'.$data.'`';
+ }
+}
+?>
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_mssql.php b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_mssql.php
new file mode 100644
index 00000000000..4cad2217878
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_mssql.php
@@ -0,0 +1,66 @@
+connection);
+ if ($this->insert_operation){
+ $last = mssql_fetch_assoc($res);
+ $this->last_id = $last["dhx_id"];
+ mssql_free_result($res);
+ }
+ if ($this->start_from)
+ mssql_data_seek($res,$this->start_from);
+ return $res;
+ }
+
+ public function get_next($res){
+ return mssql_fetch_assoc($res);
+ }
+
+ protected function get_new_id(){
+ /*
+ MSSQL doesn't support identity or auto-increment fields
+ Insert SQL returns new ID value, which stored in last_id field
+ */
+ return $this->last_id;
+ }
+
+ protected function insert_query($data,$request){
+ $sql = parent::insert_query($data,$request);
+ $this->insert_operation=true;
+ return $sql.";SELECT @@IDENTITY AS dhx_id";
+ }
+
+ protected function select_query($select,$from,$where,$sort,$start,$count){
+ $sql="SELECT " ;
+ if ($count)
+ $sql.=" TOP ".($count+$start);
+ $sql.=" ".$select." FROM ".$from;
+ if ($where) $sql.=" WHERE ".$where;
+ if ($sort) $sql.=" ORDER BY ".$sort;
+ if ($start && $count)
+ $this->start_from=$start;
+ else
+ $this->start_from=false;
+ return $sql;
+ }
+
+ public function escape($data){
+ /*
+ there is no special escaping method for mssql - use common logic
+ */
+ return str_replace("'","''",$data);
+ }
+
+ public function begin_transaction(){
+ $this->query("BEGIN TRAN");
+ }
+}
+?>
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_mysqli.php b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_mysqli.php
new file mode 100644
index 00000000000..a33ca71bbe4
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_mysqli.php
@@ -0,0 +1,53 @@
+connection->query($sql);
+ if ($res===false) throw new Exception("MySQL operation failed\n".$this->connection->error);
+ return $res;
+ }
+
+ public function get_next($res){
+ return $res->fetch_assoc();
+ }
+
+ protected function get_new_id(){
+ return $this->connection->insert_id;
+ }
+
+ public function escape($data){
+ return $this->connection->real_escape_string($data);
+ }
+
+ public function tables_list() {
+ $result = $this->connection->query("SHOW TABLES");
+ if ($result===false) throw new Exception("MySQL operation failed\n".$this->connection->error);
+
+ $tables = array();
+ while ($table = $result->fetch_array()) {
+ $tables[] = $table[0];
+ }
+ return $tables;
+ }
+
+ public function fields_list($table) {
+ $result = $this->connection->query("SHOW COLUMNS FROM `".$table."`");
+ if ($result===false) throw new Exception("MySQL operation failed\n".$this->connection->error);
+ $fields = array();
+ while ($field = $result->fetch_array()) {
+ if ($field['Key'] == "PRI") {
+ $fields[$field[0]] = 1;
+ } else {
+ $fields[$field[0]] = 0;
+ }
+ }
+ return $fields;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_oracle.php b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_oracle.php
new file mode 100644
index 00000000000..46c3e88bebe
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_oracle.php
@@ -0,0 +1,79 @@
+connection,$sql);
+ if ($stm===false) throw new Exception("Oracle - sql parsing failed\n".oci_error($this->connection));
+
+ $out = array(0=>null);
+ if($this->insert_operation){
+ oci_bind_by_name($stm,":outID",$out[0],999);
+ $this->insert_operation=false;
+ }
+
+
+ $mode = ($this->is_record_transaction() || $this->is_global_transaction())?OCI_DEFAULT:OCI_COMMIT_ON_SUCCESS;
+ $res=oci_execute($stm,$mode);
+ if ($res===false) throw new Exception("Oracle - sql execution failed\n".oci_error($this->connection));
+
+ $this->last_id=$out[0];
+
+ return $stm;
+ }
+
+ public function get_next($res){
+ $data = oci_fetch_assoc($res);
+ if (array_key_exists("VALUE",$data))
+ $data["value"]=$data["VALUE"];
+ return $data;
+ }
+
+ protected function get_new_id(){
+ /*
+ Oracle doesn't support identity or auto-increment fields
+ Insert SQL returns new ID value, which stored in last_id field
+ */
+ return $this->last_id;
+ }
+
+ protected function insert_query($data,$request){
+ $sql = parent::insert_query($data,$request);
+ $this->insert_operation=true;
+ return $sql." returning ".$this->config->id["db_name"]." into :outID";
+ }
+
+ protected function select_query($select,$from,$where,$sort,$start,$count){
+ $sql="SELECT ".$select." FROM ".$from;
+ if ($where) $sql.=" WHERE ".$where;
+ if ($sort) $sql.=" ORDER BY ".$sort;
+ if ($start || $count)
+ $sql="SELECT * FROM ( select /*+ FIRST_ROWS(".$count.")*/dhx_table.*, ROWNUM rnum FROM (".$sql.") dhx_table where ROWNUM <= ".($count+$start)." ) where rnum >".$start;
+ return $sql;
+ }
+
+ public function escape($data){
+ /*
+ as far as I can see the only way to escape data is by using oci_bind_by_name
+ while it is neat solution in common case, it conflicts with existing SQL building logic
+ fallback to simple escaping
+ */
+ return str_replace("'","''",$data);
+ }
+
+ public function begin_transaction(){
+ //auto-start of transaction
+ }
+ public function commit_transaction(){
+ oci_commit($this->connection);
+ }
+ public function rollback_transaction(){
+ oci_rollback($this->connection);
+ }
+}
+?>
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_pdo.php b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_pdo.php
new file mode 100644
index 00000000000..8fb6cf4578b
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_pdo.php
@@ -0,0 +1,65 @@
+connection->query($sql);
+ if ($res===false) throw new Exception("PDO - sql execution failed\n".$this->connection->errorInfo());
+
+ return new PDOResultSet($res);
+ }
+
+ protected function select_query($select,$from,$where,$sort,$start,$count){
+ $sql="SELECT ".$select." FROM ".$from;
+ if ($where) $sql.=" WHERE ".$where;
+ if ($sort) $sql.=" ORDER BY ".$sort;
+ if ($start || $count) {
+ if ($this->connection->getAttribute(PDO::ATTR_DRIVER_NAME)=="pgsql")
+ $sql.=" OFFSET ".$start." LIMIT ".$count;
+ else
+ $sql.=" LIMIT ".$start.",".$count;
+ }
+ return $sql;
+ }
+
+
+ public function get_next($res){
+ $data = $res->next();
+ return $data;
+ }
+
+ protected function get_new_id(){
+ return $this->connection->lastInsertId();
+ }
+
+ public function escape($str){
+ $res=$this->connection->quote($str);
+ if ($res===false) //not supported by pdo driver
+ return str_replace("'","''",$str);
+ return substr($res,1,-1);
+ }
+
+}
+
+class PDOResultSet{
+ private $res;
+ public function __construct($res){
+ $this->res = $res;
+ }
+ public function next(){
+ $data = $this->res->fetch(PDO::FETCH_ASSOC);
+ if (!$data){
+ $this->res->closeCursor();
+ return null;
+ }
+ return $data;
+ }
+}
+?>
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_postgre.php b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_postgre.php
new file mode 100644
index 00000000000..08f1b1aaa79
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/db_postgre.php
@@ -0,0 +1,66 @@
+connection,$sql);
+ if ($res===false) throw new Exception("Postgre - sql execution failed\n".pg_last_error($this->connection));
+
+ return $res;
+ }
+
+ protected function select_query($select,$from,$where,$sort,$start,$count){
+ $sql="SELECT ".$select." FROM ".$from;
+ if ($where) $sql.=" WHERE ".$where;
+ if ($sort) $sql.=" ORDER BY ".$sort;
+ if ($start || $count)
+ $sql.=" OFFSET ".$start." LIMIT ".$count;
+ return $sql;
+ }
+
+ public function get_next($res){
+ return pg_fetch_assoc($res);
+ }
+
+ protected function get_new_id(){
+ $res = pg_query( $this->connection, "SELECT LASTVAL() AS seq");
+ $data = pg_fetch_assoc($res);
+ pg_free_result($res);
+ return $data['seq'];
+ }
+
+ public function escape($data){
+ //need to use oci_bind_by_name
+ return pg_escape_string($this->connection,$data);
+ }
+
+ public function tables_list() {
+ $sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'";
+ $res = pg_query($this->connection, $sql);
+ $tables = array();
+ while ($table = pg_fetch_assoc($res)) {
+ $tables[] = $table['table_name'];
+ }
+ return $tables;
+ }
+
+ public function fields_list($table) {
+ $sql = "SELECT * FROM information_schema.constraint_column_usage";
+ $result = pg_query($this->connection, $sql);
+ $field = pg_fetch_assoc($result);
+ $id = $field['column_name'];
+
+ $sql = "SELECT * FROM information_schema.columns WHERE table_name ='".$table."';";
+ $result = pg_query($this->connection, $sql);
+ $fields = array();
+ $id = "";
+ while ($field = pg_fetch_assoc($result)) {
+ $fields[] = $field["column_name"];
+ }
+ return array('fields' => $fields, 'key' => $id );
+ }
+}
+?>
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/grid_connector.php b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/grid_connector.php
new file mode 100644
index 00000000000..5167528739f
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/grid_connector.php
@@ -0,0 +1,268 @@
+row_attrs=array();
+ $this->cell_attrs=array();
+ $this->userdata=array();
+ }
+ /*! set color of row
+
+ @param color
+ color of row
+ */
+ function set_row_color($color){
+ $this->row_attrs["bgColor"]=$color;
+ }
+ /*! set style of row
+
+ @param color
+ color of row
+ */
+ function set_row_style($color){
+ $this->row_attrs["style"]=$color;
+ }
+ /*! assign custom style to the cell
+
+ @param name
+ name of column
+ @param value
+ css style string
+ */
+ function set_cell_style($name,$value){
+ $this->set_cell_attribute($name,"style",$value);
+ }
+ /*! assign custom class to specific cell
+
+ @param name
+ name of column
+ @param value
+ css class name
+ */
+ function set_cell_class($name,$value){
+ $this->set_cell_attribute($name,"class",$value);
+ }
+ /*! set custom cell attribute
+
+ @param name
+ name of column
+ @param attr
+ name of attribute
+ @param value
+ value of attribute
+ */
+ function set_cell_attribute($name,$attr,$value){
+ if (!$this->cell_attrs[$name]) $this->cell_attrs[$name]=array();
+ $this->cell_attrs[$name][$attr]=$value;
+ }
+
+ /*! set userdata section for the item
+
+ @param name
+ name of userdata
+ @param value
+ value of userdata
+ */
+ function set_userdata($name, $value){
+ $this->userdata[$name]=$value;
+ }
+
+ /*! set custom row attribute
+
+ @param attr
+ name of attribute
+ @param value
+ value of attribute
+ */
+ function set_row_attribute($attr,$value){
+ $this->row_attrs[$attr]=$value;
+ }
+
+ /*! return self as XML string, starting part
+ */
+ public function to_xml_start(){
+ if ($this->skip) return "";
+
+ $str="row_attrs as $k=>$v)
+ $str.=" ".$k."='".$v."'";
+ $str.=">";
+ for ($i=0; $i < sizeof($this->config->text); $i++){
+ $str.="config->text[$i]["name"];
+ if (isset($this->cell_attrs[$name])){
+ $cattrs=$this->cell_attrs[$name];
+ foreach ($cattrs as $k => $v)
+ $str.=" ".$k."='".$this->xmlentities($v)."'";
+ }
+ $str.=">data[$name]."]]>";
+ }
+ foreach ($this->userdata as $key => $value)
+ $str.="";
+
+ return $str;
+ }
+ /*! return self as XML string, ending part
+ */
+ public function to_xml_end(){
+ if ($this->skip) return "";
+
+ return "";
+ }
+}
+/*! Connector for the dhtmlxgrid
+**/
+class GridConnector extends Connector{
+ protected $extra_output="";//!< extra info which need to be sent to client side
+ private $options=array();//!< hash of OptionsConnector
+
+ /*! constructor
+
+ Here initilization of all Masters occurs, execution timer initialized
+ @param res
+ db connection resource
+ @param type
+ string , which hold type of database ( MySQL or Postgre ), optional, instead of short DB name, full name of DataWrapper-based class can be provided
+ @param item_type
+ name of class, which will be used for item rendering, optional, DataItem will be used by default
+ @param data_type
+ name of class which will be used for dataprocessor calls handling, optional, DataProcessor class will be used by default.
+ */
+ public function __construct($res,$type=false,$item_type=false,$data_type=false){
+ if (!$item_type) $item_type="GridDataItem";
+ if (!$data_type) $data_type="GridDataProcessor";
+ parent::__construct($res,$type,$item_type,$data_type);
+ }
+
+
+ protected function parse_request(){
+ parent::parse_request();
+
+ if (isset($_GET["dhx_colls"]))
+ $this->fill_collections($_GET["dhx_colls"]);
+
+ if (isset($_GET["posStart"]) && isset($_GET["count"]))
+ $this->request->set_limit($_GET["posStart"],$_GET["count"]);
+ }
+ protected function resolve_parameter($name){
+ if (intval($name).""==$name)
+ return $this->config->text[intval($name)]["db_name"];
+ return $name;
+ }
+
+ /*! replace xml unsafe characters
+
+ @param string
+ string to be escaped
+ @return
+ escaped string
+ */
+ private function xmlentities($string) {
+ return str_replace( array( '&', '"', "'", '<', '>', '’' ), array( '&' , '"', ''' , '<' , '>', ''' ), $string);
+ }
+
+ /*! assign options collection to the column
+
+ @param name
+ name of the column
+ @param options
+ array or connector object
+ */
+ public function set_options($name,$options){
+ if (is_array($options)){
+ $str="";
+ foreach($options as $k => $v)
+ $str.="";
+ $options=$str;
+ }
+ $this->options[$name]=$options;
+ }
+ /*! generates xml description for options collections
+
+ @param list
+ comma separated list of column names, for which options need to be generated
+ */
+ protected function fill_collections($list){
+ $names=explode(",",$list);
+ for ($i=0; $i < sizeof($names); $i++) {
+ $name = $this->resolve_parameter($names[$i]);
+ if (!array_key_exists($name,$this->options)){
+ $this->options[$name] = new DistinctOptionsConnector($this->get_connection(),$this->names["db_class"]);
+ $c = new DataConfig($this->config);
+ $r = new DataRequestConfig($this->request);
+ $c->minimize($name);
+
+ $this->options[$name]->render_connector($c,$r);
+ }
+
+ $this->extra_output.="";
+ if (!is_string($this->options[$name]))
+ $this->extra_output.=$this->options[$name]->render();
+ else
+ $this->extra_output.=$this->options[$name];
+ $this->extra_output.="";
+ }
+ }
+
+ /*! renders self as xml, starting part
+ */
+ protected function xml_start(){
+ if ($this->dload){
+ if ($pos=$this->request->get_start())
+ return "";
+ else
+ return "";
+ }
+ else
+ return "";
+ }
+
+
+ /*! renders self as xml, ending part
+ */
+ protected function xml_end(){
+ return $this->extra_output."";
+ }
+
+ public function set_config($config = false){
+ if (gettype($config) == 'boolean')
+ $config = new GridConfiguration($config);
+
+ $this->event->attach("beforeOutput", Array($config, "attachHeaderToXML"));
+ }
+}
+
+/*! DataProcessor class for Grid component
+**/
+class GridDataProcessor extends DataProcessor{
+
+ /*! convert incoming data name to valid db name
+ converts c0..cN to valid field names
+ @param data
+ data name from incoming request
+ @return
+ related db_name
+ */
+ function name_data($data){
+ if ($data == "gr_id") return $this->config->id["name"];
+ $parts=explode("c",$data);
+ if ($parts[0]=="" && intval($parts[1])==$parts[1])
+ return $this->config->text[intval($parts[1])]["name"];
+ return $data;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/scheduler_connector.php b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/scheduler_connector.php
new file mode 100644
index 00000000000..82a1f4601e0
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/scheduler_connector.php
@@ -0,0 +1,121 @@
+skip) return "";
+
+ $str="";
+ $str.="data[$this->config->text[0]["name"]]."]]>";
+ $str.="data[$this->config->text[1]["name"]]."]]>";
+ $str.="data[$this->config->text[2]["name"]]."]]>";
+ for ($i=3; $iconfig->text); $i++){
+ $extra = $this->config->text[$i]["name"];
+ $str.="<".$extra.">data[$extra]."]]>".$extra.">";
+ }
+ return $str."";
+ }
+}
+
+
+/*! Connector class for dhtmlxScheduler
+**/
+class SchedulerConnector extends Connector{
+
+ protected $extra_output="";//!< extra info which need to be sent to client side
+ private $options=array();//!< hash of OptionsConnector
+
+
+ /*! assign options collection to the column
+
+ @param name
+ name of the column
+ @param options
+ array or connector object
+ */
+ public function set_options($name,$options){
+ if (is_array($options)){
+ $str="";
+ foreach($options as $k => $v)
+ $str.="";
+ $options=$str;
+ }
+ $this->options[$name]=$options;
+ }
+ /*! generates xml description for options collections
+
+ @param list
+ comma separated list of column names, for which options need to be generated
+ */
+ protected function fill_collections(){
+ foreach ($this->options as $k=>$v) {
+ $name = $k;
+ $this->extra_output.="";
+ if (!is_string($this->options[$name]))
+ $this->extra_output.=$this->options[$name]->render();
+ else
+ $this->extra_output.=$this->options[$name];
+ $this->extra_output.="";
+ }
+ }
+
+ /*! renders self as xml, ending part
+ */
+ protected function xml_end(){
+ $this->fill_collections();
+ return $this->extra_output."";
+ }
+
+
+ /*! constructor
+
+ Here initilization of all Masters occurs, execution timer initialized
+ @param res
+ db connection resource
+ @param type
+ string , which hold type of database ( MySQL or Postgre ), optional, instead of short DB name, full name of DataWrapper-based class can be provided
+ @param item_type
+ name of class, which will be used for item rendering, optional, DataItem will be used by default
+ @param data_type
+ name of class which will be used for dataprocessor calls handling, optional, DataProcessor class will be used by default.
+ */
+ public function __construct($res,$type=false,$item_type=false,$data_type=false){
+ if (!$item_type) $item_type="SchedulerDataItem";
+ if (!$data_type) $data_type="SchedulerDataProcessor";
+ parent::__construct($res,$type,$item_type,$data_type);
+ }
+
+ //parse GET scoope, all operations with incoming request must be done here
+ function parse_request(){
+ parent::parse_request();
+ if (count($this->config->text)){
+ if (isset($_GET["to"]))
+ $this->request->set_filter($this->config->text[0]["name"],$_GET["to"],"<");
+ if (isset($_GET["from"]))
+ $this->request->set_filter($this->config->text[1]["name"],$_GET["from"],">");
+ }
+ }
+}
+
+/*! DataProcessor class for Scheduler component
+**/
+class SchedulerDataProcessor extends DataProcessor{
+ function name_data($data){
+ if ($data=="start_date")
+ return $this->config->text[0]["db_name"];
+ if ($data=="id")
+ return $this->config->id["db_name"];
+ if ($data=="end_date")
+ return $this->config->text[1]["db_name"];
+ if ($data=="text")
+ return $this->config->text[2]["db_name"];
+
+ return $data;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/tools.php b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/tools.php
new file mode 100644
index 00000000000..c5b92e6ab2b
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/connector/tools.php
@@ -0,0 +1,254 @@
+events=array();
+ }
+ /*! Method check if event with such name already exists.
+ @param name
+ name of event, case non-sensitive
+ @return
+ true if event with such name registered, false otherwise
+ */
+ public function exist($name){
+ $name=strtolower($name);
+ return (isset($this->events[$name]) && sizeof($this->events[$name]));
+ }
+ /*! Attach custom code to event.
+
+ Only on event handler can be attached in the same time. If new event handler attached - old will be detached.
+
+ @param name
+ name of event, case non-sensitive
+ @param method
+ function which will be attached. You can use array(class, method) if you want to attach the method of the class.
+ */
+ public function attach($name,$method){
+ $name=strtolower($name);
+ if (!array_key_exists($name,$this->events))
+ $this->events[$name]=array();
+ $this->events[$name][]=$method;
+ }
+
+ public static function attach_static($name, $method){
+ $name=strtolower($name);
+ if (!array_key_exists($name,EventMaster::$eventsStatic))
+ EventMaster::$eventsStatic[$name]=array();
+ EventMaster::$eventsStatic[$name][]=$method;
+ }
+
+ public static function trigger_static($name, $method){
+ $arg_list = func_get_args();
+ $name=strtolower(array_shift($arg_list));
+
+ if (isset(EventMaster::$eventsStatic[$name]))
+ foreach(EventMaster::$eventsStatic[$name] as $method){
+ if (is_array($method) && !method_exists($method[0],$method[1]))
+ throw new Exception("Incorrect method assigned to event: ".$method[0].":".$method[1]);
+ if (!is_array($method) && !function_exists($method))
+ throw new Exception("Incorrect function assigned to event: ".$method);
+ call_user_func_array($method, $arg_list);
+ }
+ return true;
+ }
+
+ /*! Detach code from event
+ @param name
+ name of event, case non-sensitive
+ */
+ public function detach($name){
+ $name=strtolower($name);
+ unset($this->events[$name]);
+ }
+ /*! Trigger event.
+ @param name
+ name of event, case non-sensitive
+ @param data
+ value which will be provided as argument for event function,
+ you can provide multiple data arguments, method accepts variable number of parameters
+ @return
+ true if event handler was not assigned , result of event hangler otherwise
+ */
+ public function trigger($name,$data){
+ $arg_list = func_get_args();
+ $name=strtolower(array_shift($arg_list));
+
+ if (isset($this->events[$name]))
+ foreach($this->events[$name] as $method){
+ if (is_array($method) && !method_exists($method[0],$method[1]))
+ throw new Exception("Incorrect method assigned to event: ".$method[0].":".$method[1]);
+ if (!is_array($method) && !function_exists($method))
+ throw new Exception("Incorrect function assigned to event: ".$method);
+ call_user_func_array($method, $arg_list);
+ }
+ return true;
+ }
+}
+
+/*! Class which handles access rules.
+**/
+class AccessMaster{
+ private $rules,$local;
+ /*! constructor
+
+ Set next access right to "allowed" by default : read, insert, update, delete
+ Basically - all common data operations allowed by default
+ */
+ function __construct(){
+ $this->rules=array("read" => true, "insert" => true, "update" => true, "delete" => true);
+ $this->local=true;
+ }
+ /*! change access rule to "allow"
+ @param name
+ name of access right
+ */
+ public function allow($name){
+ $this->rules[$name]=true;
+ }
+ /*! change access rule to "deny"
+
+ @param name
+ name of access right
+ */
+ public function deny($name){
+ $this->rules[$name]=false;
+ }
+
+ /*! change all access rules to "deny"
+ */
+ public function deny_all(){
+ $this->rules=array();
+ }
+
+ /*! check access rule
+
+ @param name
+ name of access right
+ @return
+ true if access rule allowed, false otherwise
+ */
+ public function check($name){
+ if ($this->local){
+ /*!
+ todo
+ add referrer check, to prevent access from remote points
+ */
+ }
+ if (!isset($this->rules[$name]) || !$this->rules[$name]){
+ return false;
+ }
+ return true;
+ }
+}
+
+/*! Controls error and debug logging.
+ Class designed to be used as static object.
+**/
+class LogMaster{
+ private static $_log=false;//!< logging mode flag
+ private static $_output=false;//!< output error infor to client flag
+ private static $session="";//!< all messages generated for current request
+
+ /*! convert array to string representation ( it is a bit more readable than var_dump )
+
+ @param data
+ data object
+ @param pref
+ prefix string, used for formating, optional
+ @return
+ string with array description
+ */
+ private static function log_details($data,$pref=""){
+ if (is_array($data)){
+ $str=array("");
+ foreach($data as $k=>$v)
+ array_push($str,$pref.$k." => ".LogMaster::log_details($v,$pref."\t"));
+ return implode("\n",$str);
+ }
+ return $data;
+ }
+ /*! put record in log
+
+ @param str
+ string with log info, optional
+ @param data
+ data object, which will be added to log, optional
+ */
+ public static function log($str="",$data=""){
+ if (LogMaster::$_log){
+ $message = $str.LogMaster::log_details($data)."\n\n";
+ LogMaster::$session.=$message;
+ error_log($message,3,LogMaster::$_log);
+ }
+ }
+
+ /*! get logs for current request
+ @return
+ string, which contains all log messages generated for current request
+ */
+ public static function get_session_log(){
+ return LogMaster::$session;
+ }
+
+ /*! error handler, put normal php errors in log file
+
+ @param errn
+ error number
+ @param errstr
+ error description
+ @param file
+ error file
+ @param line
+ error line
+ @param context
+ error cntext
+ */
+ public static function error_log($errn,$errstr,$file,$line,$context){
+ LogMaster::log($errstr." at ".$file." line ".$line);
+ }
+
+ /*! exception handler, used as default reaction on any error - show execution log and stop processing
+
+ @param exception
+ instance of Exception
+ */
+ public static function exception_log($exception){
+ LogMaster::log("!!!Uncaught Exception\nCode: " . $exception->getCode() . "\nMessage: " . $exception->getMessage());
+ if (LogMaster::$_output){
+ echo "
";
+scheduler._dp_init=function(a){a._methods=["setEventTextStyle","","changeEventId","deleteEvent"];this.attachEvent("onEventAdded",function(b){!this._loading&&this.validId(b)&&a.setUpdated(b,!0,"inserted")});this.attachEvent("onConfirmedBeforeEventDelete",function(b){if(this.validId(b)){var c=a.getState(b);if(c=="inserted"||this._new_event)return a.setUpdated(b,!1),!0;if(c=="deleted")return!1;if(c=="true_deleted")return!0;a.setUpdated(b,!0,"deleted");return!1}});this.attachEvent("onEventChanged",function(b){!this._loading&&
+this.validId(b)&&a.setUpdated(b,!0,"updated")});a._getRowData=function(a){var c=this.obj.getEvent(a),d={},e;for(e in c)e.indexOf("_")!=0&&(d[e]=c[e]&&c[e].getUTCFullYear?this.obj.templates.xml_format(c[e]):c[e]);return d};a._clearUpdateFlag=function(){};a.attachEvent("insertCallback",scheduler._update_callback);a.attachEvent("updateCallback",scheduler._update_callback);a.attachEvent("deleteCallback",function(a,c){this.obj.setUserData(c,this.action_param,"true_deleted");this.obj.deleteEvent(c)})};
+scheduler.setUserData=function(a,b,c){a?this.getEvent(a)[b]=c:this._userdata[b]=c};scheduler.getUserData=function(a,b){return a?this.getEvent(a)[b]:this._userdata[b]};scheduler.setEventTextStyle=function(a,b){this.for_rendered(a,function(a){a.style.cssText+=";"+b});var c=this.getEvent(a);c._text_style=b;this.event_updated(c)};scheduler.validId=function(){return!0};
+scheduler._update_callback=function(a){var b=scheduler.xmlNodeToJSON(a.firstChild);b.text=b.text||b._tagvalue;b.start_date=scheduler.templates.xml_date(b.start_date);b.end_date=scheduler.templates.xml_date(b.end_date);scheduler.addEvent(b)};
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/dhtmlxscheduler_debug.js b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/dhtmlxscheduler_debug.js
index a3c14bee033..6b2e961051c 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/dhtmlxscheduler_debug.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/dhtmlxscheduler_debug.js
@@ -1,11 +1,38 @@
-/*
-dhtmlxScheduler v.2.3
-
+/*
This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
-to use it in not GPL project. Please contact sales@dhtmlx.com for details
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+
+window.dhtmlx || (dhtmlx=function(obj){
+ for (var a in obj) dhtmlx[a]=obj[a];
+ return dhtmlx; //simple singleton
+})
+dhtmlx.extend_api=function(name,map,ext){
+ var t = window[name];
+ if (!t) return; //component not defined
+ window[name]=function(obj){
+ if (obj && typeof obj == "object" && !obj.tagName && !(obj instanceof Array)){
+ var that = t.apply(this,(map._init?map._init(obj):arguments));
+ //global settings
+ for (var a in dhtmlx)
+ if (map[a]) this[map[a]](dhtmlx[a]);
+ //local settings
+ for (var a in obj){
+ if (map[a]) this[map[a]](obj[a]);
+ else if (a.indexOf("on")==0){
+ this.attachEvent(a,obj[a]);
+ }
+ }
+ } else
+ var that = t.apply(this,arguments);
+ if (map._patch) map._patch(this);
+ return that||this;
+ };
+ window[name].prototype=t.prototype;
+ if (ext)
+ dhtmlXHeir(window[name].prototype,ext);
+};
-(c) DHTMLX Ltd.
-*/
dhtmlxAjax={
get:function(url,callback){
var t=new dtmlXMLLoaderObject(true);
@@ -554,12 +581,15 @@ dhtmlDragAndDropObject.prototype.initFrameRoute=function(win, mode){
}
}
-var _isFF = false;
-var _isIE = false;
-var _isOpera = false;
-var _isKHTML = false;
-var _isMacOS = false;
-var _isChrome = false;
+_isFF = false;
+_isIE = false;
+_isOpera = false;
+_isKHTML = false;
+_isMacOS = false;
+_isChrome = false;
+_KHTMLrv = false;
+_OperaRv = false;
+_FFrv = false;
if (navigator.userAgent.indexOf('Macintosh') != -1)
_isMacOS=true;
@@ -876,8 +906,14 @@ dhtmlxEventable=function(obj){
this[list[0]].removeEvent(list[1]); //remove event
}
}
+ obj.detachAllEvents = function(){
+ for (var name in this){
+ if (name.indexOf("ev_")==0)
+ delete this[name];
+ }
+ }
}
-
+
/**
* @desc: constructor, data processor object
* @param: serverProcessorURL - url used for update
@@ -1242,6 +1278,8 @@ dataProcessor.prototype={
var soid = sid;
switch (action) {
+ case "update":
+ case "updated":
case "inserted":
case "insert":
if (tid != sid) {
@@ -1458,7 +1496,7 @@ dataProcessor.prototype={
};
-//(c)dhtmlx ltd. www.dhtmlx.com
+//(c)dhtmlx ltd. www.dhtmlx.com
dataProcessor.prototype._o_init = dataProcessor.prototype.init;
dataProcessor.prototype.init=function(obj){
this._console=this._console||this._createConsole();
@@ -1547,7 +1585,7 @@ dataProcessor.wrap("sendData",function(rowId){
if (!this.obj._idpull[rowId])
this._log(" Error! item with such ID not exists "+rowId+"");
} else {
- if (!this.obj.rowsAr[rowId])
+ if (this.rowsAr && !this.obj.rowsAr[rowId])
this._log(" Error! row with such ID not exists "+rowId+"");
}
}
@@ -1611,7 +1649,7 @@ dataProcessor.wrap("afterUpdateCallback",function(sid,tid,action){
if (this.obj.mytype=="tree"){
if (!this.obj._idpull[sid]) this._log("Incorrect SID, item with such ID not exists in grid");
} else {
- if (!this.obj.rowsAr[sid]) this._log("Incorrect SID, row with such ID not exists in grid");
+ if (this.obj.rowsAr && !this.obj.rowsAr[sid]) this._log("Incorrect SID, row with such ID not exists in grid");
}
this._log(" Action: "+action+" SID:"+sid+" TID:"+tid);
},function(){
@@ -1623,7 +1661,7 @@ dataProcessor.wrap("afterUpdateCallback",function(sid,tid,action){
-
+
/*
dhx_sort[index]=direction
dhx_filter[index]=mask
@@ -1633,10 +1671,10 @@ if (window.dhtmlXGridObject){
dhtmlXGridObject.prototype._init_point=function(){
var clear_url=function(url){
url=url.replace(/(\?|\&)connector[^\f]*/g,"");
- return url+(url.indexOf("?")!=-1?"&":"?")+"connector=true"+(mygrid.hdr.rows.length > 0 ? "&dhx_no_header=1":"");
+ return url+(url.indexOf("?")!=-1?"&":"?")+"connector=true"+(this.hdr.rows.length > 0 ? "&dhx_no_header=1":"");
};
var combine_urls=function(url){
- return clear_url(url)+(this._connector_sorting||"")+(this._connector_filter||"");
+ return clear_url.call(this,url)+(this._connector_sorting||"")+(this._connector_filter||"");
};
var sorting_url=function(url,ind,dir){
this._connector_sorting="&dhx_sort["+ind+"]="+dir;
@@ -1738,14 +1776,10 @@ if (window.dhtmlXGridObject){
}
if (this._con_f_used[f*1])
this._con_f_used[f*1]=v;
- };
+ }
this._colls_loaded=true;
}
- };
-
-
-
-
+ };
}
if (window.dataProcessor){
@@ -1757,16 +1791,20 @@ if (window.dataProcessor){
this.setTransactionMode("POST",true);
this.serverProcessor+=(this.serverProcessor.indexOf("?")!=-1?"&":"?")+"editing=true";
};
-};
+}
dhtmlxError.catchError("LoadXML",function(a,b,c){
- alert(c[0].responseText);
+ if (c[0].status != 0) {
+ alert(c[0].responseText);
+ }
});
-
-window.dhtmlXScheduler=window.scheduler={version:2.2};
+
+window.dhtmlXScheduler=window.scheduler={version:3.0};
dhtmlxEventable(scheduler);
scheduler.init=function(id,date,mode){
date=date||(new Date());
mode=mode||"week";
+
+ scheduler.date.init();
this._obj=(typeof id == "string")?document.getElementById(id):id;
this._els=[];
@@ -1783,9 +1821,9 @@ scheduler.init=function(id,date,mode){
if (scheduler.callEvent("onSchedulerResize",[]))
scheduler.update_view();
}, 100);
- })
-
+ });
this.set_sizes();
+ scheduler.callEvent('onSchedulerReady', []);
this.setCurrentView(date,mode);
};
scheduler.xy={
@@ -1821,7 +1859,7 @@ scheduler.set_sizes=function(){
var data_y=this.xy.scale_height+this.xy.nav_height+(this._quirks?-2:0);
this.set_xy(this._els["dhx_cal_data"][0],w,h-(data_y+2),0,data_y+2);
-}
+};
scheduler.set_xy=function(node,w,h,x,y){
node.style.width=Math.max(0,w)+"px";
node.style.height=Math.max(0,h)+"px";
@@ -1829,7 +1867,7 @@ scheduler.set_xy=function(node,w,h,x,y){
node.style.left=x+"px";
node.style.top=y+"px";
}
-}
+};
scheduler.get_elements=function(){
//get all child elements as named hash
var els=this._obj.getElementsByTagName("DIV");
@@ -1842,26 +1880,26 @@ scheduler.get_elements=function(){
var t=scheduler.locale.labels[els[i].getAttribute("name")||name];
if (t) els[i].innerHTML=t;
}
-}
+};
scheduler.set_actions=function(){
for (var a in this._els)
if (this._click[a])
for (var i=0; i < this._els[a].length; i++)
this._els[a][i].onclick=scheduler._click[a];
- this._obj.onselectstart=function(e){ return false; }
+ this._obj.onselectstart=function(e){ return false; };
this._obj.onmousemove=function(e){
scheduler._on_mouse_move(e||event);
- }
+ };
this._obj.onmousedown=function(e){
scheduler._on_mouse_down(e||event);
- }
+ };
this._obj.onmouseup=function(e){
scheduler._on_mouse_up(e||event);
- }
+ };
this._obj.ondblclick=function(e){
scheduler._on_dbl_click(e||event);
}
-}
+};
scheduler.select=function(id){
if (this._table_view || !this.getEvent(id)._timed) return; //temporary block
if (this._select_id==id) return;
@@ -1869,13 +1907,13 @@ scheduler.select=function(id){
this.unselect();
this._select_id = id;
this.updateEvent(id);
-}
+};
scheduler.unselect=function(id){
if (id && id!=this._select_id) return;
var t=this._select_id;
this._select_id = null;
if (t) this.updateEvent(t);
-}
+};
scheduler.getState=function(){
return {
mode: this._mode,
@@ -1883,11 +1921,13 @@ scheduler.getState=function(){
min_date: this._min_date,
max_date: this._max_date,
editor_id: this._edit_id,
- lightbox_id: this._lightbox_id
+ lightbox_id: this._lightbox_id,
+ new_event: this._new_event
};
-}
+};
scheduler._click={
dhx_cal_data:function(e){
+ //debugger;
var trg = e?e.target:event.srcElement;
var id = scheduler._locate_event(trg);
@@ -1913,7 +1953,8 @@ scheduler._click={
scheduler.setCurrentView(new Date());
},
dhx_cal_tab:function(){
- var mode = this.getAttribute("name").split("_")[0];
+ var name = this.getAttribute("name");
+ var mode = name.substring(0, name.search("_tab"));
scheduler.setCurrentView(scheduler._date,mode);
},
buttons:{
@@ -1923,11 +1964,10 @@ scheduler._click={
details:function(id){ scheduler.showLightbox(id); },
cancel:function(id){ scheduler.editStop(false); }
}
-}
-
+};
scheduler.addEventNow=function(start,end,e){
var base = {};
- if (typeof start == "object"){
+ if (start && start.constructor.toString().match(/object/i) !== null){
base = start;
start = null;
}
@@ -1943,14 +1983,18 @@ scheduler.addEventNow=function(start,end,e){
}
end = start+d;
}
-
-
+ var end_date = new Date(end);
+
+ // scheduler.addEventNow(new Date(), new Date()) + collision though get_visible events defect (such event was not retrieved)
+ if(start_date.valueOf() == end_date.valueOf())
+ end_date.setTime(end_date.valueOf()+d);
+
base.start_date = base.start_date||start_date;
- base.end_date = base.end_date||new Date(end);
+ base.end_date = base.end_date||end_date;
base.text = base.text||this.locale.labels.new_event;
base.id = this._drag_id = this.uid();
this._drag_mode="new-size";
-
+
this._loading=true;
this.addEvent(base);
this.callEvent("onEventCreated",[this._drag_id,e]);
@@ -1958,7 +2002,7 @@ scheduler.addEventNow=function(start,end,e){
this._drag_event={}; //dummy , to trigger correct event updating logic
this._on_mouse_up(e);
-}
+};
scheduler._on_dbl_click=function(e,src){
src = src||(e.target||e.srcElement);
if (this.config.readonly) return;
@@ -1967,6 +2011,7 @@ scheduler._on_dbl_click=function(e,src){
case "dhx_scale_holder":
case "dhx_scale_holder_now":
case "dhx_month_body":
+ case "dhx_wa_day_data":
if (!scheduler.config.dblclick_create) break;
var pos=this._mouse_coords(e);
var start=this._min_date.valueOf()+(pos.y*this.config.time_step+(this._table_view?0:pos.x)*24*60)*60000;
@@ -1974,6 +2019,7 @@ scheduler._on_dbl_click=function(e,src){
this.addEventNow(start,null,e);
break;
case "dhx_body":
+ case "dhx_wa_ev_body":
case "dhx_cal_event_line":
case "dhx_cal_event_clear":
var id = this._locate_event(src);
@@ -1991,7 +2037,7 @@ scheduler._on_dbl_click=function(e,src){
if (t) t.call(this,e);
break;
}
-}
+};
scheduler._mouse_coords=function(ev){
var pos;
@@ -2002,17 +2048,17 @@ scheduler._mouse_coords=function(ev){
else pos={
x:ev.clientX + (b.scrollLeft||d.scrollLeft||0) - b.clientLeft,
y:ev.clientY + (b.scrollTop||d.scrollTop||0) - b.clientTop
- }
+ };
//apply layout
pos.x-=getAbsoluteLeft(this._obj)+(this._table_view?0:this.xy.scale_width);
pos.y-=getAbsoluteTop(this._obj)+this.xy.nav_height+(this._dy_shift||0)+this.xy.scale_height-this._els["dhx_cal_data"][0].scrollTop;
pos.ev = ev;
-
+
var handler = this["mouse_"+this._mode];
if (handler)
return handler.call(this,pos);
-
+
//transform to date
if (!this._table_view){
pos.x=Math.max(0,Math.ceil(pos.x/this._cols[0])-1);
@@ -2022,7 +2068,7 @@ scheduler._mouse_coords=function(ev){
for (dy=1; dy < this._colsS.heights.length; dy++)
if (this._colsS.heights[dy]>pos.y) break;
- pos.y=(Math.max(0,Math.ceil(pos.x/this._cols[0])-1)+Math.max(0,dy-1)*7)*24*60/this.config.time_step;
+ pos.y=(Math.max(0,Math.ceil(pos.x/this._cols[0])-1)+Math.max(0,dy-1)*7)*24*60/this.config.time_step;
pos.x=0;
}
@@ -2034,14 +2080,14 @@ scheduler._close_not_saved=function(){
if (!c || confirm(c))
scheduler.editStop(scheduler.config.positive_closing);
}
-}
+};
scheduler._correct_shift=function(start, back){
return start-=((new Date(scheduler._min_date)).getTimezoneOffset()-(new Date(start)).getTimezoneOffset())*60000*(back?-1:1);
-}
+};
scheduler._on_mouse_move=function(e){
if (this._drag_mode){
var pos=this._mouse_coords(e);
- if (!this._drag_pos || this._drag_pos.x!=pos.x || this._drag_pos.y!=pos.y){
+ if (!this._drag_pos || pos.custom || this._drag_pos.x!=pos.x || this._drag_pos.y!=pos.y){
if (this._edit_id!=this._drag_id)
this._close_not_saved();
@@ -2080,8 +2126,11 @@ scheduler._on_mouse_move=function(e){
end = ev.end_date.valueOf()-(ev.start_date.valueOf()-start);
} else {
start = ev.start_date.valueOf();
- if (this._table_view)
+ if (this._table_view) {
end = this._min_date.valueOf()+pos.y*this.config.time_step*60000 + (pos.custom?0:24*60*60000);
+ if (this._mode == "month")
+ end = this._correct_shift(end, false);
+ }
else{
end = this.date.date_part(new Date(ev.end_date)).valueOf()+pos.y*this.config.time_step*60000;
this._els["dhx_cal_data"][0].style.cursor="s-resize";
@@ -2091,7 +2140,7 @@ scheduler._on_mouse_move=function(e){
if (this._drag_mode == "new-size"){
if (end <= this._drag_start){
var shift = pos.shift||((this._table_view && !pos.custom)?24*60*60000:0);
- start = end-shift;
+ start = end-(pos.shift?0:shift);
end = this._drag_start+(shift||(this.config.time_step*60000));
} else {
start = this._drag_start;
@@ -2103,7 +2152,7 @@ scheduler._on_mouse_move=function(e){
var new_end = new Date(end-1);
var new_start = new Date(start);
//prevent out-of-borders situation for day|week view
- if (this._table_view || (new_end.getDate()==new_start.getDate() && new_end.getHours() this._min_date && now.getHours() >= this.config.first_hour && now.getHours()
"+this.templates.month_day(sd)+"
"
+ html+=">
"+this.templates.month_day(sd)+"
";
sd=this.date.add(sd,1,"day");
}
html+="";
@@ -2389,7 +2479,7 @@ scheduler._reset_month_scale=function(b,dd,sd){
b.innerHTML=html;
return sd;
-}
+};
scheduler.getLabel = function(property, key) {
var sections = this.config.lightbox.sections;
for (var i=0; ib.start_date?1:-1; });
+ evs.sort(function(a,b){
+ if(a.start_date.valueOf()==b.start_date.valueOf())
+ return a.id>b.id?1:-1;
+ return a.start_date>b.start_date?1:-1;
+ });
var days=[]; //events by weeks
var evs_originals = [];
for (var i=0; i < evs.length; i++) {
@@ -2926,12 +3090,70 @@ scheduler._pre_render_events_line=function(evs,hold){
if (!hold){
ev._inner=false;
+
var stack=days[ev._sday];
while (stack.length && stack[stack.length-1].end_date<=ev.start_date)
stack.splice(stack.length-1,1);
- if (stack.length) stack[stack.length-1]._inner=true;
- ev._sorder=stack.length; stack.push(ev);
- if (stack.length>(stack.max_count||0)) stack.max_count=stack.length;
+
+ var sorderSet = false;
+ for(var j=0; j _max_sorder)
+ _max_sorder = stack[j]._sorder;
+ ev._sorder = _max_sorder + 1;
+ ev._inner = false;
+ }
+
+ }
+ else
+ ev._sorder = 0;
+ }
+
+ stack.push(ev);
+
+ if (stack.length>(stack.max_count||0)) {
+ stack.max_count=stack.length;
+ ev._count=stack.length;
+ }
+ else {
+ ev._count=(ev._count)?ev._count:1;
+ }
}
if (sh < this.config.first_hour || eh >= this.config.last_hour){
@@ -2949,23 +3171,23 @@ scheduler._pre_render_events_line=function(evs,hold){
evs.splice(i,1); i--; continue;
}
}
-
}
if (!hold){
- for (var i=0; i < evs.length; i++)
- evs[i]._count=days[evs[i]._sday].max_count;
- for (var i=0; i < evs_originals.length; i++)
+ for (var i=0; i < evs.length; i++) {
+ evs[i]._count = days[evs[i]._sday].max_count;
+ }
+ for (var i=0; i < evs_originals.length; i++)
evs_originals[i]._count=days[evs_originals[i]._sday].max_count;
}
return evs;
};
scheduler._time_order=function(evs){
- evs.sort(function(a,b){
+ evs.sort(function(a,b){
if (a.start_date.valueOf()==b.start_date.valueOf()){
if (a._timed && !b._timed) return 1;
if (!a._timed && b._timed) return -1;
- return 0;
+ return a.id>b.id?1:-1;
}
return a.start_date>b.start_date?1:-1;
});
@@ -3004,8 +3226,10 @@ scheduler._pre_render_events_table=function(evs,hold){ // max - max height of we
for (stack_line=0; stack_line";
- var obj = this._render_v_bar(ev.id,left-menu+1,top,menu,icons.length*20+26,"","",icons_str,true);
+ icons_str+="";
+ var obj = this._render_v_bar(ev.id,left-menu+1,top,menu,icons.length*20+26,"","",icons_str,true);
obj.style.left=left-menu+1;
this._els["dhx_cal_data"][0].appendChild(obj);
this._rendered.push(obj);
@@ -3132,17 +3364,19 @@ scheduler.render_event=function(ev){
};
scheduler._render_v_bar=function(id,x,y,w,h,style,contentA,contentB,bottom){
var d=document.createElement("DIV");
-
var ev = this.getEvent(id);
var cs = "dhx_cal_event";
var cse = scheduler.templates.event_class(ev.start_date,ev.end_date,ev);
if (cse) cs=cs+" "+cse;
+
+ var bg_color = (ev.color?("background-color:"+ev.color+";"):"");
+ var color = (ev.textColor?("color:"+ev.textColor+";"):"");
var html='
';
- html+='
';
- html+='
'+contentA+'
';
- html+='
'+contentB+'
';
- html+='
';
+ html+='
';
+ html+='
'+contentA+'
';
+ html+='
'+contentB+'
';
+ html+='';
d.innerHTML=html;
return d.firstChild;
@@ -3158,22 +3392,25 @@ scheduler.locate_holder_day=function(date,past){
return day;
};
scheduler.render_event_bar=function(ev){
- var parent=this._els["dhx_cal_data"][0];
+ var parent=this._rendered_location;
var x=this._colsS[ev._sday];
var x2=this._colsS[ev._eday];
if (x2==x) x2=this._colsS[ev._eday+1];
var hb = this.xy.bar_height;
- var y=this._colsS.heights[ev._sweek]+(this._colsS.height?(this.xy.month_scale_height+2):2)+ev._sorder*hb;
+ var y=this._colsS.heights[ev._sweek]+(this._colsS.height?(this.xy.month_scale_height+2):2)+(ev._sorder*hb);
var d=document.createElement("DIV");
var cs = ev._timed?"dhx_cal_event_clear":"dhx_cal_event_line";
var cse = scheduler.templates.event_class(ev.start_date,ev.end_date,ev);
- if (cse) cs=cs+" "+cse;
+ if (cse) cs=cs+" "+cse;
+
+ var bg_color = (ev.color?("background-color:"+ev.color+";"):"");
+ var color = (ev.textColor?("color:"+ev.textColor+";"):"");
+
+ var html='
';
- var html='
';
-
if (ev._timed)
html+=scheduler.templates.event_bar_date(ev.start_date,ev.end_date,ev);
html+=scheduler.templates.event_bar_text(ev.start_date,ev.end_date,ev)+'
';
@@ -3230,6 +3467,7 @@ scheduler.getEvents = function(from,to){
}
return result;
};
+
scheduler._loaded={};
scheduler._load=function(url,from){
url=url||this._load_url;
@@ -3270,13 +3508,14 @@ scheduler._load=function(url,from){
dhtmlxAjax.get(url,function(l){scheduler.on_load(l);});
this.callEvent("onXLS",[]);
return true;
-}
+};
scheduler.on_load=function(loader){
this._loading=true;
+ var evs;
if (this._process)
- var evs=this[this._process].parse(loader.xmlDoc.responseText);
+ evs=this[this._process].parse(loader.xmlDoc.responseText);
else
- var evs=this._magic_parser(loader);
+ evs=this._magic_parser(loader);
this._not_render=true;
for (var i=0; i
";
+ },
+ set_value:function(node,value,ev,config){
+ node.innerHTML = value||"";
+ },
+ get_value:function(node,ev,config){
+ return node.innerHTML||"";
+ },
+ focus: function(node){
+ }
+ },
textarea:{
render:function(sns){
var height=(sns.height||"130")+"px";
@@ -3499,7 +3783,7 @@ scheduler.form_blocks={
select:{
render:function(sns){
var height=(sns.height||"23")+"px";
- var html="";
+ d.innerHTML=html;
+ if (scheduler.config.drag_lightbox){
+ d.firstChild.onmousedown = scheduler._ready_to_dnd;
+ d.firstChild.onselectstart = function(){ return false; };
+ d.firstChild.style.cursor = "pointer";
+ scheduler._init_dnd_events();
+
+ }
document.body.insertBefore(d,document.body.firstChild);
this._lightbox=d;
var sns=this.config.lightbox.sections;
- var html="";
+ html="";
for (var i=0; i < sns.length; i++) {
var block=this.form_blocks[sns[i].type];
if (!block) continue; //ignore incorrect blocks
sns[i].id="area_"+this.uid();
var button = "";
- if (sns[i].button) button = "
",data:{text:"You have forgot to define the text :) "}},{view:"button",height:60,id:"dhx_alert_ok",type:"big",label:"Ok",click:function(){this.getParent().getParent().Bb(!0)}}]}},$init:function(){(!this.b.parentNode||!this.b.parentNode.tagName)&&document.body.appendChild(this.b);this.$ready.push(this.resize)},
+Yc:function(a){typeof a=="string"&&(a={title:this.defaults.head.template,message:a});dhx.extend(a,this.defaults);delete a.head;delete a.body;this.Rb(a,{});this.resize();this.show()},title_setter:function(a){this.R.define("template",a);this.R.render()},message_setter:function(a){var b=this.h.c[0];b.data={text:a};b.render()},labelOk_setter:function(a){var b=this.h.c[1];b.config.label=a;b.render()},labelCancel_setter:function(a){var b=this.h.c[2];b.config.label=a;b.render()},Bb:function(a){this.hide();
+this.a.callback&&dhx.toFunctor(this.a.callback).call(this,a,this.a.details)}},dhx.ui.window);dhx.alert=dhx.single(dhx.ui.alert);
+dhx.protoUI({name:"confirm",defaults:{height:210,body:{type:"clean",rows:[{id:"dhx_confirm_message",template:"
#text#
",data:{text:"You have forgot to define the text :) "}},{height:53,view:"button",type:"big",id:"dhx_confirm_ok",label:"Ok",click:function(){this.getParent().getParent().Bb(!0)}},{height:55,view:"button",type:"biground",id:"dhx_confirm_cancel",label:"Cancel",click:function(){this.getParent().getParent().Bb(!1)}}]}}},dhx.ui.alert);dhx.confirm=dhx.single(dhx.ui.confirm);
+dhx.dp=function(a){if(typeof a=="object"&&a.a)a=a.a.id;if(dhx.dp.Tb[a])return dhx.dp.Tb[a];if(typeof a=="string"||typeof a=="number")a={master:dhx.ui.get(a)};var b=new dhx.DataProcessor(a);return dhx.dp.Tb[b.a.master.a.id]=b};dhx.dp.Tb={};
+dhx.DataProcessor=dhx.proto({defaults:{autoupdate:!0,mode:"post"},$init:function(){this.V=[];this.bf=[];this.X=null;this.na=!1;this.name="DataProcessor";this.$ready.push(this.zb)},master_setter:function(a){var b=a;if(a.name!="DataStore")b=a.data;this.a.store=b;return a},zb:function(){this.a.store.attachEvent("onStoreUpdated",dhx.bind(this.Sc,this))},ignore:function(a,b){var c=this.na;this.na=!0;a.call(b||this);this.na=c},off:function(){this.na=!0},on:function(){this.na=!1},Kd:function(a){var b={},
+c;for(c in a)c.indexOf("$")!==0&&(b[c]=a[c]);return b},save:function(a,b){b=b||"update";this.Sc(a,this.a.store.item(a),b)},Sc:function(a,b,c){if(this.na===!0||!c)return!0;var d={id:a,data:this.Kd(b)};switch(c){case "update":d.operation="update";break;case "add":d.operation="insert";break;case "delete":d.operation="delete";break;default:return!0}if(d.operation!="delete"&&!this.validate(d.data))return!1;this.Gd(d)&&this.V.push(d);this.a.autoupdate&&this.send();return!0},Gd:function(a){for(var b=0;b<
+this.V.length;b++){var c=this.V[b];if(c.id==a.id){if(a.operation=="delete")c.operation=="insert"?this.V.splice(b,1):c.operation="delete";c.data=a.data;return!1}}return!0},send:function(){this.Ge()},Ge:function(){if(this.a.url){for(var a=this.V,b=[],c=0;c=0&&this.V.splice(i,1),h.tid!=h.sid&&this.a.store.changeId(h.sid,h.tid),this.callEvent("onAfter"+h.type,[h])}this.callEvent("onAfterSync",[f,a,b,c])},escape:function(a){return this.a.escape?this.a.escape(a):encodeURIComponent(a)}},dhx.Settings,dhx.EventSystem,dhx.ValidateData);
+(function(){var a=dhx.Touch={config:{longTouchDelay:1E3,scrollDelay:150,gravity:500,deltaStep:30,speed:"0ms",finish:1500},disable:function(){a.Fb=!0},enable:function(){a.Fb=!1},$init:function(){dhx.env.touch?(dhx.event(document.body,"touchstart",a.nd),dhx.event(document.body,"touchmove",a.gc),dhx.event(document.body,"touchend",a.md)):(a.bb=a.Wd,dhx.event(document.body,"mousedown",a.nd),dhx.event(document.body,"mousemove",a.gc),dhx.event(document.body,"mouseup",a.md),document.body.style.overflowX=
+document.body.style.overflowY="hidden");dhx.event(document.body,"dragstart",function(a){return dhx.html.preventEvent(a)});dhx.event(document.body,"touchstart",function(b){if(!a.Fb&&dhx.env.isSafari)return b.srcElement.tagName=="SELECT"?!0:dhx.html.preventEvent(b)});a.Ca()},Ca:function(){a.A=a.w=a.ca=null;a.H=a.v=a.n=null;a.I={wb:0,xb:0,Na:0};if(a.Xa)dhx.html.removeCss(a.Xa,"dhx_touch"),a.Xa=null;window.clearTimeout(a.Kc);a.ud=!0;a.Sa=!0;a.Ta=!0;a.ic||a.ua()},md:function(b){if(a.A){if(a.H){var c=a.Hb(a.v),
+d=c.e,e=c.f,f=a.config.finish,g=a.Bc(b,!0);if(g.Na){var h=d+a.config.gravity*g.wb/g.Na,i=e+a.config.gravity*g.xb/g.Na,j=a.q[0]?a.Wa(h,!1,!1,a.n.dx,a.n.px):d,k=a.q[1]?a.Wa(i,!1,!1,a.n.dy,a.n.py):e,o=Math.max(Math.abs(j-d),Math.abs(k-e));o<150&&(f=f*o/150);if(j!=d||k!=e)f=Math.round(f*Math.max((j-d)/(h-d),(k-e)/(i-e)));var m={e:j,f:k},l=dhx.ui.get(a.v);l&&l.callEvent&&l.callEvent("onAfterScroll",[m]);f=Math.max(100,f);d!=m.e||e!=m.f?(a.wa(a.v,m.e,m.f,f+"ms"),a.dd(m.e,m.f,f+"ms")):a.ua()}else a.ua()}else if(a.Ta&&
+!a.Sa)a.ya("onSwipeX");else if(a.Sa&&!a.Ta)a.ya("onSwipeY");else if(dhx.env.isSafari){var n=a.A.target;dhx.delay(function(){var a=document.createEvent("MouseEvents");a.initEvent("click",!0,!0);n.dispatchEvent(a)})}a.ya("onTouchEnd");a.Ca()}},gc:function(b){if(a.A){var c=a.Bc(b);a.ya("onTouchMove");if(a.H)a.ed(c);else if(a.Sa=a.lc(c.Ye,"x",a.Sa),a.Ta=a.lc(c.Ze,"y",a.Ta),a.H){var d=a.Cc("onBeforeScroll");if(d){var e={};d.callEvent("onBeforeScroll",[e]);if(e.update)a.config.speed=e.speed,a.config.scale=
+e.scale}a.ce(c)}return dhx.html.preventEvent(b)}},ed:function(){if(a.v){var b=a.Hb(a.v),c=b.e,d=b.f,e=a.ca||a.A;if(a.q[0])b.e=a.Wa(b.e-e.x+a.w.x,!0,b.e,a.n.dx,a.n.px);if(a.q[1])b.f=a.Wa(b.f-e.y+a.w.y,!0,b.f,a.n.dy,a.n.py);a.wa(a.v,b.e,b.f,"0ms");a.dd(b.e,b.f,"0ms")}},dd:function(b,c,d){var e=a.n.px/a.n.dx*-b,f=a.n.py/a.n.dy*-c;a.q[0]&&a.wa(a.q[0],e,0,d);a.q[1]&&a.wa(a.q[1],0,f,d)},wa:function(b,c,d,e){a.ic=!0;b.style[dhx.env.transformPrefix+"Transform"]=dhx.env.translate+"("+Math.round(c)+"px, "+
+Math.round(d)+"px"+(dhx.env.translate=="translate3d"?", 0":"")+")";b.style[dhx.env.transformPrefix+"TransitionDuration"]=e},Hb:function(a){var c=window.getComputedStyle(a)[dhx.env.transformPrefix+"Transform"];if(c=="none")return{e:0,f:0};else{if(window.WebKitCSSMatrix)return new WebKitCSSMatrix(c);for(var d=c.replace(/(matrix\()(.*)(\))/gi,"$2"),d=d.replace(/\s/gi,""),d=d.split(","),e={},f="a,b,c,d,e,f".split(","),g=0;g0)return c?d+h*Math.sqrt(g):0;var i=e-f;return i+a<0?c?d-Math.sqrt(-(a-d)):-i:a},ce:function(){a.H.indexOf("x")!=-1&&(a.q[0]=a.vc("x",a.n.dx,a.n.px,"width"));a.H.indexOf("y")!=-1&&(a.q[1]=a.vc("y",a.n.dy,a.n.py,"height"));if(!a.v.scroll_enabled){a.v.scroll_enabled=!0;a.v.parentNode.style.position="relative";var b=dhx.env.transformCSSPrefix;a.v.style.cssText+=b+"transition: "+b+"transform; "+b+"user-select:none; "+b+"transform-style:flat;";a.v.addEventListener(dhx.env.transitionEnd,
+a.ua,!1)}window.setTimeout(a.ed,1)},vc:function(b,c,d,e){if(c-d<2)return a.H="";var f=dhx.html.create("DIV",{"class":"dhx_scroll_"+b},"");f.style[e]=d*d/c-7+"px";a.v.parentNode.appendChild(f);return f},lc:function(b,c,d){if(b>a.config.deltaStep){if(a.ud&&(a.he(c),(a.H||"").indexOf(c)==-1))a.H="";return!1}return d},ua:function(){if(!a.H)dhx.html.remove(a.q),a.q=[null,null];a.ic=!1},he:function(b){window.clearTimeout(a.Kc);a.ud=!1;a.Jc(b)},nd:function(b){if(!a.Fb){a.A=a.bb(b);a.ya("onTouchStart");a.q[0]||
+a.q[1]?a.Re(b,a.q[0]?"x":"y"):a.Kc=window.setTimeout(a.ie,a.config.longTouchDelay);var c=dhx.ui.get(b);if(c&&c.touchable&&(!b.target.className||b.target.className.indexOf("dhx_view")!==0))a.Xa=c.getNode(b),dhx.html.addCss(a.Xa,"dhx_touch")}},ie:function(){a.ya("onLongTouch");dhx.callEvent("onClick",[a.A]);a.Ca()},Re:function(b,c){a.Jc(c);var d=a.q[0]||a.q[1];if(d&&(!a.v||d.parentNode!=a.v.parentNode))a.Ca(),a.ua(),a.A=a.bb(b);a.gc(b)},Bc:function(b){a.ca=a.w;a.w=a.bb(b);a.I.Ye=Math.abs(a.A.x-a.w.x);
+a.I.Ze=Math.abs(a.A.y-a.w.y);if(a.ca)a.w.time-a.ca.time";this.g=this.b.firstChild;this.map=null;this.$ready.push(this.render)},render:function(){var a=this.a,b={zoom:a.zoom,center:a.center,mapTypeId:a.mapType};this.map=new google.maps.Map(this.g,b)},center_setter:function(a){typeof a!="object"&&(a={});this.Ia(a,{x:48.724,y:8.215});a=new google.maps.LatLng(a.x,a.y);this.map&&this.map.setCenter(a);return a},
+mapType_setter:function(a){a=google.maps.MapTypeId[a];this.map&&this.map.setMapTypeId(a);return a},zoom_setter:function(a){this.map&&this.map.setZoom(a);return a},defaults:{zoom:5,center:{},mapType:"ROADMAP"},$setSize:function(){dhx.ui.view.prototype.$setSize.apply(this,arguments);google.maps.event.trigger(this.map,"resize")}},dhx.ui.view);if(!window.scheduler)window.scheduler={config:{},templates:{},xy:{},locale:{}};if(!scheduler.locale)scheduler.locale={};
+scheduler.locale.labels={list_tab:"List",day_tab:"Day",month_tab:"Month",icon_today:"Today",icon_save:"Save",icon_delete:"Delete event",icon_cancel:"Cancel",icon_edit:"Edit",icon_back:"Back",icon_close:"Close form",icon_yes:"Yes",icon_no:"No",confirm_closing:"Your changes will be lost, are your sure ?",confirm_deleting:"Event will be deleted permanently, are you sure?",label_event:"Event",label_start:"Start",label_end:"End",label_details:"Notes",label_from:"from",label_to:"to"};
+scheduler.config={init_date:new Date,form_date:"%d-%m-%Y %H:%i",xml_date:"%Y-%m-%d %H:%i",item_date:"%d.%m.%Y",header_date:"%d.%m.%Y",hour_date:"%H:%i",scale_hour:"%H",calendar_date:"%F %Y"};scheduler.config.form_rules={end_date:function(a,b){return b.start_date.valueOf()";b+="
"),templateCss:dhx.Template(""),templateColor:dhx.Template("#color#"),
+templateTextColor:dhx.Template("#textColor#"),padding:2},we:function(){var a=this.data.getRange(),b=[],c,d,e,f,g;for(d=0;dg)g=b[e].$sorder;c.$sorder=g+1;c.$inner=!1}else c.$sorder=0;b.push(c);if(b.length>(b.max_count||0))b.max_count=b.length}for(d=0;ddhx.Date.datePart(d).valueOf()&&(d=c);dhx.Date.datePart(c).valueOf()dhx.Date.datePart(b).valueOf()&&(d=dhx.Date.datePart(b),d.setMinutes(0),d.setHours(this.config.lastHour));if(e=this.config.lastHour)e=this.config.lastHour&&(d.setMinutes(0),
+d.setHours(this.config.lastHour));var g=Math.floor((this.j-this.config.timeScaleWidth-this.config.eventOffset-8)/a.$count);a.$left=a.$sorder*g+this.config.timeScaleWidth+this.config.eventOffset;a.$inner||(g*=a.$count-a.$sorder);a.$width=g-this.config.eventOffset-this.type.padding*2;var h=c.getHours()*60+c.getMinutes(),i=d.getHours()*60+d.getMinutes()||this.config.lastHour*60;a.$top=Math.round((h-this.config.firstHour/60)*(this.config.timeScaleHeight+1)/60);a.$height=Math.max(10,(i-h)*(this.config.timeScaleHeight+
+1)/60-2)-this.type.padding*2}},dhx.MouseEvents,dhx.SelectionModel,dhx.Scrollable,dhx.RenderStack,dhx.DataLoader,dhx.ui.view,dhx.EventSystem,dhx.Settings);
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_active_links.js b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_active_links.js
index d7889307153..6499338d09b 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_active_links.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_active_links.js
@@ -1,9 +1,6 @@
-/*
-dhtmlxScheduler v.2.3
-
+/*
This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
-to use it in not GPL project. Please contact sales@dhtmlx.com for details
-
-(c) DHTMLX Ltd.
-*/
-scheduler.attachEvent("onTemplatesReady",function(){var B=scheduler.date.str_to_date(scheduler.config.api_date);var C=scheduler.date.date_to_str(scheduler.config.api_date);var D=scheduler.templates.month_day;scheduler.templates.month_day=function(E){return""+D(E)+""};var A=scheduler.templates.week_scale_date;scheduler.templates.week_scale_date=function(E){return""+A(E)+""};dhtmlxEvent(this._obj,"click",function(E){var G=E.target||event.srcElement;var F=G.getAttribute("jump_to");if(F){scheduler.setCurrentView(B(F),"day")}})});
\ No newline at end of file
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.attachEvent("onTemplatesReady",function(){var d=scheduler.date.str_to_date(scheduler.config.api_date),b=scheduler.date.date_to_str(scheduler.config.api_date),e=scheduler.templates.month_day;scheduler.templates.month_day=function(a){return""+e(a)+""};var f=scheduler.templates.week_scale_date;scheduler.templates.week_scale_date=function(a){return""+f(a)+""};dhtmlxEvent(this._obj,"click",function(a){var b=a.target||event.srcElement,
+c=b.getAttribute("jump_to");if(c)return scheduler.setCurrentView(d(c),"day"),a&&a.preventDefault&&a.preventDefault(),!1})});
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_agenda_view.js b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_agenda_view.js
index c0293e8a2a8..c0eb363b8d5 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_agenda_view.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_agenda_view.js
@@ -1,9 +1,10 @@
-/*
-dhtmlxScheduler v.2.3
-
+/*
This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
-to use it in not GPL project. Please contact sales@dhtmlx.com for details
-
-(c) DHTMLX Ltd.
-*/
-scheduler.date.add_agenda=function(A){return(new Date(A.valueOf()))};scheduler.dblclick_dhx_agenda_area=function(){if(!this.config.readonly&&this.config.dblclick_create){this.addEventNow()}};scheduler.templates.agenda_time=function(C,A,B){if(B._timed){return this.day_date(B.start_date,B.end_date,B)+" "+this.event_date(C)}else{return scheduler.templates.day_date(C)+" – "+scheduler.templates.day_date(A)}};scheduler.templates.agenda_text=function(A){return A.text};scheduler.date.agenda_start=function(A){return A};scheduler.attachEvent("onTemplatesReady",function(){scheduler.attachEvent("onSchedulerResize",function(){if(this._mode=="agenda"){this.agenda_view(true);return false}return true});var A=scheduler.render_data;scheduler.render_data=function(D){if(this._mode=="agenda"){B()}else{return A.apply(this,arguments)}};function C(E){if(E){var D=scheduler.locale.labels;scheduler._els.dhx_cal_header[0].innerHTML="
"}d+="";scheduler._els.dhx_cal_data[0].innerHTML=d;scheduler._els.dhx_cal_data[0].childNodes[0].scrollTop=
+scheduler._agendaScrollTop||0;var g=scheduler._els.dhx_cal_data[0].firstChild.childNodes;scheduler._els.dhx_cal_date[0].innerHTML="";scheduler._rendered=[];for(e=0;escheduler.config.collision_limit){scheduler._drag_event.start_date=D;N[G]=C;P=false}}else{if(Q.length>scheduler.config.collision_limit){P=false}}if(!P){return !scheduler.callEvent("onEventCollision",[N,Q])}return P}})();
\ No newline at end of file
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+(function(){function h(a){var b=scheduler._props?scheduler._props[scheduler._mode]:null,f=scheduler.matrix?scheduler.matrix[scheduler._mode]:null,c=b||f;if(b)var d=c.map_to;if(f)d=c.y_property;c&&a&&(n=scheduler.getEvent(a)[d])}function g(a){var b=[];if(a.rec_type){for(var f=scheduler.getRecDates(a),c=0;c=scheduler.config.collision_limit&&(a[j]=n,k=!1)}else b.length>scheduler.config.collision_limit&&(k=!1);return!k?!scheduler.callEvent("onEventCollision",[a,b]):k}var n,e;scheduler.config.collision_limit=1;scheduler.attachEvent("onBeforeDrag",function(a){h(a);
+return!0});scheduler.attachEvent("onBeforeLightbox",function(a){var b=scheduler.getEvent(a);e=[b.start_date,b.end_date];h(a);return!0});scheduler.attachEvent("onEventChanged",function(a){if(!a)return!0;var b=scheduler.getEvent(a);if(!g(b)){if(!e)return!1;b.start_date=e[0];b.end_date=e[1];b._timed=this.is_one_day_event(b)}return!0});scheduler.attachEvent("onBeforeEventChanged",function(a){return g(a)});scheduler.attachEvent("onEventSave",function(a,b){return b.rec_type?(scheduler._roll_back_dates(b),
+g(b)):!0})})();
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_cookie.js b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_cookie.js
index 0e58357f735..ef80ea8e8d0 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_cookie.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_cookie.js
@@ -1,9 +1,6 @@
-/*
-dhtmlxScheduler v.2.3
-
+/*
This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
-to use it in not GPL project. Please contact sales@dhtmlx.com for details
-
-(c) DHTMLX Ltd.
-*/
-(function(){function B(E,D,F){var G=E+"="+F+(D?("; "+D):"");document.cookie=G}function A(E){var F=E+"=";if(document.cookie.length>0){var G=document.cookie.indexOf(F);if(G!=-1){G+=F.length;var D=document.cookie.indexOf(";",G);if(D==-1){D=document.cookie.length}return document.cookie.substring(G,D)}}return""}var C=true;scheduler.attachEvent("onBeforeViewChange",function(F,E,D,I){if(C){C=false;var G=A("scheduler_settings");if(G){G=G.split("@");G[0]=this.templates.xml_date(G[0]);this.setCurrentView(G[0],G[1]);return false}}var H=this.templates.xml_format(I||E)+"@"+(D||F);B("scheduler_settings","expires=Sun, 31 Jan 9999 22:00:00 GMT",H);return true})})();
\ No newline at end of file
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+(function(){function g(e,b,a){var c=e+"="+a+(b?"; "+b:"");document.cookie=c}function h(e){var b=e+"=";if(document.cookie.length>0){var a=document.cookie.indexOf(b);if(a!=-1){a+=b.length;var c=document.cookie.indexOf(";",a);if(c==-1)c=document.cookie.length;return document.cookie.substring(a,c)}}return""}var f=!0;scheduler.attachEvent("onBeforeViewChange",function(e,b,a,c){if(f){f=!1;var d=h("scheduler_settings");if(d)return d=d.split("@"),d[0]=this.templates.xml_date(d[0]),this.setCurrentView(d[0],
+d[1]),!1}var i=this.templates.xml_format(c||b)+"@"+(a||e);g("scheduler_settings","expires=Sun, 31 Jan 9999 22:00:00 GMT",i);return!0})})();
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_editors.js b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_editors.js
index ad4d85b0a8e..38ba960c470 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_editors.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_editors.js
@@ -1,9 +1,10 @@
-/*
-dhtmlxScheduler v.2.3
-
+/*
This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
-to use it in not GPL project. Please contact sales@dhtmlx.com for details
-
-(c) DHTMLX Ltd.
-*/
-scheduler.form_blocks.combo={render:function(B){var A="";A+="";return A},set_value:function(F,H,E,C){if(F._combo){F._combo.destructor()}window.dhx_globalImgPath=C.image_path||"/";F._combo=new dhtmlXCombo(F,C.name,F.offsetWidth-8);F._combo.enableFilteringMode(!!C.filtering,C.script_path||null,!!C.cache);if(!C.script_path){var G=[];for(var D=0;D";for(var A=0;A";if(C.vertical){B+=" "}}B+="";return B},set_value:function(D,F,C,A){var E=D.getElementsByTagName("input");for(var B=0;B"},get_value:function(C,B,A){var D=C.previousSibling.getElementsByTagName("input")[0];return(D.checked)?(A.checked_value||true):(A.unchecked_value||false)},focus:function(A){}};
\ No newline at end of file
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.form_blocks.combo={render:function(a){var d="";d+="";return d},set_value:function(a,d,c,b){a._combo&&a._combo.destructor();window.dhx_globalImgPath=b.image_path||"/";a._combo=new dhtmlXCombo(a,b.name,a.offsetWidth-8);a._combo.enableFilteringMode(!!b.filtering,b.script_path||null,!!b.cache);if(b.script_path)a._combo.setComboValue(c[b.map_to]||null);else{for(var f=[],e=0;e";for(var c=0;c";a.vertical&&(d+=" ")}d+="";return d},set_value:function(a,d,c,b){for(var f=a.getElementsByTagName("input"),e=0;e':""},set_value:function(a,d,c,b){var a=document.getElementById(b.id),f=scheduler.uid(),e=!1;typeof b.checked_value!="undefined"&&c[b.map_to]==b.checked_value&&(e=!0);a.className+=" dhx_cal_checkbox";var g="",h="";scheduler.config.wide_form?(a.innerHTML=h,a.nextSibling.innerHTML=g):a.innerHTML=g+h},get_value:function(a,d,c){var a=document.getElementById(c.id),b=a.getElementsByTagName("input")[0];b||(b=a.nextSibling.getElementsByTagName("input")[0]);return b.checked?c.checked_value||!0:c.unchecked_value||!1},focus:function(){}};
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_expand.js b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_expand.js
index e05c11401d7..06a1187a723 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_expand.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_expand.js
@@ -1,9 +1,8 @@
-/*
-dhtmlxScheduler v.2.3
-
+/*
This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
-to use it in not GPL project. Please contact sales@dhtmlx.com for details
-
-(c) DHTMLX Ltd.
-*/
-scheduler.expand=function(){var A=scheduler._obj;do{A._position=A.style.position||"";A.style.position="static"}while((A=A.parentNode)&&A.style);A=scheduler._obj;A.style.position="absolute";A._width=A.style.width;A._height=A.style.height;A.style.width=A.style.height="100%";A.style.top=A.style.left="0px";var B=document.body;B.scrollTop=0;B=B.parentNode;if(B){B.scrollTop=0}document.body._overflow=document.body.style.overflow||"";document.body.style.overflow="hidden";scheduler._maximize()};scheduler.collapse=function(){var A=scheduler._obj;do{A.style.position=A._position}while((A=A.parentNode)&&A.style);A=scheduler._obj;A.style.width=A._width;A.style.height=A._height;document.body.style.overflow=document.body._overflow;scheduler._maximize()};scheduler.attachEvent("onTemplatesReady",function(){var A=document.createElement("DIV");A.className="dhx_expand_icon";scheduler.toggleIcon=A;scheduler._obj.appendChild(A);A.onclick=function(){if(!scheduler.expanded){scheduler.expand()}else{scheduler.collapse()}}});scheduler._maximize=function(){this.expanded=!this.expanded;this.toggleIcon.style.backgroundPosition="0px "+(this._expand?"0":"18")+"px";if(scheduler.callEvent("onSchedulerResize",[])){scheduler.update_view()}};
\ No newline at end of file
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.expand=function(){var a=scheduler._obj;do a._position=a.style.position||"",a.style.position="static";while((a=a.parentNode)&&a.style);a=scheduler._obj;a.style.position="absolute";a._width=a.style.width;a._height=a.style.height;a.style.width=a.style.height="100%";a.style.top=a.style.left="0px";var b=document.body;b.scrollTop=0;if(b=b.parentNode)b.scrollTop=0;document.body._overflow=document.body.style.overflow||"";document.body.style.overflow="hidden";scheduler._maximize()};
+scheduler.collapse=function(){var a=scheduler._obj;do a.style.position=a._position;while((a=a.parentNode)&&a.style);a=scheduler._obj;a.style.width=a._width;a.style.height=a._height;document.body.style.overflow=document.body._overflow;scheduler._maximize()};scheduler.attachEvent("onTemplatesReady",function(){var a=document.createElement("DIV");a.className="dhx_expand_icon";scheduler.toggleIcon=a;scheduler._obj.appendChild(a);a.onclick=function(){scheduler.expanded?scheduler.collapse():scheduler.expand()}});
+scheduler._maximize=function(){this.expanded=!this.expanded;this.toggleIcon.style.backgroundPosition="0px "+(this.expanded?"0":"18")+"px";for(var a=["left","top"],b=0;bscheduler.config.limit_end.valueOf()||this.date.add(F,1,C)<=scheduler.config.limit_start.valueOf()){setTimeout(function(){scheduler.setCurrentView(scheduler._date,C)},1);return false}}return true});var A=function(D){var E=scheduler.config;var C=(D.start_date.valueOf()>=E.limit_start.valueOf()&&D.end_date.valueOf()<=E.limit_end.valueOf());if(!C){scheduler._drag_id=null;scheduler._drag_mode=null;scheduler.callEvent("onLimitViolation",[D.id,D])}return C};scheduler.attachEvent("onBeforeDrag",function(C){if(!C){return true}return A(scheduler.getEvent(C))});scheduler.attachEvent("onClick",function(D,C){return A(scheduler.getEvent(D))});scheduler.attachEvent("onBeforeLightbox",function(D){var C=scheduler.getEvent(D);B=[C.start_date,C.end_date];return A(C)});scheduler.attachEvent("onEventAdded",function(D){if(!D){return true}var C=scheduler.getEvent(D);if(!A(C)){if(C.start_datescheduler.config.limit_end){C.end_date=new Date(scheduler.config.limit_end);C._timed=this.is_one_day_event(C)}if(C.start_date>C.end_date){C.end_date=this.date.add(C.start_date,(this.config.event_duration||this.config.time_step),"minute")}}return true});scheduler.attachEvent("onEventChanged",function(D){if(!D){return true}var C=scheduler.getEvent(D);if(!A(C)){if(!B){return false}C.start_date=B[0];C.end_date=B[1];C._timed=this.is_one_day_event(C)}return true});scheduler.attachEvent("onBeforeEventChanged",function(D,C,E){return A(D)})})();
\ No newline at end of file
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.config.limit_start=new Date(-3999,0,0);scheduler.config.limit_end=new Date(3999,0,0);scheduler.config.limit_view=!1;
+(function(){var g=null,k={},l={},m=!1;scheduler.blockTime=function(b,a){var c=this.config.first_hour*60,d=this.config.last_hour*60;a=="fullday"&&(a=[c,d]);typeof b=="object"?k[this.date.date_part(b).valueOf()]=a:l[b]=a;for(var e=0;ed&&(a[e+1]=d);m=!0};scheduler.attachEvent("onScaleAdd",function(b,a){var c=k[a.valueOf()]||l[a.getDay()];if(c)for(var d=0;dscheduler.config.limit_end.valueOf()||this.date.add(d,1,c)<=scheduler.config.limit_start.valueOf())?(setTimeout(function(){scheduler.setCurrentView(scheduler._date,
+c)},1),!1):!0});var f=function(b){var a=scheduler.config,c=b.start_date.valueOf()>=a.limit_start.valueOf()&&b.end_date.valueOf()<=a.limit_end.valueOf();if(c&&m&&b._timed){var d=scheduler.date.date_part(new Date(b.start_date.valueOf())),e=k[d.valueOf()]||l[d.getDay()],f=b.start_date.getHours()*60+b.start_date.getMinutes(),h=b.end_date.getHours()*60+b.end_date.getMinutes();if(e)for(var j=0;jf){if(f<=i&&f>=g){if(i==1440||h=g&&h=scheduler.config.limit_end.valueOf())a.start_date=this.date.add(scheduler.config.limit_end,-1,"day");if(a.end_date=scheduler.config.limit_end.valueOf())a.end_date=this.date.add(scheduler.config.limit_end,-1,"day");if(a.start_date.valueOf()>=a.end_date.valueOf())a.end_date=this.date.add(a.start_date,this.config.event_duration||this.config.time_step,"minute");a._timed=this.is_one_day_event(a)}return!0});scheduler.attachEvent("onEventChanged",function(b){if(!b)return!0;var a=scheduler.getEvent(b);if(!f(a)){if(!g)return!1;a.start_date=g[0];a.end_date=
+g[1];a._timed=this.is_one_day_event(a)}return!0});scheduler.attachEvent("onBeforeEventChanged",function(b){return f(b)})})();
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_map_view.js b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_map_view.js
index 4404ea13eb4..57735c07a0e 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_map_view.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_map_view.js
@@ -1,9 +1,29 @@
-/*
-dhtmlxScheduler v.2.3
-
+/*
This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
-to use it in not GPL project. Please contact sales@dhtmlx.com for details
-
-(c) DHTMLX Ltd.
-*/
-scheduler.xy.map_date_width=188;scheduler.xy.map_description_width=400;scheduler.config.map_resolve_event_location=true;scheduler.config.map_resolve_user_location=true;scheduler.config.map_initial_position=new google.maps.LatLng(48.724,8.215);scheduler.config.map_error_position=new google.maps.LatLng(15,15);scheduler.config.map_infowindow_max_width=300;scheduler.config.map_type=google.maps.MapTypeId.ROADMAP;scheduler.config.map_zoom_after_resolve=15;scheduler.locale.labels.marker_geo_success="It seems you are here.";scheduler.locale.labels.marker_geo_fail="Sorry, could not get your current position using geolocation.";scheduler.templates.marker_date=scheduler.date.date_to_str("%Y-%m-%d %H:%i");scheduler.templates.marker_text=function(C,A,B){return"
"},set_value:function(b,c,a){function d(a,b,c){n(a,b,c);a.value=scheduler.templates.calendar_time(b);a._date=scheduler.date.date_part(new Date(b))}var e=b.getElementsByTagName("input"),f=b.getElementsByTagName("select"),n=function(a,b,c){a.onclick=function(){scheduler.destroyCalendar(null,!0);scheduler.renderCalendar({position:a,date:new Date(this._date),navigation:!0,handler:function(b){a.value=scheduler.templates.calendar_time(b);
+a._date=new Date(b);scheduler.destroyCalendar();scheduler.config.event_duration&&scheduler.config.auto_end_date&&c==0&&o()}})}};if(scheduler.config.full_day){if(!b._full_day){var m="";scheduler.config.wide_form||(m=b.previousSibling.innerHTML+m);b.previousSibling.innerHTML=m;b._full_day=!0}var k=b.previousSibling.getElementsByTagName("input")[0],p=scheduler.date.time_part(a.start_date)==
+0&&scheduler.date.time_part(a.end_date)==0&&a.end_date.valueOf()-a.start_date.valueOf()<1728E5;k.checked=p;for(var i in f)f[i].disabled=k.checked;for(i=0;i";for(var A=0;A"+C.options[A].label+"";if(convertStringToBoolean(C.vertical)){B+=" "}}B+="";return B},set_value:function(C,J,I,A){var E=C.getElementsByTagName("input");for(var G=0;G",b=0;b"+d.options[b].label+"",convertStringToBoolean(d.vertical)&&(a+=" ");a+="";return a},set_value:function(d,a,b,c){function h(b){for(var c=d.getElementsByTagName("input"),a=0;a"}I=U[0].offsetWidth;return T}function G(V,W){var T=parseInt(V.style.left);for(var U=0;UV){return T}}return W}function A(W){var U="";var X=W.firstChild.rows;for(var V=0;V";H=W.firstChild.rows[0].cells[0].offsetHeight}return U}function S(X){var U="";U+="";if(scheduler._mode=="agenda"){var T=scheduler._els.dhx_cal_header[0].childNodes[0].childNodes;U+=""+T[0].innerHTML+""+T[1].innerHTML+""}else{if(scheduler._mode=="year"){var T=scheduler._els.dhx_cal_data[0].childNodes;for(var V=0;V";U+=O(T[V].childNodes[1].childNodes);U+=A(T[V].childNodes[2]);U+=""}}else{U+="";var T=scheduler._els.dhx_cal_header[0].childNodes;U+=O(T);U+="";var W=scheduler._els.dhx_cal_data[0];if(W.firstChild.tagName=="TABLE"){U+=A(W)}else{W=W.childNodes[W.childNodes.length-1];while(W.className.indexOf("dhx_scale_holder")==-1){W=W.previousSibling}W=W.childNodes;U+="";for(var V=0;V"}U+="";H=W[0].offsetHeight}}}U+="";return U}function E(U,T){return(window.getComputedStyle?(window.getComputedStyle(U,null)[T]):(U.currentStyle?U.currentStyle[T]:null))||""}function B(){var b="";var j=scheduler._rendered;if(scheduler._mode=="agenda"){for(var Z=0;Z"+j[Z].childNodes[0].innerHTML+""+j[Z].childNodes[2].innerHTML+""}}else{if(scheduler._mode=="year"){var j=scheduler.get_visible_events();for(var Z=0;Z";scheduler._mark_year_date(f);f=scheduler.date.add(f,1,"day");if(f.valueOf()>=scheduler._max_date.valueOf()){break}}}}else{for(var Z=0;Z";if(Y=="event"){b+="";var W=F?E(j[Z].childNodes[2],"color"):"";var h=F?E(j[Z].childNodes[2],"backgroundColor"):"";b+=""}else{var W=F?E(j[Z],"color"):"";var h=F?E(j[Z],"backgroundColor"):"";b+=""}b+=""}}}return b}function K(){var T="";return T}var D=(new Date()).valueOf();var R=document.createElement("div");R.style.display="none";document.body.appendChild(R);R.innerHTML='';document.getElementById(D).firstChild.value=S(J).replace("\u2013","-")+B()+K();document.getElementById(D).submit();R.parentNode.removeChild(R);grid=null};
\ No newline at end of file
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.toPDF=function(x,f,m,n){function g(c){return c.replace(html_regexp,"")}function j(c){c=parseFloat(c);return isNaN(c)?"auto":100*c/(o+1)}function t(c){c=parseFloat(c);return isNaN(c)?"auto":100*c/k}function q(c){var a="";if(scheduler.matrix&&scheduler.matrix[scheduler._mode])c=c[0].childNodes;for(var b=0;b";o=c[0].offsetWidth;return a}function y(c,a){for(var b=parseInt(c.style.left),d=0;db)return d;return a}function w(c){for(var a="",b=c.firstChild.rows,d=0;d";k=c.firstChild.rows[0].cells[0].offsetHeight}return a}function A(c){var a=
+"";a+="";if(scheduler._mode=="agenda"){var b=scheduler._els.dhx_cal_header[0].childNodes[0].childNodes;a+=""+g(b[0].innerHTML)+""+g(b[1].innerHTML)+""}else if(scheduler._mode=="year")for(var b=scheduler._els.dhx_cal_data[0].childNodes,d=0;d",a+=q(b[d].childNodes[1].childNodes),a+=w(b[d].childNodes[2]),a+="";else{a+="";b=scheduler._els.dhx_cal_header[0].childNodes;a+=q(b);a+="";var e=scheduler._els.dhx_cal_data[0];if(scheduler.matrix&&scheduler.matrix[scheduler._mode]){a+="";for(d=0;d";a+="";k=e.firstChild.rows[0].cells[0].offsetHeight}else if(e.firstChild.tagName=="TABLE")a+=w(e);else{for(e=e.childNodes[e.childNodes.length-
+1];e.className.indexOf("dhx_scale_holder")==-1;)e=e.previousSibling;e=e.childNodes;a+="";for(d=0;d";a+="";k=e[0].offsetHeight}}a+="";return a}function r(c,a){return(window.getComputedStyle?window.getComputedStyle(c,null)[a]:c.currentStyle?c.currentStyle[a]:null)||""}function B(){var c="",a=scheduler._rendered;if(scheduler._mode=="agenda")for(var b=0;b"+g(a[b].childNodes[0].innerHTML)+""+
+g(a[b].childNodes[2].innerHTML)+"";else if(scheduler._mode=="year"){a=scheduler.get_visible_events();for(b=0;b";d=scheduler.date.add(d,1,"day");
+if(d.valueOf()>=scheduler._max_date.valueOf())break}}}else for(b=0;b";if(n=="event"){c+="";var u=p?r(a[b].childNodes[2],"color"):"",v=p?r(a[b].childNodes[2],"backgroundColor"):
+"";c+=""}else u=p?r(a[b],"color"):"",v=p?r(a[b],"backgroundColor"):"",c+="";c+=""}return c}function C(){var c="";return c}var o=0,k=0,p=!1;f=="fullcolor"&&(p=!0,f="color");f=f||"color";html_regexp=RegExp("<[^>]*>","g");var l=(new Date).valueOf(),i=document.createElement("div");i.style.display="none";document.body.appendChild(i);
+i.innerHTML='';document.getElementById(l).firstChild.value=A(f).replace("\u2013","-")+B()+C();document.getElementById(l).submit();i.parentNode.removeChild(i);grid=null};
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_readonly.js b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_readonly.js
index cc182b4b12a..066e5e5a57b 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_readonly.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_readonly.js
@@ -1,9 +1,9 @@
-/*
-dhtmlxScheduler v.2.3
-
+/*
This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
-to use it in not GPL project. Please contact sales@dhtmlx.com for details
-
-(c) DHTMLX Ltd.
-*/
-scheduler.attachEvent("onTemplatesReady",function(){scheduler.attachEvent("onBeforeLightbox",function(F){if(this.config.readonly_form||this.getEvent(F).readonly){this.config.readonly_active=true}else{this.config.readonly_active=false;return true}for(var E=0;E=0;I--){var L=F[I];if(!J){L.disabled=true}else{var H=document.createElement("SPAN");H.className="dhx_text_disabled";H.innerHTML=J(G[I]);L.parentNode.insertBefore(H,L);L.parentNode.removeChild(L)}}}var B=scheduler._fill_lightbox;scheduler._fill_lightbox=function(){var H=this.config.lightbox.sections;if(this.config.readonly_active){for(var F=0;F=0;g--)if(c=a[g],f){var i=document.createElement("SPAN");i.className="dhx_text_disabled";i.innerHTML=f(e[g]);c.parentNode.insertBefore(i,c);c.parentNode.removeChild(c)}else c.disabled=!0}scheduler.attachEvent("onBeforeLightbox",function(d){if(this.config.readonly_form||this.getEvent(d).readonly)this.config.readonly_active=!0;else return this.config.readonly_active=
+!1,!0;for(var b=0;bA){return G.setDate(G.getDate()+D[B]*1-A-(C?F:E))}}this.transpose_day_week(G,D,F+C,null,F)};scheduler.transpose_type=function(D){var F="transpose_"+D;if(!this.date[F]){var G=D.split("_");var A=60*60*24*1000;var C="add_"+D;var E=this.transponse_size[G[0]]*G[1];if(G[0]=="day"||G[0]=="week"){var H=null;if(G[4]){H=G[4].split(",");if(scheduler.config.start_on_monday){for(var B=0;B0){I.setDate(I.getDate()+J*E)}if(H){scheduler.transpose_day_week(I,H,1,E)}};this.date[C]=function(K,J){var L=new Date(K.valueOf());if(H){for(var I=0;I=0){I.setMonth(I.getMonth()+J*E)}if(G[3]){scheduler.date.day_week(I,G[2],G[3])}};this.date[C]=function(J,I){var K=new Date(J.valueOf());K.setMonth(K.getMonth()+I*E);if(G[3]){scheduler.date.day_week(K,G[2],G[3])}return K}}}}};scheduler.repeat_date=function(F,G,C,I,J){I=I||this._min_date;J=J||this._max_date;var E=new Date(F.start_date.valueOf());if(!F.rec_pattern&&F.rec_type){F.rec_pattern=F.rec_type.split("#")[0]}this.transpose_type(F.rec_pattern);scheduler.date["transpose_"+F.rec_pattern](E,I);while(E0){B.end_date=new Date(E.valueOf()+F.event_length*1000-D*60*1000)}else{B.end_date=new Date(B.end_date.valueOf()+D*60*1000)}}B._timed=this.is_one_day_event(B);if(!B._timed&&!this._table_view&&!this.config.multi_day){return }G.push(B);if(!C){this._events[B.id]=B;this._rec_temp.push(B)}}else{if(C){G.push(A)}}E=this.date.add(E,1,F.rec_pattern)}};scheduler.getRecDates=function(B,H){var G=typeof B=="object"?B:scheduler.getEvent(B);var E=0;var J=[];H=H||1000;var C=new Date(G.start_date.valueOf());var I=new Date(C.valueOf());if(!G.rec_type){return[{start_date:G.start_date,end_date:G.end_date}]}this.transpose_type(G.rec_pattern);scheduler.date["transpose_"+G.rec_pattern](C,I);while(CG){if(D.rec_pattern){if(D.rec_pattern=="none"){continue}var E=[];this.repeat_date(D,E,true,G,F);for(var C=0;CG){A.push(E[C])}}}else{if(!D.event_pid||D.event_pid==0){A.push(D)}}}}return A};scheduler.config.repeat_date="%m.%d.%Y";scheduler.config.lightbox.sections=[{name:"description",height:130,map_to:"text",type:"textarea",focus:true},{name:"recurring",height:115,type:"recurring",map_to:"rec_type",button:"recurring"},{name:"time",height:72,type:"time",map_to:"auto"}];scheduler._copy_dummy=function(A){this.start_date=new Date(this.start_date);this.end_date=new Date(this.end_date);this.event_length=this.event_pid=this.rec_pattern=this.rec_type=this._timed=null};scheduler.__recurring_template='
';
\ No newline at end of file
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.form_blocks.recurring={render:function(){return scheduler.__recurring_template},_ds:{},_init_set_value:function(a,b,c){function d(a){for(var b=0;be)return a.setDate(a.getDate()+b[h]*1-e-(d?c:f));this.transpose_day_week(a,b,c+d,null,c)};
+scheduler.transpose_type=function(a){var b="transpose_"+a;if(!this.date[b]){var c=a.split("_"),d=864E5,f="add_"+a,e=this.transponse_size[c[0]]*c[1];if(c[0]=="day"||c[0]=="week"){var h=null;if(c[4]&&(h=c[4].split(","),scheduler.config.start_on_monday)){for(var j=0;j0&&a.setDate(a.getDate()+c*e);h&&scheduler.transpose_day_week(a,h,1,e)};this.date[f]=function(a,b){var c=new Date(a.valueOf());
+if(h)for(var d=0;d=0&&a.setMonth(a.getMonth()+d*e);c[3]&&scheduler.date.day_week(a,c[2],c[3])},this.date[f]=function(a,b){var d=new Date(a.valueOf());d.setMonth(d.getMonth()+b*e);c[3]&&scheduler.date.day_week(d,c[2],c[3]);return d}}};
+scheduler.repeat_date=function(a,b,c,d,f){var d=d||this._min_date,f=f||this._max_date,e=new Date(a.start_date.valueOf());if(!a.rec_pattern&&a.rec_type)a.rec_pattern=a.rec_type.split("#")[0];this.transpose_type(a.rec_pattern);for(scheduler.date["transpose_"+a.rec_pattern](e,d);e0?new Date(e.valueOf()+a.event_length*1E3-k*6E4):new Date(i.end_date.valueOf()+k*6E4);i._timed=this.is_one_day_event(i);if(!i._timed&&!this._table_view&&!this.config.multi_day)break;b.push(i);c||(this._events[i.id]=i,this._rec_temp.push(i))}e=this.date.add(e,1,a.rec_pattern)}};
+scheduler.getRecDates=function(a,b){var c=typeof a=="object"?a:scheduler.getEvent(a),d=0,f=[],b=b||1E3,e=new Date(c.start_date.valueOf()),h=new Date(e.valueOf());if(!c.rec_type)return[{start_date:c.start_date,end_date:c.end_date}];this.transpose_type(c.rec_pattern);for(scheduler.date["transpose_"+c.rec_pattern](e,h);ea)if(f.rec_pattern){if(f.rec_pattern!="none"){var e=[];this.repeat_date(f,e,!0,a,b);for(var h=0;ha&&!this._rec_markers[e[h].id]&&c.push(e[h])}}else f.id.toString().indexOf("#")==-1&&c.push(f)}return c};scheduler.config.repeat_date="%m.%d.%Y";
+scheduler.config.lightbox.sections=[{name:"description",height:130,map_to:"text",type:"textarea",focus:!0},{name:"recurring",type:"recurring",map_to:"rec_type",button:"recurring"},{name:"time",height:72,type:"time",map_to:"auto"}];scheduler._copy_dummy=function(){this.start_date=new Date(this.start_date);this.end_date=new Date(this.end_date);this.event_length=this.event_pid=this.rec_pattern=this.rec_type=this._timed=null};
+scheduler.__recurring_template='
';
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_serialize.js b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_serialize.js
index 2e041981b10..fd3b34913bb 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_serialize.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_serialize.js
@@ -1,9 +1,8 @@
-/*
-dhtmlxScheduler v.2.3
-
+/*
This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
-to use it in not GPL project. Please contact sales@dhtmlx.com for details
-
-(c) DHTMLX Ltd.
-*/
-scheduler.data_attributes=function(){var C=[];var E=scheduler.templates.xml_format;for(var A in this._events){var D=this._events[A];for(var B in D){if(B.substr(0,1)!="_"){C.push([B,((B=="start_date"||B=="end_date")?E:null)])}}break}return C};scheduler.toXML=function(F){var C=[];var B=this.data_attributes();for(var A in this._events){var E=this._events[A];if(E.id.toString().indexOf("#")!=-1){continue}C.push("");for(var D=0;D"+B[D][0]+">")}C.push("")}return(F||"")+""+C.join("\n")+""};scheduler.toJSON=function(){var E=[];var C=this.data_attributes();for(var B in this._events){var F=this._events[B];if(F.id.toString().indexOf("#")!=-1){continue}var F=this._events[B];var A=[];for(var D=0;D");for(var b=0;b"+c[b][0]+">");d.push("")}}return(f||"")+""+d.join("\n")+""};
+scheduler.toJSON=function(){var f=[],d=this.data_attributes(),c;for(c in this._events){var e=this._events[c];if(e.id.toString().indexOf("#")==-1){for(var e=this._events[c],a=[],b=0;bU.x){break}}T=0;for(Q;QU.y){break}}U.fields={};U.fields[O.y_property]=P[O.y_property]=O.y_unit[Q].key;U.x=Q/10000000;if(this._drag_mode=="new-size"&&P.start_date*1==this._drag_start*1){S++}if(S>=O._trace_x.length){var R=scheduler.date.add(O._trace_x[O._trace_x.length-1],O.x_step,O.x_unit)}else{var R=O._trace_x[S]}U.y=Math.round((R-this._min_date)/(1000*60*this.config.time_step));U.custom=true;U.shift=M;return U}}};scheduler.render_timeline_event=function(U,V,R){var N=E(U,false,this._step);var L=E(U,true,this._step);var P=scheduler.xy.bar_height;var T=2+V*P;var Q=scheduler.templates.event_class(U.start_date,U.end_date,U);Q="dhx_cal_event_line "+(Q||"");var O='
"),
+ templateCss:dhx.Template(""),
+ templateColor:dhx.Template("#color#"),
+ templateTextColor:dhx.Template("#textColor#"),
+ padding:2
+ },
+ _prepareEvents:function(){
+ var evs = this.data.getRange();
+ var stack = [];
+ var ev,i,j,k,_is_sorder,_max_sorder,_sorder_set;
+ for(i=0; i< evs.length;i++){
+ ev=evs[i];
+ ev.$inner=false;
+ while (stack.length && stack[stack.length-1].end_date.valueOf()<=ev.start_date.valueOf()){
+ stack.splice(stack.length-1,1);
+ }
+ _sorder_set = false;
+
+ for(j=0;j< stack.length;j++){
+ if(stack[j].end_date.valueOf()<=ev.start_date.valueOf()){
+ _sorder_set = true;
+ ev.$sorder=stack[j].$sorder;
+ stack.splice(j,1);
+ ev.$inner=true;
+ break;
+ }
+ }
+
+ if (stack.length) stack[stack.length-1].$inner=true;
+
+ if(!_sorder_set){
+ if(stack.length){
+ if(stack.length<=stack[stack.length-1].$sorder){
+ if(!stack[stack.length-1].$sorder)
+ ev.$sorder = 0;
+ else
+ for(j=0;j_max_sorder)
+ _max_sorder = stack[j].$sorder;
+ ev.$sorder = _max_sorder+1;
+ ev.$inner = false;
+ }
+ }
+ else
+ ev.$sorder = 0;
+ }
+ stack.push(ev);
+ if (stack.length>(stack.max_count||0)) stack.max_count=stack.length;
+ }
+
+ for (var i=0; i < evs.length; i++){
+ evs[i].$count=stack.max_count;
+ this._setPosition(evs[i]);
+ }
+ },
+ _setPosition:function(ev){
+
+ var date = this.config.date.getValue?this.config.date.getValue():this.config.date;
+
+ var start = dhx.Date.copy(ev.start_date);
+ var end = dhx.Date.copy(ev.end_date);
+ var sh = start.getHours();
+ var eh = end.getHours();
+ if(dhx.Date.datePart(start).valueOf()>dhx.Date.datePart(end).valueOf()){
+ end = start;
+ }
+
+ if(dhx.Date.datePart(start).valueOf()dhx.Date.datePart(date).valueOf()){
+ end = dhx.Date.datePart(date);
+ end.setMinutes(0);
+ end.setHours(this.config.lastHour);
+ }
+ if (sh < this.config.firstHour || eh >= this.config.lastHour){
+ if (sh < this.config.firstHour){
+ end.setHours(this.config.firstHour);
+ ev.start_date.setMinutes(0);
+ }
+ if (eh >= this.config.lastHour){
+ end.setMinutes(0);
+ end.setHours(this.config.lastHour);
+ }
+ }
+ var temp_width = Math.floor((this._content_width-this.config.timeScaleWidth-this.config.eventOffset-8)/ev.$count);
+ ev.$left=ev.$sorder*(temp_width)+this.config.timeScaleWidth+this.config.eventOffset;
+ if (!ev.$inner) temp_width=temp_width*(ev.$count-ev.$sorder);
+ ev.$width = temp_width-this.config.eventOffset-this.type.padding*2;
+
+ var sm = start.getHours()*60+start.getMinutes();
+ var em = (end.getHours()*60+end.getMinutes())||(this.config.lastHour*60);
+ ev.$top = Math.round((sm-this.config.firstHour/60)*(this.config.timeScaleHeight+1)/60); //42px/hour
+ ev.$height = Math.max(10,(em-sm)*(this.config.timeScaleHeight+1)/60-2)-this.type.padding*2;
+ }
+}, dhx.MouseEvents, dhx.SelectionModel, dhx.Scrollable, dhx.RenderStack, dhx.DataLoader, dhx.ui.view, dhx.EventSystem, dhx.Settings);
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxcommon.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxcommon.js
index 0dcaa7a070c..ce3c3891f0f 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxcommon.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxcommon.js
@@ -1,3 +1,37 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+dhtmlx=function(obj){
+ for (var a in obj) dhtmlx[a]=obj[a];
+ return dhtmlx; //simple singleton
+};
+dhtmlx.extend_api=function(name,map,ext){
+ var t = window[name];
+ if (!t) return; //component not defined
+ window[name]=function(obj){
+ if (obj && typeof obj == "object" && !obj.tagName && !(obj instanceof Array)){
+ var that = t.apply(this,(map._init?map._init(obj):arguments));
+ //global settings
+ for (var a in dhtmlx)
+ if (map[a]) this[map[a]](dhtmlx[a]);
+ //local settings
+ for (var a in obj){
+ if (map[a]) this[map[a]](obj[a]);
+ else if (a.indexOf("on")==0){
+ this.attachEvent(a,obj[a]);
+ }
+ }
+ } else
+ var that = t.apply(this,arguments);
+ if (map._patch) map._patch(this);
+ return that||this;
+ };
+ window[name].prototype=t.prototype;
+ if (ext)
+ dhtmlXHeir(window[name].prototype,ext);
+};
+
dhtmlxAjax={
get:function(url,callback){
var t=new dtmlXMLLoaderObject(true);
@@ -546,12 +580,15 @@ dhtmlDragAndDropObject.prototype.initFrameRoute=function(win, mode){
}
}
-var _isFF = false;
-var _isIE = false;
-var _isOpera = false;
-var _isKHTML = false;
-var _isMacOS = false;
-var _isChrome = false;
+_isFF = false;
+_isIE = false;
+_isOpera = false;
+_isKHTML = false;
+_isMacOS = false;
+_isChrome = false;
+_KHTMLrv = false;
+_OperaRv = false;
+_FFrv = false;
if (navigator.userAgent.indexOf('Macintosh') != -1)
_isMacOS=true;
@@ -868,4 +905,10 @@ dhtmlxEventable=function(obj){
this[list[0]].removeEvent(list[1]); //remove event
}
}
+ obj.detachAllEvents = function(){
+ for (var name in this){
+ if (name.indexOf("ev_")==0)
+ delete this[name];
+ }
+ }
}
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxdataprocessor.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxdataprocessor.js
index 8dfc1cb0dd1..4a4143f947f 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxdataprocessor.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxdataprocessor.js
@@ -1,3 +1,7 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
/**
* @desc: constructor, data processor object
* @param: serverProcessorURL - url used for update
@@ -362,6 +366,8 @@ dataProcessor.prototype={
var soid = sid;
switch (action) {
+ case "update":
+ case "updated":
case "inserted":
case "insert":
if (tid != sid) {
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxdataprocessor_debug.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxdataprocessor_debug.js
index 2b251515166..e26776e533a 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxdataprocessor_debug.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxdataprocessor_debug.js
@@ -1,3 +1,7 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
dataProcessor.prototype._o_init = dataProcessor.prototype.init;
dataProcessor.prototype.init=function(obj){
this._console=this._console||this._createConsole();
@@ -86,7 +90,7 @@ dataProcessor.wrap("sendData",function(rowId){
if (!this.obj._idpull[rowId])
this._log(" Error! item with such ID not exists "+rowId+"");
} else {
- if (!this.obj.rowsAr[rowId])
+ if (this.rowsAr && !this.obj.rowsAr[rowId])
this._log(" Error! row with such ID not exists "+rowId+"");
}
}
@@ -150,7 +154,7 @@ dataProcessor.wrap("afterUpdateCallback",function(sid,tid,action){
if (this.obj.mytype=="tree"){
if (!this.obj._idpull[sid]) this._log("Incorrect SID, item with such ID not exists in grid");
} else {
- if (!this.obj.rowsAr[sid]) this._log("Incorrect SID, row with such ID not exists in grid");
+ if (this.obj.rowsAr && !this.obj.rowsAr[sid]) this._log("Incorrect SID, row with such ID not exists in grid");
}
this._log(" Action: "+action+" SID:"+sid+" TID:"+tid);
},function(){
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxdataprocessor_jsonp.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxdataprocessor_jsonp.js
new file mode 100644
index 00000000000..19779666494
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/dhtmlxdataprocessor_jsonp.js
@@ -0,0 +1,57 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+if(dataProcessor) {
+ dataProcessor.prototype.enableJSONP = function(mode) {
+ if(mode) {
+ this._jsonp_attach_id = this.attachEvent("onBeforeDataSending", function(rowId,rowIdState,a1){
+ if (rowId)
+ this._in_progress[rowId]=(new Date()).valueOf();
+
+ var url = this.serverProcessor+(this._user?(getUrlSymbol(this.serverProcessor)+["dhx_user="+this._user,"dhx_version="+this.obj.getUserData(0,"version")].join("&")):"");
+ url += ((url.indexOf("?")!=-1)?"&":"?")+this.serialize(a1,rowId);
+
+ this._jsonp(url, [], function(data){
+ var xml = new dtmlXMLLoaderObject(this.afterUpdate,this,true);
+ xml.loadXMLString(data);
+ this.afterUpdate(this, null, null, null, xml);
+ }, this);
+
+ this._waitMode++;
+ return false;
+ });
+ }
+ else {
+ if(this._jsonp_attach_id)
+ this.detachEvent(this._jsonp_attach_id);
+ }
+ };
+ dataProcessor.prototype._jsonp = function(url, params, callback, master){
+ var global_obj = "dataProcessor";
+ var id = "dp_jsonp_"+new Date().valueOf();
+ var script = document.createElement('script');
+ script.id = id;
+ script.type = 'text/javascript';
+
+ var head = document.getElementsByTagName("head")[0];
+
+ if (!params)
+ params = {};
+ params.jsonp = global_obj+"."+id; // would be called as dataProcessor.dp_jsonp_1938948394
+ dataProcessor[id]=function(){
+ callback.apply(master||window, arguments);
+ script.parentNode.removeChild(script);
+ callback = head = master = script = null;
+ delete dataProcessor[id];
+ };
+
+ var vals = [];
+ for (var key in params) vals.push(key+"="+encodeURIComponent(params[key]));
+
+ url += (url.indexOf("?") == -1 ? "?" : "&")+vals.join("&");
+
+ script.src = url ;
+ head.appendChild(script);
+ };
+}
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/event.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/event.js
index 202a6e5fcb9..18542ecbe3b 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/event.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/event.js
@@ -1,3 +1,7 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
scheduler.uid=function(){
if (!this._seed) this._seed=(new Date).valueOf();
return this._seed++;
@@ -9,6 +13,8 @@ scheduler.clearAll=function(){
this.clear_view();
};
scheduler.addEvent=function(start_date,end_date,text,id,extra_data){
+ if(!arguments.length)
+ return this.addEventNow();
var ev=start_date;
if (arguments.length!=1){
ev=extra_data||{};
@@ -16,12 +22,17 @@ scheduler.addEvent=function(start_date,end_date,text,id,extra_data){
ev.end_date=end_date;
ev.text=text;
ev.id=id;
- };
+ }
ev.id = ev.id||scheduler.uid();
ev.text = ev.text||"";
-
+
if (typeof ev.start_date == "string") ev.start_date=this.templates.api_date(ev.start_date);
if (typeof ev.end_date == "string") ev.end_date=this.templates.api_date(ev.end_date);
+
+ var d = (this.config.event_duration||this.config.time_step)*60000;
+ if(ev.start_date.valueOf() == ev.end_date.valueOf())
+ ev.end_date.setTime(ev.end_date.valueOf()+d);
+
ev._timed=this.is_one_day_event(ev);
var is_new=!this._events[ev.id];
@@ -30,15 +41,17 @@ scheduler.addEvent=function(start_date,end_date,text,id,extra_data){
if (!this._loading)
this.callEvent(is_new?"onEventAdded":"onEventChanged",[ev.id,ev]);
};
-scheduler.deleteEvent=function(id,silent){
+scheduler.deleteEvent=function(id,silent){
var ev=this._events[id];
- if (!silent && !this.callEvent("onBeforeEventDelete",[id,ev])) return;
-
+ if (!silent && (!this.callEvent("onBeforeEventDelete",[id,ev]) || !this.callEvent("onConfirmedBeforeEventDelete", [id,ev])))
+ return;
if (ev){
delete this._events[id];
this.unselect(id);
this.event_updated(ev);
}
+
+ this.callEvent("onEventDeleted", [id]);
};
scheduler.getEvent=function(id){
return this._events[id];
@@ -64,6 +77,7 @@ scheduler.changeEventId=function(id,new_id){
});
if (this._select_id==id) this._select_id=new_id;
if (this._edit_id==id) this._edit_id=new_id;
+ //if (this._drag_id==id) this._drag_id=new_id;
this.callEvent("onEventIdChange",[id,new_id]);
};
@@ -92,8 +106,7 @@ scheduler.event_updated=function(ev,force){
else this.clear_event(ev.id);
};
scheduler.is_visible_events=function(ev){
- if (ev.start_dateb.start_date?1:-1; });
+ evs.sort(function(a,b){
+ if(a.start_date.valueOf()==b.start_date.valueOf())
+ return a.id>b.id?1:-1;
+ return a.start_date>b.start_date?1:-1;
+ });
var days=[]; //events by weeks
var evs_originals = [];
for (var i=0; i < evs.length; i++) {
@@ -239,12 +268,70 @@ scheduler._pre_render_events_line=function(evs,hold){
if (!hold){
ev._inner=false;
+
var stack=days[ev._sday];
while (stack.length && stack[stack.length-1].end_date<=ev.start_date)
stack.splice(stack.length-1,1);
- if (stack.length) stack[stack.length-1]._inner=true;
- ev._sorder=stack.length; stack.push(ev);
- if (stack.length>(stack.max_count||0)) stack.max_count=stack.length;
+
+ var sorderSet = false;
+ for(var j=0; j _max_sorder)
+ _max_sorder = stack[j]._sorder;
+ ev._sorder = _max_sorder + 1;
+ ev._inner = false;
+ }
+
+ }
+ else
+ ev._sorder = 0;
+ }
+
+ stack.push(ev);
+
+ if (stack.length>(stack.max_count||0)) {
+ stack.max_count=stack.length;
+ ev._count=stack.length;
+ }
+ else {
+ ev._count=(ev._count)?ev._count:1;
+ }
}
if (sh < this.config.first_hour || eh >= this.config.last_hour){
@@ -262,23 +349,23 @@ scheduler._pre_render_events_line=function(evs,hold){
evs.splice(i,1); i--; continue;
}
}
-
}
if (!hold){
- for (var i=0; i < evs.length; i++)
- evs[i]._count=days[evs[i]._sday].max_count;
- for (var i=0; i < evs_originals.length; i++)
+ for (var i=0; i < evs.length; i++) {
+ evs[i]._count = days[evs[i]._sday].max_count;
+ }
+ for (var i=0; i < evs_originals.length; i++)
evs_originals[i]._count=days[evs_originals[i]._sday].max_count;
}
return evs;
};
scheduler._time_order=function(evs){
- evs.sort(function(a,b){
+ evs.sort(function(a,b){
if (a.start_date.valueOf()==b.start_date.valueOf()){
if (a._timed && !b._timed) return 1;
if (!a._timed && b._timed) return -1;
- return 0;
+ return a.id>b.id?1:-1;
}
return a.start_date>b.start_date?1:-1;
});
@@ -317,8 +404,10 @@ scheduler._pre_render_events_table=function(evs,hold){ // max - max height of we
for (stack_line=0; stack_line";
- var obj = this._render_v_bar(ev.id,left-menu+1,top,menu,icons.length*20+26,"","",icons_str,true);
+ icons_str+="";
+ var obj = this._render_v_bar(ev.id,left-menu+1,top,menu,icons.length*20+26,"","",icons_str,true);
obj.style.left=left-menu+1;
this._els["dhx_cal_data"][0].appendChild(obj);
this._rendered.push(obj);
@@ -445,17 +542,19 @@ scheduler.render_event=function(ev){
};
scheduler._render_v_bar=function(id,x,y,w,h,style,contentA,contentB,bottom){
var d=document.createElement("DIV");
-
var ev = this.getEvent(id);
var cs = "dhx_cal_event";
var cse = scheduler.templates.event_class(ev.start_date,ev.end_date,ev);
if (cse) cs=cs+" "+cse;
+
+ var bg_color = (ev.color?("background-color:"+ev.color+";"):"");
+ var color = (ev.textColor?("color:"+ev.textColor+";"):"");
var html='
';
- html+='
';
- html+='
'+contentA+'
';
- html+='
'+contentB+'
';
- html+='
';
+ html+='
';
+ html+='
'+contentA+'
';
+ html+='
'+contentB+'
';
+ html+='';
d.innerHTML=html;
return d.firstChild;
@@ -471,22 +570,25 @@ scheduler.locate_holder_day=function(date,past){
return day;
};
scheduler.render_event_bar=function(ev){
- var parent=this._els["dhx_cal_data"][0];
+ var parent=this._rendered_location;
var x=this._colsS[ev._sday];
var x2=this._colsS[ev._eday];
if (x2==x) x2=this._colsS[ev._eday+1];
var hb = this.xy.bar_height;
- var y=this._colsS.heights[ev._sweek]+(this._colsS.height?(this.xy.month_scale_height+2):2)+ev._sorder*hb;
+ var y=this._colsS.heights[ev._sweek]+(this._colsS.height?(this.xy.month_scale_height+2):2)+(ev._sorder*hb);
var d=document.createElement("DIV");
var cs = ev._timed?"dhx_cal_event_clear":"dhx_cal_event_line";
var cse = scheduler.templates.event_class(ev.start_date,ev.end_date,ev);
- if (cse) cs=cs+" "+cse;
+ if (cse) cs=cs+" "+cse;
+
+ var bg_color = (ev.color?("background-color:"+ev.color+";"):"");
+ var color = (ev.textColor?("color:"+ev.textColor+";"):"");
+
+ var html='
';
- var html='
';
-
if (ev._timed)
html+=scheduler.templates.event_bar_date(ev.start_date,ev.end_date,ev);
html+=scheduler.templates.event_bar_text(ev.start_date,ev.end_date,ev)+'
';
@@ -542,4 +644,4 @@ scheduler.getEvents = function(from,to){
result.push(ev);
}
return result;
-};
\ No newline at end of file
+};
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext.css b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext.css
index 402c5b38271..de19bca63ed 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext.css
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext.css
@@ -1,6 +1,15 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+.dhx_scale_bar_header {
+ position: absolute;
+ border-bottom: 1px dotted #8894A3;
+ width: 100%;
+}
.dhx_expand_icon {
position:absolute; top:0px; right:0px;
- background-image:url(../codebase/imgs/colapce-expand-icon.gif);
+ background-image:url(./imgs/colapce-expand-icon.gif);
width:18px; height:18px;
cursor:pointer;
background-position:0px 18px;
@@ -10,7 +19,7 @@
width:100%;
height:100%;
overflow-y:auto;
- background-image:url(../codebase/imgs/databg.png);
+ background-image:url(./imgs/databg.png);
}
.dhx_agenda_line{
height:21px;
@@ -37,7 +46,7 @@
.dhx_agenda_line .dhx_event_icon{
width:20px;
border-width:0px;
- background:url(../codebase/imgs/icon.png) no-repeat;
+ background:url(./imgs/icon.png) no-repeat;
background-position: 5px 4px;
cursor:pointer;
}
@@ -51,7 +60,6 @@
border-left:1px dotted #586A7E;
}
.dhx_year_week{
- height:20px;
position:relative;
}
.dhx_scale_bar_last{
@@ -79,7 +87,7 @@
}
.dhx_tooltip{
border:1px solid #BBBBBB;
- background-image:url(../codebase/imgs/databg.png);
+ background-image:url(./imgs/databg.png);
position:absolute;
z-index:9998;
width:300px;
@@ -101,7 +109,7 @@
float:left;
border-width:0px;
position:relative;
- background:url(../codebase/imgs/icon.png) no-repeat;
+ background:url(./imgs/icon.png) no-repeat;
background-position: 5px 4px;
cursor:pointer;
}
@@ -136,10 +144,12 @@
left:190px;
top:1px;
cursor:pointer;
- background-image:url(../imgs/calendar.gif);
+ background-image:url(./imgs/calendar.gif);
}
-
+.dhx_matrix_scell {
+ height: 100%;
+}
.dhx_matrix_cell, .dhx_matrix_scell{
overflow:hidden;
@@ -151,10 +161,12 @@
.dhx_matrix_cell{
background-color:white;
}
+.dhx_matrix_line{
+ overflow: hidden;
+}
.dhx_matrix_cell div, .dhx_matrix_scell div{
overflow:hidden;
text-align:center;
- width:100%;
height:auto;
}
@@ -179,12 +191,17 @@
.dhx_matrix_scell .dhx_scell_level2{
padding-left: 35px;
}
+.dhx_matrix_scell .dhx_scell_level3{
+ padding-left: 50px;
+}
+.dhx_matrix_scell .dhx_scell_level4{
+ padding-left: 65px;
+}
.dhx_matrix_scell.folder{
font-weight: bold;
text-align: left;
}
-
.dhx_matrix_scell.folder .dhx_scell_expand{
float: left;
width: 10px;
@@ -198,13 +215,17 @@
padding-left:15px;
text-align: left;
}
-.dhx_section_timeline, .dhx_section_timeline2{
- overflow: hidden;
- padding: 2px 0 2px 10px;
+.dhx_data_table.folder .dhx_matrix_cell{
+ border-right: 0;
}
-.dhx_section_timeline select, .dhx_section_timeline2 select{
+.dhx_section_timeline {
+ overflow: hidden;
+ padding: 4px 0 2px 10px;
+}
+.dhx_section_timeline select{
width: 552px;
}
+
/* Tree view end*/
/* Map view */
@@ -213,12 +234,12 @@
height:100%;
overflow-y: auto;
overflow-x: hidden;
- background-image:url(../codebase/imgs/databg.png);
+ background-image:url(./imgs/databg.png);
}
.dhx_map_line .dhx_event_icon{
width:20px;
border-width:0px;
- background:url(../codebase/imgs/icon.png) no-repeat;
+ background:url(./imgs/icon.png) no-repeat;
background-position: 5px 4px;
cursor:pointer;
}
@@ -247,7 +268,7 @@
}
.dhx_map_line .dhx_map_description{
float:left;
- border-right: 0px dotted #8894A3;
+ border-right: 0 dotted #8894A3;
text-align:center;
line-height:21px;
overflow:hidden;
@@ -271,8 +292,12 @@
/* dhtmlXTooltip start */
.dhtmlXTooltip.tooltip{
-moz-box-shadow:3px 3px 3px #888888;
- -khtml-box-shadow:3px 3px 3px #888888;
-
+ -webkit-box-shadow:3px 3px 3px #888888;
+ -o-box-shadow:3px 3px 3px #888888;
+ box-shadow:3px 3px 3px #888888;
+ filter:
+ progid:DXImageTransform.Microsoft.Shadow(color='#888888', Direction=135, Strength=5)
+ ;
background-color:white;
border-left:1px dotted #887A2E;
border-top:1px dotted #887A2E;
@@ -315,3 +340,47 @@
padding: 4px;
}
/* Lightbox dhtmlx combo section end */
+
+/* Agenda week start */
+.dhx_wa_column {
+ float: left;
+}
+.dhx_wa_column_last .dhx_wa_day_cont{
+ border-left: 1px dotted #8894A3;
+}
+.dhx_wa_scale_bar {
+ font-family: Tahoma;
+ padding-left: 10px;
+ font-size: 11px;
+ border-top: 1px dotted #8894A3;
+ border-bottom: 1px dotted #8894A3;
+}
+.dhx_wa_day_data {
+ background-color: #FCFEFC;
+ overflow-y: auto;
+}
+.dhx_wa_ev_body {
+ border-bottom: 1px dotted #778899;
+ font-size: 12px;
+ padding: 5px 0 5px 7px;
+}
+.dhx_wa_dnd {
+ font-family: Tahoma;
+ position: absolute;
+ padding-right: 7px;
+ color: #887AE2 !important;
+ background-color: #FFE763 !important;
+ border: 1px solid #B7A543;
+}
+.dhx_cal_event_selected{
+ background-color: #9cc1db;
+ color: white;
+}
+/* Agenda week end */
+
+/* timeline second scale start */
+.dhx_second_scale_bar {
+ border-bottom: 1px dotted #586A7E;
+ padding-top: 2px;
+}
+/* timeline second scale end */
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_active_links.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_active_links.js
index 79ebce494bb..46bc624c1ea 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_active_links.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_active_links.js
@@ -1,3 +1,7 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
scheduler.attachEvent("onTemplatesReady",function(){
var s_d = scheduler.date.str_to_date(scheduler.config.api_date);
var d_s = scheduler.date.date_to_str(scheduler.config.api_date);
@@ -5,17 +9,18 @@ scheduler.attachEvent("onTemplatesReady",function(){
var month_x = scheduler.templates.month_day;
scheduler.templates.month_day=function(date){
return ""+month_x(date)+"";
- }
+ };
var week_x = scheduler.templates.week_scale_date;
scheduler.templates.week_scale_date=function(date){
return ""+week_x(date)+"";
- }
-
-
+ };
dhtmlxEvent(this._obj,"click",function(e){
var start = e.target || event.srcElement;
var to = start.getAttribute("jump_to");
- if (to)
+ if (to) {
scheduler.setCurrentView(s_d(to),"day");
+ if (e && e.preventDefault) e.preventDefault();
+ return false;
+ }
})
-})
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_agenda_view.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_agenda_view.js
index 6fcdd5cc106..08d06e0e644 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_agenda_view.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_agenda_view.js
@@ -1,20 +1,24 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
scheduler.date.add_agenda = function(date){
return (new Date(date.valueOf()));
-}
+};
scheduler.dblclick_dhx_agenda_area=function(){
if (!this.config.readonly && this.config.dblclick_create)
this.addEventNow();
-}
+};
scheduler.templates.agenda_time = function(start,end,ev){
if (ev._timed)
return this.day_date(ev.start_date, ev.end_date, ev)+" "+this.event_date(start);
else
return scheduler.templates.day_date(start)+" – "+scheduler.templates.day_date(end);
-}
-scheduler.templates.agenda_text = function(ev){
- return ev.text;
-}
+};
+scheduler.templates.agenda_text = function(start,end,event){
+ return event.text;
+};
scheduler.date.agenda_start=function(d){ return d; };
scheduler.attachEvent("onTemplatesReady",function(){
@@ -37,6 +41,19 @@ scheduler.attachEvent("onTemplatesReady",function(){
else
return old.apply(this,arguments);
}
+
+ var old_render_view_data = scheduler.render_view_data;
+ scheduler.render_view_data=function(){
+ if(this._mode == "agenda") {
+ scheduler._agendaScrollTop = scheduler._els["dhx_cal_data"][0].childNodes[0].scrollTop;
+ scheduler._els["dhx_cal_data"][0].childNodes[0].scrollTop = 0;
+ scheduler._els["dhx_cal_data"][0].style.overflowY = 'hidden';
+ }
+ else {
+ scheduler._els["dhx_cal_data"][0].style.overflowY = 'auto';
+ }
+ return old_render_view_data.apply(this,arguments);
+ }
function set_full_view(mode){
@@ -59,15 +76,18 @@ scheduler.attachEvent("onTemplatesReady",function(){
//generate html for the view
var html="
";
+ var ev = events[i];
+ var bg_color = (ev.color?("background-color:"+ev.color+";"):"");
+ var color = (ev.textColor?("color:"+ev.textColor+";"):"");
+ html+="
";
//render html
- scheduler._els["dhx_cal_data"][0].scrollTop = 0; //fix flickering in FF
scheduler._els["dhx_cal_data"][0].innerHTML = html;
+ scheduler._els["dhx_cal_data"][0].childNodes[0].scrollTop = scheduler._agendaScrollTop||0;
var t=scheduler._els["dhx_cal_data"][0].firstChild.childNodes;
scheduler._els["dhx_cal_date"][0].innerHTML="";
@@ -90,4 +110,4 @@ scheduler.attachEvent("onTemplatesReady",function(){
//agenda tab de-activated
}
}
-})
\ No newline at end of file
+})
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_collision.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_collision.js
index d2582a05926..e1e5d0fb52f 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_collision.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_collision.js
@@ -1,27 +1,35 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
(function(){
-var temp_section,temp_time;
+var temp_section;
var before;
scheduler.config.collision_limit = 1;
-scheduler.attachEvent("onBeforeDrag",function(id){
- var pr = scheduler._props?scheduler._props[this._mode]:null;
- var matrix = scheduler.matrix?scheduler.matrix[this._mode]:null;
- var checked_mode = pr||matrix;
+
+function _setTempSection(event_id) { // for custom views (matrix, timeline, units)
+ var pr = scheduler._props?scheduler._props[scheduler._mode]:null;
+ var matrix = scheduler.matrix?scheduler.matrix[scheduler._mode]:null;
+ var checked_mode = pr||matrix; // units or matrix mode
if(pr)
var map_to = checked_mode.map_to;
if(matrix)
var map_to = checked_mode.y_property;
+ if ((checked_mode) && event_id){
+ temp_section = scheduler.getEvent(event_id)[map_to];
+ }
+}
- if ((checked_mode) && id){
- temp_section = this.getEvent(id)[map_to];
- temp_time = this.getEvent(id).start_date;
- }
+scheduler.attachEvent("onBeforeDrag",function(id){
+ _setTempSection(id);
return true;
});
scheduler.attachEvent("onBeforeLightbox",function(id){
var ev = scheduler.getEvent(id);
before = [ev.start_date, ev.end_date];
+ _setTempSection(id);
return true;
});
scheduler.attachEvent("onEventChanged",function(id){
@@ -39,17 +47,16 @@ scheduler.attachEvent("onBeforeEventChanged",function(ev,e,is_new){
return collision_check(ev);
});
scheduler.attachEvent("onEventSave",function(id, edited_ev){
- //var ev = scheduler.getEvent(id);
- if(edited_ev.rec_type)
+ if(edited_ev.rec_type){
scheduler._roll_back_dates(edited_ev);
-
- return collision_check(edited_ev);
+ return collision_check(edited_ev);
+ }
+ return true;
+ //return collision_check(edited_ev);
});
-
function collision_check(ev){
var evs = [];
-
if (ev.rec_type) {
var evs_dates = scheduler.getRecDates(ev);
for(var k=0; k scheduler.config.collision_limit) {
- scheduler._drag_event.start_date = temp_time;
- ev[map_to] = temp_section;
+ if (count >= scheduler.config.collision_limit) {
+ ev[map_to] = temp_section; // from _setTempSection for custom views
single = false;
}
}
else {
- if (evs.length > scheduler.config.collision_limit)
+ if (evs.length > scheduler.config.collision_limit)
single = false;
}
-
if (!single) return !scheduler.callEvent("onEventCollision",[ev,evs]);
return single;
-};
+}
-})();
\ No newline at end of file
+})();
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_cookie.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_cookie.js
index 0df4852ccdc..71f1d5e6794 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_cookie.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_cookie.js
@@ -1,3 +1,7 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
(function(){
function setCookie(name,cookie_param,value) {
var str = name + "=" + value + (cookie_param?("; "+cookie_param):"");
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_editors.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_editors.js
index 8c64d13eddc..e76eff631f4 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_editors.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_editors.js
@@ -1,3 +1,7 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
scheduler.form_blocks['combo']={
render:function(sns) {
var res = '';
@@ -40,7 +44,7 @@ scheduler.form_blocks['combo']={
scheduler.form_blocks['radio']={
render:function(sns) {
var res = '';
- res += "
";
+ res += "
";
for (var i=0; i";
@@ -74,20 +78,32 @@ scheduler.form_blocks['radio']={
scheduler.form_blocks['checkbox']={
render:function(sns) {
- return '';
+ if (scheduler.config.wide_form)
+ return '';
+ else
+ return '';
},
set_value:function(node,value,ev,config){
+ node=document.getElementById(config.id);
var id = scheduler.uid();
var isChecked = false;
if (typeof config.checked_value != 'undefined' && ev[config.map_to] == config.checked_value) {
isChecked = true;
}
- node.previousSibling.className += " dhx_cal_checkbox";
- node.previousSibling.innerHTML="";
-
+ node.className += " dhx_cal_checkbox";
+ var check_html = "";
+ var label_html = "";
+ if (scheduler.config.wide_form){
+ node.innerHTML = label_html;
+ node.nextSibling.innerHTML=check_html;
+ } else
+ node.innerHTML=check_html+label_html;
},
get_value:function(node,ev,config){
- var checkbox = node.previousSibling.getElementsByTagName('input')[0]; // moved to the header
+ node=document.getElementById(config.id);
+ var checkbox = node.getElementsByTagName('input')[0]; // moved to the header
+ if (!checkbox)
+ checkbox = node.nextSibling.getElementsByTagName('input')[0];
return (checkbox.checked)?(config.checked_value||true):(config.unchecked_value||false);
},
focus:function(node){
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_expand.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_expand.js
index 9224bef1af5..5e916128cf9 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_expand.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_expand.js
@@ -1,27 +1,30 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
scheduler.expand = function(){
- var t = scheduler._obj;
- do {
- t._position = t.style.position||"";
- t.style.position = "static";
- } while ((t = t.parentNode) && t.style );
- t = scheduler._obj;
- t.style.position="absolute";
- t._width = t.style.width;
- t._height = t.style.height;
- t.style.width = t.style.height = "100%";
- t.style.top = t.style.left = "0px";
-
- var top =document.body;
- top.scrollTop = 0;
-
- top = top.parentNode;
- if (top)
- top.scrollTop = 0;
- document.body._overflow=document.body.style.overflow||"";
- document.body.style.overflow = "hidden";
- scheduler._maximize()
-}
-
+ var t = scheduler._obj;
+ do {
+ t._position = t.style.position||"";
+ t.style.position = "static";
+ } while ((t = t.parentNode) && t.style );
+ t = scheduler._obj;
+ t.style.position="absolute";
+ t._width = t.style.width;
+ t._height = t.style.height;
+ t.style.width = t.style.height = "100%";
+ t.style.top = t.style.left = "0px";
+
+ var top = document.body;
+ top.scrollTop = 0;
+
+ top = top.parentNode;
+ if (top)
+ top.scrollTop = 0;
+ document.body._overflow=document.body.style.overflow||"";
+ document.body.style.overflow = "hidden";
+ scheduler._maximize();
+};
scheduler.collapse = function(){
var t = scheduler._obj;
do {
@@ -31,9 +34,8 @@ scheduler.collapse = function(){
t.style.width = t._width;
t.style.height = t._height;
document.body.style.overflow=document.body._overflow;
- scheduler._maximize()
-}
-
+ scheduler._maximize();
+};
scheduler.attachEvent("onTemplatesReady",function(){
var t = document.createElement("DIV");
t.className="dhx_expand_icon";
@@ -46,9 +48,27 @@ scheduler.attachEvent("onTemplatesReady",function(){
scheduler.collapse();
}
});
+
scheduler._maximize = function(){
- this.expanded = !this.expanded;
- this.toggleIcon.style.backgroundPosition="0px "+(this._expand?"0":"18")+"px";
- if (scheduler.callEvent("onSchedulerResize",[]))
- scheduler.update_view();
-}
+ this.expanded = !this.expanded;
+ this.toggleIcon.style.backgroundPosition="0px "+(this.expanded?"0":"18")+"px";
+
+ var directions = ['left', 'top'];
+ for(var i=0; i= scheduler.config.collision_limit);
+ });
+
+ scheduler.addEvent=function(start_date,end_date,text,id,extra_data){
+ var ev=start_date;
+ if (arguments.length!=1){
+ ev=extra_data||{};
+ ev.start_date=start_date;
+ ev.end_date=end_date;
+ ev.text=text;
+ ev.id=id;
+ ev.layer = this.defaultLayer;
+ };
+ ev.id = ev.id||scheduler.uid();
+ ev.text = ev.text||"";
+
+
+ if (typeof ev.start_date == "string") ev.start_date=this.templates.api_date(ev.start_date);
+ if (typeof ev.end_date == "string") ev.end_date=this.templates.api_date(ev.end_date);
+ ev._timed=this.is_one_day_event(ev);
+
+ var is_new=!this._events[ev.id];
+ this._events[ev.id]=ev;
+ this.event_updated(ev);
+ if (!this._loading)
+ this.callEvent(is_new?"onEventAdded":"onEventChanged",[ev.id,ev]);
+ };
+
+ this._evs_layer = {};
+ for (var i = 0; i < this.layers.length; i++) { // array in object for each layer
+ this._evs_layer[this.layers[i].name] = [];
+ }
+
+ scheduler.addEventNow=function(start,end,e){
+ var base = {};
+ if (typeof start == "object"){
+ base = start;
+ start = null;
+ }
+
+ var d = (this.config.event_duration||this.config.time_step)*60000;
+ if (!start) start = Math.round((new Date()).valueOf()/d)*d;
+ var start_date = new Date(start);
+ if (!end){
+ var start_hour = this.config.first_hour;
+ if (start_hour > start_date.getHours()){
+ start_date.setHours(start_hour);
+ start = start_date.valueOf();
+ }
+ end = start+d;
+ }
+
+
+ base.start_date = base.start_date||start_date;
+ base.end_date = base.end_date||new Date(end);
+ base.text = base.text||this.locale.labels.new_event;
+ base.id = this._drag_id = this.uid();
+ base.layer = this.defaultLayer;
+ this._drag_mode="new-size";
+
+ this._loading=true;
+ this.addEvent(base);
+ this.callEvent("onEventCreated",[this._drag_id,e]);
+ this._loading=false;
+
+ this._drag_event={}; //dummy , to trigger correct event updating logic
+ this._on_mouse_up(e);
+ }
+
+ scheduler._t_render_view_data = function(events) { // helper
+ if (this.config.multi_day && !this._table_view) {
+ var tvs = [];
+ var tvd = [];
+ for (var k = 0; k < events.length; k++) {
+ if (events[k]._timed)
+ tvs.push(events[k]);
+ else
+ tvd.push(events[k]);
+ }
+ this._table_view = true;
+ this.render_data(tvd);
+ this._table_view = false;
+ this.render_data(tvs);
+ }
+ else
+ this.render_data(events);
+ };
+
+ scheduler.render_view_data = function(){
+ if (this._not_render) {
+ this._render_wait = true;
+ return;
+ }
+ this._render_wait = false;
+
+ this.clear_view();
+
+ this._evs_layer = {};
+ for (var i = 0; i < this.layers.length; i++) { // array in object for each layer
+ this._evs_layer[this.layers[i].name] = [];
+ }
+
+ var evs = this.get_visible_events();
+ for (var i = 0; i < evs.length; i++) { // filling layer arrays with events
+ if(this._evs_layer[evs[i].layer])
+ this._evs_layer[evs[i].layer].push(evs[i]);
+ }
+
+ if(this._mode == 'month') { // old logic is used
+ var tevs = [];
+ for (var i = 0; i < this.layers.length; i++) {
+ if (this.layers[i].visible)
+ tevs = tevs.concat(this._evs_layer[this.layers[i].name]);
+ }
+ this._t_render_view_data(tevs);
+ }
+ else { // week, day; should use new logic
+ for (var i = 0; i < this.layers.length; i++) {
+ if (this.layers[i].visible) {
+ var evs_layer = this._evs_layer[this.layers[i].name];
+ this._t_render_view_data(evs_layer);
+ }
+ }
+ }
+ };
+
+ scheduler._render_v_bar=function(id,x,y,w,h,style,contentA,contentB,bottom){
+ var ev = this.getEvent(id);
+ if(contentA.indexOf('
';
+ html+='
';
+ html+='
'+contentA+'
';
+ html+='
'+contentB+'
';
+ html+='
';
+
+ d.innerHTML=html;
+ d.style.zIndex = 100;
+ return d.firstChild;
+ };
+
+ scheduler.render_event_bar=function(ev){
+ var parent=this._els["dhx_cal_data"][0];
+
+ var x=this._colsS[ev._sday];
+ var x2=this._colsS[ev._eday];
+ if (x2==x) x2=this._colsS[ev._eday+1];
+ var hb = this.xy.bar_height;
+
+ var y=this._colsS.heights[ev._sweek]+(this._colsS.height?(this.xy.month_scale_height+2):2)+ev._sorder*hb;
+
+ var d=document.createElement("DIV");
+ var cs = ev._timed?"dhx_cal_event_clear":"dhx_cal_event_line";
+ var cse = (scheduler.templates['event_class_'+ev.layer])?scheduler.templates['event_class_'+ev.layer](ev.start_date,ev.end_date,ev):scheduler.templates.event_class(ev.start_date,ev.end_date,ev);
+ if (cse) cs=cs+" "+cse;
+
+ var html='
';
+
+ d.innerHTML=html;
+
+ this._rendered.push(d.firstChild);
+ parent.appendChild(d.firstChild);
+ };
+
+ scheduler.render_event=function(ev){
+ var menu = scheduler.xy.menu_width;
+ if(scheduler.getLayer(ev.layer).noMenu)
+ menu = 0;
+
+ if (ev._sday<0) return; //can occur in case of recurring event during time shift
+ var parent=scheduler.locate_holder(ev._sday);
+ if (!parent) return; //attempt to render non-visible event
+ var sm = ev.start_date.getHours()*60+ev.start_date.getMinutes();
+ var em = (ev.end_date.getHours()*60+ev.end_date.getMinutes())||(scheduler.config.last_hour*60);
+
+ var top = (Math.round((sm*60*1000-this.config.first_hour*60*60*1000)*this.config.hour_size_px/(60*60*1000)))%(this.config.hour_size_px*24)+1; //42px/hour
+ var height = Math.max(scheduler.xy.min_event_height,(em-sm)*this.config.hour_size_px/60)+1; //42px/hour
+ //var height = Math.max(25,Math.round((ev.end_date.valueOf()-ev.start_date.valueOf())*(this.config.hour_size_px+(this._quirks?1:0))/(60*60*1000))); //42px/hour
+ var width=Math.floor((parent.clientWidth-menu)/ev._count);
+ var left=ev._sorder*width+1;
+ if (!ev._inner) width=width*(ev._count-ev._sorder);
+
+
+
+ var d=this._render_v_bar(ev.id,menu+left,top,width,height,ev._text_style,scheduler.templates.event_header(ev.start_date,ev.end_date,ev),scheduler.templates.event_text(ev.start_date,ev.end_date,ev));
+
+ this._rendered.push(d);
+ parent.appendChild(d);
+
+ left=left+parseInt(parent.style.left,10)+menu;
+
+ top+=this._dy_shift; //corrupt top, to include possible multi-day shift
+ d.style.zIndex = this._layers_zindex[ev.layer];
+
+ if (this._edit_id==ev.id){
+ d.style.zIndex = parseInt(d.style.zIndex)+1; //fix overlapping issue
+ var new_zIndex = d.style.zIndex;
+ width=Math.max(width-4,scheduler.xy.editor_width);
+ var d=document.createElement("DIV");
+ d.setAttribute("event_id",ev.id);
+ this.set_xy(d,width,height-20,left,top+14);
+ d.className="dhx_cal_editor";
+ d.style.zIndex = new_zIndex;
+ var d2=document.createElement("DIV");
+ this.set_xy(d2,width-6,height-26);
+ d2.style.cssText+=";margin:2px 2px 2px 2px;overflow:hidden;";
+
+
+ d2.style.zIndex = new_zIndex;
+ d.appendChild(d2);
+ this._els["dhx_cal_data"][0].appendChild(d);
+ this._rendered.push(d);
+
+ d2.innerHTML="";
+ if (this._quirks7) d2.firstChild.style.height=height-12+"px"; //IEFIX
+ this._editor=d2.firstChild;
+ this._editor.onkeypress=function(e){
+ if ((e||event).shiftKey) return true;
+ var code=(e||event).keyCode;
+ if (code==scheduler.keys.edit_save) scheduler.editStop(true);
+ if (code==scheduler.keys.edit_cancel) scheduler.editStop(false);
+ };
+ this._editor.onselectstart=function(e){ return (e||event).cancelBubble=true; };
+ d2.firstChild.focus();
+ //IE and opera can add x-scroll during focusing
+ this._els["dhx_cal_data"][0].scrollLeft=0;
+ d2.firstChild.select();
+ }
+ if (this._select_id==ev.id){
+ d.style.zIndex = parseInt(d.style.zIndex)+1; //fix overlapping issue
+ var icons=this.config["icons_"+((this._edit_id==ev.id)?"edit":"select")];
+ var icons_str="";
+ for (var i=0; i
";
+ var obj = this._render_v_bar(ev.id,left-menu+1,top,menu,icons.length*20+26,"","",icons_str,true);
+ obj.style.left=left-menu+1;
+ obj.style.zIndex = d.style.zIndex;
+ this._els["dhx_cal_data"][0].appendChild(obj);
+ this._rendered.push(obj);
+ }
+
+ };
+
+ scheduler.filter_agenda = function(id, event) {
+ var layer = scheduler.getLayer(event.layer);
+ return (layer && layer.visible);
+ };
+});
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_limit.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_limit.js
index 4a8ad2fed6d..ad790cf3ea9 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_limit.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_limit.js
@@ -1,3 +1,7 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
scheduler.config.limit_start = new Date(-3999,0,0);
scheduler.config.limit_end = new Date( 3999,0,0);
scheduler.config.limit_view = false;
@@ -5,6 +9,48 @@ scheduler.config.limit_view = false;
(function(){
var before = null;
+ var block_days = {};
+ var block_weeks = {};
+ var time_block_set = false;
+ scheduler.blockTime = function(day, zones){
+ var bottom = this.config.first_hour*60
+ var top = this.config.last_hour*60
+ if (zones == "fullday")
+ zones = [bottom,top];
+
+ if (typeof day == "object")
+ block_days[this.date.date_part(day).valueOf()] = zones;
+ else
+ block_weeks[day] = zones;
+
+ for (var i=0; itop)
+ zones[i+1] = top;
+ }
+
+ time_block_set = true;
+ };
+
+ scheduler.attachEvent("onScaleAdd", function(area, day){
+ var zones = block_days[day.valueOf()] || block_weeks[day.getDay()];
+ if (zones){
+ for (var i = 0; i < zones.length; i+=2){
+ var start = zones[i];
+ var end = zones[i+1];
+ var block = document.createElement("DIV");
+ block.className = "dhx_time_block";
+
+ var h_px // FIXME
+ block.style.top = (Math.round((start*60*1000-this.config.first_hour*60*60*1000)*this.config.hour_size_px/(60*60*1000)))%(this.config.hour_size_px*24)+"px";
+ block.style.height = (Math.round(((end-start-1)*60*1000)*this.config.hour_size_px/(60*60*1000)))%(this.config.hour_size_px*24)+"px";
+
+ area.appendChild(block);
+ }
+ }
+ });
+
scheduler.attachEvent("onBeforeViewChange",function(om,od,nm,nd){
nd = nd||od; nm = nm||om;
if (scheduler.config.limit_view){
@@ -20,6 +66,44 @@ scheduler.config.limit_view = false;
var blocker = function(ev){
var c = scheduler.config;
var res = (ev.start_date.valueOf() >= c.limit_start.valueOf() && ev.end_date.valueOf() <= c.limit_end.valueOf());
+ if (res && time_block_set && ev._timed){
+ var day = scheduler.date.date_part(new Date(ev.start_date.valueOf()));
+ var zones = block_days[day.valueOf()] || block_weeks[day.getDay()];
+ var sm = ev.start_date.getHours()*60+ev.start_date.getMinutes();
+ var em = ev.end_date.getHours()*60+ev.end_date.getMinutes();
+ if (zones){
+ for (var i = 0; i < zones.length; i+=2){
+ var sz = zones[i];
+ var ez = zones[i+1];
+ if (szsm) {
+ if (sm<=ez && sm >=sz){
+ if (ez == 24*60 || em=sz && em scheduler.config.limit_end) {
- ev.end_date = new Date(scheduler.config.limit_end);
- // as end date was changed need to recheck if event occuring during one day
- ev._timed = this.is_one_day_event(ev);
+ if (ev.start_date.valueOf() >= scheduler.config.limit_end.valueOf()) {
+ ev.start_date = this.date.add(scheduler.config.limit_end, -1, "day");
+ }
+ if (ev.end_date < scheduler.config.limit_start) {
+ ev.end_date = new Date(scheduler.config.limit_start);
+ }
+ if (ev.end_date.valueOf() >= scheduler.config.limit_end.valueOf()) {
+ ev.end_date = this.date.add(scheduler.config.limit_end, -1, "day");
}
- // in case if both start and end date were specified < scheduler.config.limit_star
- if (ev.start_date > ev.end_date) {
+ if (ev.start_date.valueOf() >= ev.end_date.valueOf()) {
ev.end_date = this.date.add(ev.start_date, (this.config.event_duration||this.config.time_step), "minute");
}
+ ev._timed=this.is_one_day_event(ev);
}
return true;
});
@@ -74,5 +163,4 @@ scheduler.config.limit_view = false;
return blocker(ev);
});
-})();
-
+})();
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_map_view.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_map_view.js
index 05845b9c468..e2e17d14e03 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_map_view.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/ext/ext_map_view.js
@@ -1,5 +1,7 @@
-
-
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
scheduler.xy.map_date_width = 188; // date column width
scheduler.xy.map_description_width = 400; // description column width
@@ -18,74 +20,90 @@ scheduler.config.map_zoom_after_resolve = 15;
scheduler.locale.labels.marker_geo_success = "It seems you are here.";
scheduler.locale.labels.marker_geo_fail = "Sorry, could not get your current position using geolocation.";
-scheduler.templates.marker_date=scheduler.date.date_to_str("%Y-%m-%d %H:%i"); // date for map's infowindow will be formated following way
+scheduler.templates.marker_date = scheduler.date.date_to_str("%Y-%m-%d %H:%i"); // date for map's infowindow will be formated following way
-scheduler.templates.marker_text=function(start, end, ev){
- return "
';
if (!attach)
return html;
else {
var d = document.createElement("DIV");
d.innerHTML = html;
-
- var ind = this.order[ev[this.y_property]];
+ var ind = this.order[section];
var parent = scheduler._els["dhx_cal_data"][0].firstChild.rows[ind].cells[1].firstChild;
scheduler._rendered.push(d.firstChild);
@@ -181,15 +198,13 @@ scheduler.render_timeline_event = function(ev, stack, attach){
}
};
-
function trace_events(){
//minimize event set
- var evs = scheduler.getEvents(scheduler._min_date, scheduler._max_date);
+ var evs = scheduler.get_visible_events();
var matrix =[];
for (var i=0; i < this.y_unit.length; i++)
matrix[i]=[];
-
//next code defines row for undefined key
//most possible it is an artifact of incorrect configuration
if (!matrix[y])
@@ -233,15 +248,15 @@ function _getX(ev, isEndPoint, step) {
}
-function y_scale(d){
-
+function y_scale(d){
var html = "
";
var evs=[];
- if (scheduler._load_mode && scheduler._load()) return;
+ if(scheduler._load_mode)
+ scheduler._load();
if (this.render == "cell")
evs = trace_events.call(this);
else {
- var tevs = scheduler.getEvents(scheduler._min_date, scheduler._max_date);
+ var tevs = scheduler.get_visible_events();
for (var j=0; jb.start_date?1:-1; });
+ var stack=[];
+ for (var j=0; j ev.start_date)
+ stack_pointer++;
+ stack[stack_pointer]=ev;
+ //render line
+
+ events_html+=scheduler.render_timeline_event.call(this, ev, stack_pointer);
+ }
+ }
+
+ if(this.fit_events){
+ var rendered_height = this._events_height[this.y_unit[i].key]||0;
+ stats.height = (rendered_height>stats.height)?rendered_height:stats.height;
+ stats.style_height = "height:"+stats.height+"px;";
+ }
// section 1
- html+="
"+stats.td_content+"
";
+ html+="
"+stats.td_content+"
";
if (this.render == "cell"){
for (var j=0; j < scheduler._cols.length; j++) {
- html+="
";
- if (evs[i]){
- evs[i].sort(function(a,b){ return a.start_date>b.start_date?1:-1; });
- var stack=[];
- for (var j=0; j ev.start_date)
- stack_pointer++;
- stack[stack_pointer]=ev;
- //render line
-
- html+=scheduler.render_timeline_event.call(this, ev, stack_pointer);
- }
- }
//section 3
html+="
";
for (var j=0; j < scheduler._cols.length; j++)
- html+="
";
+ html+="
";
html+="
";
html+="
";
}
@@ -329,7 +356,7 @@ function y_scale(d){
}
html += "
";
this._matrix = evs;
- d.scrollTop = 0; //fix flickering in FF
+ //d.scrollTop = 0; //fix flickering in FF; disabled as it was impossible to create dnd event if scroll was used (window jumped to the top)
d.innerHTML = html;
scheduler._rendered = [];
@@ -343,35 +370,82 @@ function y_scale(d){
}
function x_scale(h){
- h.innerHTML = ""; h=h.firstChild;
-
- scheduler._cols=[]; //store for data section
- scheduler._colsS={height:0};
- this._trace_x =[];
-
- scheduler._min_date_timeline = scheduler._min_date;
-
- var start = scheduler._min_date;
- var summ = scheduler._x-this.dx-18; //border delta
+ var current_sh = scheduler.xy.scale_height;
+ var original_sh = this._header_resized||scheduler.xy.scale_height;
+ scheduler._cols=[]; //store for data section, each column width
+ scheduler._colsS={height:0}; // heights of the y sections
+ this._trace_x =[]; // list of dates per cells
+ var summ = scheduler._x-this.dx-18; //border delta, whole width
+ var left = [this.dx]; // left margins, initial left margin
+ var header = scheduler._els['dhx_cal_header'][0];
+ header.style.width = (left[0]+summ)+'px';
+
+ scheduler._min_date_timeline = scheduler._min_date;
- var left = this.dx;
-
- for (var i=0; i";
+ var bg_color = (evs[i].color?("background-color:"+evs[i].color+";"):"");
+ var color = (evs[i].textColor?("color:"+evs[i].textColor+";"):"");
+ html+="
";
\ No newline at end of file
+};
+scheduler._lightbox_template="
";
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/load.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/load.js
index cb81b4ee2ee..6d1579862ff 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/load.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/load.js
@@ -1,3 +1,7 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
scheduler._loaded={};
scheduler._load=function(url,from){
url=url||this._load_url;
@@ -38,13 +42,14 @@ scheduler._load=function(url,from){
dhtmlxAjax.get(url,function(l){scheduler.on_load(l);});
this.callEvent("onXLS",[]);
return true;
-}
+};
scheduler.on_load=function(loader){
this._loading=true;
+ var evs;
if (this._process)
- var evs=this[this._process].parse(loader.xmlDoc.responseText);
+ evs=this[this._process].parse(loader.xmlDoc.responseText);
else
- var evs=this._magic_parser(loader);
+ evs=this._magic_parser(loader);
this._not_render=true;
for (var i=0; i
';
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
';
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_cs.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_cs.js
index 69fd9d50454..310f5c508fb 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_cs.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_cs.js
@@ -1,3 +1,7 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
scheduler.__recurring_template='
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_da.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_da.js
new file mode 100644
index 00000000000..1d3e272a936
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_da.js
@@ -0,0 +1,6 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
';
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
';
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_el.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_el.js
new file mode 100644
index 00000000000..d3d18ab4358
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_el.js
@@ -0,0 +1,6 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
';
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
';
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
';
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
';
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
';
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_nb.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_nb.js
new file mode 100644
index 00000000000..65078dbc0b7
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_nb.js
@@ -0,0 +1,5 @@
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
';
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_nl.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_nl.js
index 4ccfb09e526..314e1b083ad 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_nl.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_nl.js
@@ -1,2 +1,6 @@
-scheduler.__recurring_template='
';
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
';
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
';
\ No newline at end of file
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
';
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_ru.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_ru.js
index 1919fe21b28..0bff7bde13a 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_ru.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_ru.js
@@ -1,2 +1,6 @@
-scheduler.__recurring_template='
';
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
';
\ No newline at end of file
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
';
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_ua.js b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_ua.js
index 5b723675b69..fbe032f3e32 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_ua.js
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/locale_recurring_ua.js
@@ -1,2 +1,6 @@
-scheduler.__recurring_template='
';
+/*
+This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
+to use it in not GPL project. Please contact sales@dhtmlx.com for details
+*/
+scheduler.__recurring_template='
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/repeat_template_el.html b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/repeat_template_el.html
new file mode 100644
index 00000000000..eddddee99aa
--- /dev/null
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/repeat_template_el.html
@@ -0,0 +1,57 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/repeat_template_es.html b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/repeat_template_es.html
index bcfcf2e81ea..94549432bc8 100644
--- a/addons/base_calendar/static/lib/dhtmlxScheduler/sources/repeat_template_es.html
+++ b/addons/base_calendar/static/lib/dhtmlxScheduler/sources/repeat_template_es.html
@@ -49,7 +49,7 @@