Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/LimeSurvey/LimeSurvey
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Feb 17, 2016
2 parents 82e618d + cacfc91 commit 08fabda
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 36 deletions.
Expand Up @@ -39,12 +39,12 @@

<div class="modal-body">
<div class="row">
<div class="col-sm-6">
<div class="col-sm-3">
<select id='labelsets' size='10' style='width:250px;'>
<option>&nbsp;</option>
</select>
</div>
<div class="col-sm-6">
<div class="col-sm-9">
<div id='labelsetpreview'>

</div>
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/survey/Question/question_view.php
Expand Up @@ -112,7 +112,7 @@
<?php eT("Warning"); ?>:
<a href='<?php echo $this->createUrl("admin/questions/sa/subquestions/surveyid/$surveyid/gid/$gid/qid/$qid"); ?>'>
<?php eT("You need to add subquestions to this question"); ?>
<span class="icon-subquestions text-success" title='<?php eT("Edit subquestions for this question"); ?>' ></span>
<span class="icon-defaultanswers text-success" title='<?php eT("Edit subquestions for this question"); ?>' ></span>
</a>
</span>
</td>
Expand Down
Expand Up @@ -152,7 +152,7 @@ class="btn btn-default"
<?php if(Permission::model()->hasSurveyPermission($surveyid,'surveycontent','read')):?>
<?php if($qtypes[$qrrow['type']]['subquestions'] >0):?>
<a class="btn btn-default" href="<?php echo $this->createUrl('admin/questions/sa/subquestions/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid); ?>" role="button">
<span class="icon-subquestions"></span>
<span class="icon-defaultanswers"></span>
<?php eT("Edit subquestions "); ?>
</a>
<?php endif;?>
Expand Down
46 changes: 33 additions & 13 deletions scripts/admin/answers.js
Expand Up @@ -403,15 +403,39 @@ function lspreview()
cache: true,
success: function(json){
$("#labelsetpreview").empty();
var tabindex='';
var tabbody='';
var tabindex='<ul class="nav nav-tabs">';
var tabbody='<div class="tab-content">';
var count=0;
for ( x in json)
{
language=json[x];
for (y in language)
{
tabindex=tabindex+'<li><a href="#language_'+y+'">'+language[y][1]+'</a></li>';
tabbody=tabbody+"<div id='language_"+y+"'><table class='limetable'>";
if(count==0)
{
active="active";
bodyactive="in active";
count++;
}
else
{
active = bodyactive = "";
}

//tabindex=tabindex+'<li><a href="#language_'+y+'">'+language[y][1]+'</a></li>';
//tabbody=tabbody+"<div id='language_"+y+"'><table class='limetable'>";

tabindex=tabindex+
'<li role="presentation" class="'+active+'">'+
' <a data-toggle="tab" href="#language_'+y+'">'+
language[y][1]+
' </a>'+
'</li>';

tabbody=tabbody+
'<div id="language_'+y+'" class="tab-page tab-pane fade '+bodyactive+'">'+
' <table class="limetable">';

lsrows=language[y][0];
tablerows='';
var highlight=true;
Expand Down Expand Up @@ -442,22 +466,18 @@ function lspreview()
tabbody=tabbody+'<th>'+strlabel+'</th></tr></thead></table></div>';
}
}
$("#labelsetpreview").append('<ul>'+tabindex+'</ul>'+tabbody);
labelcache[lsid]='<ul>'+tabindex+'</ul>'+tabbody;
$("#labelsetpreview").tabs();
$("#labelsetpreview").tabs('refresh');
tabindex=tabindex+'</ul>';
tabbody=tabbody+'</div>';
$("#labelsetpreview").append(tabindex+tabbody);
labelcache[lsid]=tabindex+tabbody;
}
});
}
else
{
$("#labelsetpreview").empty();
$("#labelsetpreview").append(labelcache[lsid]);
$("#labelsetpreview").tabs();
$("#labelsetpreview").tabs('refresh');
}


}

/**
Expand Down Expand Up @@ -763,7 +783,7 @@ function quickaddlabels()
' <span class="glyphicon glyphicon-pencil btneditanswerena" data-toggle="tooltip" data-placement="bottom" title="Start HTML editor in a popup window" ></span>'+
' <span class="btneditanswerdis glyphicon glyphicon-pencil text-success" title="Give focus to the HTML editor popup window" style="display: none;"></span>'+
' </a>'+

' <span class="btnaddanswer icon-add text-success"></span>'+
' <span class="btndelanswer glyphicon glyphicon-trash text-warning"></span>'+
' </td>'+
Expand Down
54 changes: 35 additions & 19 deletions scripts/admin/subquestions.js
Expand Up @@ -457,9 +457,9 @@ function lsbrowser()
}
else
{
$("#labelsetpreview").html("<p class='ui-state-highlight ui-corner-all ui-notify-message'>"+strNoLabelSet+"</p>");
$('#btnlsreplace').addClass('ui-state-disabled');
$('#btnlsinsert').addClass('ui-state-disabled');
$("#labelsetpreview").html("<p class='alert alert-warning'>"+strNoLabelSet+"</p>");
$('#btnlsreplace').addClass('disabled');
$('#btnlsinsert').addClass('disabled');
$('#btnlsreplace').prop( "disabled", true );
$('#btnlsinsert').prop( "disabled", true );
}
Expand All @@ -479,7 +479,7 @@ function lspreview()
surveyid=$('input[name=sid]').val();
// check if this label set is already cached
if (!isset(labelcache[lsid]))
{
{
$.ajax({
url: lsdetailurl,
dataType: 'json',
Expand All @@ -488,49 +488,65 @@ function lspreview()
success: function(json){
//$("#labelsetpreview").tabs('destroy');
$("#labelsetpreview").empty();
var tabindex='';
var tabbody='';
var tabindex='<ul class="nav nav-tabs">';
var tabbody='<div class="tab-content">';
var count=0;
for ( x in json)
{

{
language=json[x];
for (y in language)
{
if(count==0)
{
active="active";
bodyactive="in active";
count++;
}
else
{
tabindex=tabindex+'<li><a href="#language_'+y+'">'+language[y][1]+'</a></li>';
tabbody=tabbody+"<div id='language_"+y+"'><table class='limetable'>";
active = bodyactive = "";
}

tabindex=tabindex+
'<li role="presentation" class="'+active+'">'+
' <a data-toggle="tab" href="#language_'+y+'">'+
language[y][1]+
' </a>'+
'</li>';

tabbody=tabbody+
'<div id="language_'+y+'" class="tab-page tab-pane fade '+bodyactive+'">'+
' <table class="limetable">';
lsrows=language[y][0];
tablerows='';
var highlight=true;
for (z in lsrows)
{
{
highlight=!highlight;
tabbody=tabbody+'<tbody><tr';
if (highlight==true) {
tabbody=tabbody+" class='highlight' ";
}
if (lsrows[z].title==null)
{
{
lsrows[z].title='';
}
tabbody=tabbody+'><td>'+lsrows[z].code+'</td><td>'+htmlspecialchars(lsrows[z].title)+'</td></tr><tbody>';
}
tabbody=tabbody+'<thead><tr><th>'+strcode+'</th><th>'+strlabel+'</th></tr></thead></table></div>';
}
}
$("#labelsetpreview").append('<ul>'+tabindex+'</ul>'+tabbody);
labelcache[lsid]='<ul>'+tabindex+'</ul>'+tabbody;
$("#labelsetpreview").tabs();
$("#labelsetpreview").tabs( "refresh" );
tabindex=tabindex+'</ul>';
tabbody=tabbody+'</div>';
$("#labelsetpreview").append(tabindex+tabbody);
labelcache[lsid]=tabindex+tabbody;
}}
);
}
else
{
//$("#labelsetpreview").tabs('destroy');
$("#labelsetpreview").empty();
$("#labelsetpreview").append(labelcache[lsid]);
$("#labelsetpreview").tabs();
$("#labelsetpreview").tabs( "refresh" );
}


Expand Down
9 changes: 9 additions & 0 deletions styles/Sea_Green/css/lime-admin-misc.css
Expand Up @@ -54,3 +54,12 @@ iframe#dialog {
#pager {
position: relative;
}

#labelsetpreview {
overflow-x: hidden;
}

#labelsetbrowserModal .modal-dialog
{
width: 80%;
}

0 comments on commit 08fabda

Please sign in to comment.