Adding "hide bar" when adding/editing documents see BT#4114

skala
Julio Montoya 13 years ago
parent 98bd40b69f
commit d2c5cb2d05
  1. 73
      main/document/create_document.php
  2. 54
      main/document/edit_document.php
  3. 6
      main/inc/lib/fckeditor/editor/dialog/fck_template.html
  4. 15
      main/newscorm/lp_add_item.php

@ -19,15 +19,32 @@ $_SESSION['whereami'] = 'document/create';
$this_section = SECTION_COURSES;
$htmlHeadXtra[] = '
<style>
.formw {
margin-left:180px !important;
}
form .label {
width: 160px !important;
<script>
var hide_bar = function() {
$("#main_content .span3").hide();
$("#doc_form").removeClass("span9");
$("#doc_form").addClass("span11");
$("#hide_bar_template").css({"background-image" : \'url("../img/hide2.png")\'})
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$("#hide_bar_template").toggle(
function() {
$("#main_content .span3").hide();
$("#doc_form").removeClass("span9");
$("#doc_form").addClass("span11");
$(this).css({"background-image" : \'url("../img/hide2.png")\'})
},
function() {
$("#main_content .span3").show();
$("#doc_form").removeClass("span11");
$("#doc_form").addClass("span9");
$(this).css("background-image", \'url("../img/hide0.png")\');
}
);
});
function InnerDialogLoaded() {
/*
var B=new window.frames[0].FCKToolbarButton(\'Templates\',window.frames[0].FCKLang.Templates);
@ -137,9 +154,7 @@ function InnerDialogLoaded() {
</script>';
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
require_once api_get_path(SYS_CODE_PATH).'document/document.inc.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
//I'm in the certification module?
$is_certificate_mode = false;
@ -290,7 +305,7 @@ if (isset ($group_properties)) {
}
// Create a new form
$form = new FormValidator('create_document','post',api_get_self().'?dir='.Security::remove_XSS(urlencode($dir)).'&selectcat='.Security::remove_XSS($_GET['selectcat']));
$form = new FormValidator('create_document','post',api_get_self().'?dir='.Security::remove_XSS(urlencode($dir)).'&selectcat='.Security::remove_XSS($_GET['selectcat']), null, array('class' =>'form-vertical' ));
// form title
$form->addElement('header', '', $nameTools);
@ -301,14 +316,12 @@ if ($is_certificate_mode) {//added condition for certicate in gradebook
$form->addElement('hidden','selectcat', intval($_GET['selectcat']));
}
$renderer = & $form->defaultRenderer();
// Hidden element with current directory
$form->addElement('hidden', 'id');
$defaults = array();
$defaults['id'] = $folder_id;
// Filename
// Filename
$form->addElement('hidden', 'title_edited', 'false', 'id="title_edited"');
/**
@ -334,16 +347,10 @@ if ($is_certificate_mode) {
if (!empty($_SESSION['_gid'])) {
$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();
// HTML-editor
$renderer->setElementTemplate('<div class="row"><div class="label" id="frmModel" style="overflow: visible;"></div><div class="formw">{element}</div></div><div class="clear"></div>', 'content');
$form->add_html_editor('content','', false, false, $html_editor_config);
// Comment-field
@ -554,18 +561,6 @@ if ($form->validate()) {
$dir_array = explode('/', $dir);
$array_len = count($dir_array);
/*
TODO:check and delete this code
if (!$is_certificate_mode) {
if ($array_len > 1) {
if (empty($_SESSION['_gid'])) {
$url_dir = 'document.php?&curdirpath=/';
$interbreadcrumb[] = array('url' => $url_dir, 'name' => get_lang('HomeDirectory'));
}
}
}
*/
// Interbreadcrumb for the current directory root path
if (empty($document_data['parents'])) {
$interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']);
@ -596,8 +591,16 @@ if ($form->validate()) {
}
$create_certificate = get_lang('CreateCertificateWithTags');
Display::display_normal_message($create_certificate.': <br /><br/>'.$str_info,false);
}
$form->display();
}
// HTML-editor
echo '<div class="row-fluid" style="overflow:hidden">
<div class="span3">
<div id="frmModel" style="overflow: visible;"></div>
</div>
<div id="hide_bar_template" class="span1"></div>
<div id="doc_form" class="span9">
'.$form->return_form().'
</div>
</div>';
Display :: display_footer();
}

@ -37,7 +37,30 @@ require_once '../inc/global.inc.php';
// Template's javascript
$htmlHeadXtra[] = '
<script type="text/javascript">
<script>
var hide_bar = function() {
$("#main_content .span3").hide();
$("#doc_form").removeClass("span9");
$("#doc_form").addClass("span11");
$("#hide_bar_template").css({"background-image" : \'url("../img/hide2.png")\'})
}
$(document).ready(function() {
$("#hide_bar_template").toggle(
function() {
$("#main_content .span3").hide();
$("#doc_form").removeClass("span9");
$("#doc_form").addClass("span11");
$(this).css({"background-image" : \'url("../img/hide2.png")\'})
},
function() {
$("#main_content .span3").show();
$("#doc_form").removeClass("span11");
$("#doc_form").addClass("span9");
$(this).css("background-image", \'url("../img/hide0.png")\');
}
);
});
function InnerDialogLoaded() {
/*
@ -78,8 +101,6 @@ $lib_path = api_get_path(LIBRARY_PATH);
require_once $lib_path.'fileManage.lib.php';
require_once $lib_path.'fileUpload.lib.php';
require_once $lib_path.'document.lib.php';
require_once $lib_path.'groupmanager.lib.php';
require_once api_get_path(SYS_CODE_PATH).'document/document.inc.php';
if (api_is_in_group()) {
@ -352,13 +373,10 @@ $last_edit_date = $document_info['lastedit_date'];
if ($owner_id == api_get_user_id() || api_is_platform_admin() || $is_allowed_to_edit || GroupManager :: is_user_in_group(api_get_user_id(), api_get_group_id() )) {
$action = api_get_self().'?id='.$document_data['id'];
$form = new FormValidator('formEdit', 'post', $action);
$form = new FormValidator('formEdit', 'post', $action, null, array('class' => 'form-vertical'));
// Form title
$form->addElement('header', $nameTools);
$renderer = $form->defaultRenderer();
$form->addElement('hidden', 'filename');
$form->addElement('hidden', 'extension');
$form->addElement('hidden', 'file_path');
@ -385,8 +403,9 @@ if ($owner_id == api_get_user_id() || api_is_platform_admin() || $is_allowed_to_
if (($extension == 'htm' || $extension == 'html') && stripos($dir, '/HotPotatoes_files') === false) {
if (empty($readonly) && $readonly == 0) {
$_SESSION['showedit'] = 1;
$renderer->setElementTemplate('<div class="row"><div class="label" id="frmModel" style="overflow: visible;"></div><div class="formw">{element}</div></div>', 'content');
$form->add_html_editor('content', '', false, true, $html_editor_config);
$form->add_html_editor('content','', false, false, $html_editor_config);
//$renderer->setElementTemplate('<div class="row"><div class="label" id="frmModel" style="overflow: visible;"></div><div class="formw">{element}</div></div>', 'content');
//$form->add_html_editor('content', '', false, true, $html_editor_config);
}
}
@ -395,16 +414,15 @@ if ($owner_id == api_get_user_id() || api_is_platform_admin() || $is_allowed_to_
//Updated on field
$last_edit_date = api_get_local_time($last_edit_date, null, date_default_timezone_get());
$display_date = date_to_str_ago($last_edit_date).'<br /><span class="dropbox_date">'.api_format_date($last_edit_date).'</span>';
$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('Metadata'), $metadata_link);
$form->addElement('static', null, get_lang('UpdatedOn'), $display_date);
}
$form->addElement('textarea', 'comment', get_lang('Comment'), 'rows="3" style="width:300px;"');
if ($owner_id == api_get_user_id() || api_is_platform_admin()) {
$renderer->setElementTemplate('<div class="row"><div class="label"></div><div class="formw">{element}{label}</div></div>', 'readonly');
$checked =& $form->addElement('checkbox', 'readonly', get_lang('ReadOnly'));
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);
}
@ -441,7 +459,15 @@ if ($owner_id == api_get_user_id() || api_is_platform_admin() || $is_allowed_to_
if ($extension=='svg' && !api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true'){
Display::display_warning_message(get_lang('BrowserDontSupportsSVG'));
}
$form->display();
echo '<div class="row-fluid" style="overflow:hidden">
<div class="span3">
<div id="frmModel" style="overflow: visible;"></div>
</div>
<div id="hide_bar_template" class="span1"></div>
<div id="doc_form" class="span9">
'.$form->return_form().'
</div>
</div>';
}
Display::display_footer();

@ -34,8 +34,12 @@
overflow: auto;
width: 148px;
}
.TplItemPopupSelectionBox {
background-color: #eee;
}
.TplItem {
.TplItem, .TplItemPopupSelectionBox {
margin: 5px;
padding: 7px;
border: #eeeeee 1px solid;

@ -36,7 +36,9 @@ function FCKeditor_OnComplete( editorInstance ) {
}
var hide_bar = function() {
$("#main_content .span3").hide();
$("#main_content .span3").hide();
$("#doc_form").removeClass("span8");
$("#doc_form").addClass("span11");
$("#hide_bar_template").css({"background-image" : \'url("../img/hide2.png")\'})
}
@ -221,15 +223,18 @@ function confirmation(name) {
}
}
$(document).ready(function() {
$(document).ready(function() {
$("#hide_bar_template").toggle(
function() {
$("#main_content .span3").hide();
$(this).css({'background-image' : 'url("../img/hide2.png")'})
$("#doc_form").removeClass("span8");
$("#doc_form").addClass("span11");
},
function() {
$("#main_content .span3").show();
$("#main_content .span3").show();
$("#doc_form").removeClass("span11");
$("#doc_form").addClass("span8");
$(this).css('background-image', 'url("../img/hide0.png")');
}
);
@ -269,7 +274,7 @@ if ($action == 'add_item' && $type == 'document' && !isset($_GET['file'])) {
echo '<div id="hide_bar_template" class="span1"></div>';
}
echo '<div class="span8">';
echo '<div id="doc_form" class="span8">';
if (isset($new_item_id) && is_numeric($new_item_id)) {
switch ($type) {

Loading…
Cancel
Save