root/releases/0.1.2a/units/files/edit_file.php

Revision 7, 2.6 kB (checked in by sven, 3 years ago)

snapshot of elgg 0.1.2a

Line 
1 <?php
2
3     global $folder;
4         
5     if (isset($_REQUEST['edit_file_id'])) {
6         $file_id = (int) $_REQUEST['edit_file_id'];
7     
8         $file_details = db_query("select files.*, users.username from files left join users on users.ident = files.owner where files.ident = $file_id and owner = " . $_SESSION['userid']);
9         if (sizeof($file_details) > 0) {
10             $file = $file_details[0];
11             $description = stripslashes($file->description);
12             $title = htmlentities(stripslashes($file->title));
13     
14             $body = <<< END
15             <form action="/_files/action_redirection.php" method="post">
16             <table>
17                 <tr>
18                     <td>
19                         <label for="edit_file_title">
20                             File title:
21                         </label>
22                     </td>
23                     <td>
24 END;
25                         $body .= run("display:input_field",array("edit_file_title",$title,"text"));
26                         $body .= <<< END
27                     </td>
28                 </tr>
29                 <tr>
30                     <td>
31                         <label for="edit_file_description">
32                             File description:
33                         </label>
34                     </td>
35                     <td>
36 END;
37                         $body .= run("display:input_field",array("edit_file_description",$description,"longtext"));
38                         $body .= <<< END
39                     </td>
40                 </tr>
41                 <tr>
42                     <td>
43                         <label for="edit_file_access">
44                             Access restrictions:
45                         </label>
46                     </td>
47                     <td>
48 END;
49                         $body .= run("display:access_level_select",array("edit_file_access",$file->access));
50                         $body .= <<< END
51                     </td>
52                 </tr>
53                 <tr>
54                     <td>
55                         <label for="edit_file_folder">
56                             File folder
57                         </label>
58                     </td>
59                     <td>
60 END;
61                         $body .= run("folder:select", array("edit_file_folder",$_SESSION['userid'],$file->folder));
62                         $body .= <<< END
63                     </td>
64                 </tr>
65                 <tr>
66                     <td>
67                         <label for="edit_file_keywords">
68                             Keywords (comma separated):
69                         </label>
70                     </td>
71                     <td>
72 END;
73                         $body .= run("display:input_field",array("edit_file_keywords","","keywords","file",$file_id));
74                         $body .= <<< END
75                     </td>
76                 </tr>
77 END;
78     
79             $body .= run("metadata:edit",$file_id);
80
81             $body .= <<< END
82                 
83                 <tr>
84                     <td colspan="2" align="center"><br />
85                         <input type="hidden" name="folder" value="{$folder}" />
86                         <input type="hidden" name="file_id" value="{$file_id}" />
87                         <input type="hidden" name="action" value="files:editfile" />
88                         <input type="submit" value="Save changes" />
89                     </td>
90                 </tr>
91     
92             </table>
93 END;
94     
95             $run_result .= run("templates:draw", array(
96                                 'context' => 'databoxvertical',
97                                 'name' => "Edit " . $title,
98                                 'contents' => $body
99                                 )
100                                 );
101     
102             $run_result .= <<< END
103         </form>
104 END;
105             }
106         }
107
108 ?>
Note: See TracBrowser for help on using the browser.