Current File : /home/users/barii/public_html/finansenl.com.pl/wodki/application/views/account/item_edit.php |
<script>
$(document).ready(function() {
var thumb_photo_num=<?php echo !empty( $item->id ) ? 2 : 1; ?>;
$('.thumb_photo_item_close').click( function() {
var id = $(this).attr('rel');
$('.success_upload_thumb').hide();
$('.thumb_photo_item_area'+id).hide();
$('.th_new_upload'+id).attr('src','');
$('#upload_thumb'+id).val('');
thumb_photo_num--;
return false;
});
$('.video_thumb_photo_item_close').click( function() {
var id = $(this).attr('rel');
$('.success_upload_video').hide();
$('.video_thumb_photo_item_area'+id).hide();
$('#upload_file').val('');
return false;
});
$('.v_thumb_photo_item_close').click( function() {
var id = $(this).attr('rel');
$('.v_l_'+id).hide();
$('#v_upload_thumb_'+id).val('');
return false;
});
new AjaxUpload('upload_file_video', {
action: "upload_ajax.php?n=upload_file_video",
name: 'upload_file_video',
onSubmit: function(file, extension) {
$('.loading_wait_video').show();
var str = file;
var ext1 = str.indexOf("mp3");
var ext2 = str.indexOf("MP3");
var ext3 = str.indexOf("mp4");
var ext4 = str.indexOf("MP4");
if( ext1 > 0 || ext2 > 0 || ext3 > 0 || ext4 > 0) {
} else {
alert('Report this file format! Only MP3 or MP4');
$('.loading_wait_video').hide();
return false;
}
},
onComplete: function(file, response) {
if( response == "SIZEOFF" ) {
alert('The file size is too big (max. 100MB)');
$('.loading_wait_video').hide();
return false;
}
file = response;
var path = 'uploads/items/'+file;
$('.loading_wait_video').hide();
$('.upload_info_video').show();
$('.video_thumb_photo_item_area_1').show();
$('#upload_file').val(path);
}
});
new AjaxUpload('thumb', {
action: "upload_ajax.php",
name: 'thumb',
onSubmit: function(file, extension) {
if( thumb_photo_num > 10 ) { alert('You can add up to 10 photos!'); return false; }
$('.loading_wait_thumb').show();
var str = file;
var ext1 = str.indexOf("JPG");
var ext2 = str.indexOf("jpg");
if( ext1 > 0 || ext2 > 0) {
} else {
alert('Report this file format! Only JPG');
$('.loading_wait_thumb').hide();
return false;
}
},
onComplete: function(file, response) {
if( response == "SIZEOFF" ) {
alert('The file size is too big (max. 10MB)');
$('.loading_wait_thumb').hide();
return false;
}
file = response;
var path = 'uploads/items/'+file;
$('.loading_wait_thumb').hide();
$('.upload_info_thumb').show();
$('.thumb_photo_item_area'+thumb_photo_num).show();
$('.th_new_upload'+thumb_photo_num).attr('src','/image.php/image-name.jpg?width=250&image=/'+path);
$('#upload_thumb'+thumb_photo_num).val(path);
thumb_photo_num++;
}
});
});
</script>
<?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="wrapper">
<?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() == 'item' AND Request::current()->param('act') == '' ) echo 'button_gray_active'; ?>" href="account/item"><?php echo __t('Twoje kody'); ?></a></li>
<a class="button_gray <?php if( Request::current()->controller() == 'Account' AND Request::current()->action() == 'item' AND Request::current()->param('act') == 'edit') echo 'button_gray_active'; ?>" href="account/item/edit"><?php echo __t('Dodaj kod'); ?></a></li>
<br style="clear: both;"/><br style="clear: both;"/>
<br style="clear: both;"/>
<h2><?php echo __t('Edycja <span>kodu</span>'); ?></h2>
<?php echo aurora::partial('frontend_account_info'); ?>
<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 style="width: 100%;">
<label><?php echo __t('Tytuł'); ?>:</label><br style="clear: both;"/><input type="text" id="title" name="title" value="<?php echo @$item->title; ?>"/>
</div>
<br style="clear: both;"/>
<input type="hidden" id="upload_file" name="upload_file" value="<?php echo @$item->file; ?>"/>
<?php for( $i=1; $i<=10; $i++ ) : ?>
<input type="hidden" id="upload_thumb<?php echo $i; ?>" name="upload_thumb<?php echo $i; ?>" value="<?php echo ($i==1) ? @$item->thumb : ''; ?>"/>
<?php endfor; ?>
<div style="width: 100%;">
<label><?php echo __t('Kody'); ?>:</label><br style="clear: both;"/><textarea type="textarea" id="description" name="description"><?php echo @$item->description; ?></textarea>
</div>
<br style="clear: both;"/>
<h2><?php echo __t('Kategoria <span>kodu</span>'); ?></h2><br style="clear: both;"/>
<div>
<label><?php echo __t('wybierz'); ?>:</label><br style="clear: both;"/>
<select id="categories_id" name="categories_id">
<option><?php echo __t('wybierz'); ?></option>
<?php foreach( $categories as $row ) : ?>
<option value="<?php echo $row->id; ?>" <?php if( !empty( $item->categories_id ) AND $row->id == $item->categories_id) echo 'SELECTED="SELECTED"'; ?>><?php echo $row->title; ?></option>
<?php endforeach; ?>
<!--<option>Zaproponuj</option>//-->
</select>
<input style="display: none;" type="text" placeholder="Własna nazwa" id="categories_id_own" name="categories_id_own" value=""/>
</div>
<div style="width: 100%;">
<label><?php echo __t('Tagi'); ?>:</label><br style="clear: both;"/><input type="text" id="tags" name="tags" value="<?php echo @$item->tags; ?>"/>
</div>
<div style="width: 100%;">
<a href="http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>" class="button_black"><?php echo __t('Anuluj'); ?></a>
<input type="submit" onclick="validateForm_Data(); return false;" id="register_buttonData" value="<?php echo __t('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 go_ahead = 1;
var form = document.forms['form_edit_data'];
if( 1 == 1 ) {
for( var i = 1; i <= 10; i++ ) {
f = "#upload_thumb"+i;
$(f).removeClass('input_error');
$('.input_error_text').remove();
if( $(f).val() == "" ) {
$(f).addClass('input_error');
error++;
} else {
go_ahead = 1;
}
}
}
if( go_ahead === 1 ) {
form.submit();
} else {
alert('<?php echo __t('Incorrectly completed form! It has not been selected at least one photo!'); ?>');
}
}
</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>