type == 'uudis') { //if (empty($node->field_link[0]['url']) && empty($node->field_audio_link[0]['url']) && empty($node->field_video_link[0]['url'])) { // form_set_error("field_link", t('One from links should be entered!')); //} //if (empty($node->field_raamatu_autor[0]['value']) && empty($node->field_raamatu_koostaja[0]['value'])) { // form_set_error("field_raamatu_autor", t('One from autors should be entered!')); //} } //romansh 08.12.2009 if($node->type == 'event') { //inserted event start $startYear = $node->event['start_exploded']['year']; $startMonth = $node->event['start_exploded']['month']; $startDay = $node->event['start_exploded']['day']; $startHour = $node->event['start_exploded']['hour']; $startMinute = $node->event['start_exploded']['minute']; $timespan = mktime($startHour, $startMinute , 0, $startMonth, $startDay, $startYear); $event_start = date('Y-m-d H:i:s', $timespan); //user inserted place of event $place_of = trim($node->field_koht[0]['value']); $result = db_query('SELECT ev.nid, ev.event_start as start, cont.field_koht_value as koht FROM event ev LEFT JOIN content_type_event cont ON cont.nid = ev.nid WHERE cont.field_koht_value ="'.$place_of.'" and ev.event_start ="'.$event_start.'" and ev.nid !='.$node->nid); while ($result_entry = db_fetch_object($result)) { $items = $result_entry; if($items) { form_set_error("field_koht", t('Event on such place at such start time already exists')); } } } if ($node->type == 'raamat') { if (empty($node->field_raamatu_isbn[0]['value']) && empty($node->field_raamatu_isnb10[0]['value'])) { form_set_error("field_raamatu_isbn", t('One from isbns should be entered!')); } //romansh 07.12.2009 if(empty($node->field_ettetellimisel[0]['url'])) { if (empty($node->field_ostmine_kirjastus[0]['url']) && empty($node->field_ostmine_apollo[0]['url']) && empty($node->field_ostmine_rahvaraamat[0]['url']) && empty($node->field_ostmine_raamatukoi[0]['url'])) { form_set_error("field_ostmine_kirjastus", t('One from shops should be entered!')); } } //romansh 07.12.2009 if(empty($node->field_ettetellimisel[0]['url'])) { if (empty($node->field_raamatu_hind[0]['value'])) { form_set_error("field_raamatu_hind", t('Hind should be entered!')); } } if (empty($node->field_raamatu_kirjastus[0]['value'])) { form_set_error("field_raamatu_kirjastus", t('Kirjastus should be entered!')); } //if (empty($node->field_raamatu_autor[0]['value']) && empty($node->field_raamatu_koostaja[0]['value'])) { // form_set_error("field_raamatu_autor", t('One from autors should be entered!')); //} if (strlen(trim($node->field_kirjeldus[0]['value']))<100) { form_set_error("field_kirjeldus", t('Kirjeldus should be entered!')); } if (empty($node->field_raamatu_pealkiri[0]['value'])) { form_set_error("field_raamatu_pealkiri", t('Pealkiri should be entered!')); } if (empty($node->field_kaanepilt[0]['filepath'])) { form_set_error("field_kaanepilt", t('Kaanepilt should be entered!')); } else { //romansh 08.12.2009 picture size validation $info = getimagesize($node->field_kaanepilt[0]['filepath']); $pic_width=$info[0]; $pic_height=$info[1]; if($pic_width<200 || $pic_height<200) { form_set_error("field_kaanepilt", t('Kaanepilt size is wrong!')); } } if (isset($_SESSION['messages']['error'])) { //romansh 07.12.2009 $firstMessage = t('Default error to show before the custom text'); $buffArray = array($firstMessage); foreach($_SESSION['messages']['error'] as $oneError) { array_push( $buffArray, $oneError); } $_SESSION['messages']['error'] = $buffArray; //$_SESSION['messages']['error'] = array(t('Default error to show before the custom text')) + $_SESSION['messages']['error']; } } break; } } ?>