We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39053
    • 34 Posts
    I have updated to Evo 1.0.14 and there is mxCalendar running 0.1.3b.
    When I want to insert a new Event I get an "MODX Parse Error"

    « MODX Parse Error »
    MODX encountered the following error while attempting to parse the requested resource:
    « Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'repeat``, `lastrepeat`, `event_occurance`, `_occurance_wkly`, `event_occurance_r' at line 1 »
    SQL > INSERT INTO `DB_Name`.`modx_mxcalendar_events` (`title`, `description`, `category`, `restrictedwebusergroup`, `link`, `linkrel`, `linktarget`, `location`, `displayGoogleMap`, `start`, `startdate`, `starttime`, `end`, `enddate`, `endtime`, ``repeat``, `lastrepeat`, `event_occurance`, `_occurance_wkly`, `event_occurance_rep`, `_occurance_properties`, `customFields`) VALUES('', '', '1', '', '', '', '', '', '0', '2014-08-24 11:43', '2014-08-24', '11:43:00', '2014-08-24 11:43', '2014-08-24', '11:43:00', '', '', '0', '', '1', '0', '{"detaillink":{"val":"Ja","name":"detaillink","type":"select","label":"Detaillink","options":"Ja,Nein","default":"Ja"},"veranstalter":{"val":"","name":"veranstalter","type":"text","label":"Veranstalter","options":"","default":""}}')
    Basic info
    REQUEST_URI : 	http://www.**.de/manager/index.php?a=112&id=3
    Manager action : 	112 - Execute module
    Referer : 	http://www.**.de/manager/index.php?a=112&id=3
    User Agent : 	Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0
    IP : 	84.154.58.104
    Benchmarks
    MySQL : 	0,0065 s (7 Requests)
    PHP : 	0,0432 s
    Total : 	0,0497 s
    Memory : 	1,5858421325684 mb
    
    Backtrace
    1	include_once()
    manager/index.php on line 560
    2	evalModule()
    manager/processors/execute_module.processor.php on line 69
    3	eval()
    manager/processors/execute_module.processor.php on line 82
    4	include_once()
    manager/processors/execute_module.processor.php(82) : eval()'d code on line 34
    5	mxCal_APP_CLASS->_mgrAddEdit()
    assets/modules/mxCalendar/mxCalendar.tpl.php on line 101
    6	mxCal_APP_CLASS->_saveEvent()
    assets/modules/mxCalendar/mxCalendar.class.php on line 265
    7	DBAPI->insert()
    assets/modules/mxCalendar/mxCalendar.class.php on line 1255
    8	DBAPI->query()
    manager/includes/extenders/dbapi.mysql.class.inc.php on line 282  


    - PHP-Version: 5.5.14
    - SQL-Version: 5.6.19
      • 51107
      • 1 Posts
      I had the same problem after upgrading to ModX Evo v1.0.15 and even tried reinstalling with mxCalendar v0.1.3plb. No success.

      To fix the issue, I edited mxCalendar.class.php on lines 1245, 2070 and 2078 changing '`repeat`' to 'repeat'. Code is below:


      <?php
      if(!class_exists("mxCal_APP_CLASS")){
      	class mxCal_APP_CLASS {
      		var $version = '0.1.3b';
      		var $user_id;
      		var $params = array();
      		var $config = array();
      		var $default_limit;
      		var $output;
      		var $tables;
                      var $tooltip;
      		//-- Messages
      		var $message;
      		var $config_message;
                      var $debug = false;
      		var $userWebUserGroups = array();
                      
      		function __construct() {
                          //-- Form tooltips
                          $this->tooltip = array(
                                      'title'=>_mxCalendar_gl_tt_title,
                                      'link'=>_mxCalendar_gl_tt_link,
      				'location' => _mxCalendar_gl_tt_location,
      				'event_occurance_rep' => _mxCalendar_gl_tt_repeatCount
                                      );
                          
      		    //--Store short list of full table names
                          $this->tables=array(
      				'events'=>'mxcalendar_events',
      				'pastevents'=>'mxcalendar_pastevents',
                                      'categories'=>'mxcalendar_categories',
                                      'config'=>'mxcalendar_config'
      				);
      		    $this->params = $_REQUEST;
      		    $this->_buildConfig();
      		    
      		    $this->default_limit = 100;
      		    $this->name = __CLASS__;
                          
       		}
                      
      		// Get an array of tables
      		function get_tables($like='') {
      			global $modx;
      			$tables = array();
      			$db = $modx->db->config['dbase'];
      			$pre = $modx->db->config['table_prefix'];
      		       
      			if($like) { $like = "LIKE '{$like}'"; }
      		       
      			$tables_sql = "SHOW TABLES FROM {$db} {$like};";
      			$result = $modx->db->query($tables_sql);
      		       
      			while($row = $modx->db->getRow($result)) {
      			 $tables[] = current($row);
      			}
      		
      		 return $tables;
      		}
                     
      		// Get an array of columns
      		function get_columns($table='') {
                          global $modx;
                          $columns = array();
                          $db = $modx->db->config['dbase'];
                          $pre = $modx->db->config['table_prefix'];
                          $col_sql = "SHOW COLUMNS FROM ".$modx->getFullTableName($table).";";
                          $result = $modx->db->query($col_sql);
                          while($row = $modx->db->getRow($result, 'assoc')) {
                              $columns[] = array($row['Field'],$row['Type'],$row['Extra']);
                          }
                          return $columns;
      		}
                      
      		//-- Upgrade Installation
      		function _upgrade_mxCalendar(){
      			global $modx;
      			if(file_exists($modx->config['base_path'].'assets/modules/mxCalendar/includes/install/'.$this->version.'.upgrade.mysql')){
      			    $pre = $modx->db->config['table_prefix'];
      			    $sql_installer = trim(str_replace('#__', $pre,file_get_contents($modx->config['base_path'].'assets/modules/mxCalendar/includes/install/'.$this->version.'.upgrade.mysql')));
      			    
      			    if($sql_installer){
      				$cnt = 0;
      				foreach(explode('##',$sql_installer) AS $sql){
      				    if(!empty($sql)){
      					$cnt ++;
      					//echo '('.$cnt.')<pre><code>'.$sql.'</pre></code>';
      					$result = $modx->db->query($sql);
      				    }
      				}
      				$this->output .= '<div class="fm_message"><h2>'.$this->version.' Update completed</h2><form method="post" action=""><input type="submit" name="submit" value="Continue" /></form></div>';
      				//Install Completed
      				$modx->logEvent(0, 3, '<p><strong>Upgrade to mxCalendar '.$this->version.' via install file ('.$modx->config['base_path'].'assets/modules/mxCalendar/includes/install/'.$this->version.'.upgrade.mysql)</strong></p>');
      				$fh = fopen( $modx->config['base_path'].'assets/modules/mxCalendar/config/config.xml', 'w+') or die("Unable to save configuration file. Please make sure write permission is granted on the folder (".$modx->config['base_path']."assets/modules/mxCalendar/config/)");
      				$stringData = '<?xml version="1.0" encoding="UTF-8"?>'."\n".'<mxCalendar>'."\n".'<setup>Yes</setup>'."\n".'<date>'.DATE('l jS \of F Y h:i:s A').'</date><version>'.$this->version.'</version>'."\n".'</mxCalendar>';
      				fwrite($fh, $stringData);
      				fclose($fh);
      			    } else {
      				$modx->logEvent(0, 3, '<p><strong>Unable to upgrade mxCalendar tables via install file ('.$modx->config['base_path'].'assets/modules/mxCalendar/includes/install/'.$this->version.'.upgrade.mysql)</strong></p>');
      				$this->output .= '<div class="fm_error">Unable to complete the upgrade, please check the system log.</div>';
      			    }
      			    return $this->output;
      			}else{
      			    return '<strong>Error: </strong>Upgrade is not supported for this version, please back up your database and remove your "_mxCalendar" tables and "/assets/mxCalendar/config/config.xml" file and try again.<br /><br />Your Current Version is: '.$this->_getConfigVersion();
      			}
      		}
      		
                      //-- Installation
                      function _install_mxCalendar(){
      			global $modx;
                              $db_setup = 0;
                              $user = $modx->db->config['user'];
                              $db = $modx->db->config['dbase'];
      			$pre = $modx->db->config['table_prefix'];
      			$tables = $this->get_tables("{$pre}mxcalendar%");
      			$installer = 'mxCalendar.mysql.install.inc';
      			
      			if(!count($tables)){
      			    $sql_installer = str_replace('#__', $pre,file_get_contents($modx->config['base_path'].'assets/modules/mxCalendar/includes/install/'.$installer));
      			    if($sql_installer){
      				foreach(explode('##',$sql_installer) AS $sql){
      				    if($sql){
      				    $result = $modx->db->query($sql);
      				    //$this->output .= $sql;
      				    if($result){
      					$theTable = preg_match('/CREATE TABLE IF NOT EXISTS `(.*)`/', $sql, $matches);
      					if(!empty($matches[1]))
      					$this->output .= '<h2>'.$matches[1].' table created successfully</h2>';
      					$db_setup++;
      				    }
      				    }
      				}
      			    } else {
      				$modx->logEvent(0, 3, '<p><strong>Unable to locate mxCalendar sql install file ('.$modx->config['base_path'].'assets/modules/mxCalendar/includes/install/'.$installer.')</strong></p>');
      				$this->output .= 'Unable to load the installer file. ('.$modx->config['base_path'].'assets/modules/mxCalendar/includes/install/'.$installer.')';
      			    }
      			}
                              if($db_setup) { $tables = $this->get_tables("{$pre}mxcalendar%"); }
                              if(count($tables) != 4){
                                  //Error Maker
                                  $modx->logEvent(0, 3, "<p><strong>"._mxCalendar_gl_installFailTable."</strong></p><p>Missing tables. Give CREATE TABLE rights to user {$user} or run the following SQL as a user with CREATE TABLE permissions</p>", $source='Module: mxCalendar');
                                  $this->output.=_mxCalendar_gl_installFail."<br />\n";
                              } else {
                                  //Install Completed
                                  $fh = fopen( $modx->config['base_path'].'assets/modules/mxCalendar/config/config.xml', 'w') or die("Unable to save configuration file. Please make sure write permission is granted on the folder (".$modx->config['base_path']."assets/modules/mxCalendar/config/)");
                                  $stringData = '<?xml version="1.0" encoding="UTF-8"?>'."\n".'<mxCalendar>'."\n".'<setup>Yes</setup>'."\n".'<date>'.DATE('l jS \of F Y h:i:s A').'</date><version>'.CAL_VERSION.'</version>'."\n".'</mxCalendar>';
                                  fwrite($fh, $stringData);
                                  fclose($fh);
                                  $this->output.= '<strong><font color="green">'._mxCalendar_gl_installSucceess."</font></strong><br /><form method='POST' action=''><input type='submit' value='Start now ...' /></form>\n";
                              }
                          return $this->output;
                      }
      
      		//-- Build config params
      		function _buildConfig(){
      			global $modx;
      			$tables = $this->get_tables($modx->db->config['table_prefix']."mxcalendar%");
      			
      			if(!empty($tables)){
      				$results = $modx->db->query('SELECT * FROM '.$modx->db->config['table_prefix'].$this->tables['config']); 
      				while($row = $modx->db->getRow($results, 'assoc')) {
      				    $this->config[$row['param']]=$row['value'];
      				}
      			}
      		}                
                      
      		//***********************//
                      //**** Manager Views ****//
      		//***********************//
                      function ListEvents($params = false){
                          global $modx;
                          
                          //-- Perform delete prior to new listing @postback
                          if(isset($_POST['fmeid']) & $_POST['fmaction'] == 'delete') {
                              $modx->db->delete($modx->getFullTableName($this->tables['events']), 'id='.$_POST['fmeid']);
                              $this->output .= '<h3 style="color:#ff0000;">Removed event.</h3>';
                          }
                          //-- setup filters [fmfiltermatch fmfiltertime]
      		        $filter = array();
      			$filter_or=array();
      			switch($_REQUEST['fmfiltertime']){
      				case "0":
      				default:
      					//-- none (all events) as this is the default config
      					$filter_or[] = ' E.startdate >=  \''.date("Y-m-d").'\' ';
      					$filter_or[] = ' E.`lastrepeat` >= \''.date("Y-m-d").'\'';
      					$filter_or[] = ' E.enddate >  \''.date("Y-m-d").'\'';
      					break;
      				case "1":
      					//-- 
      					$filter[] = ' E.startdate <=  \''.date("Y-m-d").'\' ';
      					$filter[] = ' E.`lastrepeat` <= \''.date("Y-m-d").'\'';
      					$filter[] = ' E.enddate <  \''.date("Y-m-d").'\'';
      					break;
      				case "all":
      					//-- all events
      					$filter[] = ' E.active=1';
      					break;
      			}
      			$fmCat = $_REQUEST['CategoryId']; 
      			switch($fmCat){
      				default:
      					//-- Add any category filtering
      					if(!empty($fmCat))
      						$filter[] = ' E.category = '.(int)$fmCat;
      					break;
      			}
      			if(!empty($_REQUEST['fmfiltermatch']))
      				$filter[] = ' title REGEXP \''.$modx->db->escape($_REQUEST['fmfiltermatch']).'\' OR description REGEXP \''.$modx->db->escape($_REQUEST['fmfiltermatch']).'\'';
      			
      			
      
                          $result = $this->_getEventsPagination($_REQUEST['fmeventlistpagelimit'],(isset($_REQUEST['pg']) ? $_REQUEST['pg'] : 0 ), $filter, $filter_or);
      		    $pagination = $result[1];
      		    $result = $result[0];
      		    
      		    $mgr_PagerSizeLimits_dl = array(10,25,50,75,100,250,'ALL');
      		    $html_mgr_PagerSizeDL='';
      		    foreach($mgr_PagerSizeLimits_dl AS $limiter)
      			$html_mgr_PagerSizeDL .= '<option value="'.$limiter.'" '.((string)$limiter == (string)$_REQUEST['fmeventlistpagelimit'] ? 'selected=selected' : '').'>'.$limiter.'</option>';
      		    
      		    $html_mgr_CateogryFilter = $this->mxcGetCategoryListUIFilter('select',true);
      		    
      		    $_mxCal_cont_col = explode(',',_mxCalendar_gl_columns);
                          if($modx->db->getRecordCount($result) > 0) {
                              $this->output .= "<table><tbody>
      			<tr><td colspan='7' align='left'><form method='POST' action='' style='float:left;width:auto;'><input type='submit' name='submit' value='Add New Event' onclick=\"document.cookie='webfxtab_tabPanel=1;path=/;'\"></form><form method='POST' action='' style='float:left;width:auto;'>  <input type='text' value='".$_REQUEST['fmfiltermatch']."' name='fmfiltermatch'/><select name='fmfiltertime'><option value='0' ".($_REQUEST['fmfiltertime']==0 ? 'selected="selected"' : '' ).">Upcoming Events</option><option value='1' ".($_REQUEST['fmfiltertime']==1 ? 'selected="selected"' : '' ).">Past Events</option><option value='all' ".($_REQUEST['fmfiltertime']=='all' ? 'selected="selected"' : '' ).">All Events</option></select>".$html_mgr_CateogryFilter."<input type='submit' name='submit' value='"._mxCalendar_btn_go."' onclick=\"document.cookie='webfxtab_tabPanel=0;path=/;'\"> <select name='fmeventlistpagelimit'>".$html_mgr_PagerSizeDL."</select>"._mxCalendar_gl_pagesite."</form></td></tr>
      			<tr><td colspan='7' align='center'>".$pagination." </td></tr>
      				<tr>";
      				foreach(explode(',', _mxCalendar_el_labels) AS $label)
      				$this->output .= "<th>".trim($label)."</th>";
      			$this->output .= "<th></th></tr>";
      			$records = $modx->db->makeArray($result);
                                  $evodbg = ' style="background-color:#ccc" ';
                                  foreach( $records as $event ) {
                                      $timeFormat = $this->config['mgrAddClockTwentryFourHour'] == true ? 'Y-m-d G:i:s' : _mxCalendar_el_timeformat;
      				$evodbg = ($evodbg) ? '' : ' style="background-color:#ccc" ';
                                      $evLastOccurance = explode(',',$event['repeat']);
      				
      				$this->output .='
                                      <tr'.$evodbg.'>
                                          <td>'.$event['eid'].'</td>
                                          <td>'.$event['title'].'</td>
                                          <td>'.$event['category'].'</td>
                                          <td>'.date($timeFormat, strtotime($event['start'])).'</td>
                                          <td>'.date($timeFormat, strtotime($event['end'])).'</td>
      				    <td>'.(!empty($event['repeat']) ? date(_mxCalendar_el_timeformat_date, strtotime($evLastOccurance[count($evLastOccurance)-1])) : '').'</td>
                                          <td><form method="post" action="" onSubmit=""><input type="hidden" name="fmeid" value="'.$event['eid'].'" ><input type="submit" name="fmaction" value="'._mxCalendar_gl_btnEdit.'" onclick="document.cookie=\'webfxtab_tabPanel=1;path=/;\'"><input type="submit" name="fmaction" value="'._mxCalendar_gl_btnDelete.'" onClick="document.cookie=\'webfxtab_tabPanel=0;path=/;\'; return confirm(\''._mxCalendar_gl_btnConfirm.'\')"></form></td>
                                      </tr>
                                      ';
                                  }
                              $this->output .= "<tr><td colspan='7' align='center'>".$pagination."</td></tr></tbody></table>";
                          } else {
                              $this->output .="<form method='POST' action='' style='float:left;width:auto;'><input type='submit' name='submit' value='Add New Event' onclick=\"document.cookie='webfxtab_tabPanel=1;path=/;'\"></form><form method='POST' action='' style='float:left;width:auto;'>  <input type='text' value='".$_REQUEST['fmfiltermatch']."' name='fmfiltermatch'/><select name='fmfiltertime'><option value='0' ".($_REQUEST['fmfiltertime']==0 ? 'selected="selected"' : '' ).">Upcoming Events</option><option value='1' ".($_REQUEST['fmfiltertime']==1 ? 'selected="selected"' : '' ).">Past Events</option><option value='all' ".($_REQUEST['fmfiltertime']=='all' ? 'selected="selected"' : '' ).">All Events</option></select><input type='submit' name='submit' value='Go' onclick=\"document.cookie='webfxtab_tabPanel=0;path=/;'\"></form>".'<div class="clear"></div><h2>'._mxCalendar_gl_noevents.'</h2>';
                              $this->output .='<h3>'._mxCalendar_gl_quicklist.'</h3>';
                              $result = $this->_getNEvents();
                          }
                          return $this->output;
                      }
                      
      		//-- Manager::Add New
      		function _mgrAddEdit(){
      		    $this->message = '';
                          if($_POST['fmaction'] == _mxCalendar_btn_addEvent || $_POST['fmaction'] == _mxCalendar_btn_updateEvent ){
                              $saved=$this->_saveEvent($_POST['fmaction']);
                              if($saved)
                                  $this->message .= $this->_makeMessageBox(str_replace("|*rec*|", $saved, _mxCalendar_ae_success)); //$saved
                              else
                                  $this->message .= $this->_makeMessageBox(str_replace("|*rec*|", $saved, _mxCalendar_ae_fail),1);
                              
                          }
      		}
      		
                      //-- Manager::Add New Event Form/Actions
                      function AddEvent($params=false){
                          global $modx;
                          
      					$this->output = $this->message;
      					$this->message='';
      
                          //-- Form action and label properties
                          $fmAction = (!isset($_REQUEST['fmeid'])) ? 'save' : 'update';
                          $fmActionLabel = (!isset($_REQUEST['fmeid'])) ? _mxCalendar_btn_save : _mxCalendar_btn_update;
                          
                          if(!empty($_REQUEST['fmeid'])){
                              //-- Get record to edit
                              $result = $modx->db->select('id,title,description,category,restrictedwebusergroup,link,linkrel,linktarget,location,displayGoogleMap,start,startdate,starttime,end,enddate,endtime,event_occurance,event_occurance_rep,_occurance_properties,lastrepeat,customFields', $modx->getFullTableName($this->tables['events']),'id = '.$_REQUEST['fmeid'] );
                              if( $modx->db->getRecordCount( $result ) ) {
                                  $output .= '<ul>';
                                  $editArr = $modx->db->getRow( $result );
                              }
                          } else { $editArr = array(); }
      					
      		    
      					$this->output .= '<h1>'.(isset($_REQUEST['fmeid']) ? _mxCalendar_ae_headingEdit.' '.$editArr['title'] : _mxCalendar_ae_headingAdd).'</h1>';
                          
                          
                          //-- Get the custom field type
      		    $arr_customFieldTypes = json_decode($this->config['mxcCustomFieldTypes'],true);
      			    
                          //-- Create custom field types
                          $dyn_form_output = '';
      		    $dyn_form_vals = json_decode($editArr['customFields'], TRUE);
      		    $dyn_form_vals = count($dyn_form_vals) ? $dyn_form_vals : $arr_customFieldTypes;
                          if(count($arr_customFieldTypes[0])){
      								foreach($dyn_form_vals AS $cft){
      									if($cft['name'] && $cft['label']){
      									$dyn_form_tpl = '<div class="fm_row"><label>%1$s</label><div><small style="color:blue;">[+mxc%3$s+]</small><br />%2$s</div></div>';
      									if($this->debug) $dyn_form_output .= '<pre><code>'.var_dump($cft).'</code></pre>';
      									SWITCH($cft['type']){
      										case 'text':
      											$dyn_form_output .= sprintf(
      												$dyn_form_tpl,
      												htmlentities($cft['label']),
      												sprintf( '<input type="text" name="mxcft_%1$s" value="%2$s">',htmlentities($cft['name']),($cft['val'] ? $cft['val'] : htmlentities($cft['default'])) ),
      												$cft['name']
      												);
      											break;
      										case 'datetime':
      										case 'date':
      										case 'time':
      											$dyn_form_output .= sprintf(
      														$dyn_form_tpl,
      														htmlentities($cft['label']),
      														str_replace('tvmxcft_'.$cft['name'],'mxcft_'.$cft['name'],$this->renderRTE($cft['type'],'mxcft_'.$cft['name'],($cft['val'] ? $cft['val'] : $cft['default']),'')),
      														$cft['name']
      														);
      											break;
      										case 'image':
      											$dyn_form_output .=sprintf(
      														$dyn_form_tpl,
      														htmlentities($cft['label']),
      											'<script type="text/javascript">
      												var lastImageCtrl;
      												var lastFileCtrl;
      												function OpenServerBrowser(url, width, height ) {
      													var iLeft = (screen.width  - width) / 2 ;
      													var iTop  = (screen.height - height) / 2 ;
      					
      													var sOptions = \'toolbar=no,status=no,resizable=yes,dependent=yes\' ;
      													sOptions += \',width=\' + width ;
      													sOptions += \',height=\' + height ;
      													sOptions += \',left=\' + iLeft ;
      													sOptions += \',top=\' + iTop ;
      					
      													var oWindow = window.open( url, \'FCKBrowseWindow\', sOptions ) ;
      												}			
      												function BrowseServer(ctrl) {
      													lastImageCtrl = ctrl;
      													var w = screen.width * 0.7;
      													var h = screen.height * 0.7;
      													OpenServerBrowser(\'/modxevo/manager/media/browser/mcpuk/browser.html?Type=images&Connector=/modxevo/manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=/modxevo/\', w, h);
      												}
      												
      												function BrowseFileServer(ctrl) {
      													lastFileCtrl = ctrl;
      													var w = screen.width * 0.7;
      													var h = screen.height * 0.7;
      													OpenServerBrowser(\'/modxevo/manager/media/browser/mcpuk/browser.html?Type=files&Connector=/modxevo/manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=/modxevo/\', w, h);
      												}
      												
      												function SetUrl(url, width, height, alt){
      													if(lastFileCtrl) {
      														var c = document.cal_form[lastFileCtrl];
      														if(c) c.value = url;
      														lastFileCtrl = \'\';
      													} else if(lastImageCtrl) {
      														//alert(\'New Image: \'+lastImageCtrl+\' == URL: \'+url);
      														var c = document.cal_form[lastImageCtrl];
      														var p = document.getElementById(\'_pv'.$cft['name'].'\').src = \'/modxevo/\'+url;
      														if(c) c.value = url;
      														lastImageCtrl = \'\';
      													} else {
      														return;
      													}
      												}
      												</script><input type="text" id="'.$cft['name'].'" name="mxcft_'.$cft['name'].'"  value="'.($cft['val'] ? $cft['val'] : $cft['default']).'"  style="" onchange="documentDirty=true;" /> <input type="button" value="Insert" onclick="BrowseServer(\''.$cft['name'].'\')" />
      												'.'<label> </label><img name="_pv'.$cft['name'].'" id="_pv'.$cft['name'].'" src="../'.($cft['val'] ? $cft['val'] : $cft['default']).'" alt="" />', $cft['name']);
      											break;
      										
      										case 'select':
      											$opt_arr = explode(',', $cft['options']);
      											if(is_array($opt_arr) && count($opt_arr)){
      												$opts='';
      												foreach($opt_arr AS $o){
      													$opts .= '<option value="'.$o.'" '.($cft['val'] == $o ? "selected=selected" : '').'>'.$o.'</option>';
      												}
      												$dyn_form_output .= sprintf(
      																$dyn_form_tpl,
      																htmlentities($cft['label']),
      																'<select name="mxcft_'.$cft['name'].'">'.$opts.'</select>',
      																$cft['name']
      															   );
      											}
      											break;
      										case 'resource':
      											
      											$resc_list = $modx->getAllChildren((!empty($cft['default']) && is_numeric($cft['default'])?(int)$cft['default']:0), 'menuindex', 'ASC', 'id, alias, menutitle');
      											$opts = '<option value=""></option>';
      											foreach($resc_list AS $v){
      												$opts .= '<option value="'.$v['id'].'" '.($cft['val'] == $v['id'] ? 'selected="selected"' : '').'>['.$v['id'].'] '.(!empty($v['menutitle']) ? $v['menutitle'] : $v['alias']).'</option>';
      											}
      											$dyn_form_output .= sprintf(
      																$dyn_form_tpl,htmlentities($cft['label']),
      																'<select name="mxcft_'.$cft['name'].'" onChange="">'.$opts.'</select>',
      																$cft['name']
      														   );
      											//** Set the UI render to use the resource fields as placeholders for the mxCalendar ?? title override - how to make that happen...
      											
      											break;
      										default:
      											//-- Do nothing
      											//var_dump($cft);
      											break;
      									}
      									
      								}
      						}
      					}
                          //-- Get language file labels
      		    $fm_label = explode(',', _mxCalendar_ae_labels);
                          $fm_columns = $this->get_columns($this->tables['events']);
                          $this->output .= '<form id="fm_bsApp" name="cal_form" method="post" action="">'."\n";
                          if(!empty($dyn_form_output)) $this->output .= '<fieldset><legend>'._mxCalendar_con_mscCustomFieldLegend.'</legend>'.$dyn_form_output.'</fieldset>';
                          $x=0;
      		    foreach($fm_columns as $key=>$val){
      				
                              //-- List of excluded table columns [DO NOT EDIT]
                              $excluded = array('id','active','start','end', 'repeat', 'event_occurance', '_occurance_wkly', 'event_occurance_rep', 'lastrepeat', '_occurance_properties','lastrepeat','customFields');
                              //-- Make sure it's not an excluded column
                              if(!in_array($val[0], $excluded)){
                                  $tooltip = ($this->tooltip[$val[0]]) ? '<img  title="'.$this->tooltip[$val[0]].'" src="'.$modx->config['base_url'].'manager/media/style/'.$modx->config['manager_theme'].'/images/icons/information.png" class="Tips1" />' : '';
                                  SWITCH ($val[1]){
                                      case 'text':
                                          if($val[0] == 'description'){
      										$this->output .= "\t".'<div class="fm_row"><label>'.$fm_label[$x].'</label><div class="fm_entry">'.$this->renderRTE('richtext','fm'.$val[0],$editArr[$val[0]],'').$tooltip.'</div></div>'."\n";
      									} else {
      										$this->output .= "\t".'<div class="fm_row"><label>'.$fm_label[$x].'</label><div class="fm_entry"><input type="text" name="fm'.$val[0].'" value="'.$editArr[$val[0]].'" />'.$tooltip.'</div></div>'."\n";
      									}
                                          break;
                                      case 'date':
                                          if($val[0] == 'startdate'){
                                            $editSD = ($editArr['start'] != '0000-00-00 00:00:00' && !empty($editArr['start']) ? strftime('%Y-%m-%d %H:%M', strtotime($editArr['start'])) : strftime('%Y-%m-%d %H:%M')); //$editArr['start'];
      									  $editSDF = $editArr['start'];
      									  $dateCSSClass = 'mxcStartDate';
                                          }
                                          elseif($val[0]=='enddate'){
      										$editSD = ($editArr['end'] != '0000-00-00 00:00:00' && !empty($editArr['end']) ? strftime('%Y-%m-%d %H:%M', strtotime($editArr['end'])) : strftime('%Y-%m-%d %H:%M')); //$editArr['end'];
      										$editSDF = $editArr['end'];
      										$dateCSSClass = 'mxcEndDate';
                                          }
                                          else{
      										$editSD = null;
      										$dateCSSClass = '';
                                          }
                                          
      				    $advancedDateEntry=$this->config['mxcAdvancedDateEntry'];
      				    if($advancedDateEntry){
      						$this->output .= "\t<div class=\"fm_row\"><label>".$fm_label[$x]."</label><div class='fm_entry'><input type=\"text\" value=\"".$editSD."\" name=\"fm".$val[0]."\">".$tooltip."</div></div>";
      				    } else {
      						$this->output .= "\t".$this->_makeDateSelector($val[0], $fm_label[$x], $tooltip, $editSD, $dateCSSClass)."\n";
      						$this->output .= "\t</div>"; //-- Fixed broken HTML tags cuasing tabs after Events to not display
      				    }
      				    
      				    break;
                                      case 'time':
                                          //-- We'll use the date picker field and extract the time
                                          break;
      									
                                      default:
                                          if($val[0] == 'category'){
                                            foreach($this->getCategories() as $cats){
                                              foreach($cats as $catsKey=>$catsVal){
                                                  $selected = ($editArr[$val[0]] == $catsKey) ? 'selected=selected' : '';
      											$selected = ((empty($editArr[$val[0]]) && $catsVal[1] == 1) ? 'selected=selected' : $selected );
                                                  $thisSDL .= '<option value="'.$catsKey.'" '.$selected.'>'.$catsVal[0].'</option>';
                                              }
                                            }
                                            $this->output .= "\t".'<div class="fm_row"><label>'.$fm_label[$x].'</label><div class="fm_entry"><select name="fm'.$val[0].'">'.$thisSDL.'</select>'.$tooltip.'</div></div>'."\n";
      									} elseif($val[0] == 'displayGoogleMap'){
      									$this->output .= "\t".'<div class="fm_row"><label>'.$fm_label[$x].'</label><div class="fm_entry"><input type="checkbox" id="fm'.$val[0].'" name="fm'.$val[0].'" value="1" '.($editArr[$val[0]] ? 'checked="checked"' : "").' />'.$tooltip.'</div></div>'."\n";
      									}  elseif($val[0] == 'restrictedwebusergroup'){
      									
      									//-- Temporary Fix for Display Mode for Web User Group
      									$param['mxcMgrWUGSelectionMode'] = 'checkbox';
      									
      									//-- Selection Mode Default Option Values
      									$thisWUGDL_defaultCombo = '<option value="" '.( empty($editArr[$val[0]]) ? 'selected=selected' : '' ).'>'._mxCalendar_con_PublicView.'</option>';
      									$thisWUGDL_defaultCheckbox = '<input name="fm'.$val[0].'[]" type="checkbox" value="" '.( empty($editArr[$val[0]]) ? 'checked="yes"' : '' ).'>'._mxCalendar_con_PublicView.'<br />';								
      									
      									//-- Loop through the web user groups and build the selection list
      									foreach($this->getWebGroups() AS $group){
      										SWITCH($param['mxcMgrWUGSelectionMode']){
      											case 'checkbox':
      												$selected = (in_array($group['id'], explode(',',$editArr[$val[0]])) ) ? 'checked="yes"' : '';
      												$thisWUGDL .= '<input name="fm'.$val[0].'[]" type="checkbox" value="'.$group['id'].'" '.$selected.'>'.$group['name'].'<br />'.PHP_EOL;
      												break;
      											
      											default:
      												$selected = (in_array($group['id'], explode(',',$editArr[$val[0]])) ) ? 'selected=selected' : '';
      												$thisWUGDL .= '<option value="'.$group['id'].'" '.$selected.'>'.$group['name'].'</option>';
      												break;
      										}
      									}
      									$mgrModeHTML = ($param['mxcMgrWUGSelectionMode'] == 'checkbox' ? $thisWUGDL_defaultCheckbox.$thisWUGDL : '<select name="fm'.$val[0].'[]" multiple="multiple">'.$thisWUGDL_defaultCombo.$thi