|
@@ -1169,67 +1169,15 @@ function to_javascript_work()
|
|
|
}
|
|
|
|
|
|
document.getElementById("file_upload").value = baseFilename;
|
|
|
- document.getElementById("file_extension").value = fileExtension;
|
|
|
-
|
|
|
+ document.getElementById("file_extension").value = fileExtension;
|
|
|
$("#contains_file_id").attr("value", 1);
|
|
|
}
|
|
|
-
|
|
|
- function checkDate(month, day, year) {
|
|
|
- var monthLength =
|
|
|
- new Array(31,28,31,30,31,30,31,31,30,31,30,31);
|
|
|
-
|
|
|
- if (!day || !month || !year)
|
|
|
- return false;
|
|
|
-
|
|
|
- // check for bisestile year
|
|
|
- if (year/4 == parseInt(year/4))
|
|
|
- monthLength[1] = 29;
|
|
|
-
|
|
|
- if (month < 1 || month > 12)
|
|
|
- return false;
|
|
|
-
|
|
|
- if (day > monthLength[month-1])
|
|
|
- return false;
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- function mktime() {
|
|
|
-
|
|
|
- var no, ma = 0, mb = 0, i = 0, d = new Date(), argv = arguments, argc = argv.length;
|
|
|
- d.setHours(0,0,0); d.setDate(1); d.setMonth(1); d.setYear(1972);
|
|
|
-
|
|
|
- var dateManip = {
|
|
|
- 0: function(tt){ return d.setHours(tt); },
|
|
|
- 1: function(tt){ return d.setMinutes(tt); },
|
|
|
- 2: function(tt){ set = d.setSeconds(tt); mb = d.getDate() - 1; return set; },
|
|
|
- 3: function(tt){ set = d.setMonth(parseInt(tt)-1); ma = d.getFullYear() - 1972; return set; },
|
|
|
- 4: function(tt){ return d.setDate(tt+mb); },
|
|
|
- 5: function(tt){ return d.setYear(tt+ma); }
|
|
|
- };
|
|
|
-
|
|
|
- for( i = 0; i < argc; i++ ){
|
|
|
- no = parseInt(argv[i]*1);
|
|
|
- if (isNaN(no)) {
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- // arg is number, lets manipulate date object
|
|
|
- if(!dateManip[i](no)){
|
|
|
- // failed
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return Math.floor(d.getTime()/1000);
|
|
|
- }
|
|
|
-
|
|
|
function setFocus() {
|
|
|
$("#work_title").focus();
|
|
|
}
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
setFocus();
|
|
|
-
|
|
|
var checked = $("#expiry_date").attr("checked");
|
|
|
if (checked) {
|
|
|
$("#option2").show();
|
|
@@ -3989,8 +3937,8 @@ function processWorkForm(
|
|
|
}
|
|
|
|
|
|
$title = $values['title'].$extension;
|
|
|
- $description = $values['description'];
|
|
|
- $contains_file = isset($values['contains_file']) && !empty($values['contains_file']) ? intval($values['contains_file']) : 0;
|
|
|
+ $description = isset($values['description']) ? $values['description'] : '';
|
|
|
+ $containsFile = isset($values['contains_file']) && !empty($values['contains_file']) ? (int) $values['contains_file'] : 0;
|
|
|
|
|
|
$saveWork = true;
|
|
|
$filename = null;
|
|
@@ -3999,7 +3947,7 @@ function processWorkForm(
|
|
|
$workData = [];
|
|
|
$message = null;
|
|
|
|
|
|
- if ($values['contains_file']) {
|
|
|
+ if ($containsFile) {
|
|
|
if ($checkDuplicated) {
|
|
|
if (checkExistingWorkFileName($file['name'], $workInfo['id'])) {
|
|
|
$saveWork = false;
|
|
@@ -4049,7 +3997,7 @@ function processWorkForm(
|
|
|
'filetype' => 'file',
|
|
|
'title' => $title,
|
|
|
'description' => $description,
|
|
|
- 'contains_file' => $contains_file,
|
|
|
+ 'contains_file' => $containsFile,
|
|
|
'active' => $active,
|
|
|
'accepted' => '1',
|
|
|
'qualificator_id' => 0,
|