-//<![CDATA[
-
-function isNotNull(f,noalert) {
- if (f.value.length ==0) {
- return false;
- }
- return true;
-}
-function toUC(f) {
- f.value = f.value.toUpperCase();
- return true;
-}
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-function Check(f) {
- var ok=1;
- var _alertString="";
- var alertString2;
- if (f.frameworkcode.value.length==0) {
- _alertString += "\n- " + _("Framework code missing");
- }
- if (!(isNotNull(window.document.Aform.frameworktext))) {
- _alertString += "\n- " + _("Description missing");
- }
- if (_alertString.length==0) {
- document.Aform.submit();
- } else {
- alertString2 = _("Form not submitted because of the following problem(s)");
- alertString2 += "\n------------------------------------------------------------------------------------\n";
- alertString2 += _alertString;
- alert(alertString2);
- return false;
- }
- return true;
-}
-
-$(document).ready(function() {
- new YAHOO.widget.Button("newframework");
-});
-//]]>
-</script>
-<script type="text/javascript">
-/* Import/Export from/to spreadsheet */
-
- var importing = false;
-
- $(document).ready(function() {
- $("body").css("cursor", "auto");
- $('.import_export_options').hide();
- $('a.import_export_fw').click(function() {
- if (!importing) {
- $('.import_export_options').hide();
- $(this).next().show('slide');
- }
- return false;
- });
- $('.import_export_close').click(function() {
- if (!importing) {
- $('.import_export_options').fadeOut('fast');
- $("body").css("cursor", "auto");
- }
- });
- $('.input_import').val("");
-
- var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search);
- if (matches && matches.length > 1) {
- alert(_("Error importing the framework ") + decodeURIComponent(matches[1]));
- }
- });
-
- $(function() {
- $('input.input_import').change( function() {
- var filename = $(this).val();
- if ( ! /(?:\.csv|\.sql|\.ods|\.xml)$/.test(filename)) {
- $(this).css("background-color","yellow");
- alert(_('Please select an ods or xml file'));
- $(this).val("");
- $(this).css("background-color","white");
- }
- });
- $('form.form_export').submit(function() {
- $('.import_export_options').hide();
- return true;
- });
- $('form.form_import').submit(function() {
- var id = $(this).attr('id');
- var obj = $('#' + id + ' input:file');
- if (/(?:\.csv|\.sql|\.ods|\.xml)$/.test(obj.val())) {
- if (confirm('Do you really want to import the framework fields/subfields (will overwrite current configuration, for safety reasons please make before an export to have a backup file)?')) {
- var frameworkcode = $('#' + id + ' input:hidden[name=frameworkcode]').val();
- $('#importing_' + frameworkcode).find("span").html("Importing <strong>" + frameworkcode + "</strong> from <i>" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + "</i>");
- if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
- var timestamp = new Date().getTime();
- $('#importing_' + frameworkcode).find("img").attr('src', '/intranet-tmpl/prog/img/loading.gif' + '?' +timestamp);
- }
- $('#importing_' + frameworkcode).css('display', 'block');
- if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) $("body").css("cursor", "progress");
- importing = true;
- return true;
- } else
- return false;
- }
- obj.css("background-color","yellow");
- alert(_('Please select an spreadsheet (csv, ods, xml) or sql file'));
- obj.val("");
- obj.css("background-color","white");
- return false;
- });
- });
-
-
-