Current File : /home/users/barii/public_html/finansenl.com.pl/wodki/application/views/account/news_edit.php
	<!-- TinyMCE -->
<script type="text/javascript" src="CMS/html/js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Example content CSS (should be your site CSS)
		content_css : "css/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		// Style formats
		style_formats : [
			{title : 'Bold text', inline : 'b'},
			{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
			{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
			{title : 'Example 1', inline : 'span', classes : 'example1'},
			{title : 'Example 2', inline : 'span', classes : 'example2'},
			{title : 'Table styles'},
			{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
		],

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
</script>
<!-- /TinyMCE -->
			<?php if (isset($message)):?>
					<div id="message-red" >
						<table border="0" width="100%" cellpadding="0" cellspacing="0">
							<tr>
								<td class="red-left">
									<?php echo $message;?>
								</td>
								<td class="red-right"><a class="close-red"><?php echo HTML::image('static/images/table/icon_close_red.gif');?></a></td>
							</tr>
						</table>
					</div>
			<?php endif;?>	
			<?php echo Message::render(); ?>
			
			<div class="container">
			<?php echo aurora::partial('frontend_sider'); ?>
		
				<div id="content">
				<h2><?php echo __t('Zarządzanie <span>profilem</span>
				</h2>
				
					<p><?php echo __t('Witaj w strefie dostępnej dla użytkowników systemu.</p>
						<br style="clear: both;"/><br style="clear: both;"/>
						<a class="button_gray <?php if( Request::current()->controller() == 'Account' AND  Request::current()->action() == 'artist' AND Request::current()->param('act') == '' ) echo 'button_gray_active'; ?>" href="account/artist">Twoi artyści</a>
						<a class="button_gray <?php if( Request::current()->controller() == 'Account' AND  Request::current()->action() == 'artist' AND Request::current()->param('act') == 'edit' ) echo 'button_gray_active'; ?>" href="account/artist/edit">Dodaj artystę</a>
						<a class="button_gray <?php if( Request::current()->controller() == 'Account' AND  Request::current()->action() == 'news' AND Request::current()->param('act') == '' ) echo 'button_gray_active'; ?>" href="account/news">Wydarzenia</a>
						<a class="button_gray <?php if( Request::current()->controller() == 'Account' AND  Request::current()->action() == 'news' AND Request::current()->param('act') == 'edit' )  echo 'button_gray_active'; ?>" href="account/news/edit">Dodaj wydarzenie</a>
						<a class="button_gray <?php if( Request::current()->controller() == 'Account' AND  Request::current()->action() == 'article' AND Request::current()->param('act') == '' ) echo 'button_gray_active'; ?>" href="account/article">Artykuły</a>
						<a class="button_gray <?php if( Request::current()->controller() == 'Account' AND  Request::current()->action() == 'article' AND Request::current()->param('act') == 'edit' )  echo 'button_gray_active'; ?>" href="account/article/edit">Dodaj artykuł</a>
							<a class="button_gray <?php if( Request::current()->controller() == 'Account' AND  Request::current()->action() == 'photos' )  echo 'button_gray_active'; ?>" href="account/photos">Zdjęcia</a>
				<h2>Edycja <span>wydarzenia</span></h2>		
					<form method="post" action="" name="form_edit_data" enctype="multipart/form-data">
					<fieldset class="forms small_fields">
					<input type="hidden" name="action" value="edit_data"/>
						<div>
							<label>Tytuł:</label><br style="clear: both;"/><input type="text" id="title" name="title" value="<?php echo @$news->title; ?>"/>
						</div>
						<div>
							<label>Data:</label><br style="clear: both;"/><input type="text" id="datetimepicker" name="date" value="<?php echo !empty($news->date) ? @date('d-m-Y H:i', $news->date) : date('d-m-Y H:i'); ?>"/>
						</div>
						
						<div style="width: 100%;">	
							<label>Treść:</label><br style="clear: both;"/><textarea type="textarea" id="description" name="description"><?php echo @$news->description; ?></textarea>
						</div>
						<div>
							<label>Utwórz jako wydarzenie na fb <input type="checkbox" id="fb_event" name="fb_event" value="1" <?php if( !empty( $news->fb_event) AND $news->fb_event == 1 ) echo 'CHECKED'; ?>/></label>
						</div>
						<div>
							<label>Zdjęcie:</label><br style="clear: both;"/><input type="file" name="thumb" value=""/>
							<?php if( !empty( $news->thumb ) ) : ?>
								<br style="clear: both;"/><br style="clear: both;"/>								
								<img src="/image.php/image-name.jpg?width=150&amp;image=/<?php echo $news->thumb; ?>"/>
								<br style="clear: both;"/>				
								<?php endif; ?>
						</div>
						<div>
							<label>Przypisz:</label><br style="clear: both;"/>
								<select id="parent" name="parent">
									<option value="0" <?php if( isset( $news->user_id ) AND $news->user_id == 0 ) echo 'SELECTED="SELECTED"'; ?>>Nieprzypisany</option>
									<option value="<?php echo $user_id; ?>" <?php if( $user_id ==  $news->user_id ) echo 'SELECTED="SELECTED"'; ?>>Ja</option>
									<?php foreach( $children as $row ) : ?>
									<option value="<?php echo $row->id; ?>" <?php if( !empty( $news->user_id ) AND $row->id == $news->user_id) echo 'SELECTED="SELECTED"'; ?>><?php echo $row->firstname; ?> <?php echo $row->lastname; ?></option>
									<?php endforeach; ?>
								</select>
						</div>		
					<br style="clear: both;"/>
						<div style="width: 100%;">	
							<a href="http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>" class="button_black">Anuluj</a>
							<input type="submit" onclick="validateForm_Data(); return false;" id="register_buttonData" value="Zastosuj"/>
			
						</div>
				</fieldset>
			</form>
			
				
					
				</div>
				
			</div>
		</div>

		<script>
$(window).ready( function() {
	$('#fv').click( function() {
		if( $('#fv:checked').length  ) {
			$('#fv_area').show();
		} else {
			$('#fv_area').hide();
		}
	});
});

function NIPIsValid(nip) {
        var weights = [6, 5, 7, 2, 3, 4, 5, 6, 7];
        nip = nip.replace(/[\s-]/g, '');
 
        if (nip.length == 10 && parseInt(nip, 10) > 0) {
                var sum = 0;
                for(var i = 0; i < 9; i++){
                        sum += nip[i] * weights[i];
                }                     
                return (sum % 11) == nip[9];
        }
        return false;           
}

	function validateForm_Data() {

		var error = 0;
		var form = document.forms['form_edit_data'];

	
		if( 1 == 1 ) {

			f = "#firstname";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			if( $(f).val() == "" ) {

				$(f).addClass('input_error');
				error++;
			} 
			
			f = "#lastname";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			if( $(f).val() == "" ) {

				$(f).addClass('input_error');
				error++;
			} 
			
			f = "#company";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			if( $(f).val() == "" ) {

				$(f).addClass('input_error');
				error++;
			} 
			
			f = "#street";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			if( $(f).val() == "" ) {

				$(f).addClass('input_error');
				error++;
			} 
			
			f = "#postcode";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			$(f).removeClass('input_error');
			if( $(f).val() == "" ) {
				$(f).addClass('input_error');
				error++;
			} else {
				if( $('#country_id').val() == 1 ) {	
					if (!$(f).val().match(/^[0-9]{2}[-][0-9]{3}$/)) {
					$(f).addClass('input_error');
					error++;
					}
				}
			}	
	
			if( $(f).val() == "" ) {

				$(f).addClass('input_error');
				error++;
			} 
			
			f = "#city";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			if( $(f).val() == "" ) {

				$(f).addClass('input_error');
				error++;
			} 
			
			f = "#nip";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			if( $('#country_id').val() == 1 ) {	
				if( !NIPIsValid( $(f).val() ) ) {

					$(f).addClass('input_error');
					error++;
				} 
			} else {
				if( $(f).val() == "" ) {

					$(f).addClass('input_error');
					error++;
				} 
			}
			
			
		} 

		if( error === 0 ) {
			form.submit();
		} else {
			alert('<?php echo __t('Błędnie wypełniony formularz'); ?>');
		}
	}
</script>
<script>
function validateForm2() {

		var error = 0;
		var form = document.forms['form_edit2'];


	
		field = "#password";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( $(field).val() == "" ) {

			$(field).addClass('input_error');
			error++;
		} 
		
		field = "#oldpassword";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( $(field).val() == "" ) {

			$(field).addClass('input_error');
			error++;
		} 
		
		field1 = "#password";
		field = "#re-password";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( $(field).val() == "" || ($(field1).val() != $(field).val() ) ) {

			$(field).addClass('input_error');
			error++;
		} 

		if( error === 0 ) {
			form.submit();
		} else {
			alert('<?php echo __t('Błędnie wypełniony formularz'); ?>');
		}
	}
	
	function validateForm() {

		var error = 0;
		var form = document.forms['form_edit'];

		field = "#email";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( $(field).val() == "" ) {
			$(field).addClass('input_error');
			error++;
		} else {
			if (!$(field).val().match(/^[0-9a-z_.-]+@([0-9a-z-]+.)+[a-z]{2,6}$/)) {
			$(field).addClass('input_error');
			error++;
			}
		}
		/*
		field = "#newsletter";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( !$(field).is(':checked') ) {
			$(field).addClass('input_error');
			error++;
			alert('Zaakceptuj otrzymywanie newslettera');
		}
		
		field = "#newsletter2";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( !$(field).is(':checked') ) {
			$(field).addClass('input_error');
			error++;
			alert('Zaakceptuj zgodę na otrzymywanie newslettera o nowych wersjach zakupionych skryptów');
		}
		*/
		field0 = "#email";
		field = "#email2";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( $(field).val() != $(field0).val() ) {
			$(field).addClass('input_error');
			error++;
		}
	
		if( error === 0 ) {
			form.submit();
		} else {
			alert('<?php echo __t('Błędnie wypełniony formularz'); ?>');
		}
	}
</script>