Bladeren bron

Adding hide bar when creating/editing documents in a LP see BT#4114

Julio Montoya 13 jaren geleden
bovenliggende
commit
baa2d2cd7f
4 gewijzigde bestanden met toevoegingen van 101 en 97 verwijderingen
  1. 4 21
      main/css/base.css
  2. 1 2
      main/css/base_chamilo.css
  3. 6 9
      main/inc/lib/fckeditor/editor/dialog/fck_template.html
  4. 90 65
      main/newscorm/lp_add_item.php

+ 4 - 21
main/css/base.css

@@ -71,12 +71,12 @@ label, input, button, select, textarea, p {
 
 form .label {
     color: #404040;
-    float: left;
-    font-size: 13px;
+    float: left;    
     line-height: 18px;
     padding-top: 6px;
     text-align: right;
     width: 150px;    
+    text-shadow:none;
 }
 form .formw {
     margin-left: 170px;
@@ -2165,23 +2165,6 @@ div.lp_resource {
     padding:5px;    
 }   
 
-/*LP changes
-.lp_resource_element img {
-        float: left;
-    margin-bottom: 0;
-    margin-left: 43px;
-    margin-right: 43px;
-    margin-top: 7px;
-}
-.lp_resource_element a {
-       float: left;
-    margin-bottom: 12px;
-    margin-left: 33px;
-    margin-right: auto;
-    margin-top: 15px;
-    width: 100%;
-}*/
-
 .doc_resource {
     margin:6px;
 }
@@ -2190,7 +2173,6 @@ div.lp_tree {
     height: 100%;
     overflow: auto;
     padding: 3px 10px 3px 0;
-    width: 230px;
 }
 
 table.lp_build td.tree {
@@ -3577,9 +3559,10 @@ a.forum_group_link {
 #hide_bar_template {
     width: 10px;    
     display: inline; 
-    overflow: hidden; 
+    float:left;
     height: 100%; 
     padding-bottom: 90em;
+    margin-bottom: -90em;
     cursor:pointer;
     background-color:#eee;
     margin-left: 0px !important;    

+ 1 - 2
main/css/base_chamilo.css

@@ -882,8 +882,7 @@ div.admin_section h4 {
 .sectioncomment {
     color: #000000;
     margin: 5px 5px 5px 0px;
-    padding: 5px;
-    font-size: 11px;
+    padding: 5px;    
 }
 .sectionvalue {
     list-style-type: none;

+ 6 - 9
main/inc/lib/fckeditor/editor/dialog/fck_template.html

@@ -194,21 +194,18 @@ function ItemDiv_OnMouseOut()
 
 function ItemDiv_OnClick()
 {
-	SelectTemplate( this.TplIndex ) ;
+	SelectTemplate( this.TplIndex ) ;    
+    if (window.top.hide_bar) {
+        window.top.hide_bar();
+    }
 }
 
 function SelectTemplate( index )
 {
 	oEditor.FCKUndo.SaveUndoStep() ;
-	FCK.SetHTML( FCK._Templates[index].Html ) ;
+	FCK.SetHTML( FCK._Templates[index].Html ) ;    
 }
-
-	</script>
-
-	<style type="text/css">
-		body, td, input, textarea, select, label { font-family: Arial, Verdana, Geneva, helvetica, sans-serif; font-size: 11px; }
-	</style>
-
+</script>
 </head>
 <body scroll="no" style="overflow: hidden; background-color: #ffffff;">
 	<table width="100%" style="height: 100%;" valign="top">

+ 90 - 65
main/newscorm/lp_add_item.php

@@ -23,70 +23,79 @@ include 'learnpath_functions.inc.php';
 include 'resourcelinker.inc.php';
 
 $language_file = 'learnpath';
-
 $htmlHeadXtra[] = '
 <script type="text/javascript">
 
-var temp=false;
-var temp2=false;
+var temp    = false;
 var use_document_title='.api_get_setting('use_document_title').';
 var load_default_template = '. ((isset($_POST['submit']) || empty($_SERVER['QUERY_STRING'])) ? 'false' : 'true' ) .';
 
 function FCKeditor_OnComplete( editorInstance ) {
-    editorInstance.Events.AttachEvent( \'OnSelectionChange\', check_for_title ) ;
-    document.getElementById(\'frmModel\').innerHTML = "<iframe height=890px width=230px; frameborder=0 src=\''.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/fckdialogframe.html \'>";
+    editorInstance.Events.AttachEvent( \'OnSelectionChange\', check_for_title) ;
+    document.getElementById(\'frmModel\').innerHTML = "<iframe id=\'frame_template\' name=\'my_frame_template\' height=890px width=220px; frameborder=0 src=\''.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/fckdialogframe.html \'>";
+    loaded = true;
 }
 
-function check_for_title() {
-        if (temp) {
-            // This functions shows that you can interact directly with the editor area
-            // DOM. In this way you have the freedom to do anything you want with it.
+var hide_bar = function() {    
+    $("#main_content .span3").hide(); 
+    $("#hide_bar_template").css({"background-image" : \'url("../img/hide2.png")\'})
+}
 
-            // Get the editor instance that we want to interact with.
-            var oEditor = FCKeditorAPI.GetInstance(\'content_lp\') ;
+function check_for_title() {    
+    
+    if (temp) {  
+    
+        // This functions shows that you can interact directly with the editor area
+        // DOM. In this way you have the freedom to do anything you want with it.
 
-            // Get the Editor Area DOM (Document object).
-            var oDOM = oEditor.EditorDocument ;
+        // Get the editor instance that we want to interact with.
+        var oEditor = FCKeditorAPI.GetInstance(\'content_lp\') ;
 
-            var iLength ;
-            var contentText ;
-            var contentTextArray;
-            var bestandsnaamNieuw = "";
-            var bestandsnaamOud = "";
+        // Get the Editor Area DOM (Document object).
+        var oDOM = oEditor.EditorDocument ;
 
-            // The are two diffent ways to get the text (without HTML markups).
-            // It is browser specific.
+        var iLength ;
+        var contentText ;
+        var contentTextArray;
+        var bestandsnaamNieuw = "";
+        var bestandsnaamOud = "";
 
-            if( document.all )		// If Internet Explorer.
+        // The are two diffent ways to get the text (without HTML markups).
+        // It is browser specific.
+
+        if( document.all )		// If Internet Explorer.
+        {
+            contentText = oDOM.body.innerText ;
+        }
+        else					// If Gecko.
+        {
+            var r = oDOM.createRange() ;
+            r.selectNodeContents( oDOM.body ) ;
+            contentText = r.toString() ;
+        }
+
+        var index=contentText.indexOf("/*<![CDATA");
+        contentText=contentText.substr(0,index);
+
+        // Compose title if there is none
+        contentTextArray = contentText.split(\' \') ;
+        var x=0;
+        for(x=0; (x<5 && x<contentTextArray.length); x++) {
+            if(x < 4)
             {
-                contentText = oDOM.body.innerText ;
+                bestandsnaamNieuw += contentTextArray[x] + \' \';
             }
-            else					// If Gecko.
+            else
             {
-                var r = oDOM.createRange() ;
-                r.selectNodeContents( oDOM.body ) ;
-                contentText = r.toString() ;
-            }
-
-            var index=contentText.indexOf("/*<![CDATA");
-            contentText=contentText.substr(0,index);
-
-            // Compose title if there is none
-            contentTextArray = contentText.split(\' \') ;
-            var x=0;
-            for(x=0; (x<5 && x<contentTextArray.length); x++) {
-                if(x < 4)
-                {
-                    bestandsnaamNieuw += contentTextArray[x] + \' \';
-                }
-                else
-                {
-                    bestandsnaamNieuw += contentTextArray[x];
-                }
+                bestandsnaamNieuw += contentTextArray[x];
             }
         }
-        temp=true;
     }
+    temp=true;
+
+        
+        
+}
 
 function InnerDialogLoaded() {
     if (document.all) {
@@ -118,7 +127,6 @@ $_SESSION['oLP']->get_js_dropdown_array() .
 '}
 
 $(function() {
-
     if ($(\'#previous\')) {
         if(\'parent is\'+$(\'#idParent\').val()) {
             load_cbo($(\'#idParent\').val());
@@ -137,10 +145,6 @@ $(function() {
 
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
 
-$tbl_lp 	 = Database::get_course_table(TABLE_LP_MAIN);
-$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
-$tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW);
-
 $isStudentView  = (int) $_REQUEST['isStudentView'];
 $learnpath_id   = (int) $_REQUEST['lp_id'];
 $submit			= $_POST['submit_button'];
@@ -180,10 +184,13 @@ if (!empty($gradebook) && $gradebook == 'view') {
         );
 }
 
+$type = isset($_GET['type']) ? $_GET['type'] : null;
+$action = isset($_GET['action']) ? $_GET['action'] : null;
+
 $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
 $interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}"));
 
-switch($_GET['type']) {
+switch($type) {
     case 'chapter':
         $interbreadcrumb[]= array ('url' => '#', 'name' => get_lang('NewChapter'));
         break;
@@ -226,6 +233,20 @@ function confirmation(name) {
         return false;
     }
 }
+
+$(document).ready(function() {
+    
+    $("#hide_bar_template").toggle(
+        function() { 
+            $("#main_content .span3").hide(); 
+            $(this).css({'background-image' : 'url("../img/hide2.png")'})
+        },
+        function() { 
+            $("#main_content .span3").show(); 
+            $(this).css('background-image', 'url("../img/hide0.png")'); 
+        }            
+    );    
+});
 </script>
 <?php
 
@@ -233,11 +254,11 @@ function confirmation(name) {
 
 echo $_SESSION['oLP']->build_action_menu();
 
-echo '<div class="row-fluid">';
+echo '<div class="row-fluid" style="overflow:hidden">';
 echo '<div class="span3">';
 
 // Show the template list.
-if (isset($_GET['type']) && $_GET['type'] == 'document' && !isset($_GET['file'])) {
+if ($type == 'document' && !isset($_GET['file'])) {
     $count_items = count($_SESSION['oLP']->ordered_items);
     $style = ($count_items > 12) ? ' style="height:250px;width:230px;overflow-x : auto; overflow-y : scroll;" ' : ' class="lp_tree" ';
     echo '<div  '.$style.'>';
@@ -245,7 +266,7 @@ if (isset($_GET['type']) && $_GET['type'] == 'document' && !isset($_GET['file'])
     echo $_SESSION['oLP']->build_tree();
     echo '</div>';
     // Show the template list.
-    echo '<p style="border-bottom:1px solid #999999; margin:0; padding:2px;"></p>';
+    echo '<p style="border-bottom:1px solid #ddd; margin:0; padding:2px;"></p>';
     echo '<br />';
     echo '<div id="frmModel" style="display:block; height:890px;width:100px; position:relative;"></div>';
 } else {
@@ -254,31 +275,35 @@ if (isset($_GET['type']) && $_GET['type'] == 'document' && !isset($_GET['file'])
     echo $_SESSION['oLP']->build_tree();
     echo '</div>';
 }
-
 echo '</div>';
 
-echo '<div class="span9">';
+//hide bar div
+if ($action == 'add_item' && $type == 'document' && !isset($_GET['file'])) {
+    echo '<div id="hide_bar_template" class="span1"></div>';
+}
+
+echo '<div class="span8">';
 
     if (isset($new_item_id) && is_numeric($new_item_id)) {
-        switch($_GET['type']) {
+        switch ($type) {
             case 'chapter':
                 echo $_SESSION['oLP']->display_manipulate($new_item_id, $_POST['type']);
                 Display::display_confirmation_message(get_lang('NewChapterCreated'));
                 break;
             case TOOL_LINK:
-                echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']);
+                echo $_SESSION['oLP']->display_manipulate($new_item_id, $type);
                 Display::display_confirmation_message(get_lang('NewLinksCreated'));
                 break;
             case TOOL_STUDENTPUBLICATION:
-                echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']);
+                echo $_SESSION['oLP']->display_manipulate($new_item_id, $type);
                 Display::display_confirmation_message(get_lang('NewStudentPublicationCreated'));
                 break;
             case 'module':
-                echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']);
+                echo $_SESSION['oLP']->display_manipulate($new_item_id, $type);
                 Display::display_confirmation_message(get_lang('NewModuleCreated'));
                 break;
             case TOOL_QUIZ:
-                echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']);
+                echo $_SESSION['oLP']->display_manipulate($new_item_id, $type);
                 Display::display_confirmation_message(get_lang('NewExerciseCreated'));
                 break;
             case TOOL_DOCUMENT:
@@ -286,21 +311,21 @@ echo '<div class="span9">';
                 echo $_SESSION['oLP']->display_item($new_item_id, true);
                 break;
             case TOOL_FORUM:
-                echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']);
+                echo $_SESSION['oLP']->display_manipulate($new_item_id, $type);
                 Display::display_confirmation_message(get_lang('NewForumCreated'));
                 break;
             case 'thread':
-                echo $_SESSION['oLP']->display_manipulate($new_item_id, $_GET['type']);
+                echo $_SESSION['oLP']->display_manipulate($new_item_id, $type);
                 Display::display_confirmation_message(get_lang('NewThreadCreated'));
                 break;
         }
     } else {
-        switch($_GET['type']) {
+        switch ($type) {
             case 'chapter':
-                echo $_SESSION['oLP']->display_item_form($_GET['type'], get_lang('EnterDataNewChapter'));
+                echo $_SESSION['oLP']->display_item_form($type, get_lang('EnterDataNewChapter'));
                 break;
             case 'module':
-                echo $_SESSION['oLP']->display_item_form($_GET['type'], get_lang('EnterDataNewModule'));
+                echo $_SESSION['oLP']->display_item_form($type, get_lang('EnterDataNewModule'));
                 break;
             case 'document':
                 if (isset($_GET['file']) && is_numeric($_GET['file'])) {