Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
shibakaneki 13 years ago
commit 36abfc5c32
  1. 16
      resources/library/interactive/Choisir.wgt/config.xml
  2. 344
      resources/library/interactive/Choisir.wgt/css/basic.css
  3. BIN
      resources/library/interactive/Choisir.wgt/icon.png
  4. BIN
      resources/library/interactive/Choisir.wgt/images/1thOption.png
  5. BIN
      resources/library/interactive/Choisir.wgt/images/2thOption.png
  6. BIN
      resources/library/interactive/Choisir.wgt/images/3thOption.png
  7. BIN
      resources/library/interactive/Choisir.wgt/images/addSomething.png
  8. BIN
      resources/library/interactive/Choisir.wgt/images/bigBlackClose.png
  9. BIN
      resources/library/interactive/Choisir.wgt/images/blueClose.png
  10. BIN
      resources/library/interactive/Choisir.wgt/images/boldBlackClose.png
  11. BIN
      resources/library/interactive/Choisir.wgt/images/boldClose.png
  12. BIN
      resources/library/interactive/Choisir.wgt/images/boldGreyClose.png
  13. BIN
      resources/library/interactive/Choisir.wgt/images/bottomLeftThing.png
  14. BIN
      resources/library/interactive/Choisir.wgt/images/complete.png
  15. BIN
      resources/library/interactive/Choisir.wgt/images/grayClose.png
  16. BIN
      resources/library/interactive/Choisir.wgt/images/greySquare.png
  17. BIN
      resources/library/interactive/Choisir.wgt/images/greySquareArrow.png
  18. BIN
      resources/library/interactive/Choisir.wgt/images/horSep.png
  19. BIN
      resources/library/interactive/Choisir.wgt/images/leftThing.png
  20. BIN
      resources/library/interactive/Choisir.wgt/images/lessBottomBorder.png
  21. BIN
      resources/library/interactive/Choisir.wgt/images/lessTopBorder.png
  22. BIN
      resources/library/interactive/Choisir.wgt/images/lowerBack.png
  23. BIN
      resources/library/interactive/Choisir.wgt/images/lowerBorder.png
  24. BIN
      resources/library/interactive/Choisir.wgt/images/lowerBorder2.png
  25. BIN
      resources/library/interactive/Choisir.wgt/images/niceBack.png
  26. BIN
      resources/library/interactive/Choisir.wgt/images/niceBack2.png
  27. BIN
      resources/library/interactive/Choisir.wgt/images/niceBack3.png
  28. BIN
      resources/library/interactive/Choisir.wgt/images/pencil.png
  29. BIN
      resources/library/interactive/Choisir.wgt/images/point.png
  30. BIN
      resources/library/interactive/Choisir.wgt/images/redBoldClose.png
  31. BIN
      resources/library/interactive/Choisir.wgt/images/reload.jpg
  32. BIN
      resources/library/interactive/Choisir.wgt/images/reload2.png
  33. BIN
      resources/library/interactive/Choisir.wgt/images/rightThing.png
  34. BIN
      resources/library/interactive/Choisir.wgt/images/separator.png
  35. BIN
      resources/library/interactive/Choisir.wgt/images/separator2.png
  36. BIN
      resources/library/interactive/Choisir.wgt/images/settings.png
  37. BIN
      resources/library/interactive/Choisir.wgt/images/sidePoints.png
  38. BIN
      resources/library/interactive/Choisir.wgt/images/spanner.png
  39. BIN
      resources/library/interactive/Choisir.wgt/images/star.png
  40. BIN
      resources/library/interactive/Choisir.wgt/images/stop.jpg
  41. BIN
      resources/library/interactive/Choisir.wgt/images/tool.png
  42. BIN
      resources/library/interactive/Choisir.wgt/images/topLeftThing.png
  43. BIN
      resources/library/interactive/Choisir.wgt/images/transparentBack.png
  44. BIN
      resources/library/interactive/Choisir.wgt/images/upperBorder.png
  45. BIN
      resources/library/interactive/Choisir.wgt/images/upperBorder2.png
  46. 24
      resources/library/interactive/Choisir.wgt/index.html
  47. 5
      resources/library/interactive/Choisir.wgt/nbproject/private/private.properties
  48. 4
      resources/library/interactive/Choisir.wgt/nbproject/private/private.xml
  49. 7
      resources/library/interactive/Choisir.wgt/nbproject/project.properties
  50. 9
      resources/library/interactive/Choisir.wgt/nbproject/project.xml
  51. 18
      resources/library/interactive/Choisir.wgt/scripts/jquery-1.6.2.min.js
  52. 436
      resources/library/interactive/Choisir.wgt/scripts/selQuestionApp.js
  53. 27
      src/web/browser/WBBrowserWindow.cpp
  54. 77
      src/web/browser/WBTabWidget.cpp
  55. 2
      src/web/browser/WBTabWidget.h

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:ub="http://uniboard.mnemis.com/widgets"
id="http://uniboard.mnemis.com/widgets/webbrowser"
version="1.1"
width="650"
height="400"
ub:resizable="true">
<name>Choisir</name>
<author href="http://www.getuniboard.com"
email="info@mnemis.com">Mnemis SA</author>
<description>Choisir widget</description>
<content src="index.html"/>
</widget>

@ -0,0 +1,344 @@
/*
Document : basic
Created on : Sep 5, 2011, 12:01:33 PM
Author : GEG.BY
Description:
Purpose of the stylesheet follows.
*/
/*
TODO customize this sample style
Syntax recommendation http://www.w3.org/TR/REC-CSS2/
*/
body{
padding: 3px;
margin: 0 auto;
height: auto;
}
.toggleButton{
width: 20px;
height: 28px;
border: none;
background-image: url(../images/greySquare.png);
font-weight: bold;
font-family: Verdana;
color: #00C6FF;;
cursor: pointer;
}
.buttonDiv{
position: absolute;
float: right;
z-index: 1;
}
.addQstDiv{
float: left;
padding: 5px;
margin: 2px;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: large;
}
.addQstButton{
margin: 0;
border: none;
background: none;
color: #E6E3DC;
cursor: pointer;
}
#addQsqSpan1{
font-size: 30px;
margin-right: 10px !important;
}
.qstDiv{
width: 90%;
margin: 2px auto;
padding: 5px;
float: left;
font-family: Verdana,Arial,Helvetica,sans-serif;
}
.qstDivDisplay{
width: 90%;
margin: 5px 5%;
padding: 5px;
float: left;
font-family: Verdana,Arial,Helvetica,sans-serif;
border: 2px solid #cccccc;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: #dadada -1px 0 4px;
-webkit-box-shadow: #dadada -1px 0 4px;
box-shadow: #dadada -1px 0 4px;
}
.spanOptConn{
float: left;
width: 100%;
}
.qstNumber{
float: left;
font-size: 30px;
margin-left: 10px !important;
color: #00C6FF;
}
.qstOptions{
float: right;
}
.changeOptions{
border: none;
background-image: url(../images/grayClose.png);
background-color: white;
background-repeat: no-repeat;
background-position: 0 50%;
width: auto;
padding-left: 18px;
color: #E6E3DC;
cursor: pointer;
}
.applyChanges{
border: none;
background-image: url(../images/blueClose.png);
background-color: white;
background-repeat: no-repeat;
background-position: 0 50%;
width: auto;
padding-left: 18px;
color: #E6E3DC;
cursor: pointer;
}
.qstDelete{
border: none;
background-image: url(../images/boldClose.png);
background-color: white;
background-repeat: no-repeat;
background-position: 0 50%;
width: auto;
padding-left: 28px;
line-height: 35px;
cursor: pointer;
}
.qstContent{
float: left;
padding: 3px;
margin-left: 10px;
margin-bottom: 10px;
width: 100%;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: small;
border: 3px solid #ccc;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: #dadada -1px 0 4px;
-webkit-box-shadow: #dadada -1px 0 4px;
box-shadow: #dadada -1px 0 4px;
}
.qstContentDisplay{
float: left;
padding: 5px;
margin: 10px;
width: 100%;
font-family: Verdana,Arial,Helvetica,sans-serif;
color:#333333;
}
.ansDiv{
float: left;
margin-left: 100px;
width: 80%;
}
.ansAdd{
border: none;
background: url(../images/blueClose.png) -0px -0px no-repeat;
background-color: white;
width: auto;
padding-left: 20px;
line-height: 24px;
color: #E6E3DC;
cursor: pointer;
}
.newAnswer{
float: left;
width: 100%;
margin: 3px;
}
.ansSpan{
border: none;
background: url(../images/point.png) -0px -0px no-repeat;
background-color: white;
background-position: 0 50%;
color: #00C6FF;
font-size: 14px;
float: left;
padding-left: 35px;
width: 20px;
}
.ansSpanDisplay{
color: #00C6FF;
font-size: 14px;
float: left;
}
.ansContent{
padding: 1px 3px 3px 3px;
margin-left: 5px;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: small;
width: 80%;
float: left;
border: 3px solid #ccc;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: #dadada -1px 0 4px;
-webkit-box-shadow: #dadada -1px 0 4px;
box-shadow: #dadada -1px 0 4px;
}
.ansContentDisplay{
padding: 1px 3px 3px 3px;
margin-left: 5px;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: small;
width: 80%;
float: left;
}
.ansDelete{
float: right;
border: none;
background-image: url(../images/boldGreyClose.png);
background-color: white;
background-repeat: no-repeat;
background-position: 0 50%;
cursor: pointer;
}
.qstOptChoice{
width: 80%;
margin: 10px 10%;
float: left;
background-color: #F3F3F2;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #ECECEB;
border-right-color: #ECECEB;
border-bottom-color: #ECECEB;
border-left-color: #ECECEB;
border-top-left-radius: 5px 5px;
border-top-right-radius: 5px 5px;
border-bottom-right-radius: 5px 5px;
border-bottom-left-radius: 5px 5px;
-webkit-box-shadow: #dededd 0 0 2px inset;
padding: 0;
}
.optDescImg{
padding: 2px;
margin: 5px;
background: url(../images/tool.png) -0px -0px no-repeat;
float: left;
margin-left: 20px;
width: 56px;
height: 51px;
}
.optDescText{
text-align: center;
width: 70%;
color: #CCC;
float: left;
font-size: small;
font-family: Verdana,Arial,Helvetica,sans-serif;
margin: 3px 5px;
padding: 5px;
}
.type{
float: left;
margin: 10px;
padding: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: #dadada -1px 0 4px;
-webkit-box-shadow: #dadada -1px 0 4px;
box-shadow: #dadada -1px 0 4px;
}
.contentType{
width: 100%;
padding: 0;
margin: 0;
background-color: white;
border-bottom: 1px solid #DFDFDE;
border-top-left-radius: 5px 5px;
border-top-right-radius: 5px 5px;
}
.divType1, .divType2, .divType3 {
width: 122px;
height: 97px;
padding: 0 15px;
margin-left: 30px;
}
.divType1{
background: url(../images/1thOption.png)-0px -0px no-repeat;
}
.divType2{
background: url(../images/2thOption.png)-0px -0px no-repeat;
}
.divType3{
background: url(../images/3thOption.png)-0px -0px no-repeat;
}
.textType{
width: 160px;
font-size: small;
font-family: Verdana,Arial,Helvetica,sans-serif;
color: #AAA;
padding: 3px;
margin-left: 20px;
}
.radioDiv{
background-color: #F5F5F5;
border-top: 1px solid white;
width: 100%;
padding: 0;
margin: 0;
height: 30px;
border-bottom-right-radius: 5px 5px;
border-bottom-left-radius: 5px 5px;
}
.radioType{
float: right;
margin: 2px;
padding: 3px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

@ -0,0 +1,24 @@
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/basic.css"/>
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="scripts/selQuestionApp.js"></script>
<script type="text/javascript">
$(document).ready(function(){
init();
});
</script>
</head>
<body>
</body>
</html>

@ -0,0 +1,5 @@
copy.src.files=false
copy.src.target=
index.file=index.html
run.as=LOCAL
url=http://localhost/Choisir.wgt/

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
</project-private>

@ -0,0 +1,7 @@
include.path=${php.global.include.path}
php.version=PHP_5
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=true
web.root=.

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>Choisir.wgt</name>
</data>
</configuration>
</project>

File diff suppressed because one or more lines are too long

@ -0,0 +1,436 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
var questionArray;
var currentQstId = "";
function init(){
//variables
var toggleFlag = false;
var endFlag = false;
var mode = false;
questionArray = new Array();
// toggle button
var buttonDiv = $("<div id='buttonDiv' class='buttonDiv'>").appendTo("body");
var toggleButton = $("<button id='toggleButton' class='toggleButton'><</button>").appendTo("#buttonDiv");
buttonDiv.css({
top:"10px",
right:0
});
// adding question block
var addQstDiv = $("<div id='addQstDiv' class='addQstDiv'>").appendTo("body");
var addQstButton = $("<button id='addQstButton' class='addQstButton'>").appendTo("#addQstDiv");
var addQsqSpan1 = $("<span id='addQsqSpan1'>Q1</span>").appendTo("#addQstButton");
var addQsqSpan2 = $("<span id='addQsqSpan2'>Add new question ... </span>").appendTo("#addQstButton");
//import saved data
if(window.sankore){
if(sankore.preference("qstArrayData","")){
questionArray = jQuery.parseJSON(sankore.preference("qstArrayData",""));
for(var i in questionArray){
addQstBlock(questionArray[i].id, questionArray[i].text, questionArray[i].type,"style='display: none;'");
for(var j in questionArray[i].answers)
addAnsBlock(questionArray[i].answers[j].id, questionArray[i].id, questionArray[i].answers[j].text);
}
}
}
// add question
addQstButton.click(function(){
//question block
var id = Math.round(Math.random()*1000);
var obj = new Question();
obj.id = id;
questionArray.push(obj);
addQstBlock(id, "Enter your question here ...", "","");
if(window.sankore)
sankore.setPreference("qstArrayData", JSON.stringify(questionArray));
});
//toggle mode
toggleButton.click(function(){
if(mode){
editData();
mode = false;
} else {
if(window.sankore)
sankore.setPreference("qstArrayData", JSON.stringify(questionArray));
if(checkArrayOnFill(questionArray) != 0)
displayData(true);
else
displayData(false);
mode = true;
}
toggleButton.trigger("mouseout");
});
// toggle button events
toggleButton.mouseover(function(){
if(!toggleFlag && !endFlag){
endFlag = true;
toggleButton.animate({
width:"72px"
},"fast",function(){
toggleFlag = true;
if(!mode)
toggleButton.text("Display");
else
toggleButton.text("Edit");
});
}
});
toggleButton.mouseout(function(){
if(toggleFlag && endFlag){
endFlag = false;
toggleButton.animate({
width:"20px"
},"fast", function(){
toggleButton.text("<");
toggleFlag = false;
});
}
});
//set used at this moment question id into the variable
$(".qstDiv").live('mouseover', function() {
currentQstId = this.id;
});
//adding new answer
$(".ansAdd").live('click', function(){
var id = Math.round(Math.random()*1000);
var obj = new Answer();
obj.id = id;
getNeededElement(questionArray, currentQstId).answers.push(obj);
addAnsBlock(id, currentQstId, "Enter the answer here ...");
});
//set answer text
$(".ansContent").live('keyup', function(event){
var id = $(event.target).attr("id").replace("ansContent","");
getNeededElement(getNeededElement(questionArray, currentQstId).answers,id).text = $(event.target).text();
//questionArray[currentQstId].answers[id].text = $(event.target).text();
});
//set question text
$(".qstContent").live('keyup', function(event){
var id = $(event.target).attr("id").replace("qstContent","");
getNeededElement(questionArray, id).text = $(event.target).text();
});
//question div border
$(".qstContent").live('mouseover', function(event){
$(event.target).css({
border:"3px solid #00C6FF"
});
});
// deleting question div border
$(".qstContent").live('mouseout', function(event){
$(event.target).css({
border:"3px solid #ccc"
});
});
//answer div border
$(".ansContent").live('mouseover', function(event){
$(event.target).css({
border:"3px solid #00C6FF"
});
});
// deleting answer div border
$(".ansContent").live('mouseout', function(event){
$(event.target).css({
border:"3px solid #ccc"
});
});
//delete answer
$(".ansDelete").live('click', function(){
var id = this.id.replace("ansDelete","");
$("#" + id).remove();
for(var i in questionArray)
if(questionArray[i].id == currentQstId){
for(var j in questionArray[i].answers)
if(questionArray[i].answers[j].id == id){
delete questionArray[i].answers[j];
break;
}
}
refreshAns();
});
//delete question
$(".qstDelete").live('click', function(){
$("#" + currentQstId).remove();
for(var i in questionArray)
if(questionArray[i].id == currentQstId){
delete questionArray[i];
break;
}
refreshQst();
});
//change options
$(".changeOptions").live('click', function(){
$("#" + currentQstId + "qstOptions .changeOptions").hide();
$("#" + currentQstId + "qstOptions .applyChanges").show();
$("#" + currentQstId + "qstOptChoice").show('fast');
});
//apply changes
$(".applyChanges").live('click', function(){
$("#" + currentQstId + "qstOptions .applyChanges").hide();
$("#" + currentQstId + "qstOptions .changeOptions").show();
$("#" + currentQstId + "qstOptChoice").hide('fast');
});
//select option
$("input:radio").live('click', function(event){
$("#" + currentQstId + " input:radio").removeAttr("checked");
$(event.target).attr("checked", "checked");
getNeededElement(questionArray, currentQstId).type = $(event.target).attr("value");
});
//toggle button click trigger
toggleButton.trigger("click");
//show data in display mode
function displayData(flag){
$("#addQstDiv").hide();
$(".qstDiv").hide();
addToPage(questionArray, flag);
}
//set widget in edit mode
function editData(){
$(".qstDivDisplay").remove();
$("#addQstDiv").show('fast');
$(".qstDiv").show('fast');
}
// show questions and answers in display mode
function addToPage(array, flag){
if(flag){
var counter = 1;
for(var i in array){
var qstDiv = $("<div class='qstDivDisplay'>");
var spanOptConn = $("<div class='spanOptConn'>").appendTo(qstDiv);
var qstNumber = $("<span class='qstNumber'>Question " + counter + "</span>").appendTo(spanOptConn);
var qstContent = $("<div class='qstContentDisplay'>" + array[i].text + "</div>").appendTo(qstDiv);
var ansDiv = $("<div class='ansDiv'>").appendTo(qstDiv);
var ansCount = 1;
var type = array[i].type;
var selInput = $("<select>");
if(type == 3){
var newAnswer = $("<div class='newAnswer'>");
newAnswer.appendTo(ansDiv);
selInput.appendTo(newAnswer);
$("<option value='0'>Choise the right answer</option>").appendTo(selInput);
}
for(var j in array[i].answers){
switch(type){
case "1":
newAnswer = $("<div class='newAnswer'>");
var ansInput = $("<input type='radio' name='" + counter + "' style='float: left; margin-right: 10px;'/>").appendTo(newAnswer);
var ansSpan = $("<span class='ansSpanDisplay'>" + ansCount + ".</span>").appendTo(newAnswer);
var ansContent = $("<div class='ansContentDisplay'>" + array[i].answers[j].text + "</div>").appendTo(newAnswer);
newAnswer.appendTo(ansDiv);
break;
case "2":
newAnswer = $("<div class='newAnswer'>");
ansInput = $("<input type='checkbox' style='float: left; margin-right: 10px;'/>").appendTo(newAnswer);
ansSpan = $("<span class='ansSpanDisplay'>" + ansCount + ".</span>").appendTo(newAnswer);
ansContent = $("<div class='ansContentDisplay'>" + array[i].answers[j].text + "</div>").appendTo(newAnswer);
newAnswer.appendTo(ansDiv);
break;
case "3":
ansInput = $("<option value='" + ansCount + "'>" + array[i].answers[j].text + "</option>").appendTo(selInput);
break;
}
ansCount++;
}
qstDiv.appendTo("body");
counter ++;
}
} else {
counter = 1;
qstDiv = $("<div class='qstDivDisplay'>");
spanOptConn = $("<div class='spanOptConn'>").appendTo(qstDiv);
qstNumber = $("<span class='qstNumber'>Question " + counter + "</span>").appendTo(spanOptConn);
qstContent = $("<div class='qstContentDisplay'>This is an example of the question.</div>").appendTo(qstDiv);
ansDiv = $("<div class='ansDiv'>").appendTo(qstDiv);
ansCount = 1;
for(j = 0; j < 3; j++){
newAnswer = $("<div class='newAnswer'>");
ansInput = $("<input type='radio' name='1' style='float: left; margin-right: 10px;'/>").appendTo(newAnswer);
ansSpan = $("<span class='ansSpanDisplay'>" + ansCount + ".</span>").appendTo(newAnswer);
ansContent = $("<div class='ansContentDisplay'>This is an example of the answer " + ansCount + ".</div>").appendTo(newAnswer);
newAnswer.appendTo(ansDiv);
ansCount++;
}
qstDiv.appendTo("body");
}
}
}
//add new question block in a edit mode
function addQstBlock(id, text, type, style){
var qstDiv = $("<div class='qstDiv' id='" + id + "' " + style + ">");
var spanOptConn = $("<div class='spanOptConn'>").appendTo(qstDiv);
var count = $(".qstNumber").size();
var qstNumber = $("<span class='qstNumber'>Q" + (count + 1) + "</span>").appendTo(spanOptConn);
var qstOptions = $("<div class='qstOptions' id='" + id + "qstOptions'>").appendTo(spanOptConn);
var changeOptions = $("<button class='changeOptions'>Options</button>").appendTo(qstOptions);
var applyChanges = $("<button class='applyChanges' style='display: none;'>Close</button>").appendTo(qstOptions);
var qstDelete = $("<button class='qstDelete'>").appendTo(qstOptions);
var qstOptChoice = $("<div class='qstOptChoice' id='" + id + "qstOptChoice' style='display: none;'>").appendTo(qstDiv);
var optDesc = $("<div style='height: 65px;'>").appendTo(qstOptChoice);
var optDescImg = $("<div class='optDescImg'>").appendTo(optDesc);
var optDescText = $("<div class='optDescText'>You can choose any of these three options of displaying your answers. See a short their description.</div>").appendTo(optDesc);
var type1 = $("<div class='type'>").appendTo(qstOptChoice);
var contentType1 = $("<div class='contentType'>").appendTo(type1);
var divType1 = $("<div class='divType1'>").appendTo(contentType1);
var textType1 = $("<div class='textType'>This option allow to choose one answer only and the answers are displayed as radio buttons.</div>").appendTo(contentType1);
var type2 = $("<div class='type'>").appendTo(qstOptChoice);
var contentType2 = $("<div class='contentType'>").appendTo(type2);
var divType2 = $("<div class='divType2'>").appendTo(contentType2);
var textType2 = $("<div class='textType'>This option allow to choose several answers and the answers are displayed as checkboxes.</div>").appendTo(contentType2);
var type3 = $("<div class='type'>").appendTo(qstOptChoice);
var contentType3 = $("<div class='contentType'>").appendTo(type3);
var divType3 = $("<div class='divType3'>").appendTo(contentType3);
var textType3 = $("<div class='textType'>This option allow to choose one answer only and the answers are displayed as pull-down menu.</div>").appendTo(contentType3);
switch(type){
case "1":
var radioType1 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='1' checked/><div></div>").appendTo(type1);
var radioType2 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='2'/><div></div>").appendTo(type2);
var radioType3 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='3'/><div></div>").appendTo(type3);
break;
case "2":
radioType1 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='1'/><div></div>").appendTo(type1);
radioType2 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='2' checked/><div></div>").appendTo(type2);
radioType3 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='3'/><div></div>").appendTo(type3);
break;
case "3":
radioType1 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='1'/><div></div>").appendTo(type1);
radioType2 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='2'/><div></div>").appendTo(type2);
radioType3 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='3' checked/><div></div>").appendTo(type3);
break;
default:
radioType1 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='1'/><div></div>").appendTo(type1);
radioType2 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='2'/><div></div>").appendTo(type2);
radioType3 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='3'/><div></div>").appendTo(type3);
break;
}
var qstContent = $("<div class='qstContent' id='" + id + "qstContent' contenteditable='true'>" + text + "</div>").appendTo(qstDiv);
var ansDiv = $("<div class='ansDiv' id='" + id + "ansDiv'>").appendTo(qstDiv);
var ansAdd = $("<button class='ansAdd'>Add answer</button>").appendTo(ansDiv);
qstDiv.insertBefore("#addQstDiv");
$("#addQsqSpan1").text("Q" + (count + 2));
}
//add answers
function addAnsBlock(id, currId, text){
var newAnswer = $("<div class='newAnswer' id='" + id + "'>");
var count = $("#" + currId + " .newAnswer").size() + 1;
var ansSpan = $("<span class='ansSpan'>A" + count + "</span>").appendTo(newAnswer);
var ansContent = $("<div class='ansContent' id='" + id +"ansContent' contenteditable='true'>" + text + "</div>").appendTo(newAnswer);
var ansDelete = $("<button class='ansDelete' id='" + id + "ansDelete'>").appendTo(newAnswer);
newAnswer.insertBefore("#" + currId + "ansDiv .ansAdd");
if(window.sankore)
sankore.setPreference("qstArrayData", JSON.stringify(questionArray));
}
//get needed array element
function getNeededElement(array,id){
for(var i in array)
if(array[i].id == id)
return array[i];
}
//check on fill
function checkArrayOnFill(array){
var count = 0;
for(var i in array)
count++;
return count;
}
//refresh answers numbers
function refreshAns(){
var count = $("#" + currentQstId + " .newAnswer").size();
for(var i = 0; i < count; i ++)
$($("#" + currentQstId + " .newAnswer span")[i]).text("A" + (i+1));
}
//refresh questions numbers
function refreshQst(){
var count = $(".qstNumber").size();
for(var i = 0; i < count; i ++)
$($(".qstNumber")[i]).text("Q" + (i+1));
$("#addQsqSpan1").text("Q" + ++count);
}
//question constructor
function Question(){
this.text = "";
this.type = "1";
this.id = "";
this.rightAns = 1;
this.answers = new Array();
}
//answer constructor
function Answer(){
this.id = "";
this.text = "";
}

@ -85,15 +85,12 @@ WBHistoryManager *WBBrowserWindow::sHistoryManager = 0;
WBBrowserWindow::WBBrowserWindow(QWidget *parent, Ui::MainWindow* uniboardMainWindow, bool isViewerWebInstance)
: QWidget(parent)
, mWebToolBar(0)
, mSearchToolBar(0)
, mTabWidget(new WBTabWidget(this))
, mSearchAction(0)
, mUniboardMainWindow(uniboardMainWindow)
, mWebToolBar(0)
{
qDebug() << "Height: " << this->height();
qDebug() << "width: " << this->width();
QWebSettings *defaultSettings = QWebSettings::globalSettings();
defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, true);
defaultSettings->setAttribute(QWebSettings::PluginsEnabled, true);
@ -110,11 +107,10 @@ WBBrowserWindow::WBBrowserWindow(QWidget *parent, Ui::MainWindow* uniboardMainWi
this->setLayout(layout);
connect(mTabWidget, SIGNAL(loadPage(const QString &)),
this, SLOT(loadPage(const QString &)));
connect(mTabWidget, SIGNAL(loadPage(const QString &)), this, SLOT(loadPage(const QString &)));
connect(mTabWidget, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &)));
connect(mTabWidget, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &)));
if (!isViewerWebInstance) {
connect(mTabWidget, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
@ -122,12 +118,7 @@ WBBrowserWindow::WBBrowserWindow(QWidget *parent, Ui::MainWindow* uniboardMainWi
connect(mTabWidget, SIGNAL(loadFinished(bool)), this, SIGNAL(activeViewPageChanged()));
connect(mTabWidget, SIGNAL(lastTabClosed()),
mTabWidget, SLOT(newTab()));
connect(mTabWidget, SIGNAL(geometryChangeRequested(const QRect &)),
this, SLOT(geometryChangeRequested(const QRect &)));
connect(mTabWidget, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(geometryChangeRequested(const QRect &)));
slotUpdateWindowTitle();
@ -141,7 +132,15 @@ WBBrowserWindow::WBBrowserWindow(QWidget *parent, Ui::MainWindow* uniboardMainWi
WBBrowserWindow::~WBBrowserWindow()
{
// NOOP
if(mTabWidget){
delete mTabWidget;
mTabWidget = NULL;
}
if(mSearchToolBar){
delete mSearchToolBar;
mSearchToolBar = NULL;
}
}

@ -87,8 +87,7 @@ WBTabBar::WBTabBar(QWidget *parent)
connect(shortCut, SIGNAL(activated()), this, SLOT(selectTabAction()));
}
setTabsClosable(true);
connect(this, SIGNAL(tabCloseRequested(int)),
this, SIGNAL(closeTab(int)));
connect(this, SIGNAL(tabCloseRequested(int)), this, SIGNAL(closeTab(int)));
setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
setMovable(true);
setDocumentMode(false);
@ -116,26 +115,23 @@ void WBTabBar::contextMenuRequested(const QPoint &position)
menu.addAction(tr("New &Tab"), this, SIGNAL(newTab()), QKeySequence::AddTab);
int index = tabAt(position);
if (-1 != index) {
QAction *action = menu.addAction(tr("Clone Tab"),
this, SLOT(cloneTab()));
QAction *action = menu.addAction(tr("Clone Tab"), this, SLOT(cloneTab()));
action->setData(index);
menu.addSeparator();
action = menu.addAction(tr("&Close Tab"),
this, SLOT(closeTab()), QKeySequence::Close);
action = menu.addAction(tr("&Close Tab"), this, SLOT(closeTab()), QKeySequence::Close);
action->setData(index);
action = menu.addAction(tr("Close &Other Tabs"),
this, SLOT(closeOtherTabs()));
action = menu.addAction(tr("Close &Other Tabs"), this, SLOT(closeOtherTabs()));
action->setData(index);
menu.addSeparator();
action = menu.addAction(tr("Reload Tab"),
this, SLOT(reloadTab()), QKeySequence::Refresh);
action = menu.addAction(tr("Reload Tab"), this, SLOT(reloadTab()), QKeySequence::Refresh);
action->setData(index);
} else {
}
else {
menu.addSeparator();
}
menu.addAction(tr("Reload All Tabs"), this, SIGNAL(reloadAllTabs()));
@ -412,45 +408,30 @@ WBWebView *WBTabWidget::newTab(bool makeCurrent)
p.setColor(QPalette::Window, palette().color(QPalette::Base));
emptyWidget->setPalette(p);
emptyWidget->setAutoFillBackground(true);
disconnect(this, SIGNAL(currentChanged(int)),
this, SLOT(currentChanged(int)));
disconnect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
addTab(emptyWidget, tr("(Untitled)"));
connect(this, SIGNAL(currentChanged(int)),
this, SLOT(currentChanged(int)));
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
return 0;
}
// webview
WBWebView *webView = new WBWebView;
urlLineEdit->setWebView(webView);
connect(webView, SIGNAL(loadStarted()),
this, SLOT(webViewLoadStarted()));
connect(webView, SIGNAL(loadFinished(bool)),
this, SLOT(webViewIconChanged()));
connect(webView, SIGNAL(iconChanged()),
this, SLOT(webViewIconChanged()));
connect(webView, SIGNAL(titleChanged(const QString &)),
this, SLOT(webViewTitleChanged(const QString &)));
connect(webView, SIGNAL(urlChanged(const QUrl &)),
this, SLOT(webViewUrlChanged(const QUrl &)));
connect(webView->page(), SIGNAL(windowCloseRequested()),
this, SLOT(windowCloseRequested()));
connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)),
this, SIGNAL(geometryChangeRequested(const QRect &)));
connect(webView->page(), SIGNAL(printRequested(QWebFrame *)),
this, SIGNAL(printRequested(QWebFrame *)));
connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)),
this, SIGNAL(menuBarVisibilityChangeRequested(bool)));
connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)),
this, SIGNAL(statusBarVisibilityChangeRequested(bool)));
connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)),
this, SIGNAL(toolBarVisibilityChangeRequested(bool)));
connect(webView, SIGNAL(pixmapCaptured(const QPixmap&, bool)),
UBApplication::applicationController, SLOT(addCapturedPixmap(const QPixmap &, bool)));
connect(webView, SIGNAL(embedCodeCaptured(const QString&)),
UBApplication::applicationController, SLOT(addCapturedEmbedCode(const QString&)));
connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted()));
connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewIconChanged()));
connect(webView, SIGNAL(iconChanged()), this, SLOT(webViewIconChanged()));
connect(webView, SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &)));
connect(webView, SIGNAL(urlChanged(const QUrl &)), this, SLOT(webViewUrlChanged(const QUrl &)));
connect(webView->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested()));
connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)), this, SIGNAL(geometryChangeRequested(const QRect &)));
connect(webView->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *)));
connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SIGNAL(menuBarVisibilityChangeRequested(bool)));
connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SIGNAL(statusBarVisibilityChangeRequested(bool)));
connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SIGNAL(toolBarVisibilityChangeRequested(bool)));
connect(webView, SIGNAL(pixmapCaptured(const QPixmap&, bool)), UBApplication::applicationController, SLOT(addCapturedPixmap(const QPixmap &, bool)));
connect(webView, SIGNAL(embedCodeCaptured(const QString&)), UBApplication::applicationController, SLOT(addCapturedEmbedCode(const QString&)));
addTab(webView, tr("(Untitled)"));
if (makeCurrent)
@ -465,7 +446,6 @@ WBWebView *WBTabWidget::newTab(bool makeCurrent)
if (count() == 1)
currentChanged(currentIndex());
emit tabsChanged();
return webView;
}
@ -553,13 +533,13 @@ void WBTabWidget::closeTab(int index)
removeTab(index);
webView->deleteLater();
emit tabsChanged();
if (hasFocus && count() > 0)
currentWebView()->setFocus();
if (count() == 0)
emit lastTabClosed();
if (count() == 0){
newTab();
emit currentChanged(0);
}
}
void WBTabWidget::webViewLoadStarted()
@ -616,7 +596,6 @@ void WBTabWidget::webViewUrlChanged(const QUrl &url)
{
mTabBar->setTabData(index, url);
}
emit tabsChanged();
// web view does not reload sometime on OSX ... force it
webView->show();

@ -143,8 +143,6 @@ class WBTabWidget : public QTabWidget
signals:
// tab widget signals
void loadPage(const QString &url);
void tabsChanged();
void lastTabClosed();
// current tab signals
void setCurrentTitle(const QString &url);

Loading…
Cancel
Save