diff --git a/cms/pages/modules/cms_calendar.php b/cms/pages/modules/cms_calendar.php index 4d534f8..72fe8fc 100644 --- a/cms/pages/modules/cms_calendar.php +++ b/cms/pages/modules/cms_calendar.php @@ -42,6 +42,7 @@ class Module_cms_calendar extends standard_crud_module var $permissions_cat_require='calendar'; var $permissions_cat_name='type'; var $posting_field_required=false; + var $edit_keep_validation=true; // These are state-set, for usage by the specialised donext manager var $donext_type=NULL; @@ -447,8 +450,16 @@ class Module_cms_calendar extends standard_crud_module // Validation if ($validated==0) $validated=get_param_integer('validated',0); if (has_some_cat_privilege(get_member(),'bypass_validation_'.$this->permissions_require.'range_content',NULL,$this->permissions_cat_require)) + { if (addon_installed('unvalidated')) $fields->attach(form_input_tick(do_lang_tempcode('VALIDATED'),do_lang_tempcode('DESCRIPTION_VALIDATED'),'validated',$validated==1)); + } else + { + if ($this->edit_keep_validation) + { + $hidden->attach(form_input_hidden('validated','1')); // Will actually be changed to -1 by crud_module, and we later change -1 to NULL, which means no-change + } + } $fields2=new ocp_tempcode(); @@ -971,6 +982,7 @@ class Module_cms_calendar extends standard_crud_module $allow_comments=post_param_integer('allow_comments',fractional_edit()?INTEGER_MAGIC_NULL:0); $notes=post_param('notes',STRING_MAGIC_NULL); $validated=post_param_integer('validated',fractional_edit()?INTEGER_MAGIC_NULL:0); + if ($validation==-1) $validation=NULL; $seg_recurrences=post_param_integer('seg_recurrences',fractional_edit()?INTEGER_MAGIC_NULL:0); if (($delete_status=='3') && (!fractional_edit())) diff --git a/sources/calendar2.php b/sources/calendar2.php index 938bc12..ed2d130 100644 --- a/sources/calendar2.php +++ b/sources/calendar2.php @@ -201,7 +201,7 @@ function add_calendar_event($type,$recurrence,$recurrences,$seg_recurrences,$tit * @param ?MEMBER The member's calendar it will be on (NULL: not on a specific member's calendar) * @param SHORT_TEXT Meta keywords * @param LONG_TEXT Meta description - * @param BINARY Whether the event has been validated + * @param ?BINARY Whether the event has been validated (NULL: don't change) * @param BINARY Whether the event may be rated * @param SHORT_INTEGER Whether comments are allowed (0=no, 1=yes, 2=review style) * @param BINARY Whether the event may be trackbacked @@ -267,7 +267,6 @@ function edit_calendar_event($id,$type,$recurrence,$recurrences,$seg_recurrences 'e_do_timezone_conv'=>$do_timezone_conv, 'e_priority'=>$priority, 'e_type'=>$type, - 'validated'=>$validated, 'allow_rating'=>$allow_rating, 'allow_comments'=>$allow_comments, 'allow_trackbacks'=>$allow_trackbacks, @@ -275,6 +274,8 @@ function edit_calendar_event($id,$type,$recurrence,$recurrences,$seg_recurrences 'notes'=>$notes )+$scheduling_map; + if (!is_null($validated)) + $update_map['validated']=$validated; $update_map['e_edit_date']=$edit_time; if (!is_null($add_time)) $update_map['e_add_date']=$add_time; diff --git a/sources/crud_module.php b/sources/crud_module.php index f40ff95..518f365 100644 --- a/sources/crud_module.php +++ b/sources/crud_module.php @@ -95,6 +95,7 @@ class standard_crud_module var $cached_max_rows=NULL; var $lang_type=NULL; var $permission_page_name=NULL; + var $edit_keep_validation=false; // These only needed if we are generate nice_get_entries automatically var $table_prefix=''; @@ -1368,10 +1369,18 @@ class standard_crud_module $test=$this->handle_confirmations($title); if (!is_null($test)) return $test; - if (($this->user_facing) && (!is_null($this->permissions_require)) && (addon_installed('unvalidated')) && (array_key_exists('validated',$_POST))) + if (($this->user_facing) && (!is_null($this->permissions_require)) && (addon_installed('unvalidated'))) { - if (!has_privilege(get_member(),'bypass_validation_'.$this->permissions_require.'range_content',$this->permission_page_name,array($this->permissions_cat_require,is_null($this->permissions_cat_name)?'':post_param($this->permissions_cat_name),$this->permissions_cat_require_b,is_null($this->permissions_cat_name_b)?'':post_param($this->permissions_cat_name_b)))) - $_POST['validated']='0'; + if (array_key_exists('validated',$_POST)) + { + if (!has_privilege(get_member(),'bypass_validation_'.$this->permissions_require.'range_content',$this->permission_page_name,array($this->permissions_cat_require,is_null($this->permissions_cat_name)?'':post_param($this->permissions_cat_name),$this->permissions_cat_require_b,is_null($this->permissions_cat_name_b)?'':post_param($this->permissions_cat_name_b)))) + { + if (!$this->edit_keep_validation) + $_POST['validated']='0'; + else + $_POST['validated']='-1'; + } + } } if (!is_null($this->upload)) require_code('uploads');