| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
global $CFG; |
|---|
| 9 |
$page_owner; |
|---|
| 10 |
$folder; |
|---|
| 11 |
|
|---|
| 12 |
$run_result .= <<< END |
|---|
| 13 |
<form action="{$CFG->wwwroot}mod/file/action_redirection.php" method="post" enctype="multipart/form-data"> |
|---|
| 14 |
END; |
|---|
| 15 |
|
|---|
| 16 |
$title = __gettext("Upload a file"); |
|---|
| 17 |
|
|---|
| 18 |
$body = <<< END |
|---|
| 19 |
|
|---|
| 20 |
<table> |
|---|
| 21 |
<tr> |
|---|
| 22 |
<td colspan="2"><p> |
|---|
| 23 |
END; |
|---|
| 24 |
|
|---|
| 25 |
$usedquota = get_field_sql('SELECT sum(size) FROM '.$CFG->prefix.'files WHERE owner = ?',array($page_owner)); |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
$totalquota = user_info('file_quota',$page_owner); |
|---|
| 29 |
if ($page_owner == $_SESSION['userid']) { |
|---|
| 30 |
$body .= sprintf(__gettext("You have used %s Mb of a total %s Mb."),round(($usedquota / 1000000),4),round(($totalquota / 1000000),4)); |
|---|
| 31 |
} else { |
|---|
| 32 |
$body .= sprintf(__gettext("Used space: %s Mb."),round(($usedquota / 1000000),4)); |
|---|
| 33 |
} |
|---|
| 34 |
$fileLabel = __gettext("File to upload:"); |
|---|
| 35 |
$fileTitle = __gettext("File title:"); |
|---|
| 36 |
$fileDesc = __gettext("File Description:"); |
|---|
| 37 |
$fileAccess = __gettext("Access restrictions:"); |
|---|
| 38 |
$body .= <<< END |
|---|
| 39 |
</p></td> |
|---|
| 40 |
<tr> |
|---|
| 41 |
<td width="30%"><p> |
|---|
| 42 |
<label for="new_file"> |
|---|
| 43 |
$fileLabel |
|---|
| 44 |
</label> |
|---|
| 45 |
</p></td> |
|---|
| 46 |
<td><p> |
|---|
| 47 |
<input name="new_file" id="new_file" type="file" /> |
|---|
| 48 |
</p></td> |
|---|
| 49 |
</tr> |
|---|
| 50 |
END; |
|---|
| 51 |
if(!WIZARD_SIMPLIFIED_ADD_FILE){ |
|---|
| 52 |
$body .= <<< END |
|---|
| 53 |
<tr> |
|---|
| 54 |
<td><p> |
|---|
| 55 |
<label for="new_file_title"> |
|---|
| 56 |
$fileTitle |
|---|
| 57 |
</label> |
|---|
| 58 |
</p> |
|---|
| 59 |
</td> |
|---|
| 60 |
<td><p> |
|---|
| 61 |
<input type="text" id="new_file_title" name="new_file_title" value="" /> |
|---|
| 62 |
</p> |
|---|
| 63 |
</td> |
|---|
| 64 |
</tr> |
|---|
| 65 |
|
|---|
| 66 |
<tr> |
|---|
| 67 |
<td><p> |
|---|
| 68 |
<label for="new_file_description"> |
|---|
| 69 |
$fileDesc |
|---|
| 70 |
</label> |
|---|
| 71 |
</p> |
|---|
| 72 |
</td> |
|---|
| 73 |
<td><p> |
|---|
| 74 |
<textarea id="new_file_description" name="new_file_description"></textarea> |
|---|
| 75 |
</p> |
|---|
| 76 |
</td> |
|---|
| 77 |
</tr> |
|---|
| 78 |
END; |
|---|
| 79 |
} |
|---|
| 80 |
$body.= <<< END |
|---|
| 81 |
<tr> |
|---|
| 82 |
<td><p> |
|---|
| 83 |
<label for="new_file_access"> |
|---|
| 84 |
$fileAccess |
|---|
| 85 |
</label> |
|---|
| 86 |
</p> |
|---|
| 87 |
</td> |
|---|
| 88 |
<td><p> |
|---|
| 89 |
END; |
|---|
| 90 |
$body .= run("display:access_level_select",array("new_file_access",default_access)); |
|---|
| 91 |
$keywords = __gettext("Keywords (comma separated):"); |
|---|
| 92 |
$body .= <<< END |
|---|
| 93 |
</p></td> |
|---|
| 94 |
</tr> |
|---|
| 95 |
END; |
|---|
| 96 |
|
|---|
| 97 |
if(!WIZARD_SIMPLIFIED_ADD_FILE){ |
|---|
| 98 |
|
|---|
| 99 |
$body .= <<< END |
|---|
| 100 |
<tr> |
|---|
| 101 |
<td><p> |
|---|
| 102 |
<label for="new_file_keywords"> |
|---|
| 103 |
$keywords |
|---|
| 104 |
</label> |
|---|
| 105 |
</p> |
|---|
| 106 |
</td> |
|---|
| 107 |
<td><p> |
|---|
| 108 |
END; |
|---|
| 109 |
$body .= display_input_field(array("new_file_keywords","","keywords","file")); |
|---|
| 110 |
$body .= <<< END |
|---|
| 111 |
</p> |
|---|
| 112 |
</td> |
|---|
| 113 |
</tr> |
|---|
| 114 |
END; |
|---|
| 115 |
|
|---|
| 116 |
$body .= run("metadata:edit"); |
|---|
| 117 |
|
|---|
| 118 |
} |
|---|
| 119 |
|
|---|
| 120 |
$copyright = __gettext("By checking this box, you are asserting that you have the legal right to share this file, and that you understand you are sharing it with other users of the system."); |
|---|
| 121 |
$upload = __gettext("Upload"); |
|---|
| 122 |
$body .= <<< END |
|---|
| 123 |
|
|---|
| 124 |
<tr> |
|---|
| 125 |
<td colspan="2"><p><label for="copyrightokcheckbox"> |
|---|
| 126 |
<input type="checkbox" id="copyrightokcheckbox" name="copyright" value="ok" /> |
|---|
| 127 |
$copyright |
|---|
| 128 |
</label></p> |
|---|
| 129 |
</td> |
|---|
| 130 |
</tr> |
|---|
| 131 |
<tr> |
|---|
| 132 |
<td colspan="2" align="center"><br /> |
|---|
| 133 |
<input type="hidden" name="folder" value="{$folder}" /> |
|---|
| 134 |
<input type="hidden" name="files_owner" value="{$page_owner}" /> |
|---|
| 135 |
<input type="hidden" name="redirection" value="{$CFG->wwwroot}mod/file/file_include_wizard.php?owner={$page_owner}&folder={$folder}" /> |
|---|
| 136 |
<input type="hidden" name="action" value="files:uploadfile" /> |
|---|
| 137 |
<input type="submit" value=$upload /> |
|---|
| 138 |
</td> |
|---|
| 139 |
</tr> |
|---|
| 140 |
|
|---|
| 141 |
</table> |
|---|
| 142 |
END; |
|---|
| 143 |
|
|---|
| 144 |
$run_result .= templates_draw(array( |
|---|
| 145 |
'context' => 'databoxvertical', |
|---|
| 146 |
'name' => $title, |
|---|
| 147 |
'contents' => $body |
|---|
| 148 |
) |
|---|
| 149 |
); |
|---|
| 150 |
|
|---|
| 151 |
$run_result .= <<< END |
|---|
| 152 |
</form> |
|---|
| 153 |
END; |
|---|
| 154 |
|
|---|
| 155 |
?> |
|---|