Bug #3646 and Issue #306 - Documents, Drobbox: Fixing person name order to be dependable on the internationalization settings, other minor corrections.

skala
Ivan Tcholakov 16 years ago
parent 7645df2669
commit d7ac1ce93b
  1. 8
      main/document/document.inc.php
  2. 28
      main/document/document.php
  3. 2
      main/dropbox/dropbox_class.inc.php
  4. 20
      main/dropbox/dropbox_functions.inc.php
  5. 4
      main/dropbox/dropbox_init.inc.php
  6. 8
      main/dropbox/dropbox_submit.php
  7. 1
      main/dropbox/index.php

@ -102,7 +102,7 @@ function build_directory_selector($folders,$curdirpath,$group_dir='',$changeRend
elseif(strstr($folder_titles[$folder], 'sf_user_'))
{
$userinfo=Database::get_user_info_from_id(substr($folder_titles[$folder],8));
$folder_titles[$folder]=$userinfo['lastname'].', '.$userinfo['firstname'];
$folder_titles[$folder]=api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
}
$label = str_repeat('   ',count($path_parts)-2).' — '.$folder_titles[$folder];
@ -189,7 +189,7 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility
$url=$www.$path;
}
//files that we want opened in a new window
if($ext=='txt') //add here
if($ext=='txt' || $ext=='log' || $ext=='css' || $ext=='js') //add here
{
$target='_blank';
}
@ -211,7 +211,7 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility
elseif(strstr($tooltip_title, 'sf_user_'))
{
$userinfo=Database::get_user_info_from_id(substr($tooltip_title,8));
$tooltip_title_alt=$userinfo['lastname'].', '.$userinfo['firstname'];
$tooltip_title_alt=api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
}
else
{
@ -271,7 +271,7 @@ function build_document_icon_tag($type, $path)
{
$icon = '../upload/users/'.substr($basename,8).'/'.$image_path['file'];
}
$basename = $userinfo['lastname'].', '.$userinfo['firstname'];
$basename = api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
}
else
{

@ -318,7 +318,7 @@ for ($i=0; $i<$array_len;$i++)
elseif(strstr($dir_array[$i], 'sf_user_'))
{
$userinfo=Database::get_user_info_from_id(substr($dir_array[$i], 8));
$dir_array[$i]=$userinfo['lastname'].', '.$userinfo['firstname'];
$dir_array[$i]=api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
}
$url_dir='document.php?&curdirpath='.$dir_acum.$dir_array[$i];
@ -370,7 +370,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
======================================*/
$my_get_move=Security::remove_XSS($_GET['move']);
if (isset($_GET['move']) && $_GET['move']!='')
{
{
if (!$is_allowed_to_edit)
{
if(DocumentManager::check_readonly($_course,$_user['user_id'],$my_get_move))
@ -606,7 +606,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
$template_text .= '<button type="submit" class="add" name="create_template">'.get_lang('CreateTemplate').'</button>';
$template_text .= '</form>';
//show the form
Display::display_normal_message($template_text,false);
Display::display_normal_message($template_text,false);
} elseif(isset($_GET['add_as_template']) && isset($_POST['create_template'])) {
@ -636,26 +636,26 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
// upload dir
$upload_dir = api_get_path(SYS_CODE_PATH).'upload/template_thumbnails/';
// resize image to max default and end upload
require_once (api_get_path(LIBRARY_PATH).'image.lib.php');
$temp = new image($_FILES['template_image']['tmp_name']);
$picture_infos=getimagesize($_FILES['template_image']['tmp_name']);
$picture_infos = @getimagesize($_FILES['template_image']['tmp_name']);
$max_width_for_picture = 100;
if ($picture_infos[0]>$max_width_for_picture) {
$thumbwidth = $max_width_for_picture;
if (empty($thumbwidth) or $thumbwidth==0) {
$thumbwidth=$max_width_for_picture;
}
$new_height = round(($thumbwidth/$picture_infos[0])*$picture_infos[1]);
$temp->resize($thumbwidth,$new_height,0);
}
$type=$picture_infos[2];
switch (!empty($type)) {
case 2 : $temp->send_image('JPG',$upload_dir.$new_file_name);
break;
@ -668,7 +668,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
}
DocumentManager::set_document_as_template($title, $description, $document_id_for_template, $course_code, $user_id, $new_file_name);
Display::display_confirmation_message(get_lang('DocumentSetAsTemplate'));
Display::display_confirmation_message(get_lang('DocumentSetAsTemplate'));
}
if(isset($_GET['remove_as_template'])) {
@ -741,12 +741,12 @@ if(isset($docs_and_folders) && is_array($docs_and_folders))
$document_name=$id['title'];
} else {
$document_name=basename($id['path']);
//Juan Carlos Ra<EFBFBD>a get lastname and firstname when folder is in shared_folder
//Juan Carlos Raña: Get firstname and lastname when folder is in shared_folder.
//TODO: check if is also necessary (above else)
if(strstr($document_name, 'sf_user_'))
{
$userinfo=Database::get_user_info_from_id(substr($document_name, 8));
$document_name=$userinfo['lastname'].', '.$userinfo['firstname'];
$document_name=api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
}
elseif(strstr($document_name, 'shared_folder'))
{
@ -764,7 +764,7 @@ if(isset($docs_and_folders) && is_array($docs_and_folders))
if(isset($_SESSION['_gid']) && $_SESSION['_gid']!='') {
if (!empty($id['insert_user_id'])) {
$user_info=UserManager::get_user_info_by_id($id['insert_user_id']);
$user_name=$user_info['firstname'].' '.$user_info['lastname'];
$user_name=api_get_person_name($user_info['firstname'], $user_info['lastname']);
$user_link='<div class="document_owner">'.get_lang('Owner').': '.display_user_link_document($id['insert_user_id'],$user_name).'</div>';
}
}

@ -104,7 +104,7 @@ class Dropbox_Work {
$this->filesize = $filesize;
$this->title = $title;
$this->description = $description;
$this->author = $_user['firstName'].' '.$_user['lastName'];
$this->author = api_get_person_name($_user['firstName'], $_user['lastName']);
$this->last_upload_date = date("Y-m-d H:i:s",time());
// Check if object exists already. If it does, the old object is used

@ -584,9 +584,9 @@ function display_add_form()
}
}
foreach ($complete_user_list_for_dropbox as $k => $e)
$complete_user_list_for_dropbox[$k] = $e +
array('lastcommafirst' => $e['lastname'] . ', ' . $e['firstname']);
foreach ($complete_user_list_for_dropbox as $k => $e) {
$complete_user_list_for_dropbox[$k] = $e + array('lastcommafirst' => api_get_person_name($e['firstname'], $e['lastname']));
}
$complete_user_list_for_dropbox = TableSort::sort_table($complete_user_list_for_dropbox, 'lastcommafirst');
@ -685,7 +685,7 @@ function getUserNameFromId ( $id) // RH: Mailing: return 'Mailing ' + id
return dropbox_lang("mailingAsUsername", "noDLTT") . $mailingId;
}
$id = intval($id);
$sql = "SELECT CONCAT(lastname,' ', firstname) AS name
$sql = "SELECT ".(api_is_western_name_order() ? "CONCAT(firstname,' ', lastname)" : "CONCAT(lastname,' ', firstname)")." AS name
FROM " . dropbox_cnf("tbl_user") . "
WHERE user_id='$id'";
$result = Database::query($sql,__FILE__,__LINE__);
@ -829,7 +829,7 @@ function dropbox_lang($variable, $notrans = 'DLTT')
/**
* Function that finds a given config setting
*
* @author Ren<EFBFBD> Haentjens, Ghent University
* @author René Haentjens, Ghent University
*/
function dropbox_cnf($variable)
{
@ -1020,10 +1020,10 @@ function store_add_dropbox()
{
include_once(api_get_path(LIBRARY_PATH) . 'usermanager.lib.php');
$recipent_temp=UserManager :: get_user_info_by_id($recipient_id);
api_mail($recipent_temp['lastname'].' '.$recipent_temp['firstname'],$recipent_temp['email'],
api_mail(api_get_person_name($recipent_temp['firstname'].' '.$recipent_temp['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $recipent_temp['email'],
get_lang('NewDropboxFileUploaded'),
get_lang('NewDropboxFileUploadedContent').' '.api_get_path(WEB_CODE_PATH).'dropbox/index.php?cidReq='.$_course['sysCode']."\n\n".$_user['firstName']." ".$_user['lastName']."\n". get_lang('Email') ." : ".$_user['mail'], $_user['firstName']." ".$_user['lastName'],$_user['mail']);
//get_lang('NewDropboxFileUploadedContent').' '.api_get_path(WEB_CODE_PATH).'dropbox/index.php?cidReq='.$_course['sysCode']."\n\n".api_get_setting('administratorName')." ".api_get_setting('administratorSurname')."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'),api_get_setting('administratorName')." ".api_get_setting('administratorSurname'),api_get_setting('emailAdministrator'));
get_lang('NewDropboxFileUploadedContent').' '.api_get_path(WEB_CODE_PATH).'dropbox/index.php?cidReq='.$_course['sysCode']."\n\n".api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS)."\n". get_lang('Email') ." : ".$_user['mail'], api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS), $_user['mail']);
//get_lang('NewDropboxFileUploadedContent').' '.api_get_path(WEB_CODE_PATH).'dropbox/index.php?cidReq='.$_course['sysCode']."\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS)."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'), api_get_person_name(api_get_setting('administratorName')." ".api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS), api_get_setting('emailAdministrator'));
}
}
@ -1057,7 +1057,7 @@ function display_user_link($user_id, $name='')
$sql="SELECT * FROM $table_user WHERE user_id='".Database::escape_string($user_id)."'";
$result=Database::query($sql,__FILE__,__LINE__);
$row=Database::fetch_array($result);
return "<a href=\"../user/userInfo.php?uInfo=".$row['user_id']."\">".$row['firstname']." ".$row['lastname']."</a>";
return "<a href=\"../user/userInfo.php?uInfo=".$row['user_id']."\">".api_get_person_name($row['firstname'], $row['lastname'])."</a>";
}
else
{
@ -1300,7 +1300,7 @@ function zip_download_alternative($files)
// Step 1: create the overview file and add it to the zip
$overview_file_content=generate_html_overview($files, array('filename'), array('title'));
$overview_file=$temp_zip_dir.'overview'.$_user['firstname'].$_user['lastname'].'.html';
$overview_file=$temp_zip_dir.'overview'.replace_dangerous_char(api_is_western_name_order() ? $_user['firstname'].$_user['lastname'] : $_user['lastname'].$_user['firstname'], 'strict').'.html';
$handle=fopen($overview_file,'w');
fwrite($handle,$overview_file_content);
// todo: find a different solution for this because even 2 seconds is no guarantee.

@ -115,7 +115,7 @@ if ($_GET['action']=='add')
-----------------------------------------------------------
*/
$javascript = "<script>
$javascript = "<script type=\"text/javascript\">
function confirmsend ()
{
if (confirm(\"".dropbox_lang("mailingConfirmSend", "noDLTT")."\")){
@ -216,7 +216,7 @@ $javascript .="
$htmlHeadXtra[] = $javascript;
$htmlHeadXtra[] =
"<script>
"<script type=\"text/javascript\">
function confirmation (name)
{
if (confirm(\" ". get_lang("AreYouSureToDelete") ." \"+ name + \" ?\"))

@ -68,7 +68,7 @@ if ( isset( $_POST["submitWork"]))
/**
* --------------------------------------
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FORM SUBMIT : VALIDATE POSTED DATA
* FORM SUBMIT : VALIDATE POSTED DATA
* --------------------------------------
*/
// the author or description field is empty
@ -142,7 +142,7 @@ if ( isset( $_POST["submitWork"]))
/**
* --------------------------------------
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>FORM SUBMIT : UPLOAD NEW FILE
* FORM SUBMIT : UPLOAD NEW FILE
* --------------------------------------
*/
if ( !$error)
@ -458,7 +458,7 @@ if ( isset( $_GET['mailingIndex'])) // examine or send
{
$errormsg .= dropbox_lang("mailingFileIsFor");
}
$errormsg .= htmlspecialchars($thisRecip[1].' '.$thisRecip[2],ENT_QUOTES,$charset);
$errormsg .= htmlspecialchars(api_get_person_name($thisRecip[2], $thisRecip[1]), ENT_QUOTES, $charset);
if ( is_null($thisRecip[3]))
{
@ -489,7 +489,7 @@ if ( isset( $_GET['mailingIndex'])) // examine or send
$remainingUsers = '';
while ( ($res = mysql_fetch_array($result)))
{
$remainingUsers .= ', ' . htmlspecialchars($res[0].' '.$res[1],ENT_QUOTES,$charset);
$remainingUsers .= ', ' . htmlspecialchars(api_get_person_name($res[1], $res[0]), ENT_QUOTES, $charset);
}
$errormsg .= '<br />' . dropbox_lang("mailingNothingFor") . api_substr($remainingUsers, 1) . '.<br />';
}

@ -521,6 +521,7 @@ if (!$_GET['view'] OR $_GET['view']=='sent' OR $dropbox_cnf['sent_received_tabs'
foreach ($dropbox_file->recipients as $recipient) {
$receivers_celldata=display_user_link($recipient['user_id'], $recipient['name']).', '.$receivers_celldata;
}
$receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma.
$dropbox_file_data[]=$receivers_celldata;
$dropbox_file_data[]=date_to_str_ago($dropbox_file->last_upload_date).'<br><span class="dropbox_date">'.$dropbox_file->last_upload_date.'</span>';

Loading…
Cancel
Save