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. * @return html code of the form that appears in a message box.
* *
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @author Julio Montoya - function rewritten
* @version march 2006
*/
function display_move_form($part, $id, $target = array(), $extra_params) {
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>'; function display_move_form($part, $id, $target = array(), $extra_params = array()) {
echo '<input type="hidden" name="id" value="'.Security::remove_XSS($id).'">'; $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);
echo '<input type="hidden" name="part" value="'.Security::remove_XSS($part).'">'; $form->addElement('header', get_lang('MoveFileTo'));
echo ' $form->addElement('hidden', 'id', intval($id));
<div class="row"> $form->addElement('hidden', 'part', Security::remove_XSS($part));
<div class="label">
<span class="form_required">*</span> '.get_lang('MoveFileTo').' $options = array('0' => get_lang('Root'));
</div> foreach ($target as $category) {
<div class="formw">'; $options[$category['cat_id']] = $category['cat_name'];
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>';
} }
echo '</select>'; $form->addElement('select', 'move_target', get_lang('MoveFileTo'), $options);
echo ' </div> $form->addElement('button', 'do_move', get_lang('MoveFile'));
</div>'; $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. * @param $id this is the id of the category we are editing.
* *
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
@author Julio Montoya UI changes
*
* @version march 2006 * @version march 2006
*/ */
function display_addcategory_form($category_name = '', $id = '', $action) { function display_addcategory_form($category_name = '', $id = '', $action) {
$course_id = api_get_course_int_id();
global $dropbox_cnf; global $dropbox_cnf;
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$title = get_lang('AddNewCategory'); $title = get_lang('AddNewCategory');
@ -410,44 +393,24 @@ function display_addcategory_form($category_name = '', $id = '', $action) {
$text = get_lang('CreateCategory'); $text = get_lang('CreateCategory');
$class = 'add'; $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 != '') { if (isset($id) AND $id != '') {
echo '<input name="edit_id" type="hidden" value="'.Security::remove_XSS($id).'">'; $form->addElement('hidden', 'edit_id', intval($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 />';
} }
echo ' <input type="text" id="category_title" name="category_name" value="'.Security::remove_XSS($category_name).'" /> $form->addElement('hidden', 'action', Security::remove_XSS($action));
</div> $form->addElement('hidden', 'target', Security::remove_XSS($target));
</div>';
$form->addElement('text', 'category_name', get_lang('CategoryName'));
echo ' <div class="row"> $form->addRule('category_name', get_lang('ThisFieldIsRequired'), 'required');
<div class="label"> $form->addElement('button', 'StoreCategory', $text);
</div>
<div class="formw"> $defaults = array();
<button class="'.$class.'" type="submit" name="StoreCategory">'.$text.'</button> $defaults['category_name'] = $category_name;
</div> $form->setDefaults($defaults);
</div>'; $form->display();
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>';
} }
/** /**
@ -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);"> <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> <legend><?php echo get_lang('UploadNewFile'); ?></legend>
<div class="row"> <div class="control-group">
<div class="label"> <label>
<span class="form_required">*</span><?php echo get_lang('UploadFile'); ?>: <span class="form_required">*</span><?php echo get_lang('UploadFile'); ?>:
</div> </label>
<div class="formw"> <div class="controls">
<input type="hidden" name="MAX_FILE_SIZE" value='<?php echo dropbox_cnf('maxFilesize'); ?>' /> <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="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; ?>" /> <input type="hidden" name="dropbox_unid" value="<?php echo $dropbox_unid; ?>" />
@ -485,13 +448,10 @@ function display_add_form() {
<?php <?php
if (dropbox_cnf('allowOverwrite')) { if (dropbox_cnf('allowOverwrite')) {
?> ?>
<div class="row"> <div class="control-group">
<div class="label"> <div class="controls">
<label class="checkbox">
</div> <input type="checkbox" name="cb_overwrite" id="cb_overwrite" value="true" />
<div class="formw">
<input type="checkbox" name="cb_overwrite" id="cb_overwrite" value="true" />
<label for="cb_overwrite">
<?php echo get_lang('OverwriteFile'); ?> <?php echo get_lang('OverwriteFile'); ?>
</label> </label>
</div> </div>
@ -500,11 +460,11 @@ function display_add_form() {
} }
?> ?>
<div class="row"> <div class="control-group">
<div class="label"> <label class="control-label">
<?php echo get_lang('SendTo'); ?> <?php echo get_lang('SendTo'); ?>
</div> </label>
<div class="formw"> <div class="controls">
<?php <?php
//list of all users in this course and all virtual courses combined with it //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 <?php
if ($dropbox_person -> isCourseTutor || $dropbox_person -> isCourseAdmin) { if ($dropbox_person -> isCourseTutor || $dropbox_person -> isCourseAdmin) {
echo 10; echo 10;
@ -590,16 +550,13 @@ function display_add_form() {
echo '<option value="user_'.$_user['user_id'].'">'.get_lang('JustUploadInSelect').'</option>'; echo '<option value="user_'.$_user['user_id'].'">'.get_lang('JustUploadInSelect').'</option>';
} }
echo ' echo '</select>
</select>
</div> </div>
</div>'; </div>';
echo ' echo '
<div class="row"> <div class="control-group">
<div class="label"> <div class="controls">
</div>
<div class="formw">
<button type="Submit" class="upload" name="submitWork">'.get_lang('Upload', '').'</button> <button type="Submit" class="upload" name="submitWork">'.get_lang('Upload', '').'</button>
</div> </div>
</div> </div>

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

Loading…
Cancel
Save