Added help (w/ show_help preference), a few special character fixes, and added version to $file_attributes that should have been commited last time

This commit is contained in:
zone 2001-07-22 08:12:08 +00:00
parent c0e4d73c10
commit 86af0afa3e
5 changed files with 105 additions and 8 deletions

View File

@ -17,5 +17,6 @@ $pref->change ("phpwebhosting", "comment", "True");
$pref->change ("phpwebhosting", "viewtextplain", True);
//$pref->change ("phpwebhosting", "dotdot", "False");
//$pref->change ("phpwebhosting", "dotfiles", "False");
//$pref->change ("phpwebhosting", "show_help", "False");
?>

View File

@ -445,4 +445,17 @@ function html_image ($src = NULL, $alt = NULL, $align = NULL, $border = NULL, $s
return (eor ($rstring, $return));
}
function html_help_link ($help_name)
{
global $settings;
global $appname;
if (!$settings["show_help"])
return 0;
$rstring = html_link ("$appname/index.php?op=help&help_name=$help_name", "[?]", 1, 1, 0, "_new");
echo $rstring;
}
?>

View File

@ -54,7 +54,7 @@ require (PHPGW_APP_INC . "/html.inc.php");
# This is used both by internally and externally for things like preferences
###
$file_attributes = array ("name" => "Filename", "mime_type" => "MIME Type", "size" => "Size", "created" => "Created", "modified" => "Modified", "owner" => "Owner", "createdby_id" => "Created by", "modifiedby_id" => "Created by", "modifiedby_id" => "Modified by", "app" => "Application", "comment" => "Comment");
$file_attributes = array ("name" => "Filename", "mime_type" => "MIME Type", "size" => "Size", "created" => "Created", "modified" => "Modified", "owner" => "Owner", "createdby_id" => "Created by", "modifiedby_id" => "Created by", "modifiedby_id" => "Modified by", "app" => "Application", "comment" => "Comment", "version" => "Version");
###
# Calculate and display B or KB
@ -87,7 +87,7 @@ function borkb ($size, $enclosed = NULL, $return = 0)
function bad_chars ($string, $return = 0)
{
if (preg_match("-([\\/<>\"])-", $string, $badchars))
if (preg_match("-([\\/<>\"'])-", $string, $badchars))
$rstring = $badchars[1];
return trim ((eor ($rstring, $return)));
@ -185,4 +185,38 @@ function translate ($text)
return ($phpgw->lang ($text));
}
$help_info = array
(
array ("up", "The Up button takes you to the directory above the current directory. For example, if you're in /home/jdoe/mydir, the Up button would take you to /home/jdoe."),
array ("directory_name", "The name of the directory you're currently in."),
array ("home", "The Home button takes you to your personal home directory."),
array ("sort_by", "Click on any of the column headers to sort the list by that column."),
array ("filename", "The name of the file or directory."),
array ("mime_type", "The MIME-type of the file. Examples include text/plain, text/html, image/jpeg. The special MIME-type Directory is used for directories."),
array ("size", "The size of the file or directory in the most convenient units: bytes (B), kilobytes (KB), megabytes (MB), gigabytes (GB). Sizes for directories include subfiles and subdirectories."),
array ("created", "When the file or directory was created."),
array ("modified", "When the file or directory was last modified."),
array ("owner", "The owner of the file or directory. This can be a user or group name."),
array ("created_by", "Displays who created the file or directory."),
array ("modified_by", "Displays who last modified the file or directory."),
array ("application", "The application associated with the file or directory. Usually the application used to create it. A blank application field is ok."),
array ("comment", "The comment for the file or directory. Comments can be set when creating the file or directory, and created or edited any time thereafter."),
array ("version", "The current version for the file or directory. Clicking on the version number will display a list of changes made to the file or directory."),
array ("edit", "Edit the text of the selected file(s). You can select more than one file; this is useful when you want to copy part of one file into another. Clicking Preview will show you a preview of the file. Click Save to save your changes"),
array ("rename", "Rename the selected file(s). You can select as many files or directories as you want. You are presented with a text field to enter the new name of each file or directory."),
array ("delete", "Delete the selected file(s). You can select as many files or directories as you want. When deleting directories, the entire directory and all of its contents are deleted. You will not be prompted to make sure you want to delete the file(s); make sure you really want to delete them before clicking Delete."),
array ("edit_comments", "Create a comment for a file or directory, or edit an existing comment. You can select as many files or directories as you want."),
array ("go_to", "The Go to button takes you to the directory selected in the drop down Directory List."),
array ("copy_to", "This will copy all selected files and directories to the directory selected in the drop down Directory List."),
array ("move_to", "This will move all selected files and directories to the directory selected in the drop down Directory List."),
array ("directory_list", "The Directory List contains a list of all directories you have (at least) read access to. Selecting a directory and clicking one of the Go to/Copy to/Move to buttons will perform the selected action on that directory. For example, if you select \"/home/somegroup/reports\" from the Directory List, and click the \"Copy to\" button, all selected files and directories will be copied to \"/home/somegroup/reports\"."),
array ("download", "Download the first selected file to your local computer. You can only download one file at a time."),
array ("create_folder", "Creates a directory (folder == directory). The name of the directory is specified in the text box next to the Create Folder button."),
array ("file_stats", "Various statistics on the number and size of the files in the current directory. In some situations, these reflect different statistics. For example, when in / and the base directory."),
array ("upload_file", "The full path of the local file to upload. You can type it in or use the Browse.. button to select it. The file will be uploaded to the current directory."),
array ("upload_comment", "The inital comment to use for the newly uploaded file. Totally optional and completely arbitrary."),
array ("update", "Sync the database with the filesystem for the current directory. This is useful if you use another interface to access the same files. Any new files or directories in the current directory will be read in, and the attributes for the other files will be updated to reflect any changes to the filesystem. Update is run automatically every few page loads (currently every 20 page load as of this writing, but that may have changed by now)."),
array ("upload_files", "This will upload the files listed in the input boxes above, and stored them in the current directory."),
);
?>

View File

@ -1,6 +1,6 @@
<?php
if ($download || $op == "view" || $op == "history")
if ($download || $op == "view" || $op == "history" || $op == help)
{
$noheader = True;
}
@ -153,9 +153,11 @@ if (($path == $homedir) && !$phpgw->vfs->file_exists ($homedir, array (RELATIVE_
}
elseif (preg_match ("|^$fakebase\/(.*)$|U", $path, $matches))
{
if (!$phpgw->vfs->file_exists ($homedir, array (RELATIVE_NONE)))
if (!$phpgw->vfs->file_exists ($path, array (RELATIVE_NONE)))
{
$phpgw->vfs->override_acl = 1;
$phpgw->vfs->mkdir ($path, array (RELATIVE_NONE));
$phpgw->vfs->override_acl = 0;
$group_id = $phpgw->accounts->name2id ($matches[1]);
$phpgw->vfs->set_attributes ($path, array (RELATIVE_NONE), array ("owner_id" => $group_id, "createdby_id" => $group_id));
@ -222,6 +224,7 @@ if ($path == $fakebase)
}
$ls_array = $phpgw->vfs->ls ("$fakebase/$group_array[account_name]", array (RELATIVE_NONE), False, False, True);
$files_array[] = $ls_array[0];
$numoffiles++;
@ -312,6 +315,28 @@ if ($op == "history" && $file)
$phpgw->common->phpgw_exit ();
}
if ($op == "help" && $help_name)
{
while (list ($num, $help_array) = each ($help_info))
{
if ($help_array[0] != $help_name)
continue;
html_font_set ("4");
$title = ereg_replace ("_", " ", $help_array[0]);
$title = ucwords ($title);
html_text ($title);
html_font_end ();
html_break (2);
html_font_set ("2");
html_text ($help_array[1]);
html_font_end ();
}
}
###
# Start Main Page
###
@ -349,7 +374,10 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
html_table_col_begin ("left");
if ($path != "/")
{
html_link ("$appname/index.php?path=$lesspath", html_image ("images/folder-up.gif", "Up", "left", 0, NULL, 1));
html_help_link ("up");
}
html_table_col_end ();
html_table_col_begin ("center");
@ -367,11 +395,15 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
html_font_set (4, HTML_TABLE_FILES_HEADER_TEXT_COLOR);
html_text_bold (strtoupper ($disppath));
html_font_end ();
html_help_link ("directory_name");
html_table_col_end ();
html_table_col_begin ("right");
if ($path != $homedir)
{
html_link ("$appname/index.php?path=$homedir", html_image ("images/folder-home.gif", "Home", "right", 0, NULL, 1));
html_help_link ("home");
}
html_table_col_end ();
html_table_row_end ();
@ -387,6 +419,7 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
html_table_col_begin ();
html_text ("Sort by:" . html_nbsp (1, 1), NULL, NULL, 1);
html_help_link ("sort_by");
html_table_col_end ();
reset ($file_attributes);
@ -396,6 +429,7 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
{
html_table_col_begin ();
html_link ("$appname/index.php?path=$path&sortby=$internal", html_text_bold ("$displayed", 1, 1));
html_help_link (strtolower (ereg_replace (" ", "_", $displayed)));
html_table_col_end ();
}
}
@ -644,7 +678,7 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
if ($settings["version"])
{
html_table_col_begin ();
html_link ("$appname/index.php?op=history&file=$files[name]&path=$path", $files["version"], NULL, NULL, NULL, "_new");
html_link ("$appname/index.php?op=history&file=" . string_encode ($files[name], 1) . "&path=$path", $files["version"], NULL, NULL, NULL, "_new");
html_table_col_end ();
}
@ -687,24 +721,28 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
if (!$rename && !$edit_comments)
{
html_form_input ("submit", "edit", "Edit");
html_help_link ("edit");
html_nbsp (3);
}
if (!$edit_comments)
{
html_form_input ("submit", "rename", "Rename");
html_help_link ("rename");
html_nbsp (3);
}
if (!$rename && !$edit_comments)
{
html_form_input ("submit", "delete", "Delete");
html_help_link ("delete");
html_nbsp (3);
}
if (!$rename)
{
html_form_input ("submit", "edit_comments", "Edit comments");
html_help_link ("edit_comments");
}
}
}
@ -721,12 +759,15 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
html_break (1);
html_form_input ("submit", "go", "Go to:");
html_help_link ("go_to");
if ($path != "/" && $path != $fakebase)
{
html_form_input ("submit", "copy", "Copy to:");
html_help_link ("copy_to");
html_form_input ("submit", "move", "Move to:");
html_help_link ("move_to");
}
html_form_select_begin ("todir");
@ -798,23 +839,28 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
}
html_form_select_end ();
html_help_link ("directory_list");
if ($path != "/" && $path != $fakebase)
{
html_break (1);
html_form_input ("submit", "download", "Download");
html_help_link ("download");
html_nbsp (3);
html_form_input ("text", "createdir", NULL, 255, 15);
html_form_input ("submit", "newdir", "Create Folder");
html_help_link ("create_folder");
}
html_break (1);
html_form_input ("submit", "update", "Update");
html_help_link ("update");
html_form_end ();
html_help_link ("file_stats");
html_break (1);
html_text_bold ("Files: ");
html_text ($numoffiles);
@ -849,9 +895,11 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
html_table_row_begin ("center");
html_table_col_begin ();
html_text_bold ("File");
html_help_link ("upload_file");
html_table_col_end ();
html_table_col_begin ();
html_text_bold ("Comment");
html_help_link ("upload_comment");
html_table_col_end ();
html_table_row_end ();
@ -865,6 +913,7 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
html_table_row_end ();
html_table_end ();
html_form_input ("submit", "upload_files", "Upload files");
html_help_link ("upload_files");
html_form_end ();
}
}
@ -1052,7 +1101,7 @@ elseif ($op == "upload" && $path != "/" && $path != $fakebase)
{
if ($fileinfo["name"] && $fileinfo["deleteable"] != "N")
{
$phpgw->vfs->set_attributes ($file_name[$i], array (RELATIVE_ALL), array ("owner_id" => $userinfo["username"], "modifiedby_id" => $userinfo["username"], "modified" => $now, "size" => $file_size[$i], mime_type => $file_type[$i], "deleteable" => "Y", "comment" => $comment[$i]));
$phpgw->vfs->set_attributes ($file_name[$i], array (RELATIVE_ALL), array ("owner_id" => $userinfo["username"], "modifiedby_id" => $userinfo["username"], "modified" => $now, "size" => $file_size[$i], mime_type => $file_type[$i], "deleteable" => "Y", "comment" => stripslashes ($comment[$i])));
$phpgw->vfs->cp ($file[$i], "$file_name[$i]", array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL));
html_text_summary ("Replaced $disppath/$file_name[$i]", $file_size[$i]);
@ -1060,7 +1109,7 @@ elseif ($op == "upload" && $path != "/" && $path != $fakebase)
else
{
$phpgw->vfs->cp ($file[$i], $file_name[$i], array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL));
$phpgw->vfs->set_attributes ($file_name[$i], array (RELATIVE_ALL), array ("mime_type" => $file_type[$i], "comment" => $comment[$i]));
$phpgw->vfs->set_attributes ($file_name[$i], array (RELATIVE_ALL), array ("mime_type" => $file_type[$i], "comment" => stripslashes ($comment[$i])));
html_text_summary ("Created $disppath/$file_name[$i]", $file_size[$i]);
}

View File

@ -17,7 +17,7 @@
/*
To add a preference, just add it here. Key is internal name, value is displayed name
*/
$other_checkboxes = array ("viewinnewwin" => "View documents in new window", "viewonserver" => "View documents on server (if available)", "viewtextplain" => "Unknown MIME-type defaults to text/plain when viewing", "dotdot" => "Show ..", "dotfiles" => "Show .files");
$other_checkboxes = array ("viewinnewwin" => "View documents in new window", "viewonserver" => "View documents on server (if available)", "viewtextplain" => "Unknown MIME-type defaults to text/plain when viewing", "dotdot" => "Show ..", "dotfiles" => "Show .files", "show_help" => "Show help");
if ($submit)
{