A series of changes to push Elgg's approach to themes in a more CSS driven direction...
[elgg.git] / units / files / edit_file.php
blobc5498b93a1f5169e27f0d160744360cfe7b13bd8
1 <?php
3 global $folder;
4 global $page_owner;
6 $url = url;
8 if (isset($_REQUEST['edit_file_id'])) {
9 $file_id = (int) $_REQUEST['edit_file_id'];
11 $file_details = db_query("select files.*, users.username from files left join users on users.ident = files.owner where files.ident = $file_id");
12 if (sizeof($file_details) > 0 && (run("permissions:check", array("files:edit",$file_details[0]->owner)) || run("permissions:check", array("files:edit",$file_details[0]->files_owner)))) {
13 $file = $file_details[0];
15 $page_owner = $file->files_owner;
17 $description = stripslashes($file->description);
18 $title = htmlentities(stripslashes($file->title));
20 $fileLabel = gettext("File title:"); // gettext variable
21 $body = <<< END
22 <form action="{$url}_files/action_redirection.php" method="post">
23 <div id="edit_files">
24 <table width="80%">
25 <tr>
26 <td width="30%">
27 <h4>$fileLabel</h4>
28 </td>
29 <td width="70%">
30 END;
31 $body .= run("display:input_field",array("edit_file_title",$title,"text"));
32 $fileDesc = gettext("File description:"); // gettext variable
33 $body .= <<< END
34 </td>
35 </tr>
36 <tr>
37 <td width="30%">
38 <h4>$fileDesc</h4>
39 </td>
40 <td width="70%">
41 END;
42 $body .= run("display:input_field",array("edit_file_description",$description,"longtext"));
43 $fileAccess = gettext("Access restrictions:"); // gettext variable
44 $body .= <<< END
45 </td>
46 </tr>
47 <tr>
48 <td width="30%">
49 <h4>$fileAccess</h4>
50 </td>
51 <td width="70%">
52 END;
53 $body .= run("display:access_level_select",array("edit_file_access",$file->access));
54 $fileFolder = gettext("File folder:"); // gettext variable
55 $body .= <<< END
56 </td>
57 </tr>
58 <tr>
59 <td width="30%">
60 <h4>$fileFolder</h4>
61 </td>
62 <td width="70%">
63 END;
64 $body .= run("folder:select", array("edit_file_folder",$file->files_owner,$file->folder));
65 $keywords = gettext("Keywords (comma separated):"); // gettext variable
66 $body .= <<< END
67 </td>
68 </tr>
69 <tr>
70 <td width="30%">
71 <h4>$keywords</h4>
72 </td>
73 <td width="70%">
74 END;
75 $body .= run("display:input_field",array("edit_file_keywords","","keywords","file",$file_id));
76 $body .= <<< END
77 </td>
78 </tr>
79 END;
81 $body .= run("metadata:edit",$file_id);
83 $saveChanges = gettext("Save changes"); // gettext variable
84 $body .= <<< END
86 <tr>
87 <td colspan="2" align="center"><br />
88 <input type="hidden" name="folder" value="{$folder}" />
89 <input type="hidden" name="file_id" value="{$file_id}" />
90 <input type="hidden" name="action" value="files:editfile" />
91 <input type="submit" value=$saveChanges />
92 </td>
93 </tr>
95 </table>
96 </div>
97 END;
99 $run_result .= run("templates:draw", array(
100 'context' => 'databoxvertical',
101 'name' => gettext("Edit ") . $title,
102 'contents' => $body
106 $run_result .= <<< END
107 </form>
108 END;
109 } else {
110 echo "?";