$groupId = api_get_group_id(); if (!empty($groupId)) { $interbreadcrumb[] = array("url" => "../group/group_space.php?" . api_get_cidreq(), "name" => get_lang('GroupSpace')); $noPHP_SELF = true; $group = GroupManager::get_group_properties($groupId); $path = explode('/', $dir); if ('/' . $path[1] != $group['directory']) { api_not_allowed(true); } } $interbreadcrumb[] = array("url" => "./document.php?curdirpath=" . urlencode($dir) . "&" . api_get_cidreq(), "name" => get_lang('Documents')); if (!$is_allowed_in_course) { api_not_allowed(true); } $rights = Session::read('group_member_with_upload_rights'); if (!($is_allowed_to_edit || $rights || DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, api_get_session_id()))) { api_not_allowed(true); } /* Header */ Event::event_access_tool(TOOL_DOCUMENT); $display_dir = $dir; if (isset($group)) { $display_dir = explode('/', $dir); unset($display_dir[0]); unset($display_dir[1]); $display_dir = implode('/', $display_dir); } // Interbreadcrumb for the current directory root path if (empty($document_data['parents'])) { $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); } else {
$dir = '/'; } if (!empty($groupId)) { $interbreadcrumb[] = array("url" => "../group/group_space.php?" . api_get_cidreq(), "name" => get_lang('GroupSpace')); $group = GroupManager::get_group_properties($groupId); $path = explode('/', $dir); if ('/' . $path[1] != $group['directory']) { api_not_allowed(true); } } $interbreadcrumb[] = array("url" => "./document.php?id=" . $document_id . '&' . api_get_cidreq(), "name" => get_lang('Documents')); if (!$is_allowed_in_course) { api_not_allowed(true); } $rights = Session::read('group_member_with_upload_rights'); if (!($is_allowed_to_edit || $rights || DocumentManager::is_my_shared_folder(api_get_user_id(), Security::remove_XSS($dir), api_get_session_id()))) { api_not_allowed(true); } /* Header */ Event::event_access_tool(TOOL_DOCUMENT); $display_dir = $dir; if (isset($group)) { $display_dir = explode('/', $dir); unset($display_dir[0]); unset($display_dir[1]); $display_dir = implode('/', $display_dir); } // Interbreadcrumb for the current directory root path $counter = 0; if (isset($document_data['parents'])) { foreach ($document_data['parents'] as $document_sub_data) {
function setFocus(){ $("#title_file").focus(); } </script>'; // This needs cleaning! if (!empty($groupId)) { // If the group id is set, check if the user has the right to be here // Get group info $group_properties = GroupManager::get_group_properties($groupId); // Only courseadmin or group members allowed if ($is_allowed_to_edit || GroupManager::is_user_in_group(api_get_user_id(), $groupId)) { $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group_space.php?' . api_get_cidreq(), 'name' => get_lang('GroupSpace')); } else { api_not_allowed(true); } } elseif ($is_allowed_to_edit || DocumentManager::is_my_shared_folder(api_get_user_id(), $path, api_get_session_id())) { } else { // No course admin and no group member... api_not_allowed(true); } // Group docs can only be uploaded in the group directory if ($groupId != 0 && $path == '/') { $path = $group_properties['directory']; } // I'm in the certification module? $is_certificate_mode = false; $is_certificate_array = explode('/', $path); array_shift($is_certificate_array); if ($is_certificate_array[0] == 'certificates') { $is_certificate_mode = true; }
} if ($groupId) { $query_vars['gidReq'] = $groupId; } $query_vars['cidReq'] = api_get_course_id(); $table->set_additional_parameters($query_vars); $column = 0; if (($is_allowed_to_edit || $group_member_with_upload_rights) && count($documentAndFolders) > 1) { $table->set_header($column++, '', false, array('style' => 'width:12px;')); } $table->set_header($column++, get_lang('Type'), true, array('style' => 'width:30px;')); $table->set_header($column++, get_lang('Name')); $table->set_header($column++, get_lang('Size'), true, array('style' => 'width:50px;')); $table->set_header($column++, get_lang('Date'), true, array('style' => 'width:150px;')); // Admins get an edit column if ($is_allowed_to_edit || $group_member_with_upload_rights || DocumentManager::is_my_shared_folder(api_get_user_id(), $curdirpath, $sessionId)) { $table->set_header($column++, get_lang('Actions'), false, array('class' => 'td_actions')); } // Actions on multiple selected documents // TODO: Currently only delete action -> take only DELETE permission into account if (count($documentAndFolders) > 1) { if ($is_allowed_to_edit || $group_member_with_upload_rights) { $form_actions = array(); $form_action['set_invisible'] = get_lang('SetInvisible'); $form_action['set_visible'] = get_lang('SetVisible'); $form_action['delete'] = get_lang('Delete'); $portfolio_actions = Portfolio::actions(); foreach ($portfolio_actions as $action) { $form_action[$action->get_name()] = $action->get_title(); } $table->set_form_actions($form_action, 'ids');
$interbreadcrumb[] = array("url" => "./document.php?curdirpath=" . urlencode($my_cur_dir_path) . '&' . api_get_cidreq(), "name" => get_lang('Documents')); } else { $interbreadcrumb[] = array('url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); } // Interbreadcrumb for the current directory root path if (empty($document_data['parents'])) { $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); } else { foreach ($document_data['parents'] as $document_sub_data) { if ($document_data['title'] == $document_sub_data['title']) { continue; } $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']); } } $is_allowedToEdit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights'] || DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); if (!$is_allowedToEdit) { api_not_allowed(true); } Event::event_access_tool(TOOL_DOCUMENT); Display::display_header($nameTools, 'Doc'); echo '<div class="actions">'; echo '<a href="document.php?id=' . $parent_id . '&' . api_get_cidreq() . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id . '&' . api_get_cidreq() . '&origin=editpaint">' . Display::return_icon('edit.png', get_lang('Rename') . '/' . get_lang('Comment'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '</div>'; ///pixlr $title = $file; //disk name. No sql name because pixlr return this when save $pixlr_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); $langpixlr = api_get_language_isocode(); $langpixlr = isset($pixlr_code_translation_table[$langpixlr]) ? $pixlredit_code_translation_table[$langpixlr] : $langpixlr;
$filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/'; $dir = '/'; } if (!empty($groupId)) { $interbreadcrumb[] = array("url" => "../group/group_space.php?" . api_get_cidreq(), "name" => get_lang('GroupSpace')); $group = GroupManager::get_group_properties($groupId); $path = explode('/', $dir); if ('/' . $path[1] != $group['directory']) { api_not_allowed(true); } } $interbreadcrumb[] = array("url" => "./document.php?id=" . $document_id . '&' . api_get_cidreq(), "name" => get_lang('Documents')); if (!$is_allowed_in_course) { api_not_allowed(true); } if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] || DocumentManager::is_my_shared_folder(api_get_user_id(), Security::remove_XSS($dir), api_get_session_id()))) { api_not_allowed(true); } /* Header */ Event::event_access_tool(TOOL_DOCUMENT); $display_dir = $dir; if (isset($group)) { $display_dir = explode('/', $dir); unset($display_dir[0]); unset($display_dir[1]); $display_dir = implode('/', $display_dir); } // Interbreadcrumb for the current directory root path $counter = 0; if (isset($document_data['parents'])) { foreach ($document_data['parents'] as $document_sub_data) {
} else { $form->addText('title', get_lang('Title'), true, array('cols-size' => [2, 10, 0], 'autofocus')); } // Show read-only box only in groups if (!empty($groupId)) { $group[] = $form->createElement('checkbox', 'readonly', '', get_lang('ReadOnly')); } $form->addRule('title', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('title', get_lang('FileExists'), 'callback', 'document_exists'); $current_session_id = api_get_session_id(); $form->addHtmlEditor('content', '', true, false, $editorConfig); // Comment-field $folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit); // If we are not in the certificates creation, display a folder chooser for the // new document created if (!$is_certificate_mode && !DocumentManager::is_my_shared_folder($userId, $dir, $current_session_id)) { $folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit); //$parent_select = $form->addElement('select', 'curdirpath', array(null, get_lang('DestinationDirectory'))); $parent_select = $form->addSelect('curdirpath', get_lang('DestinationDirectory'), null, array('cols-size' => [2, 10, 0])); // Following two conditions copied from document.inc.php::build_directory_selector() $folder_titles = array(); if (is_array($folders)) { $escaped_folders = array(); foreach ($folders as $key => &$val) { // Hide some folders if ($val == '/HotPotatoes_files' || $val == '/certificates' || basename($val) == 'css') { continue; } // Admin setting for Hide/Show the folders of all users if (api_get_setting('document.show_users_folders') == 'false' && (strstr($val, '/shared_folder') || strstr($val, 'shared_folder_session_'))) { continue;
} else { $interbreadcrumb[] = array('url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); } // Interbreadcrumb for the current directory root path if (empty($document_data['parents'])) { $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); } else { foreach ($document_data['parents'] as $document_sub_data) { if ($document_data['title'] == $document_sub_data['title']) { continue; } $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']); } } $rights = Session::read('group_member_with_upload_rights'); $is_allowedToEdit = api_is_allowed_to_edit(null, true) || $rights || DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); if (!$is_allowedToEdit) { api_not_allowed(true); } Event::event_access_tool(TOOL_DOCUMENT); Display::display_header($nameTools, 'Doc'); echo '<div class="actions">'; echo '<a href="document.php?id=' . $parent_id . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id . $req_gid . '&origin=editdraw">' . Display::return_icon('edit.png', get_lang('Rename') . '/' . get_lang('Comments'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '</div>'; if (api_browser_support('svg')) { //automatic loading the course language $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); $langsvgedit = api_get_language_isocode(); $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit; $langsvgedit = file_exists(api_get_path(LIBRARY_PATH) . 'svg-edit/locale/lang.' . $langsvgedit . '.js') ? $langsvgedit : 'en';
$read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null; // Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor. // This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573 $defaults['content'] = str_replace('<!--[', '<!-- [', $content); // HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved. $showSystemFolders = api_get_course_setting('show_system_folders'); $condition = stripos($dir, '/HotPotatoes_files') === false; if ($showSystemFolders == 1) { $condition = true; } if (($extension == 'htm' || $extension == 'html') && $condition) { if (empty($readonly) && $readonly == 0) { $form->addHtmlEditor('content', '', true, true, $editorConfig); } } if (!$group_document && !DocumentManager::is_my_shared_folder(api_get_user_id(), $currentDirPath, $sessionId)) { // Updated on field $last_edit_date = api_get_local_time($last_edit_date); $display_date = date_to_str_ago($last_edit_date) . ' <span class="dropbox_date">' . api_format_date($last_edit_date) . '</span>'; $form->addElement('static', null, get_lang('UpdatedOn'), $display_date); } $form->addElement('textarea', 'comment', get_lang('Comment'), ['cols-size' => [2, 10, 0]]); if ($owner_id == api_get_user_id() || api_is_platform_admin()) { $checked =& $form->addElement('checkbox', 'readonly', null, get_lang('ReadOnly')); if ($readonly == 1) { $checked->setChecked(true); } } if ($is_certificate_mode) { $form->addButtonUpdate(get_lang('SaveCertificate')); } else {