Fixing delete button in exercise list, renaming the api_get_jqgrid_js() function to api_get_jquery_ui_js

skala
Julio Montoya 15 years ago
parent e24c9e25ba
commit dd75b7d2e0
  1. 2
      main/admin/career_dashboard.php
  2. 2
      main/admin/careers.php
  3. 2
      main/admin/promotions.php
  4. 2
      main/admin/usergroups.php
  5. 5
      main/exercice/admin.php
  6. 65
      main/exercice/question_list_admin.inc.php
  7. 31
      main/inc/lib/main_api.lib.php

@ -22,7 +22,7 @@ api_protect_admin_script();
$this_section = SECTION_PLATFORM_ADMIN;
//Adds the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
$htmlHeadXtra[] = api_get_jquery_ui_js(true);
// setting breadcrumbs
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));

@ -19,7 +19,7 @@ api_protect_admin_script();
//Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
$htmlHeadXtra[] = api_get_jquery_ui_js(true);
// setting breadcrumbs
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));

@ -19,7 +19,7 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
//Adds the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
$htmlHeadXtra[] = api_get_jquery_ui_js(true);
// setting breadcrumbs
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[]=array('url' => 'career_dashboard.php','name' => get_lang('CareersAndPromotions'));

@ -19,7 +19,7 @@ api_protect_admin_script();
//Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
$htmlHeadXtra[] = api_get_jquery_ui_js(true);
// setting breadcrumbs
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));

@ -286,9 +286,8 @@ if($modifyIn == 'thisExercise') {
}
}
$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/cupertino/jquery-ui-1.8.7.custom.css" type="text/css" media="print, projection, screen">';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-1.4.4.min.js" type="text/javascript" language="javascript"></script>'; //jQuery
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/cupertino/jquery-ui-1.8.7.custom.min.js" type="text/javascript" language="javascript"></script>'; //jQuery
$htmlHeadXtra[] = api_get_jquery_ui_js();
$htmlHeadXtra[] = '<script type="text/javascript">

@ -63,8 +63,46 @@ if($deleteQuestion) {
padding-left:4px;
}
</style>
<div id="dialog-confirm" title="<?php echo get_lang("ConfirmYourChoice"); ?>">
<p>
<span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;">
</span>
<?php echo get_lang("AreYouSureToDelete"); ?>
</p>
</div>
<script>
$(function() {
$(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-confirm" ).dialog({
autoOpen: false,
show: "blind",
resizable: false,
height:150,
modal: false
});
$(".opener").click(function() {
var my_id = this.id;
my_id = my_id.split("delete_");
var targetUrl = $(this).attr("href");
$( "#dialog-confirm" ).dialog({
buttons: {
"<?php echo get_lang("Ok"); ?>": function() {
location.href = targetUrl;
$( this ).dialog( "close" );
},
"<?php echo get_lang("Cancel"); ?>": function() {
$( this ).dialog( "close" );
}
}
});
$( "#dialog-confirm" ).dialog("open");
return false;
});
var stop = false;
$( "#question_list h3" ).click(function( event ) {
@ -82,11 +120,14 @@ $(function() {
};
/*We can add links in the accordion header*/
$("div > div > div > .edition > div > a").click(function() {
newWind = window.open(this.href,"_self");
newWind.focus();
return false;
/* We can add links in the accordion header */
$("div > div > div > .edition > div > a").click(function() {
//Avoid the redirecto when selecting the delete button
if (this.id.indexOf('delete') == -1) {
newWind = window.open(this.href,"_self");
newWind.focus();
return false;
}
});
$( "#question_list" ).accordion({
@ -94,7 +135,7 @@ $(function() {
autoHeight: false,
active: false, // all items closed by default
collapsible: true,
header: ".test1",
header: ".header_operations",
})
.sortable({
@ -103,8 +144,7 @@ $(function() {
var order = $(this).sortable("serialize") + "&a=update_question_order";
$.post("<?php echo api_get_path(WEB_AJAX_PATH)?>exercise.ajax.php", order, function(reponse){
$("#message").html(reponse);
});
});
},
axis: "y",
placeholder: "ui-state-highlight", //defines the yellow highlight
@ -148,14 +188,15 @@ if ($nbrQuestions) {
$edit_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&type='.$objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'">'.Display::return_icon('edit.gif',get_lang('Modify')).'</a>';
// this variable $show_quiz_edition comes from admin.php blocks the exercise/quiz modifications
if ($show_quiz_edition) {
$delete_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'))).' \')) return false;">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a>';
$delete_link = '<a id="delete_'.$id.'" class="opener" href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" >'.Display::return_icon('delete.gif',get_lang('Delete')).'</a>';
//$delete_link = '<a id="delete_'.$id.'" class="opener" href="#">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a>';
}
$edit_link = Display::tag('div',$edit_link, array('style'=>'float:left;padding:0px; margin:0px'));
$delete_link = Display::tag('div',$delete_link, array('style'=>'float:left;padding:0px; margin:0px'));
$actions = Display::tag('div',$edit_link.$delete_link, array('class'=>'edition','style'=>'width:70px; right:10px; margin-top: 0px; position: absolute; top: 10%;'));
$actions = Display::tag('div',$edit_link.$delete_link, array('class'=>'edition','style'=>'width:70px; right:10px; margin-top: 0px; position: absolute; top: 10%;'));
echo '<div id="question_id_list_'.$id.'" >';
echo '<div class="test1">';
echo '<div class="header_operations">';
$move = Display::return_icon('move.png',get_lang('Move'), array('class'=>'moved', 'style'=>'margin-bottom:-0.5em;'));
$level = '';
if (!empty($objQuestionTmp->level)) {

@ -4753,23 +4753,19 @@ function api_check_browscap(){
}
/**
* Returns the jqgrid js headers
* Returns the jquery-ui library js headers
* @param bool add the jqgrid library
* @param bool add the jquery library
* @return string html tags
*
*/
function api_get_jqgrid_js($include_jquery = true) {
function api_get_jquery_ui_js($include_jqgrid = false, $include_jquery = true) {
$js = '';
$theme = 'smoothness'; // Current themes: cupertino, smoothness, ui-lightness. Find the themes folder in main/inc/lib/javascript/jquery-ui
$languaje = 'en';
$platform_isocode = strtolower(api_get_language_isocode());
//languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n
$jqgrid_langs = array('bg', 'bg1251', 'cat','cn','cs','da','de','el','en','es','fa','fi','fr','gl','he','hu','is','it','ja','nl','no','pl','pt-br','pt','ro','ru','sk','sr','sv','tr','ua');
if (in_array($platform_isocode, $jqgrid_langs)) {
$languaje = $platform_isocode;
}
if ($include_jquery) {
//Jquery
$js .= '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-1.4.4.min.js" type="text/javascript" language="javascript"></script>'; //jQuery
@ -4777,14 +4773,23 @@ function api_get_jqgrid_js($include_jquery = true) {
//Jquery ui
$js .= '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/'.$theme.'/jquery-ui-1.8.7.custom.css" type="text/css">';
$js .= '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/'.$theme.'/jquery-ui-1.8.7.custom.min.js" type="text/javascript" language="javascript"></script>';
//Grid js
$js .= '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jqgrid/css/ui.jqgrid.css" type="text/css">';
$js .= '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jqgrid/js/i18n/grid.locale-'.$languaje.'.js" type="text/javascript" language="javascript"></script>';
$js .= '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript" language="javascript"></script>';
if ($include_jqgrid) {
//languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n
$jqgrid_langs = array('bg', 'bg1251', 'cat','cn','cs','da','de','el','en','es','fa','fi','fr','gl','he','hu','is','it','ja','nl','no','pl','pt-br','pt','ro','ru','sk','sr','sv','tr','ua');
if (in_array($platform_isocode, $jqgrid_langs)) {
$languaje = $platform_isocode;
}
$js .= '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jqgrid/css/ui.jqgrid.css" type="text/css">';
$js .= '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jqgrid/js/i18n/grid.locale-'.$languaje.'.js" type="text/javascript" language="javascript"></script>';
$js .= '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript" language="javascript"></script>';
}
//Adding default CSS changes for Chamilo in order to preserve the neutral layout
$js .= '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/default.css" type="text/css">';
return $js;
}
}
Loading…
Cancel
Save