{* $Id$ *}
{title help="References" admpage="wiki" url="tiki-references.php"}{tr}References{/tr}{/title}
{if isset($referenceinfo.ref_id)}
{button href="?add=1" class="btn btn-primary" _text="{tr}Add a new library reference{/tr}"}
{/if}
{tabset name='tabs_admin_references'}
{* ---------------------- tab with list -------------------- *}
{if $references|count > 0}
{tab name="{tr}References{/tr}"}
{tr}References{/tr}
{pagination_links cant=$cant step=$maxRecords offset=$offset}
tiki-references.php?find={$find}&maxRecords={$maxRecords}
{/pagination_links}
{/tab}
{/if}
{* ---------------------- tab with form -------------------- *}
{if isset($referenceinfo.ref_id) && $referenceinfo.ref_id}
{$add_edit_reference_tablabel = "{tr}Edit reference{/tr}"}
{$schedulename = "{$referenceinfo.biblio_code|escape}"}
{else}
{$add_edit_reference_tablabel = "{tr}Add a new library reference{/tr}"}
{$schedulename = ""}
{/if}
{tab name="{$add_edit_reference_tablabel} {$schedulename}"}
{if isset($referenceinfo.id) && $referenceinfo.ref_id}
{remarksbox type="note" title="{tr}Information{/tr}"}
{tr}If you change the value of Biblio Code, you might loose the link between references{/tr}
{/remarksbox}
{/if}
{/tab}
{if isset($referenceinfo.ref_id) && $referenceinfo.ref_id}
{tab name="{tr}Reference usage{/tr}"}
{tr _0=$referenceinfo.biblio_code|escape}Pages using reference %0{/tr}
{/tab}
{/if}
{/tabset}
{if empty($referenceinfo.biblio_code)}
{jq}
$('#add_ref_auto_biblio_code').click(function(){
if ($('#add_ref_auto_biblio_code').is(':checked')) {
$('#ref_biblio_code_block').hide();
$('#ref_biblio_code').val('');
} else {
$('#ref_biblio_code_block').show();
}
});
{/jq}
{/if}
{jq}
$('#references-edit-form').submit(function(event){
var ck_code = /^[A-Za-z0-9]+$/;
{* var ck_uri = /^((https?|ftp|smtp):\/\/)?(www.)?[a-z0-9]+(\.[a-z]{2, }){1, 3}(#?\/?[a-zA-Z0-9#]+)*\/?(\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?)?$/; *}
var ck_year = /^[1-2][0-9][0-9][0-9]$/;
if (!$('#add_ref_auto_biblio_code').is(':checked') && $('#ref_biblio_code').val() == '') {
alert('Please fill the biblio code field or enable biblio code auto generator');
return false;
}
if(!$('#add_ref_auto_biblio_code').is(':checked') && !ck_code.test($('#ref_biblio_code').val())){
alert('Biblio code is not valid');
return false;
}
{* if(!$('#add_ref_uri').val() == '' && !ck_uri.test($('#add_ref_uri').val())){
alert('uri no valid');
return false;
} *}
if(!$('#ref_author').val().trim()){
alert('Author is not valid');
return false;
}
if(!$('#ref_year').val() == '' && !ck_year.test($('#ref_year').val())){
alert('Year is not valid');
return false;
}
return true;
})
{/jq}