Browse Source

Restoring jquery-ui styles

Julio Montoya 12 years ago
parent
commit
9fd6838989
3 changed files with 77 additions and 82 deletions
  1. 75 75
      main/admin/session_list.php
  2. 0 2
      main/inc/lib/main_api.lib.php
  3. 2 5
      main/inc/lib/template.lib.php

+ 75 - 75
main/admin/session_list.php

@@ -11,14 +11,14 @@ api_protect_admin_script(true);
 
 //Add the JS needed to use the jqgrid
 $htmlHeadXtra[] = api_get_jqgrid_js();
+
 $htmlHeadXtra[] = api_get_js('json-js/json2.js');
 $htmlHeadXtra[] = api_get_js('date/date.js');
 
 $htmlHeadXtra = api_get_datetime_picker_js($htmlHeadXtra);
 
-$action = $_REQUEST['action'];
-$idChecked = $_REQUEST['idChecked'];
-
+$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
+$idChecked = isset($_REQUEST['idChecked']) ? $_REQUEST['idChecked'] : null;
 $list_type = isset($_REQUEST['list_type']) ? $_REQUEST['list_type'] : 'simple';
 
 if ($action == 'delete') {
@@ -50,13 +50,13 @@ $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions&list_type='.$l
 
 if (isset($_REQUEST['keyword'])) {
     //Begin with see the searchOper param
-    $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions&_search=true&rows=20&page=1&sidx=&sord=asc&filters=&searchField=name&searchString='.Security::remove_XSS($_REQUEST['keyword']).'&searchOper=bw';    
+    $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions&_search=true&rows=20&page=1&sidx=&sord=asc&filters=&searchField=name&searchString='.Security::remove_XSS($_REQUEST['keyword']).'&searchOper=bw';
 }
 
-//Autowidth             
+//Autowidth
 $extra_params['autowidth'] = 'true';
-//Height auto 
-$extra_params['height'] = '100%'; 
+//Height auto
+$extra_params['height'] = '100%';
 
 $extra_params['rowList'] = array(20, 50, 100, 250, 500);
 
@@ -65,15 +65,15 @@ $columns = $result['columns'];
 $column_model = $result['column_model'];
 
 $extra_params['postData'] =array (
-                    'filters' => array(                                        
-                                        "groupOp" => "AND",                                         
-                                        "rules" => $result['rules'], 
+                    'filters' => array(
+                                        "groupOp" => "AND",
+                                        "rules" => $result['rules'],
                                         /*array(
                                             array( "field" => "display_start_date", "op" => "gt", "data" => ""),
                                             array( "field" => "display_end_date", "op" => "gt", "data" => "")
-                                        ),*/ 
+                                        ),*/
                                         //'groups' => $groups
-                                )                                
+                                )
 );
 
 //With this function we can add actions to the jgrid (edit, delete, etc)
@@ -83,17 +83,17 @@ $action_links = 'function action_formatter(cellvalue, options, rowObject) {
                          '&nbsp;<a href="add_courses_to_session.php?page=session_list.php&id_session=\'+options.rowId+\'">'.Display::return_icon('courses_to_session.png',get_lang('SubscribeCoursesToSession'),'',ICON_SIZE_SMALL).'</a>'.
                          '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;"  href="session_list.php?action=copy&idChecked=\'+options.rowId+\'">'.Display::return_icon('copy.png',get_lang('Copy'),'',ICON_SIZE_SMALL).'</a>'.
                          '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;"  href="session_list.php?action=delete&idChecked=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
-                         '\'; 
+                         '\';
                  }';
 $url_select = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1';
 ?>
 <script>
 
-function setSearchSelect(columnName) {    
+function setSearchSelect(columnName) {
     $("#sessions").jqGrid('setColProp', columnName, {
-        
+
        /*searchoptions:{
-            dataInit:function(el){                            
+            dataInit:function(el){
                 $("option[value='1']",el).attr("selected", "selected");
                 setTimeout(function(){
                     $(el).trigger('change');
@@ -106,14 +106,14 @@ var added_cols = [];
 var original_cols = [];
 
 function clean_cols(grid, added_cols) {
-    //Cleaning 
+    //Cleaning
     for (key in added_cols) {
-        //console.log('hide: ' + key);                    
+        //console.log('hide: ' + key);
         grid.hideCol(key);
     };
     grid.showCol('name');
     grid.showCol('display_start_date');
-    grid.showCol('display_end_date');    
+    grid.showCol('display_end_date');
     grid.showCol('course_title');
 }
 
@@ -122,14 +122,14 @@ function show_cols(grid, added_cols) {
     for (key in added_cols) {
         //console.log('show: ' + key);
         grid.showCol(key);
-    };    
+    };
 }
 
 var second_filters = [];
 
 $(function() {
-  
-    
+
+
     date_pick_today = function(elem) {
         $(elem).datetimepicker({dateFormat: "yy-mm-dd"});
         $(elem).datetimepicker('setDate', (new Date()));
@@ -139,20 +139,20 @@ $(function() {
         next_month = Date.today().next().month();
         $(elem).datetimepicker('setDate', next_month);
     }
-    
+
     //Great hack
     register_second_select = function(elem) {
-        second_filters[$(elem).val()] = $(elem);        
+        second_filters[$(elem).val()] = $(elem);
     }
-    
+
     fill_second_select = function(elem) {
         $(elem).on("change", function() {
             composed_id = $(this).val();
             field_id = composed_id.split("#")[0];
             id = composed_id.split("#")[1];
-            
+
             $.ajax({
-                url: "<?php echo $url_select ?>&a=get_second_select_options", 
+                url: "<?php echo $url_select ?>&a=get_second_select_options",
                 dataType: "json",
                 data: "type=session&field_id="+field_id+"&option_value_id="+id,
                 success: function(data) {
@@ -163,106 +163,106 @@ $(function() {
                             value: index,
                             text: value
                         }));
-                    });            
+                    });
                 }
-            }); 
-        });        
+            });
+        });
     }
 
-    <?php 
-        echo Display::grid_js('sessions', $url, $columns, $column_model, $extra_params, array(), $action_links, true);      
+    <?php
+        echo Display::grid_js('sessions', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
     ?>
-    
+
     setSearchSelect("status");
-    
+
     var grid = $("#sessions"),
     prmSearch = {
-        multipleSearch : true, 
-        overlay : false, 
+        multipleSearch : true,
+        overlay : false,
         width: 'auto',
         caption: '<?php echo addslashes(get_lang('Search')); ?>',
-        formclass:'data_table',     
+        formclass:'data_table',
         onSearch : function() {
             var postdata = grid.jqGrid('getGridParam', 'postData');
-            
+
             if (postdata && postdata.filters) {
                 filters = jQuery.parseJSON(postdata.filters);
                 clean_cols(grid, added_cols);
-                added_cols = [];    
+                added_cols = [];
                 //console.log(postdata);
                 $.each(filters, function(key, value){
                     console.log('key: ' + key );
-                    
+
                     if (key == 'rules') {
                         $.each(value, function(subkey, subvalue) {
-                            
-                            if (subvalue.data == undefined) {                                
+
+                            if (subvalue.data == undefined) {
                             }
-                            
+
                             //if (added_cols[value.field] == undefined) {
                                 added_cols[subvalue.field] = subvalue.field;
                             //}
-                            //grid.showCol(value.field);                            
+                            //grid.showCol(value.field);
                         });
-                    }                    
+                    }
                 });
-                show_cols(grid, added_cols);                
+                show_cols(grid, added_cols);
             }
        },
-       onReset: function() {      
+       onReset: function() {
             clean_cols(grid, added_cols);
        }
     };
-    
-    original_cols = grid.jqGrid('getGridParam', 'colModel');    
-    
-    grid.jqGrid('navGrid','#sessions_pager', 
+
+    original_cols = grid.jqGrid('getGridParam', 'colModel');
+
+    grid.jqGrid('navGrid','#sessions_pager',
         {edit:false,add:false,del:false},
-        {height:280,reloadAfterSubmit:false}, // edit options 
-        {height:280,reloadAfterSubmit:false}, // add options 
-        {reloadAfterSubmit:false},// del options 
+        {height:280,reloadAfterSubmit:false}, // edit options
+        {height:280,reloadAfterSubmit:false}, // add options
+        {reloadAfterSubmit:false},// del options
         prmSearch
     );
-                  
+
     // create the searching dialog
     grid.searchGrid(prmSearch);
-    
+
     //Fixes search table
     var searchDialogAll = $("#fbox_"+grid[0].id);
     searchDialogAll.addClass("table");
-    
-    var searchDialog = $("#searchmodfbox_"+grid[0].id);    
+
+    var searchDialog = $("#searchmodfbox_"+grid[0].id);
     searchDialog.addClass("ui-jqgrid ui-widget ui-widget-content ui-corner-all");
-    searchDialog.css({position:"relative", "z-index":"auto", "float":"left"})    
+    searchDialog.css({position:"relative", "z-index":"auto", "float":"left"})
     var gbox = $("#gbox_"+grid[0].id);
     gbox.before(searchDialog);
     gbox.css({clear:"left"});
-    
-    //Select first elements by default 
+
+    //Select first elements by default
     $('.input-elm').each(function(){
-        $(this).find('option:first').attr('selected', 'selected');        
+        $(this).find('option:first').attr('selected', 'selected');
     });
-    
+
     $('.delete-rule').each(function(){
         $(this).click(function(){
              $('.input-elm').each(function(){
-                $(this).find('option:first').attr('selected', 'selected');        
+                $(this).find('option:first').attr('selected', 'selected');
             });
-        });        
+        });
     });
-    
+
     /*
     $('.delete-rule').on('click', function(){
         console.log('deleted');
         $('.input-elm').each(function(){
-            $(this).find('option:first').attr('selected', 'selected');        
+            $(this).find('option:first').attr('selected', 'selected');
         });
     });*/
-    
-    
+
+
 });
 </script>
-<?php 
+<?php
 echo '<div class="actions">';
 echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/session_add.php">'.Display::return_icon('new_session.png',get_lang('AddSession'),'',ICON_SIZE_MEDIUM).'</a>';
 echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/add_many_session_to_category.php">'.Display::return_icon('session_to_category.png',get_lang('AddSessionsInCategories'),'',ICON_SIZE_MEDIUM).'</a>';
@@ -282,17 +282,17 @@ $form->addElement('text', 'start_date_start', get_lang('Between'), array('id' =>
 $form->addElement('text', 'start_date_end', get_lang('And'), array('id' =>'start_date_end'));
 $renderer = $form->defaultRenderer();
 
-$renderer->setElementTemplate(get_lang('StartDate').' {label} {element}', 'start_date_start');  
-$renderer->setElementTemplate('{label} {element}', 'start_date_end');  
+$renderer->setElementTemplate(get_lang('StartDate').' {label} {element}', 'start_date_start');
+$renderer->setElementTemplate('{label} {element}', 'start_date_end');
 
 $form->addElement('html', '<div class="clear"></div>');
 
 $form->addElement('text', 'end_date_start', get_lang('Between'), array('id' =>'end_date_start'));
 $form->addElement('text', 'end_date_end', get_lang('And'), array('id' =>'end_date_end'));
 
-$renderer->setElementTemplate(get_lang('EndDate').' {label} {element}', 'end_date_start');  
-$renderer->setElementTemplate('{label} {element}', 'end_date_end');  
-           
+$renderer->setElementTemplate(get_lang('EndDate').' {label} {element}', 'end_date_start');
+$renderer->setElementTemplate('{label} {element}', 'end_date_end');
+
 $options = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
 $form->addElement('select', 'course', get_lang('Course'), $options);
 $form->addElement('button', 'submit', get_lang('Search'), array('id' => 'search_button'));

+ 0 - 2
main/inc/lib/main_api.lib.php

@@ -22,7 +22,6 @@ define('REQUIRED_MIN_POST_MAX_SIZE',        '10');
 
 use \ChamiloSession as Session;
 
-
 // USER STATUS CONSTANTS
 /** global status of a user: student */
 define('STUDENT', 5);
@@ -5953,7 +5952,6 @@ function api_get_jquery_libraries_js($libraries) {
         if (in_array($platform_isocode, $jqgrid_langs)) {
             $languaje = $platform_isocode;
         }
-        //$js .= '<link rel="stylesheet" href="'.$js_path.'jqgrid/css/ui.jqgrid.css" type="text/css">';
         $js .= api_get_css($js_path.'jqgrid/css/ui.jqgrid.css');
         $js .= api_get_js('jqgrid/js/i18n/grid.locale-'.$languaje.'.js');
         $js .= api_get_js('jqgrid/js/jquery.jqGrid.min.js');

+ 2 - 5
main/inc/lib/template.lib.php

@@ -8,9 +8,6 @@
  * */
 use \ChamiloSession as Session;
 
-require_once api_get_path(LIBRARY_PATH) . 'banner.lib.php';
-require_once api_get_path(LIBRARY_PATH) . 'symfony/Twig/Autoloader.php';
-
 class Template {
 
     public $style = 'default'; //see the template folder
@@ -402,8 +399,8 @@ class Template {
             $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chat/css/chat.css';
         }
 
-        //$css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/'.$this->jquery_ui_theme.'/jquery-ui-custom.css';
-        //$css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/default.css';
+        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/'.$this->jquery_ui_theme.'/jquery-ui-custom.css';
+        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/default.css';
 
         $css_file_to_string = null;
         foreach ($css as $file) {