Improving UI in dropbox

skala
Julio Montoya 13 years ago
parent c7e498606c
commit 2a313714c8
  1. 139
      main/dropbox/dropbox_functions.inc.php
  2. 16
      main/dropbox/index.php

@ -148,39 +148,23 @@ function delete_category($action, $id) {
*
* @return html code of the form that appears in a message box.
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
function display_move_form($part, $id, $target = array(), $extra_params) {
* @author Julio Montoya - function rewritten
echo '<form name="form1" method="post" action="'.api_get_self().'?view_received_category='.Security::remove_XSS($_GET['view_received_category']).'&view_sent_category='.Security::remove_XSS($_GET['view_sent_category']).'&view='.Security::remove_XSS($_GET['view']).'&'.$extra_params.'">';
echo '<legend>'.get_lang('MoveFileTo').'</legend>';
echo '<input type="hidden" name="id" value="'.Security::remove_XSS($id).'">';
echo '<input type="hidden" name="part" value="'.Security::remove_XSS($part).'">';
echo '
<div class="row">
<div class="label">
<span class="form_required">*</span> '.get_lang('MoveFileTo').'
</div>
<div class="formw">';
echo '<select name="move_target">';
echo '<option value="0">'.get_lang('Root').'</option>';
foreach ($target as $key => $category) {
echo '<option value="'.$category['cat_id'].'">'.$category['cat_name'].'</option>';
*/
function display_move_form($part, $id, $target = array(), $extra_params = array()) {
$form = new FormValidator('form1', 'post', api_get_self().'?view_received_category='.Security::remove_XSS($_GET['view_received_category']).'&view_sent_category='.Security::remove_XSS($_GET['view_sent_category']).'&view='.Security::remove_XSS($_GET['view']).'&'.$extra_params);
$form->addElement('header', get_lang('MoveFileTo'));
$form->addElement('hidden', 'id', intval($id));
$form->addElement('hidden', 'part', Security::remove_XSS($part));
$options = array('0' => get_lang('Root'));
foreach ($target as $category) {
$options[$category['cat_id']] = $category['cat_name'];
}
echo '</select>';
echo ' </div>
</div>';
$form->addElement('select', 'move_target', get_lang('MoveFileTo'), $options);
$form->addElement('button', 'do_move', get_lang('MoveFile'));
$form->display();
echo '<div class="row">
<div class="label">
</div>
<div class="formw">
<button class="next" type="submit" name="do_move" value="'.get_lang('Ok').'">'.get_lang('MoveFile').'</button>
</div>
</div>';
echo '</form>';
echo '<div style="clear: both;"></div>';
}
/**
@ -368,13 +352,12 @@ function store_addcategory() {
* @param $id this is the id of the category we are editing.
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
@author Julio Montoya UI changes
*
* @version march 2006
*/
function display_addcategory_form($category_name = '', $id = '', $action) {
$course_id = api_get_course_int_id();
global $dropbox_cnf;
$course_id = api_get_course_int_id();
$title = get_lang('AddNewCategory');
@ -410,44 +393,24 @@ function display_addcategory_form($category_name = '', $id = '', $action) {
$text = get_lang('CreateCategory');
$class = 'add';
}
echo '<form name="add_new_category" method="post" action="'.api_get_self().'?view="'.Security::remove_XSS($_GET['view']).'">'."\n";
echo '<legend>'.$title.'</legend>';
$form = new FormValidator('add_new_category', 'post', api_get_self().'?view="'.Security::remove_XSS($_GET['view']));
$form->addElement('header', $title);
if (isset($id) AND $id != '') {
echo '<input name="edit_id" type="hidden" value="'.Security::remove_XSS($id).'">';
}
echo '<input name="action" type="hidden" value="'.Security::remove_XSS($action).'">';
echo '<input name="target" type="hidden" value="'.$target.'">';
echo ' <div class="row">
<div class="label">
<span class="form_required">*</span> '.get_lang('CategoryName').'
</div>
<div class="formw">';
if ($_POST AND empty($_POST['category_name'])) {
echo '<span class="form_error">'.get_lang('ThisFieldIsRequired').'. '.get_lang('ErrorPleaseGiveCategoryName').'<span><br />';
}
if ($_POST AND !empty($_POST['category_name'])) {
echo '<span class="form_error">'.get_lang('CategoryAlreadyExistsEditIt').'<span><br />';
$form->addElement('hidden', 'edit_id', intval($id));
}
echo ' <input type="text" id="category_title" name="category_name" value="'.Security::remove_XSS($category_name).'" />
</div>
</div>';
echo ' <div class="row">
<div class="label">
</div>
<div class="formw">
<button class="'.$class.'" type="submit" name="StoreCategory">'.$text.'</button>
</div>
</div>';
echo ' <div class="row">
<div class="label">
</div>
<div class="formw">
<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>
</div>
</div>';
echo '</form>';
echo '<div style="clear: both;"></div>';
$form->addElement('hidden', 'action', Security::remove_XSS($action));
$form->addElement('hidden', 'target', Security::remove_XSS($target));
$form->addElement('text', 'category_name', get_lang('CategoryName'));
$form->addRule('category_name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('button', 'StoreCategory', $text);
$defaults = array();
$defaults['category_name'] = $category_name;
$form->setDefaults($defaults);
$form->display();
}
/**
@ -465,11 +428,11 @@ function display_add_form() {
<form method="post" action="index.php?view_received_category=<?php echo Security::remove_XSS($_GET['view_received_category']); ?>&view_sent_category=<?php echo Security::remove_XSS($_GET['view_sent_category']); ?>&view=<?php echo Security::remove_XSS($_GET['view']); ?>&<?php echo "origin=$origin"."&".api_get_cidreq(); ?>" enctype="multipart/form-data" onsubmit="javascript: return checkForm(this);">
<legend><?php echo get_lang('UploadNewFile'); ?></legend>
<div class="row">
<div class="label">
<div class="control-group">
<label>
<span class="form_required">*</span><?php echo get_lang('UploadFile'); ?>:
</div>
<div class="formw">
</label>
<div class="controls">
<input type="hidden" name="MAX_FILE_SIZE" value='<?php echo dropbox_cnf('maxFilesize'); ?>' />
<input type="file" name="file" size="20" <?php if (dropbox_cnf('allowOverwrite')) echo 'onChange="javascript: checkfile(this.value);"'; ?> />
<input type="hidden" name="dropbox_unid" value="<?php echo $dropbox_unid; ?>" />
@ -485,13 +448,10 @@ function display_add_form() {
<?php
if (dropbox_cnf('allowOverwrite')) {
?>
<div class="row">
<div class="label">
</div>
<div class="formw">
<input type="checkbox" name="cb_overwrite" id="cb_overwrite" value="true" />
<label for="cb_overwrite">
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" name="cb_overwrite" id="cb_overwrite" value="true" />
<?php echo get_lang('OverwriteFile'); ?>
</label>
</div>
@ -500,11 +460,11 @@ function display_add_form() {
}
?>
<div class="row">
<div class="label">
<div class="control-group">
<label class="control-label">
<?php echo get_lang('SendTo'); ?>
</div>
<div class="formw">
</label>
<div class="controls">
<?php
//list of all users in this course and all virtual courses combined with it
@ -532,7 +492,7 @@ function display_add_form() {
?>
<select name="recipients[]" size="
<select name="recipients[]" size="
<?php
if ($dropbox_person -> isCourseTutor || $dropbox_person -> isCourseAdmin) {
echo 10;
@ -590,16 +550,13 @@ function display_add_form() {
echo '<option value="user_'.$_user['user_id'].'">'.get_lang('JustUploadInSelect').'</option>';
}
echo '
</select>
echo '</select>
</div>
</div>';
echo '
<div class="row">
<div class="label">
</div>
<div class="formw">
<div class="control-group">
<div class="controls">
<button type="Submit" class="upload" name="submitWork">'.get_lang('Upload', '').'</button>
</div>
</div>

@ -104,7 +104,6 @@ if ($_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] == '') {
$last_access = $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX];
}
// Do the tracking
event_access_tool(TOOL_DROPBOX);
@ -112,7 +111,6 @@ event_access_tool(TOOL_DROPBOX);
$dropbox_unid = md5(uniqid(rand(), true));
/* DISPLAY SECTION */
Display::display_introduction_section(TOOL_DROPBOX);
// Build URL-parameters for table-sorting
@ -354,12 +352,14 @@ if ($action != 'add') {
if ($dropbox_cnf['sent_received_tabs']) {
?>
<div id="tabbed_menu">
<ul id="tabbed_menu_tabs">
<li><a href="index.php?<?php echo api_get_cidreq(); ?>&view=sent" <?php if (!$_GET['view'] OR $_GET['view'] == 'sent') { echo 'class="active"'; } ?>><?php echo get_lang('SentFiles'); ?></a></li>
<li><a href="index.php?<?php echo api_get_cidreq(); ?>&view=received" <?php if ($_GET['view'] == 'received') { echo 'class="active"'; } ?> ><?php echo get_lang('ReceivedFiles'); ?></a></li>
</ul>
</div>
<ul class="nav nav-tabs">
<li <?php if (!$_GET['view'] OR $_GET['view'] == 'sent') { echo 'class="active"'; } ?> >
<a href="index.php?<?php echo api_get_cidreq(); ?>&view=sent" ><?php echo get_lang('SentFiles'); ?></a></li>
<li <?php if ($_GET['view'] == 'received') { echo 'class="active"'; } ?> >
<a href="index.php?<?php echo api_get_cidreq(); ?>&view=received" ><?php echo get_lang('ReceivedFiles'); ?></a></li>
</ul>
<?php
}

Loading…
Cancel
Save