Commit 986e8e8f authored by Claudio Valerio's avatar Claudio Valerio

Merge remote-tracking branch 'origin/develop' into claudio-dev

parents e2e3dc0f 49ee9868
...@@ -550,8 +550,8 @@ QDomElement UBCFFAdaptor::UBToCFFConverter::parsePage(const QString &pageFileNam ...@@ -550,8 +550,8 @@ QDomElement UBCFFAdaptor::UBToCFFConverter::parsePage(const QString &pageFileNam
pageFile.close(); pageFile.close();
return QDomElement(); return QDomElement();
} }
} else if (tagname == tUBZGroup) { } else if (tagname == tUBZGroups) {
group = parseGroupPageSection(nextTopElement); group = parseGroupsPageSection(nextTopElement);
if (group.isNull()) { if (group.isNull()) {
qDebug() << "Page doesn't contains any groups."; qDebug() << "Page doesn't contains any groups.";
pageFile.close(); pageFile.close();
...@@ -634,6 +634,7 @@ QDomElement UBCFFAdaptor::UBToCFFConverter::parseSvgPageSection(const QDomElemen ...@@ -634,6 +634,7 @@ QDomElement UBCFFAdaptor::UBToCFFConverter::parseSvgPageSection(const QDomElemen
else if (tagName == tUBZLine) parseUBZLine(nextElement, svgElements); else if (tagName == tUBZLine) parseUBZLine(nextElement, svgElements);
else if (tagName == tUBZPolygon) parseUBZPolygon(nextElement, svgElements); else if (tagName == tUBZPolygon) parseUBZPolygon(nextElement, svgElements);
else if (tagName == tUBZPolyline) parseUBZPolyline(nextElement, svgElements); else if (tagName == tUBZPolyline) parseUBZPolyline(nextElement, svgElements);
else if (tagName == tUBZGroups) parseGroupsPageSection(nextElement);
nextElement = nextElement.nextSiblingElement(); nextElement = nextElement.nextSiblingElement();
} }
...@@ -694,12 +695,34 @@ bool UBCFFAdaptor::UBToCFFConverter::writeExtendedIwbSection() ...@@ -694,12 +695,34 @@ bool UBCFFAdaptor::UBToCFFConverter::writeExtendedIwbSection()
// extended element options // extended element options
// editable, background, locked are supported for now // editable, background, locked are supported for now
QDomElement UBCFFAdaptor::UBToCFFConverter::parseGroupPageSection(const QDomElement &element) QDomElement UBCFFAdaptor::UBToCFFConverter::parseGroupsPageSection(const QDomElement &groupRoot)
{ {
// First sankore side implementation needed. TODO in Sankore 1.5 // First sankore side implementation needed. TODO in Sankore 1.5
Q_UNUSED(element) if (!groupRoot.hasChildNodes()) {
qDebug() << "Group root is empty";
return QDomElement();
}
QDomElement groupElement = groupRoot.firstChildElement();
while (!groupElement.isNull()) {
QDomElement extendedElement = mDataModel->createElementNS(iwbNS, groupElement.tagName());
QDomElement groupChildElement = groupElement.firstChildElement();
while (!groupChildElement.isNull()) {
QDomElement extSubElement = mDataModel->createElementNS(iwbNS, groupChildElement.tagName());
extSubElement.setAttribute(aRef, groupChildElement.attribute(aID, QUuid().toString()));
extendedElement.appendChild(extSubElement);
groupChildElement = groupChildElement.nextSiblingElement();
}
mExtendedElements.append(extendedElement);
groupElement = groupElement.nextSiblingElement();
}
qDebug() << "parsing ubz group section"; qDebug() << "parsing ubz group section";
return QDomElement(); return groupRoot;
} }
QString UBCFFAdaptor::UBToCFFConverter::getDstContentFolderName(const QString &elementType) QString UBCFFAdaptor::UBToCFFConverter::getDstContentFolderName(const QString &elementType)
...@@ -1250,6 +1273,19 @@ bool UBCFFAdaptor::UBToCFFConverter::setCFFAttribute(const QString &attributeNam ...@@ -1250,6 +1273,19 @@ bool UBCFFAdaptor::UBToCFFConverter::setCFFAttribute(const QString &attributeNam
{ {
setGeometryFromUBZ(ubzElement, svgElement); setGeometryFromUBZ(ubzElement, svgElement);
} }
else
if (attributeName.contains(aUBZUuid))
{
QString parentId = ubzElement.attribute(aUBZParent);
QString id;
if (!parentId.isEmpty())
id = "{" + parentId + "}" + "{" + ubzElement.attribute(aUBZUuid)+"}";
else
id = "{" + ubzElement.attribute(aUBZUuid)+"}";
svgElement.setAttribute(aID, id);
}
else else
if (attributeName.contains(aUBZHref)||attributeName.contains(aSrc)) if (attributeName.contains(aUBZHref)||attributeName.contains(aSrc))
{ {
...@@ -1799,7 +1835,10 @@ bool UBCFFAdaptor::UBToCFFConverter::parseUBZPolygon(const QDomElement &element, ...@@ -1799,7 +1835,10 @@ bool UBCFFAdaptor::UBToCFFConverter::parseUBZPolygon(const QDomElement &element,
if (0 < iwbElementPart.attributes().count()) if (0 < iwbElementPart.attributes().count())
{ {
QString id = QUuid::createUuid().toString(); QString id = svgElementPart.attribute(aUBZUuid);
if (id.isEmpty())
id = QUuid::createUuid().toString();
svgElementPart.setAttribute(aID, id); svgElementPart.setAttribute(aID, id);
iwbElementPart.setAttribute(aRef, id); iwbElementPart.setAttribute(aRef, id);
......
...@@ -63,7 +63,7 @@ private: ...@@ -63,7 +63,7 @@ private:
QDomElement parseSvgPageSection(const QDomElement &element); QDomElement parseSvgPageSection(const QDomElement &element);
void writeQDomElementToXML(const QDomNode &node); void writeQDomElementToXML(const QDomNode &node);
bool writeExtendedIwbSection(); bool writeExtendedIwbSection();
QDomElement parseGroupPageSection(const QDomElement &element); QDomElement parseGroupsPageSection(const QDomElement &groupRoot);
bool createBackground(const QDomElement &element, QMultiMap<int, QDomElement> &dstSvgList); bool createBackground(const QDomElement &element, QMultiMap<int, QDomElement> &dstSvgList);
QString createBackgroundImage(const QDomElement &element, QSize size); QString createBackgroundImage(const QDomElement &element, QSize size);
......
...@@ -28,6 +28,7 @@ const QString tIWBPageSet = "pageset"; ...@@ -28,6 +28,7 @@ const QString tIWBPageSet = "pageset";
const QString tId = "id"; const QString tId = "id";
const QString tElement = "element"; const QString tElement = "element";
const QString tUBZGroup = "group"; const QString tUBZGroup = "group";
const QString tUBZGroups = "groups";
const QString tUBZG = "g"; const QString tUBZG = "g";
const QString tUBZPolygon = "polygon"; const QString tUBZPolygon = "polygon";
const QString tUBZPolyline = "polyline"; const QString tUBZPolyline = "polyline";
...@@ -67,6 +68,7 @@ const QString aBackground = "background"; ...@@ -67,6 +68,7 @@ const QString aBackground = "background";
const QString aCrossedBackground = "crossed-background"; const QString aCrossedBackground = "crossed-background";
const QString aUBZType = "type"; const QString aUBZType = "type";
const QString aUBZUuid = "uuid"; const QString aUBZUuid = "uuid";
const QString aUBZParent = "parent";
const QString aFill = "fill"; // IWB attribute contans color to fill const QString aFill = "fill"; // IWB attribute contans color to fill
const QString aID = "id"; // ID of any svg element can be placed in to iwb section const QString aID = "id"; // ID of any svg element can be placed in to iwb section
...@@ -334,8 +336,10 @@ stroke-lineshape-end \ ...@@ -334,8 +336,10 @@ stroke-lineshape-end \
const QString ubzElementAttributesToConvert(" \ const QString ubzElementAttributesToConvert(" \
xlink:href, \ xlink:href, \
src, \ src, \
transform \ transform, \
"); uuid \
"
);
// additional attributes. Have references in SVG section. // additional attributes. Have references in SVG section.
const QString svgElementAttributes(" \ const QString svgElementAttributes(" \
...@@ -376,4 +380,4 @@ struct UBItemLayerType ...@@ -376,4 +380,4 @@ struct UBItemLayerType
}; };
}; };
#endif // UBCFFCONSTANTS_H #endif // UBCFFCONSTANTS_H
\ No newline at end of file
...@@ -60,11 +60,6 @@ ...@@ -60,11 +60,6 @@
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -74,7 +69,17 @@ ...@@ -74,7 +69,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="ub-widget"> <div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
...@@ -36,11 +36,6 @@ ...@@ -36,11 +36,6 @@
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -50,7 +45,17 @@ ...@@ -50,7 +45,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="ub-widget"> <div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
...@@ -26,7 +26,7 @@ function checkResponse() ...@@ -26,7 +26,7 @@ function checkResponse()
*/ */
var sankoreLang = { var sankoreLang = {
view: "Afficher", view: "Fermer",
edit: "Modifier", edit: "Modifier",
example: "Cette phrase\nest un\nexemple", example: "Cette phrase\nest un\nexemple",
wgt_name: "Ordonner des phrases", wgt_name: "Ordonner des phrases",
...@@ -36,23 +36,23 @@ var sankoreLang = { ...@@ -36,23 +36,23 @@ var sankoreLang = {
none: "aucun", none: "aucun",
help: "Aide", help: "Aide",
help_content: "<p><h2>Ordonner des phrases</h2></p>"+ help_content: "<p><h2>Ordonner des phrases</h2></p>"+
"<p><h3>Ordonner des segments de phrases pour reconstituer le texte.</h3></p>"+ "<p><h3>Ordonner des segments de phrases pour reconstituer le texte.</h3></p>"+
"<p>Des étiquettes avec des phrases sont dans le désordre. Le but est de les remettre en ordre pour avoir un texte compréhensible et correct. Lorsque le texte est en ordre, l’interactivité se colore en vert. L’activité s’effectue par un glisser-déposer des étiquettes pour remettre le texte en ordre.</p>"+ "<p>Des étiquettes avec des phrases sont dans le désordre. Le but est de les remettre en ordre pour avoir un texte compréhensible et correct. Lorsque le texte est en ordre, l’interactivité se colore en vert. L’activité s’effectue par un glisser-déposer des étiquettes pour remettre le texte en ordre.</p>"+
"<p>Le bouton “Recharger” réinitialise l’exercice.</p>"+ "<p>Le bouton “Recharger” réinitialise l’exercice.</p>"+
"<p>Le bouton “Modifier” vous permet : </p>"+ "<p>Le bouton “Modifier” vous permet : </p>"+
"<ul><li>de choisir le thème de l’interactivité : tablette, ardoise ou aucun (par défaut aucun),</li>"+ "<ul><li>de choisir le thème de l’interactivité : tablette, ardoise ou aucun (par défaut aucun),</li>"+
"<li>de déterminer le texte à reconstituer et le nombre de séparations dans l’énoncé.</li></ul>"+ "<li>de déterminer le texte à reconstituer et le nombre de séparations dans l’énoncé.</li></ul>"+
"<p>Pour insérer du texte dans la zone, cliquez sur la zone et saisissez le texte souhaité.</p>"+ "<p>Pour insérer du texte dans la zone, cliquez sur la zone et saisissez le texte souhaité.</p>"+
"<p>Pour ajouter des séparations dans l’énoncé, retournez à la ligne. Votre texte sera séparé lors d'un retour à la ligne.</p>"+ "<p>Pour ajouter des séparations dans l’énoncé, retournez à la ligne. Votre texte sera séparé lors d'un retour à la ligne.</p>"+
"<p>Le bouton “Afficher” vous permet d’utiliser l’activité.</p>" "<p>Le bouton “Afficher” vous permet d’utiliser l’activité.</p>",
theme:"Thème"
}; };
var sentence = ""; var sentence = "";
var curSentence = ""; var curSentence = "";
...@@ -82,23 +82,34 @@ var input_width = 606; ...@@ -82,23 +82,34 @@ var input_width = 606;
var widget_padding = 0; var widget_padding = 0;
$(document).ready(function(){ $(document).ready(function(){
if(sankore.preference("ord_phrases_style","")){ if(window.sankore)
changeStyle(sankore.preference("ord_phrases_style","")); if(sankore.preference("ord_phrases_style","")){
$(".style_select").val(sankore.preference("ord_phrases_style","")); changeStyle(sankore.preference("ord_phrases_style",""));
} else $("#style_select").val(sankore.preference("ord_phrases_style",""));
changeStyle("3") } else
changeStyle("3")
$("#wgt_display").text(sankoreLang.view); $("#wgt_display").text(sankoreLang.view);
$("#wgt_edit").text(sankoreLang.edit); $("#wgt_edit").text(sankoreLang.edit);
$("#wgt_help").text(sankoreLang.help); $("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content); $("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){ $("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){ if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){ if(!$(this).hasClass("selected")){
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_edit").removeClass("selected"); $("#wgt_edit").removeClass("selected");
$(".style_select").css("display","none"); $("#parameters").css("display","none");
$(this).css("display", "none"); $(this).css("display", "none");
$("#wgt_edit").css("display", "block"); $("#wgt_edit").css("display", "block");
modeView(); modeView();
...@@ -107,7 +118,7 @@ $(document).ready(function(){ ...@@ -107,7 +118,7 @@ $(document).ready(function(){
if(!$(this).hasClass("selected")){ if(!$(this).hasClass("selected")){
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_display").removeClass("selected"); $("#wgt_display").removeClass("selected");
$(".style_select").css("display","block"); $("#parameters").css("display","block");
$(this).css("display", "none"); $(this).css("display", "none");
$("#wgt_display").css("display", "block"); $("#wgt_display").css("display", "block");
modeEdit(); modeEdit();
...@@ -120,11 +131,13 @@ $(document).ready(function(){ ...@@ -120,11 +131,13 @@ $(document).ready(function(){
$("#wgt_help").click(function(){ $("#wgt_help").click(function(){
var tmp = $(this); var tmp = $(this);
if($(this).hasClass("open")){ if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){ $("#help").slideUp("100", function(){
tmp.removeClass("open"); tmp.removeClass("open");
$("#ub-widget").show(); $("#ub-widget").show();
}); });
} else { } else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#ub-widget").hide(); $("#ub-widget").hide();
$("#help").slideDown("100", function(){ $("#help").slideDown("100", function(){
tmp.addClass("open"); tmp.addClass("open");
...@@ -158,13 +171,7 @@ $(document).ready(function(){ ...@@ -158,13 +171,7 @@ $(document).ready(function(){
} }
}); });
$(".style_select option[value='1']").text(sankoreLang.slate);
$(".style_select option[value='2']").text(sankoreLang.pad);
$(".style_select option[value='3']").text(sankoreLang.none);
$(".style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
}) })
function str_replace( w, b, s ){ function str_replace( w, b, s ){
...@@ -230,10 +237,10 @@ function changeStyle(val){ ...@@ -230,10 +237,10 @@ function changeStyle(val){
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload"); $("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help"); $("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit"); $("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_display").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color"); $("#wgt_name").removeClass("pad_color");
$(".style_select").removeClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").addClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select option:first").attr('selected',true);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break; break;
case "2": case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back"); $(".b_top_left").addClass("btl_pad").removeClass("without_back");
...@@ -247,10 +254,10 @@ function changeStyle(val){ ...@@ -247,10 +254,10 @@ function changeStyle(val){
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select option:first").next().attr('selected',true);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break; break;
case "3": case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad"); $(".b_top_left").addClass("without_back").removeClass("btl_pad");
...@@ -264,10 +271,10 @@ function changeStyle(val){ ...@@ -264,10 +271,10 @@ function changeStyle(val){
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").addClass("without_radius"); $("#style_select option:last").attr('selected',true);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break; break;
} }
} }
...@@ -355,7 +362,7 @@ function modeEdit() ...@@ -355,7 +362,7 @@ function modeEdit()
if (window.widget) { if (window.widget) {
window.widget.onleave = function(){ window.widget.onleave = function(){
sankore.setPreference("ord_phrases_style", $(".style_select").find("option:selected").val()); sankore.setPreference("ord_phrases_style", $("#style_select").find("option:selected").val());
if($( "#mp_word textarea" ).val()) if($( "#mp_word textarea" ).val())
{ {
modeView(); modeView();
...@@ -377,4 +384,4 @@ if (window.widget) { ...@@ -377,4 +384,4 @@ if (window.widget) {
} }
sankore.setPreference("rightOrdPhrases", sentence); sankore.setPreference("rightOrdPhrases", sentence);
} }
} }
\ No newline at end of file
...@@ -36,11 +36,6 @@ ...@@ -36,11 +36,6 @@
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -50,7 +45,17 @@ ...@@ -50,7 +45,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="ub-widget"> <div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
...@@ -27,7 +27,7 @@ function checkResponse() ...@@ -27,7 +27,7 @@ function checkResponse()
var sankoreLang = { var sankoreLang = {
edit: "Изменить", edit: "Изменить",
view: "Просмотр", view: "Закрыть",
example: "это\nпример\nпредложения", example: "это\nпример\nпредложения",
wgt_name: "Порядок фраз", wgt_name: "Порядок фраз",
reload: "Обновить", reload: "Обновить",
...@@ -35,10 +35,10 @@ var sankoreLang = { ...@@ -35,10 +35,10 @@ var sankoreLang = {
pad: "Планшет", pad: "Планшет",
none: "Нет", none: "Нет",
help: "Помощь", help: "Помощь",
help_content: "Пример текста помощи ..." help_content: "Пример текста помощи ...",
theme: "Тема"
} }
var sentence = ""; var sentence = "";
var curSentence = ""; var curSentence = "";
...@@ -68,23 +68,34 @@ var input_width = 606; ...@@ -68,23 +68,34 @@ var input_width = 606;
var widget_padding = 0; var widget_padding = 0;
$(document).ready(function(){ $(document).ready(function(){
if(sankore.preference("ord_phrases_style","")){ if(window.sankore)
changeStyle(sankore.preference("ord_phrases_style","")); if(sankore.preference("ord_phrases_style","")){
$(".style_select").val(sankore.preference("ord_phrases_style","")); changeStyle(sankore.preference("ord_phrases_style",""));
} else $("#style_select").val(sankore.preference("ord_phrases_style",""));
changeStyle("3") } else
changeStyle("3")
$("#wgt_display").text(sankoreLang.view); $("#wgt_display").text(sankoreLang.view);
$("#wgt_edit").text(sankoreLang.edit); $("#wgt_edit").text(sankoreLang.edit);
$("#wgt_help").text(sankoreLang.help); $("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content); $("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){ $("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){ if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){ if(!$(this).hasClass("selected")){
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_edit").removeClass("selected"); $("#wgt_edit").removeClass("selected");
$(".style_select").css("display","none"); $("#parameters").css("display","none");
$(this).css("display", "none"); $(this).css("display", "none");
$("#wgt_edit").css("display", "block"); $("#wgt_edit").css("display", "block");
modeView(); modeView();
...@@ -93,7 +104,7 @@ $(document).ready(function(){ ...@@ -93,7 +104,7 @@ $(document).ready(function(){
if(!$(this).hasClass("selected")){ if(!$(this).hasClass("selected")){
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_display").removeClass("selected"); $("#wgt_display").removeClass("selected");
$(".style_select").css("display","block"); $("#parameters").css("display","block");
$(this).css("display", "none"); $(this).css("display", "none");
$("#wgt_display").css("display", "block"); $("#wgt_display").css("display", "block");
modeEdit(); modeEdit();
...@@ -106,11 +117,13 @@ $(document).ready(function(){ ...@@ -106,11 +117,13 @@ $(document).ready(function(){
$("#wgt_help").click(function(){ $("#wgt_help").click(function(){
var tmp = $(this); var tmp = $(this);
if($(this).hasClass("open")){ if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){ $("#help").slideUp("100", function(){
tmp.removeClass("open"); tmp.removeClass("open");
$("#ub-widget").show(); $("#ub-widget").show();
}); });
} else { } else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#ub-widget").hide(); $("#ub-widget").hide();
$("#help").slideDown("100", function(){ $("#help").slideDown("100", function(){
tmp.addClass("open"); tmp.addClass("open");
...@@ -144,13 +157,7 @@ $(document).ready(function(){ ...@@ -144,13 +157,7 @@ $(document).ready(function(){
} }
}); });
$(".style_select option[value='1']").text(sankoreLang.slate);
$(".style_select option[value='2']").text(sankoreLang.pad);
$(".style_select option[value='3']").text(sankoreLang.none);
$(".style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
}) })
function str_replace( w, b, s ){ function str_replace( w, b, s ){
...@@ -216,10 +223,10 @@ function changeStyle(val){ ...@@ -216,10 +223,10 @@ function changeStyle(val){
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload"); $("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help"); $("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit"); $("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_display").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color"); $("#wgt_name").removeClass("pad_color");
$(".style_select").removeClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").addClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select option:first").attr('selected',true);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break; break;
case "2": case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back"); $(".b_top_left").addClass("btl_pad").removeClass("without_back");
...@@ -233,10 +240,10 @@ function changeStyle(val){ ...@@ -233,10 +240,10 @@ function changeStyle(val){
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select option:first").next().attr('selected',true);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break; break;
case "3": case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad"); $(".b_top_left").addClass("without_back").removeClass("btl_pad");
...@@ -250,10 +257,10 @@ function changeStyle(val){ ...@@ -250,10 +257,10 @@ function changeStyle(val){
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").addClass("without_radius"); $("#style_select option:last").attr('selected',true);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break; break;
} }
} }
...@@ -341,7 +348,7 @@ function modeEdit() ...@@ -341,7 +348,7 @@ function modeEdit()
if (window.widget) { if (window.widget) {
window.widget.onleave = function(){ window.widget.onleave = function(){
sankore.setPreference("ord_phrases_style", $(".style_select").find("option:selected").val()); sankore.setPreference("ord_phrases_style", $("#style_select").find("option:selected").val());
if($( "#mp_word textarea" ).val()) if($( "#mp_word textarea" ).val())
{ {
modeView(); modeView();
...@@ -363,4 +370,4 @@ if (window.widget) { ...@@ -363,4 +370,4 @@ if (window.widget) {
} }
sankore.setPreference("rightOrdPhrases", sentence); sankore.setPreference("rightOrdPhrases", sentence);
} }
} }
\ No newline at end of file
...@@ -28,7 +28,7 @@ function checkResponse() ...@@ -28,7 +28,7 @@ function checkResponse()
var sankoreLang = { var sankoreLang = {
edit: "Edit", edit: "Edit",
view: "Display", view: "Close",
example: "this is\nan example\nsentence", example: "this is\nan example\nsentence",
wgt_name: "Order phrases", wgt_name: "Order phrases",
reload: "Reload", reload: "Reload",
...@@ -36,7 +36,8 @@ var sankoreLang = { ...@@ -36,7 +36,8 @@ var sankoreLang = {
pad: "Pad", pad: "Pad",
none: "None", none: "None",
help: "Help", help: "Help",
help_content: "This is an example of help content ..." help_content: "This is an example of help content ...",
theme: "Theme"
} }
...@@ -72,7 +73,7 @@ $(document).ready(function(){ ...@@ -72,7 +73,7 @@ $(document).ready(function(){
if(window.sankore) if(window.sankore)
if(sankore.preference("ord_phrases_style","")){ if(sankore.preference("ord_phrases_style","")){
changeStyle(sankore.preference("ord_phrases_style","")); changeStyle(sankore.preference("ord_phrases_style",""));
$(".style_select").val(sankore.preference("ord_phrases_style","")); $("#style_select").val(sankore.preference("ord_phrases_style",""));
} else } else
changeStyle("3") changeStyle("3")
...@@ -80,13 +81,23 @@ $(document).ready(function(){ ...@@ -80,13 +81,23 @@ $(document).ready(function(){
$("#wgt_edit").text(sankoreLang.edit); $("#wgt_edit").text(sankoreLang.edit);
$("#wgt_help").text(sankoreLang.help); $("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content); $("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){ $("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){ if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){ if(!$(this).hasClass("selected")){
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_edit").removeClass("selected"); $("#wgt_edit").removeClass("selected");
$(".style_select").css("display","none"); $("#parameters").css("display","none");
$(this).css("display", "none"); $(this).css("display", "none");
$("#wgt_edit").css("display", "block"); $("#wgt_edit").css("display", "block");
modeView(); modeView();
...@@ -95,7 +106,7 @@ $(document).ready(function(){ ...@@ -95,7 +106,7 @@ $(document).ready(function(){
if(!$(this).hasClass("selected")){ if(!$(this).hasClass("selected")){
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_display").removeClass("selected"); $("#wgt_display").removeClass("selected");
$(".style_select").css("display","block"); $("#parameters").css("display","block");
$(this).css("display", "none"); $(this).css("display", "none");
$("#wgt_display").css("display", "block"); $("#wgt_display").css("display", "block");
modeEdit(); modeEdit();
...@@ -108,11 +119,13 @@ $(document).ready(function(){ ...@@ -108,11 +119,13 @@ $(document).ready(function(){
$("#wgt_help").click(function(){ $("#wgt_help").click(function(){
var tmp = $(this); var tmp = $(this);
if($(this).hasClass("open")){ if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){ $("#help").slideUp("100", function(){
tmp.removeClass("open"); tmp.removeClass("open");
$("#ub-widget").show(); $("#ub-widget").show();
}); });
} else { } else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#ub-widget").hide(); $("#ub-widget").hide();
$("#help").slideDown("100", function(){ $("#help").slideDown("100", function(){
tmp.addClass("open"); tmp.addClass("open");
...@@ -146,13 +159,7 @@ $(document).ready(function(){ ...@@ -146,13 +159,7 @@ $(document).ready(function(){
} }
}); });
$(".style_select option[value='1']").text(sankoreLang.slate);
$(".style_select option[value='2']").text(sankoreLang.pad);
$(".style_select option[value='3']").text(sankoreLang.none);
$(".style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
}) })
function str_replace( w, b, s ){ function str_replace( w, b, s ){
...@@ -218,10 +225,10 @@ function changeStyle(val){ ...@@ -218,10 +225,10 @@ function changeStyle(val){
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload"); $("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help"); $("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit"); $("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_display").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color"); $("#wgt_name").removeClass("pad_color");
$(".style_select").removeClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").addClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select option:first").attr('selected',true);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break; break;
case "2": case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back"); $(".b_top_left").addClass("btl_pad").removeClass("without_back");
...@@ -235,10 +242,10 @@ function changeStyle(val){ ...@@ -235,10 +242,10 @@ function changeStyle(val){
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select option:first").next().attr('selected',true);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break; break;
case "3": case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad"); $(".b_top_left").addClass("without_back").removeClass("btl_pad");
...@@ -252,10 +259,10 @@ function changeStyle(val){ ...@@ -252,10 +259,10 @@ function changeStyle(val){
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").addClass("without_radius"); $("#style_select option:last").attr('selected',true);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break; break;
} }
} }
...@@ -343,7 +350,7 @@ function modeEdit() ...@@ -343,7 +350,7 @@ function modeEdit()
if (window.widget) { if (window.widget) {
window.widget.onleave = function(){ window.widget.onleave = function(){
sankore.setPreference("ord_phrases_style", $(".style_select").find("option:selected").val()); sankore.setPreference("ord_phrases_style", $("#style_select").find("option:selected").val());
if($( "#mp_word textarea" ).val()) if($( "#mp_word textarea" ).val())
{ {
modeView(); modeView();
......
...@@ -3,7 +3,7 @@ html, body{ ...@@ -3,7 +3,7 @@ html, body{
height: 100%; height: 100%;
margin: 0; margin: 0;
padding: 0; padding: 0;
border-radius: 50px; border-radius: 35px;
overflow: hidden; overflow: hidden;
} }
...@@ -149,57 +149,40 @@ textarea{ ...@@ -149,57 +149,40 @@ textarea{
margin: 10px 10px 0 10px; margin: 10px 10px 0 10px;
padding: 0; padding: 0;
float: left; float: left;
/*font-family: "Lobster13Regular";*/ font-family: Arial,Helvetica,sans-serif;
font-size: 24px; font-size: 24px;
color: #8c5730; color: #7F613F;
text-shadow: #FFDCA9 0 1px 0;
} }
#wgt_reload, #wgt_edit, #wgt_display, #wgt_help{ #wgt_reload, #wgt_edit, #wgt_display, #wgt_help{
cursor: pointer; cursor: pointer;
height: 44px;
margin: 10px 10px 0 0; margin: 10px 10px 0 0;
float: right; float: right;
/*font-family: "Lobster13Regular";*/ font-family: Arial,Helvetica,sans-serif;
font-size: 24px; font-size: 24px;
color: #8c5730; line-height: 32px;
} }
#wgt_display{ #wgt_display{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-edit.png); background: url(../img/toolbar-edit.png) left -32px no-repeat;
background-repeat: no-repeat; color: white;
background-position: top 0;
display: none; display: none;
} }
#wgt_edit{ #wgt_edit{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-edit.png); background: url(../img/slate-toolbar-edit.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
} }
#wgt_reload{ #wgt_reload{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-toolbar-reload.png); background: url(../img/slate-toolbar-reload.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
}
.style_select{
width: 120px;
/*font-family: "Lobster13Regular";*/
font-size: 24px;
float: right;
margin: 10px 20px 0 0;
border-radius: 10px;
background-image: url(../img/ar_down.png);
background-color: #d4aa79;
color: #8c5730;
background-position: 105px 11px;
background-repeat: no-repeat;
-webkit-appearance: menulist-text;
display: none;
} }
.btl_pad{ .btl_pad{
...@@ -234,51 +217,50 @@ textarea{ ...@@ -234,51 +217,50 @@ textarea{
background-image: url(../img/pad-bottom-right.png) !important; background-image: url(../img/pad-bottom-right.png) !important;
} }
.pad_color{ .without_radius{
color: white !important; border-radius: 0 !important;
} }
.pad_reload{ .without_back{
background-image: url(../img/slate-toolbar-reload-white.png) !important; background: none !important;
} }
.pad_edit{ .pad_color{
background-image: url(../img/slate-display.png) !important; color: #FC9 !important;
text-shadow: none !important;
} }
.pad_select{ .pad_reload{
background-color: black !important; background: url(../img/toolbar-reload.png) left top no-repeat !important;
color: white !important;
background-image: url(../img/ar_down_white.png) !important;
} }
.without_radius{ .pad_edit{
border-radius: 0 !important; background: url(../img/toolbar-edit.png) left top no-repeat !important;
} }
.without_back{ .pad_help{
background: none !important; background: url(../img/toolbar-help.png) left top no-repeat !important;
} }
.none_select{ .help_wood{
background-color: #333 !important; background: url(../img/slate-toolbar-help.png) left -32px no-repeat !important;
color: white !important; color: white !important;
background-image: url(../img/ar_down_white.png) !important; text-shadow: #7F613F 0 -1px 0 !important;
} }
.pad_help{ .help_pad{
background-image: url(../img/slate-help-white.png) !important; background: url(../img/toolbar-help.png) left -32px no-repeat !important;
color: white !important;
} }
#wgt_help{ #wgt_help{
padding-left: 32px; padding-left: 35px;
background-image: url(../img/slate-help.png); background: url(../img/slate-toolbar-help.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
} }
#help{ #help{
width: 100%;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
display: none; display: none;
...@@ -287,5 +269,36 @@ textarea{ ...@@ -287,5 +269,36 @@ textarea{
} }
.open{ .open{
}
#parameters{
display: none;
padding: 10px 20px;
background: url("../img/parameters-bg.png");
border-radius: 4px 4px 0 0;
}
.inline{
display: inline-block;
font-family: "helvetica neue";
font-size: 14px;
color: #666;
}
#parameters label {
font-style: italic;
}
#style_select{
margin-left: 10px;
}
.display_wood{
background: url(../img/slate-toolbar-edit.png) left -32px no-repeat !important;
text-shadow: #7F613F 0 -1px 0;
}
.radius_ft{
border-radius: 45px !important;
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ html, body{ ...@@ -3,7 +3,7 @@ html, body{
height: 100%; height: 100%;
margin: 0; margin: 0;
padding: 0; padding: 0;
border-radius: 50px; border-radius: 35px;
overflow: hidden; overflow: hidden;
} }
...@@ -28,14 +28,6 @@ body{ ...@@ -28,14 +28,6 @@ body{
margin: 5px 10px; margin: 5px 10px;
} }
.green_point{
background-image: url(../img/green_point.png);
}
.red_point{
background-image: url(../img/red_point.png);
}
#display_text, #edit_text{ #display_text, #edit_text{
height: 19px; height: 19px;
padding: 3px 0 0 0; padding: 3px 0 0 0;
...@@ -322,57 +314,40 @@ body{ ...@@ -322,57 +314,40 @@ body{
margin: 10px 10px 0 10px; margin: 10px 10px 0 10px;
padding: 0; padding: 0;
float: left; float: left;
/*font-family: "Lobster13Regular";*/ font-family: Arial,Helvetica,sans-serif;
font-size: 24px; font-size: 24px;
color: #8c5730; color: #7F613F;
text-shadow: #FFDCA9 0 1px 0;
} }
#wgt_reload, #wgt_edit, #wgt_display, #wgt_help{ #wgt_reload, #wgt_edit, #wgt_display, #wgt_help{
cursor: pointer; cursor: pointer;
height: 44px;
margin: 10px 10px 0 0; margin: 10px 10px 0 0;
float: right; float: right;
/*font-family: "Lobster13Regular";*/ font-family: Arial,Helvetica,sans-serif;
font-size: 24px; font-size: 24px;
color: #8c5730; line-height: 32px;
} }
#wgt_display{ #wgt_display{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-edit.png); background: url(../img/toolbar-edit.png) left -32px no-repeat;
background-repeat: no-repeat; color: white;
background-position: top 0;
display: none; display: none;
} }
#wgt_edit{ #wgt_edit{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-edit.png); background: url(../img/slate-toolbar-edit.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
} }
#wgt_reload{ #wgt_reload{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-toolbar-reload.png); background: url(../img/slate-toolbar-reload.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
}
.style_select{
width: 120px;
/*font-family: "Lobster13Regular";*/
font-size: 24px;
float: right;
margin: 10px 20px 0 0;
border-radius: 10px;
background-image: url(../img/ar_down.png);
background-color: #d4aa79;
color: #8c5730;
background-position: 105px 11px;
background-repeat: no-repeat;
-webkit-appearance: menulist-text;
display: none;
} }
.btl_pad{ .btl_pad{
...@@ -407,51 +382,50 @@ body{ ...@@ -407,51 +382,50 @@ body{
background-image: url(../img/pad-bottom-right.png) !important; background-image: url(../img/pad-bottom-right.png) !important;
} }
.pad_color{ .without_radius{
color: white !important; border-radius: 0 !important;
} }
.pad_reload{ .without_back{
background-image: url(../img/slate-toolbar-reload-white.png) !important; background: none !important;
} }
.pad_edit{ .pad_color{
background-image: url(../img/slate-display.png) !important; color: #FC9 !important;
text-shadow: none !important;
} }
.pad_select{ .pad_reload{
background-color: black !important; background: url(../img/toolbar-reload.png) left top no-repeat !important;
color: white !important;
background-image: url(../img/ar_down_white.png) !important;
} }
.without_radius{ .pad_edit{
border-radius: 0 !important; background: url(../img/toolbar-edit.png) left top no-repeat !important;
} }
.without_back{ .pad_help{
background: none !important; background: url(../img/toolbar-help.png) left top no-repeat !important;
} }
.none_select{ .help_wood{
background-color: #333 !important; background: url(../img/slate-toolbar-help.png) left -32px no-repeat !important;
color: white !important; color: white !important;
background-image: url(../img/ar_down_white.png) !important; text-shadow: #7F613F 0 -1px 0 !important;
} }
.pad_help{ .help_pad{
background-image: url(../img/slate-help-white.png) !important; background: url(../img/toolbar-help.png) left -32px no-repeat !important;
color: white !important;
} }
#wgt_help{ #wgt_help{
padding-left: 32px; padding-left: 35px;
background-image: url(../img/slate-help.png); background: url(../img/slate-toolbar-help.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
} }
#help{ #help{
width: 100%;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
display: none; display: none;
...@@ -460,5 +434,36 @@ body{ ...@@ -460,5 +434,36 @@ body{
} }
.open{ .open{
}
#parameters{
display: none;
padding: 10px 20px;
background: url("../img/parameters-bg.png");
border-radius: 4px 4px 0 0;
}
.inline{
display: inline-block;
font-family: "helvetica neue";
font-size: 14px;
color: #666;
}
#parameters label {
font-style: italic;
}
#style_select{
margin-left: 10px;
}
.display_wood{
background: url(../img/slate-toolbar-edit.png) left -32px no-repeat !important;
text-shadow: #7F613F 0 -1px 0;
}
.radius_ft{
border-radius: 45px !important;
} }
\ No newline at end of file
...@@ -52,11 +52,6 @@ ...@@ -52,11 +52,6 @@
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -66,7 +61,17 @@ ...@@ -66,7 +61,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="data"> <div id="data">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
var sankoreLang = { var sankoreLang = {
display: "Display", display: "Close",
edit: "Edit", edit: "Edit",
short_desc: "Select animals from the following list:", short_desc: "Select animals from the following list:",
add: "Add new block", add: "Add new block",
...@@ -15,7 +15,8 @@ var sankoreLang = { ...@@ -15,7 +15,8 @@ var sankoreLang = {
pad: "Pad", pad: "Pad",
none: "None", none: "None",
help: "Help", help: "Help",
help_content: "This is an example of help content ..." help_content: "This is an example of help content ...",
theme: "Theme"
}; };
//main function //main function
...@@ -27,9 +28,11 @@ function start(){ ...@@ -27,9 +28,11 @@ function start(){
$("#wgt_reload").text(sankoreLang.reload); $("#wgt_reload").text(sankoreLang.reload);
$("#wgt_help").text(sankoreLang.help); $("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content); $("#help").html(sankoreLang.help_content);
$(".style_select option[value='1']").text(sankoreLang.slate); $("#style_select option[value='1']").text(sankoreLang.slate);
$(".style_select option[value='2']").text(sankoreLang.pad); $("#style_select option[value='2']").text(sankoreLang.pad);
$(".style_select option[value='3']").text(sankoreLang.none); $("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
if(window.sankore){ if(window.sankore){
if(sankore.preference("selectionner","")){ if(sankore.preference("selectionner","")){
...@@ -39,7 +42,7 @@ function start(){ ...@@ -39,7 +42,7 @@ function start(){
showExample(); showExample();
if(sankore.preference("sel_style","")){ if(sankore.preference("sel_style","")){
changeStyle(sankore.preference("sel_style","")); changeStyle(sankore.preference("sel_style",""));
$(".style_select").val(sankore.preference("sel_style","")); $("#style_select").val(sankore.preference("sel_style",""));
} else } else
changeStyle("3") changeStyle("3")
} }
...@@ -50,18 +53,20 @@ function start(){ ...@@ -50,18 +53,20 @@ function start(){
if (window.widget) { if (window.widget) {
window.widget.onleave = function(){ window.widget.onleave = function(){
exportData(); exportData();
sankore.setPreference("sel_style", $(".style_select").find("option:selected").val()); sankore.setPreference("sel_style", $("#style_select").find("option:selected").val());
} }
} }
$("#wgt_help").click(function(){ $("#wgt_help").click(function(){
var tmp = $(this); var tmp = $(this);
if($(this).hasClass("open")){ if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){ $("#help").slideUp("100", function(){
tmp.removeClass("open"); tmp.removeClass("open");
$("#data").show(); $("#data").show();
}); });
} else { } else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#data").hide(); $("#data").hide();
$("#help").slideDown("100", function(){ $("#help").slideDown("100", function(){
tmp.addClass("open"); tmp.addClass("open");
...@@ -83,7 +88,7 @@ function start(){ ...@@ -83,7 +88,7 @@ function start(){
$("#wgt_display").trigger("click"); $("#wgt_display").trigger("click");
}); });
$(".style_select").change(function (event){ $("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val()); changeStyle($(this).find("option:selected").val());
}) })
...@@ -94,7 +99,7 @@ function start(){ ...@@ -94,7 +99,7 @@ function start(){
sankore.enableDropOnWidget(false); sankore.enableDropOnWidget(false);
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_edit").removeClass("selected"); $("#wgt_edit").removeClass("selected");
$(".style_select").css("display","none"); $("#parameters").css("display","none");
$(".add_block").remove(); $(".add_block").remove();
$(".cont").each(function(){ $(".cont").each(function(){
var container = $(this); var container = $(this);
...@@ -122,7 +127,7 @@ function start(){ ...@@ -122,7 +127,7 @@ function start(){
sankore.enableDropOnWidget(true); sankore.enableDropOnWidget(true);
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_display").removeClass("selected"); $("#wgt_display").removeClass("selected");
$(".style_select").css("display","block"); $("#parameters").css("display","block");
$(".cont").each(function(){ $(".cont").each(function(){
var container = $(this); var container = $(this);
...@@ -446,10 +451,10 @@ function changeStyle(val){ ...@@ -446,10 +451,10 @@ function changeStyle(val){
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload"); $("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help"); $("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit"); $("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_display").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color"); $("#wgt_name").removeClass("pad_color");
$(".style_select").removeClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").addClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select").val(val);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break; break;
case "2": case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back"); $(".b_top_left").addClass("btl_pad").removeClass("without_back");
...@@ -463,10 +468,10 @@ function changeStyle(val){ ...@@ -463,10 +468,10 @@ function changeStyle(val){
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select").val(val);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break; break;
case "3": case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad"); $(".b_top_left").addClass("without_back").removeClass("btl_pad");
...@@ -480,10 +485,10 @@ function changeStyle(val){ ...@@ -480,10 +485,10 @@ function changeStyle(val){
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").addClass("without_radius"); $("#style_select").val(val);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break; break;
} }
} }
......
...@@ -26,11 +26,6 @@ ...@@ -26,11 +26,6 @@
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -40,7 +35,17 @@ ...@@ -40,7 +35,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="data"> <div id="data">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
var sankoreLang = { var sankoreLang = {
display: "Afficher", display: "Fermer",
edit: "Modifier", edit: "Modifier",
short_desc: "Sélectionner les animaux dans la liste suivante :", short_desc: "Sélectionner les animaux dans la liste suivante :",
add: "Nouveau bloc", add: "Nouveau bloc",
...@@ -16,24 +16,25 @@ var sankoreLang = { ...@@ -16,24 +16,25 @@ var sankoreLang = {
none: "aucun", none: "aucun",
help: "Aide", help: "Aide",
help_content: "<p><h2>Sélectionner</h2></p>"+ help_content: "<p><h2>Sélectionner</h2></p>"+
"<p><h3>Trouver les éléments correspondants à la consigne.</h3></p>"+ "<p><h3>Trouver les éléments correspondants à la consigne.</h3></p>"+
"<p>Une consigne est écrite précisant le ou les éléments à chercher parmi tous les éléments proposés. Le but est de trouver les éléments correspondants à la consigne. L’activité s’effectue en cochant les cases sous les éléments correspondants. Une fois que tous les éléments corrects sont cochés, la zone se colore en vert.</p>"+ "<p>Une consigne est écrite précisant le ou les éléments à chercher parmi tous les éléments proposés. Le but est de trouver les éléments correspondants à la consigne. L’activité s’effectue en cochant les cases sous les éléments correspondants. Une fois que tous les éléments corrects sont cochés, la zone se colore en vert.</p>"+
"<p>Le bouton “Recharger” réinitialise les exercices.</p>"+ "<p>Le bouton “Recharger” réinitialise les exercices.</p>"+
"<p>Le bouton “Modifier” vous permet :</p>"+ "<p>Le bouton “Modifier” vous permet :</p>"+
"<ul><li>de choisir le thème de l’interactivité : tablette, ardoise ou aucun (par défaut aucun),</li>"+ "<ul><li>de choisir le thème de l’interactivité : tablette, ardoise ou aucun (par défaut aucun),</li>"+
"<li>de modifier un exercice ou d’en créer de nouveaux dans la même activité. </li></ul>"+ "<li>de modifier un exercice ou d’en créer de nouveaux dans la même activité. </li></ul>"+
"<p>En mode édition, pour créer un nouvel exercice, cliquez sur “Nouveau bloc” en bas, puis</p>"+ "<p>En mode édition, pour créer un nouvel exercice, cliquez sur “Nouveau bloc” en bas, puis</p>"+
"<ul><li>insérez une consigne en cliquant sur le champ de texte “Saisir votre consigne ici ...”, </li>"+ "<ul><li>insérez une consigne en cliquant sur le champ de texte “Saisir votre consigne ici ...”, </li>"+
"<li>ajoutez des zones de texte en cliquant sur le gros “+T” vert en dessous puis entrez le texte voulu.</li></ul>"+ "<li>ajoutez des zones de texte en cliquant sur le gros “+T” vert en dessous puis entrez le texte voulu.</li></ul>"+
"<p>Pour supprimer une zone de texte, cliquez sur la croix située dans le coin supérieur de celle-ci.</p>"+ "<p>Pour supprimer une zone de texte, cliquez sur la croix située dans le coin supérieur de celle-ci.</p>"+
"<p>Pour supprimer un exercice, cliquez sur la croix à gauche du numéro de l’exercice.</p>"+ "<p>Pour supprimer un exercice, cliquez sur la croix à gauche du numéro de l’exercice.</p>"+
"<p>Le bouton “Afficher” vous permet d’utiliser l’activité.</p>" "<p>Le bouton “Afficher” vous permet d’utiliser l’activité.</p>",
theme:"Thème"
}; };
//main function //main function
...@@ -45,9 +46,11 @@ function start(){ ...@@ -45,9 +46,11 @@ function start(){
$("#wgt_reload").text(sankoreLang.reload); $("#wgt_reload").text(sankoreLang.reload);
$("#wgt_help").text(sankoreLang.help); $("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content); $("#help").html(sankoreLang.help_content);
$(".style_select option[value='1']").text(sankoreLang.slate); $("#style_select option[value='1']").text(sankoreLang.slate);
$(".style_select option[value='2']").text(sankoreLang.pad); $("#style_select option[value='2']").text(sankoreLang.pad);
$(".style_select option[value='3']").text(sankoreLang.none); $("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
if(window.sankore){ if(window.sankore){
if(sankore.preference("selectionner","")){ if(sankore.preference("selectionner","")){
...@@ -57,7 +60,7 @@ function start(){ ...@@ -57,7 +60,7 @@ function start(){
showExample(); showExample();
if(sankore.preference("sel_style","")){ if(sankore.preference("sel_style","")){
changeStyle(sankore.preference("sel_style","")); changeStyle(sankore.preference("sel_style",""));
$(".style_select").val(sankore.preference("sel_style","")); $("#style_select").val(sankore.preference("sel_style",""));
} else } else
changeStyle("3") changeStyle("3")
} }
...@@ -68,18 +71,20 @@ function start(){ ...@@ -68,18 +71,20 @@ function start(){
if (window.widget) { if (window.widget) {
window.widget.onleave = function(){ window.widget.onleave = function(){
exportData(); exportData();
sankore.setPreference("sel_style", $(".style_select").find("option:selected").val()); sankore.setPreference("sel_style", $("#style_select").find("option:selected").val());
} }
} }
$("#wgt_help").click(function(){ $("#wgt_help").click(function(){
var tmp = $(this); var tmp = $(this);
if($(this).hasClass("open")){ if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){ $("#help").slideUp("100", function(){
tmp.removeClass("open"); tmp.removeClass("open");
$("#data").show(); $("#data").show();
}); });
} else { } else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#data").hide(); $("#data").hide();
$("#help").slideDown("100", function(){ $("#help").slideDown("100", function(){
tmp.addClass("open"); tmp.addClass("open");
...@@ -101,7 +106,7 @@ function start(){ ...@@ -101,7 +106,7 @@ function start(){
$("#wgt_display").trigger("click"); $("#wgt_display").trigger("click");
}); });
$(".style_select").change(function (event){ $("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val()); changeStyle($(this).find("option:selected").val());
}) })
...@@ -112,7 +117,7 @@ function start(){ ...@@ -112,7 +117,7 @@ function start(){
sankore.enableDropOnWidget(false); sankore.enableDropOnWidget(false);
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_edit").removeClass("selected"); $("#wgt_edit").removeClass("selected");
$(".style_select").css("display","none"); $("#parameters").css("display","none");
$(".add_block").remove(); $(".add_block").remove();
$(".cont").each(function(){ $(".cont").each(function(){
var container = $(this); var container = $(this);
...@@ -140,7 +145,7 @@ function start(){ ...@@ -140,7 +145,7 @@ function start(){
sankore.enableDropOnWidget(true); sankore.enableDropOnWidget(true);
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_display").removeClass("selected"); $("#wgt_display").removeClass("selected");
$(".style_select").css("display","block"); $("#parameters").css("display","block");
$(".cont").each(function(){ $(".cont").each(function(){
var container = $(this); var container = $(this);
...@@ -196,31 +201,31 @@ function start(){ ...@@ -196,31 +201,31 @@ function start(){
if($(this).is(":checked")) if($(this).is(":checked"))
$(this).parent().find("input:hidden").val(1); $(this).parent().find("input:hidden").val(1);
else else
$(this).parent().find("input:hidden").val(0); $(this).parent().find("input:hidden").val(0);
} }
}); });
//play/pause event //play/pause event
$(".play, .stop").live("click", function(){ $(".play, .stop").live("click", function(){
var tmp_audio = $(this); var tmp_audio = $(this);
var audio = tmp_audio.parent().find("audio").get(0); var audio = tmp_audio.parent().find("audio").get(0);
if($(this).hasClass("play")){ if($(this).hasClass("play")){
if(tmp_audio.parent().find("source").attr("src")){ if(tmp_audio.parent().find("source").attr("src")){
tmp_audio.removeClass("play").addClass("stop"); tmp_audio.removeClass("play").addClass("stop");
var id = setInterval(function(){ var id = setInterval(function(){
if(audio.currentTime == audio.duration){ if(audio.currentTime == audio.duration){
clearInterval(id); clearInterval(id);
tmp_audio.removeClass("stop").addClass("play"); tmp_audio.removeClass("stop").addClass("play");
} }
}, 10); }, 10);
tmp_audio.parent().find("input").val(id); tmp_audio.parent().find("input").val(id);
audio.play(); audio.play();
} }
} else { } else {
$(this).removeClass("stop").addClass("play"); $(this).removeClass("stop").addClass("play");
clearInterval( tmp_audio.parent().find("input").val()) clearInterval( tmp_audio.parent().find("input").val())
audio.pause(); audio.pause();
} }
}); });
$(".replay").live("click", function(){ $(".replay").live("click", function(){
...@@ -463,10 +468,10 @@ function changeStyle(val){ ...@@ -463,10 +468,10 @@ function changeStyle(val){
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload"); $("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help"); $("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit"); $("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_display").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color"); $("#wgt_name").removeClass("pad_color");
$(".style_select").removeClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").addClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select").val(val);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break; break;
case "2": case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back"); $(".b_top_left").addClass("btl_pad").removeClass("without_back");
...@@ -480,10 +485,10 @@ function changeStyle(val){ ...@@ -480,10 +485,10 @@ function changeStyle(val){
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select").val(val);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break; break;
case "3": case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad"); $(".b_top_left").addClass("without_back").removeClass("btl_pad");
...@@ -497,10 +502,10 @@ function changeStyle(val){ ...@@ -497,10 +502,10 @@ function changeStyle(val){
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").addClass("without_radius"); $("#style_select").val(val);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break; break;
} }
} }
......
...@@ -26,11 +26,6 @@ ...@@ -26,11 +26,6 @@
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -40,7 +35,17 @@ ...@@ -40,7 +35,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="data"> <div id="data">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
var sankoreLang = { var sankoreLang = {
display: "Показать", display: "Закрыть",
edit: "Изменить", edit: "Изменить",
short_desc: "Выберите животных из следующего списка:", short_desc: "Выберите животных из следующего списка:",
add: "Новый блок", add: "Новый блок",
...@@ -15,7 +15,8 @@ var sankoreLang = { ...@@ -15,7 +15,8 @@ var sankoreLang = {
pad: "Планшет", pad: "Планшет",
none: "Нет", none: "Нет",
help: "Помощь", help: "Помощь",
help_content: "Пример текста помощи ..." help_content: "Пример текста помощи ...",
theme: "Тема"
}; };
//main function //main function
...@@ -27,9 +28,11 @@ function start(){ ...@@ -27,9 +28,11 @@ function start(){
$("#wgt_reload").text(sankoreLang.reload); $("#wgt_reload").text(sankoreLang.reload);
$("#wgt_help").text(sankoreLang.help); $("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content); $("#help").html(sankoreLang.help_content);
$(".style_select option[value='1']").text(sankoreLang.slate); $("#style_select option[value='1']").text(sankoreLang.slate);
$(".style_select option[value='2']").text(sankoreLang.pad); $("#style_select option[value='2']").text(sankoreLang.pad);
$(".style_select option[value='3']").text(sankoreLang.none); $("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
if(window.sankore){ if(window.sankore){
if(sankore.preference("selectionner","")){ if(sankore.preference("selectionner","")){
...@@ -39,7 +42,7 @@ function start(){ ...@@ -39,7 +42,7 @@ function start(){
showExample(); showExample();
if(sankore.preference("sel_style","")){ if(sankore.preference("sel_style","")){
changeStyle(sankore.preference("sel_style","")); changeStyle(sankore.preference("sel_style",""));
$(".style_select").val(sankore.preference("sel_style","")); $("#style_select").val(sankore.preference("sel_style",""));
} else } else
changeStyle("3") changeStyle("3")
} }
...@@ -50,18 +53,20 @@ function start(){ ...@@ -50,18 +53,20 @@ function start(){
if (window.widget) { if (window.widget) {
window.widget.onleave = function(){ window.widget.onleave = function(){
exportData(); exportData();
sankore.setPreference("sel_style", $(".style_select").find("option:selected").val()); sankore.setPreference("sel_style", $("#style_select").find("option:selected").val());
} }
} }
$("#wgt_help").click(function(){ $("#wgt_help").click(function(){
var tmp = $(this); var tmp = $(this);
if($(this).hasClass("open")){ if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){ $("#help").slideUp("100", function(){
tmp.removeClass("open"); tmp.removeClass("open");
$("#data").show(); $("#data").show();
}); });
} else { } else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#data").hide(); $("#data").hide();
$("#help").slideDown("100", function(){ $("#help").slideDown("100", function(){
tmp.addClass("open"); tmp.addClass("open");
...@@ -83,7 +88,7 @@ function start(){ ...@@ -83,7 +88,7 @@ function start(){
$("#wgt_display").trigger("click"); $("#wgt_display").trigger("click");
}); });
$(".style_select").change(function (event){ $("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val()); changeStyle($(this).find("option:selected").val());
}) })
...@@ -94,7 +99,7 @@ function start(){ ...@@ -94,7 +99,7 @@ function start(){
sankore.enableDropOnWidget(false); sankore.enableDropOnWidget(false);
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_edit").removeClass("selected"); $("#wgt_edit").removeClass("selected");
$(".style_select").css("display","none"); $("#parameters").css("display","none");
$(".add_block").remove(); $(".add_block").remove();
$(".cont").each(function(){ $(".cont").each(function(){
var container = $(this); var container = $(this);
...@@ -122,7 +127,7 @@ function start(){ ...@@ -122,7 +127,7 @@ function start(){
sankore.enableDropOnWidget(true); sankore.enableDropOnWidget(true);
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_display").removeClass("selected"); $("#wgt_display").removeClass("selected");
$(".style_select").css("display","block"); $("#parameters").css("display","block");
$(".cont").each(function(){ $(".cont").each(function(){
var container = $(this); var container = $(this);
...@@ -178,31 +183,31 @@ function start(){ ...@@ -178,31 +183,31 @@ function start(){
if($(this).is(":checked")) if($(this).is(":checked"))
$(this).parent().find("input:hidden").val(1); $(this).parent().find("input:hidden").val(1);
else else
$(this).parent().find("input:hidden").val(0); $(this).parent().find("input:hidden").val(0);
} }
}); });
//play/pause event //play/pause event
$(".play, .stop").live("click", function(){ $(".play, .stop").live("click", function(){
var tmp_audio = $(this); var tmp_audio = $(this);
var audio = tmp_audio.parent().find("audio").get(0); var audio = tmp_audio.parent().find("audio").get(0);
if($(this).hasClass("play")){ if($(this).hasClass("play")){
if(tmp_audio.parent().find("source").attr("src")){ if(tmp_audio.parent().find("source").attr("src")){
tmp_audio.removeClass("play").addClass("stop"); tmp_audio.removeClass("play").addClass("stop");
var id = setInterval(function(){ var id = setInterval(function(){
if(audio.currentTime == audio.duration){ if(audio.currentTime == audio.duration){
clearInterval(id); clearInterval(id);
tmp_audio.removeClass("stop").addClass("play"); tmp_audio.removeClass("stop").addClass("play");
} }
}, 10); }, 10);
tmp_audio.parent().find("input").val(id); tmp_audio.parent().find("input").val(id);
audio.play(); audio.play();
} }
} else { } else {
$(this).removeClass("stop").addClass("play"); $(this).removeClass("stop").addClass("play");
clearInterval( tmp_audio.parent().find("input").val()) clearInterval( tmp_audio.parent().find("input").val())
audio.pause(); audio.pause();
} }
}); });
$(".replay").live("click", function(){ $(".replay").live("click", function(){
...@@ -445,10 +450,10 @@ function changeStyle(val){ ...@@ -445,10 +450,10 @@ function changeStyle(val){
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload"); $("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help"); $("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit"); $("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_display").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color"); $("#wgt_name").removeClass("pad_color");
$(".style_select").removeClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").addClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select").val(val);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break; break;
case "2": case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back"); $(".b_top_left").addClass("btl_pad").removeClass("without_back");
...@@ -462,10 +467,10 @@ function changeStyle(val){ ...@@ -462,10 +467,10 @@ function changeStyle(val){
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select").val(val);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break; break;
case "3": case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad"); $(".b_top_left").addClass("without_back").removeClass("btl_pad");
...@@ -479,10 +484,10 @@ function changeStyle(val){ ...@@ -479,10 +484,10 @@ function changeStyle(val){
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").addClass("without_radius"); $("#style_select").val(val);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break; break;
} }
} }
......
...@@ -58,11 +58,6 @@ ...@@ -58,11 +58,6 @@
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -72,7 +67,17 @@ ...@@ -72,7 +67,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="ub-widget"> <div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
...@@ -36,11 +36,6 @@ ...@@ -36,11 +36,6 @@
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -50,7 +45,17 @@ ...@@ -50,7 +45,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="ub-widget"> <div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
var sankoreLang = { var sankoreLang = {
view: "Afficher", view: "Fermer",
edit: "Modifier", edit: "Modifier",
example: "Ceci est une série de mots à séparer correctement", example: "Ceci est une série de mots à séparer correctement",
wgt_name: "Séparer une phrase", wgt_name: "Séparer une phrase",
...@@ -9,25 +9,26 @@ var sankoreLang = { ...@@ -9,25 +9,26 @@ var sankoreLang = {
none: "aucun", none: "aucun",
help: "Aide", help: "Aide",
help_content: "<p><h2>Séparer une phrase</h2></p>"+ help_content: "<p><h2>Séparer une phrase</h2></p>"+
"<p><h3>Séparer les mots d’une phrase.</h3></p>"+ "<p><h3>Séparer les mots d’une phrase.</h3></p>"+
"<p>Une phrase est écrite sans que les mots ne soient séparés. Le but de cette activité est d’insérer les espaces aux bons endroits. Une fois que les séparations sont placées correctement, la phrase se colore en vert.</p>"+ "<p>Une phrase est écrite sans que les mots ne soient séparés. Le but de cette activité est d’insérer les espaces aux bons endroits. Une fois que les séparations sont placées correctement, la phrase se colore en vert.</p>"+
"<p>Pour ajouter des séparations entre les mots, déplacez le curseur et cliquez entre deux lettres, une séparation s’ajoute alors.</p>"+ "<p>Pour ajouter des séparations entre les mots, déplacez le curseur et cliquez entre deux lettres, une séparation s’ajoute alors.</p>"+
"<p>Le bouton “Recharger” réinitialise l’exercice.</p>"+ "<p>Le bouton “Recharger” réinitialise l’exercice.</p>"+
"<p>Le bouton “Modifier” vous permet :</p>"+ "<p>Le bouton “Modifier” vous permet :</p>"+
"<ul><li>de choisir le thème de l’interactivité : tablette, ardoise ou aucun (par défaut aucun), </li>"+ "<ul><li>de choisir le thème de l’interactivité : tablette, ardoise ou aucun (par défaut aucun), </li>"+
"<li>de déterminer la phrase sur laquelle travailler.</li></ul>"+ "<li>de déterminer la phrase sur laquelle travailler.</li></ul>"+
"<p>Ecrivez simplement une phrase dans la zone de texte.</p>"+ "<p>Ecrivez simplement une phrase dans la zone de texte.</p>"+
"<p>Le bouton “Afficher” vous permet d’utiliser l’activité.</p>" "<p>Le bouton “Afficher” vous permet d’utiliser l’activité.</p>",
theme: "Thème"
}; };
...@@ -38,180 +39,180 @@ var isBrowser = ( typeof( widget ) == "undefined" ); ...@@ -38,180 +39,180 @@ var isBrowser = ( typeof( widget ) == "undefined" );
function wcontainer( containerID ) function wcontainer( containerID )
{ {
// some protecred variables // some protecred variables
var thisInstance = this; var thisInstance = this;
this.editMode = false; this.editMode = false;
var data = {}; // see setData and getData var data = {}; // see setData and getData
// widget size parameters // widget size parameters
this.minHeight = 100; this.minHeight = 100;
this.minWidth = 400; this.minWidth = 400;
// set to 0 for no max width restriction // set to 0 for no max width restriction
this.maxWidth = 0; this.maxWidth = 0;
// links to the elements of the widget // links to the elements of the widget
this.elements = {}; this.elements = {};
/* /*
============ ============
create create
============ ============
- creates html base, inits this.elements, assings events - creates html base, inits this.elements, assings events
*/ */
this.create = function( containerID ) this.create = function( containerID )
{ {
var html = var html =
'<div id="mp_content">' + '<div id="mp_content">' +
'<div class="viewmode" id="mp_view">' + '<div class="viewmode" id="mp_view">' +
'</div>' + '</div>' +
'<div class="editmode" id="mp_edit">' + '<div class="editmode" id="mp_edit">' +
'</div>' + '</div>' +
'</div>'; '</div>';
var container = $( containerID ); var container = $( containerID );
container.append( html ); container.append( html );
this.elements.edit = container.find( ".editmode" ); this.elements.edit = container.find( ".editmode" );
this.elements.view = container.find( ".viewmode" ); this.elements.view = container.find( ".viewmode" );
this.elements.container = container; this.elements.container = container;
this.elements.subcontainer = container.find( "#mp_content" ); this.elements.subcontainer = container.find( "#mp_content" );
this.elements.containerView = this.elements.subcontainer.find( ".viewmode" ); this.elements.containerView = this.elements.subcontainer.find( ".viewmode" );
this.elements.containerEdit = this.elements.subcontainer.find( ".editmode" ); this.elements.containerEdit = this.elements.subcontainer.find( ".editmode" );
$("#wgt_edit").live("click", function(){ $("#wgt_edit").live("click", function(){
thisInstance.modeEdit(); thisInstance.modeEdit();
} ); } );
$("#wgt_display").live("click", function(){ $("#wgt_display").live("click", function(){
thisInstance.modeView(); thisInstance.modeView();
} ); } );
}; };
/* /*
=============== ===============
setViewContent setViewContent
=============== ===============
- assigns custom html to the viewmode container - assigns custom html to the viewmode container
*/ */
this.setViewContent = function( html ) this.setViewContent = function( html )
{ {
this.elements.container.find( "#mp_content .viewmode" ).html( html ); this.elements.container.find( "#mp_content .viewmode" ).html( html );
}; };
/* /*
=============== ===============
setEditContent setEditContent
=============== ===============
- assigns custom html to the editmode container - assigns custom html to the editmode container
*/ */
this.setEditContent = function( html ) this.setEditContent = function( html )
{ {
this.elements.container.find( "#mp_content .editmode" ).html( html ); this.elements.container.find( "#mp_content .editmode" ).html( html );
}; };
/* /*
========================= =========================
modeEdit and modeView modeEdit and modeView
========================= =========================
- switch the widget betweed modes - switch the widget betweed modes
* for customization extend onEditMode and onViewMode * for customization extend onEditMode and onViewMode
*/ */
this.modeEdit = function() this.modeEdit = function()
{ {
this.onEditMode(); this.onEditMode();
this.editMode = true; this.editMode = true;
this.elements.edit.removeClass( "hide" ); this.elements.edit.removeClass( "hide" );
this.elements.view.addClass( "hide" ); this.elements.view.addClass( "hide" );
//this.adjustSize(); //this.adjustSize();
}; };
this.modeView = function() this.modeView = function()
{ {
this.onViewMode(); this.onViewMode();
this.editMode = false; this.editMode = false;
this.elements.edit.addClass( "hide" ); this.elements.edit.addClass( "hide" );
this.elements.view.removeClass( "hide" ); this.elements.view.removeClass( "hide" );
//this.adjustSize(); //this.adjustSize();
}; };
/* /*
====================== ======================
setData and getData setData and getData
====================== ======================
- store some data inside - store some data inside
*/ */
this.setData = function( name, value ){ this.setData = function( name, value ){
data[name] = value; data[name] = value;
}; };
this.getData = function( name ){ this.getData = function( name ){
if( typeof( data[name] ) == "undefined" ){ if( typeof( data[name] ) == "undefined" ){
return null; return null;
} else return data[name]; } else return data[name];
}; };
// redefinable methods // redefinable methods
/* /*
========================== ==========================
onEditMode and onViewMode onEditMode and onViewMode
========================== ==========================
- these are called when the mode is being changed - these are called when the mode is being changed
*/ */
this.onEditMode = function(){ this.onEditMode = function(){
// //
}; };
this.onViewMode = function(){ this.onViewMode = function(){
// //
}; };
/* /*
====================== ======================
viewSize and editSize viewSize and editSize
====================== ======================
- calculate container size for the adjustSize method - calculate container size for the adjustSize method
* they are likely to be redefined for each particular widget * they are likely to be redefined for each particular widget
*/ */
this.viewSize = function(){ this.viewSize = function(){
return { return {
w: this.elements.containerView.outerWidth(), w: this.elements.containerView.outerWidth(),
h: this.elements.containerView.outerHeight() h: this.elements.containerView.outerHeight()
}; };
}; };
this.editSize = function(){ this.editSize = function(){
return { return {
w: this.elements.containerEdit.outerWidth(), w: this.elements.containerEdit.outerWidth(),
h: this.elements.containerEdit.outerHeight() h: this.elements.containerEdit.outerHeight()
}; };
}; };
/* /*
===================== =====================
checkAnswer checkAnswer
===================== =====================
- check if the exercise in the view mode was done right - check if the exercise in the view mode was done right
* redefine it for each particular widget * redefine it for each particular widget
*/ */
this.checkAnswer = function() this.checkAnswer = function()
{ {
// //
}; };
// constructor end // constructor end
// if the constructor was called with a parameter, // if the constructor was called with a parameter,
// call create() automatically // call create() automatically
if( arguments.length > 0 ){ if( arguments.length > 0 ){
this.create( containerID ); this.create( containerID );
} }
this.setData( "dw", this.elements.container.outerWidth( true ) - this.elements.container.width() ); this.setData( "dw", this.elements.container.outerWidth( true ) - this.elements.container.width() );
this.setData( "dh", this.elements.container.outerHeight( true ) - this.elements.container.height() ); this.setData( "dh", this.elements.container.outerHeight( true ) - this.elements.container.height() );
window.winstance = thisInstance; window.winstance = thisInstance;
} }
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
<script type="text/javascript" src="../../scripts/app.js"></script> <script type="text/javascript" src="../../scripts/app.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
alert(2)
if(window.sankore) if(window.sankore)
sankore.enableDropOnWidget(false); sankore.enableDropOnWidget(false);
}); });
...@@ -37,11 +36,6 @@ ...@@ -37,11 +36,6 @@
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -51,7 +45,17 @@ ...@@ -51,7 +45,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="ub-widget"> <div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
var sankoreLang = { var sankoreLang = {
view: "Показать", view: "Закрыть",
edit: "Изменить", edit: "Изменить",
example: "это группа слов которую нужно разделить", example: "это группа слов которую нужно разделить",
wgt_name: "Разделить фразу", wgt_name: "Разделить фразу",
...@@ -8,7 +8,8 @@ var sankoreLang = { ...@@ -8,7 +8,8 @@ var sankoreLang = {
pad: "Планшет", pad: "Планшет",
none: "Нет", none: "Нет",
help: "Помощь", help: "Помощь",
help_content: "Пример текста помощи ..." help_content: "Пример текста помощи ...",
theme: "Тема"
}; };
// if use the "view/edit" button or rely on the api instead // if use the "view/edit" button or rely on the api instead
......
...@@ -31,7 +31,7 @@ $(document).ready(function() ...@@ -31,7 +31,7 @@ $(document).ready(function()
if (window.widget) { if (window.widget) {
window.widget.onleave = function(){ window.widget.onleave = function(){
sankore.setPreference("spl_phrase_style", $(".style_select").find("option:selected").val()); sankore.setPreference("spl_phrase_style", $("#style_select").find("option:selected").val());
if(w.editMode){ if(w.editMode){
sankore.setPreference("ordSplPhrases", w.elements.container.find( "textarea" ).val()); sankore.setPreference("ordSplPhrases", w.elements.container.find( "textarea" ).val());
sankore.setPreference("ordSplPhrasesState", "0"); sankore.setPreference("ordSplPhrasesState", "0");
...@@ -47,7 +47,6 @@ $(document).ready(function() ...@@ -47,7 +47,6 @@ $(document).ready(function()
if(window.sankore && sankore.preference("spl_phrase_style","")){ if(window.sankore && sankore.preference("spl_phrase_style","")){
changeStyle(sankore.preference("spl_phrase_style","")); changeStyle(sankore.preference("spl_phrase_style",""));
$(".style_select").val(sankore.preference("spl_phrase_style",""));
} else } else
changeStyle("3") changeStyle("3")
...@@ -55,13 +54,23 @@ $(document).ready(function() ...@@ -55,13 +54,23 @@ $(document).ready(function()
$("#wgt_edit").text(sankoreLang.edit); $("#wgt_edit").text(sankoreLang.edit);
$("#wgt_help").text(sankoreLang.help); $("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content); $("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){ $("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){ if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){ if(!$(this).hasClass("selected")){
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_edit").removeClass("selected"); $("#wgt_edit").removeClass("selected");
$(".style_select").css("display","none"); $("#parameters").css("display","none");
$(this).css("display", "none"); $(this).css("display", "none");
$("#wgt_edit").css("display", "block"); $("#wgt_edit").css("display", "block");
w.modeView(); w.modeView();
...@@ -70,7 +79,7 @@ $(document).ready(function() ...@@ -70,7 +79,7 @@ $(document).ready(function()
if(!$(this).hasClass("selected")){ if(!$(this).hasClass("selected")){
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_display").removeClass("selected"); $("#wgt_display").removeClass("selected");
$(".style_select").css("display","block"); $("#parameters").css("display","block");
$(this).css("display", "none"); $(this).css("display", "none");
$("#wgt_display").css("display", "block"); $("#wgt_display").css("display", "block");
w.modeEdit(); w.modeEdit();
...@@ -83,11 +92,13 @@ $(document).ready(function() ...@@ -83,11 +92,13 @@ $(document).ready(function()
$("#wgt_help").click(function(){ $("#wgt_help").click(function(){
var tmp = $(this); var tmp = $(this);
if($(this).hasClass("open")){ if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){ $("#help").slideUp("100", function(){
tmp.removeClass("open"); tmp.removeClass("open");
$("#ub-widget").show(); $("#ub-widget").show();
}); });
} else { } else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#ub-widget").hide(); $("#ub-widget").hide();
$("#help").slideDown("100", function(){ $("#help").slideDown("100", function(){
tmp.addClass("open"); tmp.addClass("open");
...@@ -104,14 +115,6 @@ $(document).ready(function() ...@@ -104,14 +115,6 @@ $(document).ready(function()
} }
}); });
$(".style_select option[value='1']").text(sankoreLang.slate);
$(".style_select option[value='2']").text(sankoreLang.pad);
$(".style_select option[value='3']").text(sankoreLang.none);
$(".style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
w.maxWidth = 600; w.maxWidth = 600;
w.setEditContent( '<div class="inputwrap"><textarea class="percent">' + sentence + '</textarea></div>' ); w.setEditContent( '<div class="inputwrap"><textarea class="percent">' + sentence + '</textarea></div>' );
...@@ -263,7 +266,7 @@ $(document).ready(function() ...@@ -263,7 +266,7 @@ $(document).ready(function()
//changing the style //changing the style
function changeStyle(val){ function changeStyle(val){
switch(val){ switch(val){
case "1": case "1":
$(".b_top_left").removeClass("btl_pad").removeClass("without_back"); $(".b_top_left").removeClass("btl_pad").removeClass("without_back");
$(".b_top_center").removeClass("btc_pad").removeClass("without_back"); $(".b_top_center").removeClass("btc_pad").removeClass("without_back");
...@@ -276,10 +279,10 @@ $(document).ready(function() ...@@ -276,10 +279,10 @@ $(document).ready(function()
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload"); $("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help"); $("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit"); $("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_display").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color"); $("#wgt_name").removeClass("pad_color");
$(".style_select").removeClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").addClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select option:first").attr('selected',true);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break; break;
case "2": case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back"); $(".b_top_left").addClass("btl_pad").removeClass("without_back");
...@@ -293,10 +296,10 @@ $(document).ready(function() ...@@ -293,10 +296,10 @@ $(document).ready(function()
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select option:first").next().attr('selected',true);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break; break;
case "3": case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad"); $(".b_top_left").addClass("without_back").removeClass("btl_pad");
...@@ -310,12 +313,12 @@ $(document).ready(function() ...@@ -310,12 +313,12 @@ $(document).ready(function()
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").addClass("without_radius"); $("#style_select option:last").attr('selected',true);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break; break;
} }
} }
}); });
\ No newline at end of file
var sankoreLang = { var sankoreLang = {
view: "Display", view: "Close",
edit: "Edit", edit: "Edit",
example: "this is a bunch of words which should be split apart", example: "this is a bunch of words which should be split apart",
wgt_name: "Split a phrase", wgt_name: "Split a phrase",
...@@ -8,7 +8,8 @@ var sankoreLang = { ...@@ -8,7 +8,8 @@ var sankoreLang = {
pad: "Pad", pad: "Pad",
none: "None", none: "None",
help: "Help", help: "Help",
help_content: "This is an example of help content ..." help_content: "This is an example of help content ...",
theme: "Theme"
}; };
// if use the "view/edit" button or rely on the api instead // if use the "view/edit" button or rely on the api instead
......
...@@ -109,57 +109,40 @@ ...@@ -109,57 +109,40 @@
margin: 10px 10px 0 10px; margin: 10px 10px 0 10px;
padding: 0; padding: 0;
float: left; float: left;
/*font-family: "Lobster13Regular";*/ font-family: Arial,Helvetica,sans-serif;
font-size: 24px; font-size: 24px;
color: #8c5730; color: #7F613F;
text-shadow: #FFDCA9 0 1px 0;
} }
#wgt_reload, #wgt_edit, #wgt_display, #wgt_help{ #wgt_reload, #wgt_edit, #wgt_display, #wgt_help{
cursor: pointer; cursor: pointer;
height: 44px;
margin: 10px 10px 0 0; margin: 10px 10px 0 0;
float: right; float: right;
/*font-family: "Lobster13Regular";*/ font-family: Arial,Helvetica,sans-serif;
font-size: 24px; font-size: 24px;
color: #8c5730; line-height: 32px;
} }
#wgt_display{ #wgt_display{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-edit.png); background: url(../img/toolbar-edit.png) left -32px no-repeat;
background-repeat: no-repeat; color: white;
background-position: top 0;
display: none; display: none;
} }
#wgt_edit{ #wgt_edit{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-edit.png); background: url(../img/slate-toolbar-edit.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
} }
#wgt_reload{ #wgt_reload{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-toolbar-reload.png); background: url(../img/slate-toolbar-reload.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
}
.style_select{
width: 120px;
/*font-family: "Lobster13Regular";*/
font-size: 24px;
float: right;
margin: 10px 20px 0 0;
border-radius: 10px;
background-image: url(../img/ar_down.png);
background-color: #d4aa79;
color: #8c5730;
background-position: 105px 11px;
background-repeat: no-repeat;
-webkit-appearance: menulist-text;
display: none;
} }
.btl_pad{ .btl_pad{
...@@ -194,51 +177,50 @@ ...@@ -194,51 +177,50 @@
background-image: url(../img/pad-bottom-right.png) !important; background-image: url(../img/pad-bottom-right.png) !important;
} }
.pad_color{ .without_radius{
color: white !important; border-radius: 0 !important;
} }
.pad_reload{ .without_back{
background-image: url(../img/slate-toolbar-reload-white.png) !important; background: none !important;
} }
.pad_edit{ .pad_color{
background-image: url(../img/slate-display.png) !important; color: #FC9 !important;
text-shadow: none !important;
} }
.pad_select{ .pad_reload{
background-color: black !important; background: url(../img/toolbar-reload.png) left top no-repeat !important;
color: white !important;
background-image: url(../img/ar_down_white.png) !important;
} }
.without_radius{ .pad_edit{
border-radius: 0 !important; background: url(../img/toolbar-edit.png) left top no-repeat !important;
} }
.without_back{ .pad_help{
background: none !important; background: url(../img/toolbar-help.png) left top no-repeat !important;
} }
.none_select{ .help_wood{
background-color: #333 !important; background: url(../img/slate-toolbar-help.png) left -32px no-repeat !important;
color: white !important; color: white !important;
background-image: url(../img/ar_down_white.png) !important; text-shadow: #7F613F 0 -1px 0 !important;
} }
.pad_help{ .help_pad{
background-image: url(../img/slate-help-white.png) !important; background: url(../img/toolbar-help.png) left -32px no-repeat !important;
color: white !important;
} }
#wgt_help{ #wgt_help{
padding-left: 32px; padding-left: 35px;
background-image: url(../img/slate-help.png); background: url(../img/slate-toolbar-help.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
} }
#help{ #help{
width: 100%;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
display: none; display: none;
...@@ -247,5 +229,36 @@ ...@@ -247,5 +229,36 @@
} }
.open{ .open{
}
#parameters{
display: none;
padding: 10px 20px;
background: url("../img/parameters-bg.png");
border-radius: 4px 4px 0 0;
}
.inline{
display: inline-block;
font-family: "helvetica neue";
font-size: 14px;
color: #666;
}
#parameters label {
font-style: italic;
}
#style_select{
margin-left: 10px;
}
.display_wood{
background: url(../img/slate-toolbar-edit.png) left -32px no-repeat !important;
text-shadow: #7F613F 0 -1px 0;
}
.radius_ft{
border-radius: 45px !important;
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ html, body{ ...@@ -3,7 +3,7 @@ html, body{
height: 100%; height: 100%;
margin: 0; margin: 0;
padding: 0; padding: 0;
border-radius: 50px; border-radius: 35px;
overflow: hidden; overflow: hidden;
} }
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
lang = sankore.locale().substr(0,2); lang = sankore.locale().substr(0,2);
} else } else
lang = "en"; lang = "en";
if(lang != "en"){ if(lang != "en"){
returnStatus(lang); returnStatus(lang);
} }
...@@ -60,12 +59,7 @@ ...@@ -60,12 +59,7 @@
<div id="wgt_help"></div> <div id="wgt_help"></div>
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -75,7 +69,17 @@ ...@@ -75,7 +69,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="ub-widget"> <div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
...@@ -36,11 +36,6 @@ ...@@ -36,11 +36,6 @@
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -50,7 +45,17 @@ ...@@ -50,7 +45,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="ub-widget"> <div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
var sankoreLang = { var sankoreLang = {
view: "Afficher", view: "Fermer",
edit: "Modifier", edit: "Modifier",
example: "bonjour, ceci est la première phrase. salut, c'est la deuxième phrase. bonjour à nouveau, c'est la troisième phrase. bonjour, c'est la quatrième phrase. salut, désolé, je suis en retard, je suis la cinquième phrase.", example: "bonjour, ceci est la première phrase. salut, c'est la deuxième phrase. bonjour à nouveau, c'est la troisième phrase. bonjour, c'est la quatrième phrase. salut, désolé, je suis en retard, je suis la cinquième phrase.",
wgt_name: "Séparer un texte", wgt_name: "Séparer un texte",
...@@ -10,23 +10,24 @@ var sankoreLang = { ...@@ -10,23 +10,24 @@ var sankoreLang = {
help: "Aide", help: "Aide",
help_content: "<p><h3>Séparer les phrases d’un texte.</h3></p>"+ help_content: "<p><h3>Séparer les phrases d’un texte.</h3></p>"+
"<p>Un texte est écrit sans que les points entre les phrases n’apparaissent. Le but de cette activité est d’insérer les points aux bons endroits. Une fois que les points sont placés correctement, la phrase se colore en vert.</p>"+ "<p>Un texte est écrit sans que les points entre les phrases n’apparaissent. Le but de cette activité est d’insérer les points aux bons endroits. Une fois que les points sont placés correctement, la phrase se colore en vert.</p>"+
"<p>Pour ajouter les points entre les phrases, déplacez le curseur et cliquez entre deux mots, un point s’ajoute alors.</p>"+ "<p>Pour ajouter les points entre les phrases, déplacez le curseur et cliquez entre deux mots, un point s’ajoute alors.</p>"+
"<p>Le bouton “Recharger” réinitialise l’exercice.</p>"+ "<p>Le bouton “Recharger” réinitialise l’exercice.</p>"+
"<p>Le bouton “Modifier” vous permet :</p>"+ "<p>Le bouton “Modifier” vous permet :</p>"+
"<ul><li>de choisir le thème de l’interactivité : tablette, ardoise ou aucun (par défaut aucun), </li>"+ "<ul><li>de choisir le thème de l’interactivité : tablette, ardoise ou aucun (par défaut aucun), </li>"+
"<li>de déterminer le texte sur lequel travailler.</li></ul>"+ "<li>de déterminer le texte sur lequel travailler.</li></ul>"+
"<p>Ecrivez simplement dans la zone de texte les différentes phrases séparées par des points.<b> NB : Les points d’interrogation, les deux points “:”, les points-virgules “;” et les points d’exclamation ne sont pas pris en compte.</b></p>"+ "<p>Ecrivez simplement dans la zone de texte les différentes phrases séparées par des points.<b> NB : Les points d’interrogation, les deux points “:”, les points-virgules “;” et les points d’exclamation ne sont pas pris en compte.</b></p>"+
"<p>Le bouton “Afficher” vous permet d’utiliser l’activité.</p>" "<p>Le bouton “Afficher” vous permet d’utiliser l’activité.</p>",
theme: "Thème"
}; };
...@@ -57,7 +58,7 @@ function wcontainer( containerID ) ...@@ -57,7 +58,7 @@ function wcontainer( containerID )
create create
============ ============
- creates html base, inits this.elements, assings events - creates html base, inits this.elements, assings events
*/ */
this.create = function( containerID ) this.create = function( containerID )
{ {
var html = var html =
...@@ -93,7 +94,7 @@ function wcontainer( containerID ) ...@@ -93,7 +94,7 @@ function wcontainer( containerID )
setViewContent setViewContent
=============== ===============
- assigns custom html to the viewmode container - assigns custom html to the viewmode container
*/ */
this.setViewContent = function( html ) this.setViewContent = function( html )
{ {
this.elements.container.find( "#mp_content .viewmode" ).html( html ); this.elements.container.find( "#mp_content .viewmode" ).html( html );
...@@ -104,7 +105,7 @@ function wcontainer( containerID ) ...@@ -104,7 +105,7 @@ function wcontainer( containerID )
setEditContent setEditContent
=============== ===============
- assigns custom html to the editmode container - assigns custom html to the editmode container
*/ */
this.setEditContent = function( html ) this.setEditContent = function( html )
{ {
this.elements.container.find( "#mp_content .editmode" ).html( html ); this.elements.container.find( "#mp_content .editmode" ).html( html );
...@@ -117,8 +118,8 @@ function wcontainer( containerID ) ...@@ -117,8 +118,8 @@ function wcontainer( containerID )
modeEdit and modeView modeEdit and modeView
========================= =========================
- switch the widget betweed modes - switch the widget betweed modes
* for customization extend onEditMode and onViewMode * for customization extend onEditMode and onViewMode
*/ */
this.modeEdit = function() this.modeEdit = function()
{ {
this.onEditMode(); this.onEditMode();
...@@ -126,7 +127,7 @@ function wcontainer( containerID ) ...@@ -126,7 +127,7 @@ function wcontainer( containerID )
this.elements.edit.removeClass( "hide" ); this.elements.edit.removeClass( "hide" );
this.elements.view.addClass( "hide" ); this.elements.view.addClass( "hide" );
//this.adjustSize(); //this.adjustSize();
}; };
this.modeView = function() this.modeView = function()
{ {
...@@ -135,7 +136,7 @@ function wcontainer( containerID ) ...@@ -135,7 +136,7 @@ function wcontainer( containerID )
this.elements.edit.addClass( "hide" ); this.elements.edit.addClass( "hide" );
this.elements.view.removeClass( "hide" ); this.elements.view.removeClass( "hide" );
//this.adjustSize(); //this.adjustSize();
}; };
...@@ -145,7 +146,7 @@ function wcontainer( containerID ) ...@@ -145,7 +146,7 @@ function wcontainer( containerID )
setData and getData setData and getData
====================== ======================
- store some data inside - store some data inside
*/ */
this.setData = function( name, value ){ this.setData = function( name, value ){
data[name] = value; data[name] = value;
}; };
...@@ -163,7 +164,7 @@ function wcontainer( containerID ) ...@@ -163,7 +164,7 @@ function wcontainer( containerID )
onEditMode and onViewMode onEditMode and onViewMode
========================== ==========================
- these are called when the mode is being changed - these are called when the mode is being changed
*/ */
this.onEditMode = function(){ this.onEditMode = function(){
// //
}; };
...@@ -176,8 +177,8 @@ function wcontainer( containerID ) ...@@ -176,8 +177,8 @@ function wcontainer( containerID )
viewSize and editSize viewSize and editSize
====================== ======================
- calculate container size for the adjustSize method - calculate container size for the adjustSize method
* they are likely to be redefined for each particular widget * they are likely to be redefined for each particular widget
*/ */
this.viewSize = function(){ this.viewSize = function(){
return { return {
w: this.elements.containerView.outerWidth(), w: this.elements.containerView.outerWidth(),
...@@ -196,8 +197,8 @@ function wcontainer( containerID ) ...@@ -196,8 +197,8 @@ function wcontainer( containerID )
checkAnswer checkAnswer
===================== =====================
- check if the exercise in the view mode was done right - check if the exercise in the view mode was done right
* redefine it for each particular widget * redefine it for each particular widget
*/ */
this.checkAnswer = function() this.checkAnswer = function()
{ {
// //
......
...@@ -36,11 +36,6 @@ ...@@ -36,11 +36,6 @@
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -50,7 +45,17 @@ ...@@ -50,7 +45,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="ub-widget"> <div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
var sankoreLang = { var sankoreLang = {
view: "Показать", view: "Закрыть",
edit: "Изменить", edit: "Изменить",
example: "привет, это первое предложение. а это второе предложение. и снова привет, это третье предложение. добрый день, это четвертое предложение. привет, извини, но я последнее предложение.", example: "привет, это первое предложение. а это второе предложение. и снова привет, это третье предложение. добрый день, это четвертое предложение. привет, извини, но я последнее предложение.",
wgt_name: "Разделить текст", wgt_name: "Разделить текст",
...@@ -8,7 +8,8 @@ var sankoreLang = { ...@@ -8,7 +8,8 @@ var sankoreLang = {
pad: "Планшет", pad: "Планшет",
none: "Нет", none: "Нет",
help: "Помощь", help: "Помощь",
help_content: "Пример текста помощи ..." help_content: "Пример текста помощи ...",
theme: "Тема"
}; };
// if use the "view/edit" button or rely on the api instead // if use the "view/edit" button or rely on the api instead
......
...@@ -32,7 +32,7 @@ $(document).ready(function() ...@@ -32,7 +32,7 @@ $(document).ready(function()
if (window.widget) { if (window.widget) {
window.widget.onleave = function(){ window.widget.onleave = function(){
sankore.setPreference("spl_text_style", $(".style_select").find("option:selected").val()); sankore.setPreference("spl_text_style", $("#style_select").find("option:selected").val());
if(w.editMode){ if(w.editMode){
sankore.setPreference("ordSplText", w.elements.container.find( "textarea" ).val()); sankore.setPreference("ordSplText", w.elements.container.find( "textarea" ).val());
sankore.setPreference("ordSplTextState", "0"); sankore.setPreference("ordSplTextState", "0");
...@@ -48,7 +48,7 @@ $(document).ready(function() ...@@ -48,7 +48,7 @@ $(document).ready(function()
if(sankore.preference("spl_text_style","")){ if(sankore.preference("spl_text_style","")){
changeStyle(sankore.preference("spl_text_style","")); changeStyle(sankore.preference("spl_text_style",""));
$(".style_select").val(sankore.preference("spl_text_style","")); $("#style_select").val(sankore.preference("spl_text_style",""));
} else } else
changeStyle("3") changeStyle("3")
...@@ -56,13 +56,23 @@ $(document).ready(function() ...@@ -56,13 +56,23 @@ $(document).ready(function()
$("#wgt_edit").text(sankoreLang.edit); $("#wgt_edit").text(sankoreLang.edit);
$("#wgt_help").text(sankoreLang.help); $("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content); $("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){ $("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){ if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){ if(!$(this).hasClass("selected")){
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_edit").removeClass("selected"); $("#wgt_edit").removeClass("selected");
$(".style_select").css("display","none"); $("#parameters").css("display","none");
$(this).css("display", "none"); $(this).css("display", "none");
$("#wgt_edit").css("display", "block"); $("#wgt_edit").css("display", "block");
w.modeView(); w.modeView();
...@@ -71,7 +81,7 @@ $(document).ready(function() ...@@ -71,7 +81,7 @@ $(document).ready(function()
if(!$(this).hasClass("selected")){ if(!$(this).hasClass("selected")){
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_display").removeClass("selected"); $("#wgt_display").removeClass("selected");
$(".style_select").css("display","block"); $("#parameters").css("display","block");
$(this).css("display", "none"); $(this).css("display", "none");
$("#wgt_display").css("display", "block"); $("#wgt_display").css("display", "block");
w.modeEdit(); w.modeEdit();
...@@ -84,11 +94,13 @@ $(document).ready(function() ...@@ -84,11 +94,13 @@ $(document).ready(function()
$("#wgt_help").click(function(){ $("#wgt_help").click(function(){
var tmp = $(this); var tmp = $(this);
if($(this).hasClass("open")){ if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){ $("#help").slideUp("100", function(){
tmp.removeClass("open"); tmp.removeClass("open");
$("#ub-widget").show(); $("#ub-widget").show();
}); });
} else { } else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#ub-widget").hide(); $("#ub-widget").hide();
$("#help").slideDown("100", function(){ $("#help").slideDown("100", function(){
tmp.addClass("open"); tmp.addClass("open");
...@@ -105,14 +117,6 @@ $(document).ready(function() ...@@ -105,14 +117,6 @@ $(document).ready(function()
} }
}); });
$(".style_select option[value='1']").text(sankoreLang.slate);
$(".style_select option[value='2']").text(sankoreLang.pad);
$(".style_select option[value='3']").text(sankoreLang.none);
$(".style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
w.maxWidth = 600; w.maxWidth = 600;
w.setEditContent( '<div class="inputwrap"><textarea class="percent">' + sentences + '</textarea></div>' ); w.setEditContent( '<div class="inputwrap"><textarea class="percent">' + sentences + '</textarea></div>' );
...@@ -279,10 +283,10 @@ $(document).ready(function() ...@@ -279,10 +283,10 @@ $(document).ready(function()
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload"); $("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help"); $("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit"); $("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_display").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color"); $("#wgt_name").removeClass("pad_color");
$(".style_select").removeClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").addClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select option:first").attr('selected',true);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break; break;
case "2": case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back"); $(".b_top_left").addClass("btl_pad").removeClass("without_back");
...@@ -296,10 +300,10 @@ $(document).ready(function() ...@@ -296,10 +300,10 @@ $(document).ready(function()
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select option:first").next().attr('selected',true);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break; break;
case "3": case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad"); $(".b_top_left").addClass("without_back").removeClass("btl_pad");
...@@ -313,10 +317,10 @@ $(document).ready(function() ...@@ -313,10 +317,10 @@ $(document).ready(function()
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").addClass("without_radius"); $("#style_select option:last").attr('selected',true);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break; break;
} }
} }
......
var sankoreLang = { var sankoreLang = {
view: "Display", view: "Close",
edit: "Edit", edit: "Edit",
example: "hello, this is the first sentence. hi, this is the second sentence. hello again, this is the third sentence. good morning, this is the fourth sentence. hi, sorry, i\'m late, i\'m the fifth sentence.", example: "hello, this is the first sentence. hi, this is the second sentence. hello again, this is the third sentence. good morning, this is the fourth sentence. hi, sorry, i\'m late, i\'m the fifth sentence.",
wgt_name: "Split a text", wgt_name: "Split a text",
...@@ -8,7 +8,8 @@ var sankoreLang = { ...@@ -8,7 +8,8 @@ var sankoreLang = {
pad: "Pad", pad: "Pad",
none: "None", none: "None",
help: "Help", help: "Help",
help_content: "This is an example of help content ..." help_content: "This is an example of help content ...",
theme: "Theme"
}; };
// if use the "view/edit" button or rely on the api instead // if use the "view/edit" button or rely on the api instead
......
...@@ -110,57 +110,40 @@ ...@@ -110,57 +110,40 @@
margin: 10px 10px 0 10px; margin: 10px 10px 0 10px;
padding: 0; padding: 0;
float: left; float: left;
/*font-family: "Lobster13Regular";*/ font-family: Arial,Helvetica,sans-serif;
font-size: 24px; font-size: 24px;
color: #8c5730; color: #7F613F;
text-shadow: #FFDCA9 0 1px 0;
} }
#wgt_reload, #wgt_edit, #wgt_display, #wgt_help{ #wgt_reload, #wgt_edit, #wgt_display, #wgt_help{
cursor: pointer; cursor: pointer;
height: 44px;
margin: 10px 10px 0 0; margin: 10px 10px 0 0;
float: right; float: right;
/*font-family: "Lobster13Regular";*/ font-family: Arial,Helvetica,sans-serif;
font-size: 24px; font-size: 24px;
color: #8c5730; line-height: 32px;
} }
#wgt_display{ #wgt_display{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-edit.png); background: url(../img/toolbar-edit.png) left -32px no-repeat;
background-repeat: no-repeat; color: white;
background-position: top 0;
display: none; display: none;
} }
#wgt_edit{ #wgt_edit{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-edit.png); background: url(../img/slate-toolbar-edit.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
} }
#wgt_reload{ #wgt_reload{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-toolbar-reload.png); background: url(../img/slate-toolbar-reload.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
}
.style_select{
width: 120px;
/*font-family: "Lobster13Regular";*/
font-size: 24px;
float: right;
margin: 10px 20px 0 0;
border-radius: 10px;
background-image: url(../img/ar_down.png);
background-color: #d4aa79;
color: #8c5730;
background-position: 105px 11px;
background-repeat: no-repeat;
-webkit-appearance: menulist-text;
display: none;
} }
.btl_pad{ .btl_pad{
...@@ -195,51 +178,50 @@ ...@@ -195,51 +178,50 @@
background-image: url(../img/pad-bottom-right.png) !important; background-image: url(../img/pad-bottom-right.png) !important;
} }
.pad_color{ .without_radius{
color: white !important; border-radius: 0 !important;
} }
.pad_reload{ .without_back{
background-image: url(../img/slate-toolbar-reload-white.png) !important; background: none !important;
} }
.pad_edit{ .pad_color{
background-image: url(../img/slate-display.png) !important; color: #FC9 !important;
text-shadow: none !important;
} }
.pad_select{ .pad_reload{
background-color: black !important; background: url(../img/toolbar-reload.png) left top no-repeat !important;
color: white !important;
background-image: url(../img/ar_down_white.png) !important;
} }
.without_radius{ .pad_edit{
border-radius: 0 !important; background: url(../img/toolbar-edit.png) left top no-repeat !important;
} }
.without_back{ .pad_help{
background: none !important; background: url(../img/toolbar-help.png) left top no-repeat !important;
} }
.none_select{ .help_wood{
background-color: #333 !important; background: url(../img/slate-toolbar-help.png) left -32px no-repeat !important;
color: white !important; color: white !important;
background-image: url(../img/ar_down_white.png) !important; text-shadow: #7F613F 0 -1px 0 !important;
} }
.pad_help{ .help_pad{
background-image: url(../img/slate-help-white.png) !important; background: url(../img/toolbar-help.png) left -32px no-repeat !important;
color: white !important;
} }
#wgt_help{ #wgt_help{
padding-left: 32px; padding-left: 35px;
background-image: url(../img/slate-help.png); background: url(../img/slate-toolbar-help.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
} }
#help{ #help{
width: 100%;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
display: none; display: none;
...@@ -248,5 +230,36 @@ ...@@ -248,5 +230,36 @@
} }
.open{ .open{
}
#parameters{
display: none;
padding: 10px 20px;
background: url("../img/parameters-bg.png");
border-radius: 4px 4px 0 0;
}
.inline{
display: inline-block;
font-family: "helvetica neue";
font-size: 14px;
color: #666;
}
#parameters label {
font-style: italic;
}
#style_select{
margin-left: 10px;
}
.display_wood{
background: url(../img/slate-toolbar-edit.png) left -32px no-repeat !important;
text-shadow: #7F613F 0 -1px 0;
}
.radius_ft{
border-radius: 45px !important;
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ html, body{ ...@@ -3,7 +3,7 @@ html, body{
height: 100%; height: 100%;
margin: 0; margin: 0;
padding: 0; padding: 0;
border-radius: 50px; border-radius: 35px;
overflow: hidden; overflow: hidden;
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
xmlns:ub="http://uniboard.mnemis.com/widgets" xmlns:ub="http://uniboard.mnemis.com/widgets"
id="http://www.example.net/widgets/helloworld" id="http://www.example.net/widgets/helloworld"
version="1.0" version="1.0"
width="750" width="770"
height="320" height="320"
ub:resizable="true"> ub:resizable="true">
......
...@@ -60,11 +60,6 @@ ...@@ -60,11 +60,6 @@
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -74,7 +69,17 @@ ...@@ -74,7 +69,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="ub-widget"> <div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
...@@ -37,11 +37,6 @@ ...@@ -37,11 +37,6 @@
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -51,7 +46,17 @@ ...@@ -51,7 +46,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="ub-widget"> <div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
var sankoreLang = { var sankoreLang = {
view: "Afficher", view: "Fermer",
edit: "Modifier", edit: "Modifier",
example: "so*phis*ti*qué", example: "so*phis*ti*qué",
wgt_name: "Syllabe", wgt_name: "Syllabe",
...@@ -9,20 +9,21 @@ var sankoreLang = { ...@@ -9,20 +9,21 @@ var sankoreLang = {
none: "aucun", none: "aucun",
help: "Aide", help: "Aide",
help_content: "<p><h2>Syllabe</h2></p>"+ help_content: "<p><h2>Syllabe</h2></p>"+
"<p><h3>Séparer les syllabes d’un mot.</h3></p>"+ "<p><h3>Séparer les syllabes d’un mot.</h3></p>"+
"<p>Un mot est écrit et le but est de découper le mot en syllabes. Une fois que le découpage est correct, le mot se colore en vert.</p>"+ "<p>Un mot est écrit et le but est de découper le mot en syllabes. Une fois que le découpage est correct, le mot se colore en vert.</p>"+
"<p>Pour ajouter une séparation entre deux syllabes, déplacez le curseur et cliquez entre deux lettres, une séparation s’ajoute. </p>"+ "<p>Pour ajouter une séparation entre deux syllabes, déplacez le curseur et cliquez entre deux lettres, une séparation s’ajoute. </p>"+
"<p>Le bouton “Recharger” réinitialise l’exercice.</p>"+ "<p>Le bouton “Recharger” réinitialise l’exercice.</p>"+
"<p>Le bouton “Modifier” vous permet :</p>"+ "<p>Le bouton “Modifier” vous permet :</p>"+
"<ul><li>de choisir le thème de l’interactivité : tablette, ardoise ou aucun (par défaut tablette), </li>"+ "<ul><li>de choisir le thème de l’interactivité : tablette, ardoise ou aucun (par défaut tablette), </li>"+
"<li>de déterminer le mot sur lequel travailler.</li></ul>"+ "<li>de déterminer le mot sur lequel travailler.</li></ul>"+
"<p>Ecrivez simplement dans la zone de texte le mot en insérant entre les syllabes une étoile *.</p>"+ "<p>Ecrivez simplement dans la zone de texte le mot en insérant entre les syllabes une étoile *.</p>"+
"<p>Le bouton “Afficher” vous permet d’utiliser l’activité.</p>" "<p>Le bouton “Afficher” vous permet d’utiliser l’activité.</p>",
theme: "Thème"
}; };
...@@ -118,7 +119,7 @@ function wcontainer( containerID ) ...@@ -118,7 +119,7 @@ function wcontainer( containerID )
this.elements.edit.removeClass( "hide" ); this.elements.edit.removeClass( "hide" );
this.elements.view.addClass( "hide" ); this.elements.view.addClass( "hide" );
//this.adjustSize(); //this.adjustSize();
}; };
this.modeView = function() this.modeView = function()
{ {
...@@ -127,7 +128,7 @@ function wcontainer( containerID ) ...@@ -127,7 +128,7 @@ function wcontainer( containerID )
this.elements.edit.addClass( "hide" ); this.elements.edit.addClass( "hide" );
this.elements.view.removeClass( "hide" ); this.elements.view.removeClass( "hide" );
//this.adjustSize(); //this.adjustSize();
}; };
......
...@@ -37,11 +37,6 @@ ...@@ -37,11 +37,6 @@
<div id="wgt_reload"></div> <div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div> <div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div> <div id="wgt_edit"></div>
<select class="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</td> </td>
<td class="b_top_right">&nbsp;</td> <td class="b_top_right">&nbsp;</td>
</tr> </tr>
...@@ -51,7 +46,17 @@ ...@@ -51,7 +46,17 @@
<td> <td>
<div id="help"></div> <div id="help"></div>
<div id="ub-widget"> <div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div> </div>
</td> </td>
<td class="b_center_right">&nbsp;</td> <td class="b_center_right">&nbsp;</td>
......
var sankoreLang = { var sankoreLang = {
view: "Показать", view: "Закрыть",
edit: "Изменить", edit: "Изменить",
example: "слож*ный", example: "слож*ный",
wgt_name: "Разделить слово", wgt_name: "Разделить слово",
...@@ -8,7 +8,8 @@ var sankoreLang = { ...@@ -8,7 +8,8 @@ var sankoreLang = {
pad: "Планшет", pad: "Планшет",
none: "Нет", none: "Нет",
help: "Помощь", help: "Помощь",
help_content: "Пример текста помощи ..." help_content: "Пример текста помощи ...",
theme: "Тема"
}; };
// if use the "view/edit" button or rely on the api instead // if use the "view/edit" button or rely on the api instead
......
...@@ -36,7 +36,7 @@ $(document).ready(function() ...@@ -36,7 +36,7 @@ $(document).ready(function()
if (window.widget) { if (window.widget) {
window.widget.onleave = function(){ window.widget.onleave = function(){
sankore.setPreference("spl_word_style", $(".style_select").find("option:selected").val()); sankore.setPreference("spl_word_style", $("#style_select").find("option:selected").val());
if(w.editMode){ if(w.editMode){
sankore.setPreference("ordSplWords", w.elements.container.find( "input" ).val().trim( ['*'] )); sankore.setPreference("ordSplWords", w.elements.container.find( "input" ).val().trim( ['*'] ));
sankore.setPreference("ordSplWordsState", "0"); sankore.setPreference("ordSplWordsState", "0");
...@@ -52,21 +52,31 @@ $(document).ready(function() ...@@ -52,21 +52,31 @@ $(document).ready(function()
if(sankore.preference("spl_word_style","")){ if(sankore.preference("spl_word_style","")){
changeStyle(sankore.preference("spl_word_style","")); changeStyle(sankore.preference("spl_word_style",""));
$(".style_select").val(sankore.preference("spl_word_style","")); $("#style_select").val(sankore.preference("spl_word_style",""));
} else } else
changeStyle("3") changeStyle("3")
$("#wgt_display").text(sankoreLang.view); $("#wgt_display").text(sankoreLang.view);
$("#wgt_edit").text(sankoreLang.edit); $("#wgt_edit").text(sankoreLang.edit);
$("#wgt_help").text(sankoreLang.help); $("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content); $("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){ $("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){ if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){ if(!$(this).hasClass("selected")){
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_edit").removeClass("selected"); $("#wgt_edit").removeClass("selected");
$(".style_select").css("display","none"); $("#parameters").css("display","none");
$(this).css("display", "none"); $(this).css("display", "none");
$("#wgt_edit").css("display", "block"); $("#wgt_edit").css("display", "block");
w.modeView(); w.modeView();
...@@ -75,7 +85,7 @@ $(document).ready(function() ...@@ -75,7 +85,7 @@ $(document).ready(function()
if(!$(this).hasClass("selected")){ if(!$(this).hasClass("selected")){
$(this).addClass("selected"); $(this).addClass("selected");
$("#wgt_display").removeClass("selected"); $("#wgt_display").removeClass("selected");
$(".style_select").css("display","block"); $("#parameters").css("display","block");
$(this).css("display", "none"); $(this).css("display", "none");
$("#wgt_display").css("display", "block"); $("#wgt_display").css("display", "block");
w.modeEdit(); w.modeEdit();
...@@ -88,11 +98,13 @@ $(document).ready(function() ...@@ -88,11 +98,13 @@ $(document).ready(function()
$("#wgt_help").click(function(){ $("#wgt_help").click(function(){
var tmp = $(this); var tmp = $(this);
if($(this).hasClass("open")){ if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){ $("#help").slideUp("100", function(){
tmp.removeClass("open"); tmp.removeClass("open");
$("#ub-widget").show(); $("#ub-widget").show();
}); });
} else { } else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#ub-widget").hide(); $("#ub-widget").hide();
$("#help").slideDown("100", function(){ $("#help").slideDown("100", function(){
tmp.addClass("open"); tmp.addClass("open");
...@@ -108,14 +120,6 @@ $(document).ready(function() ...@@ -108,14 +120,6 @@ $(document).ready(function()
$("#wgt_display").trigger("click"); $("#wgt_display").trigger("click");
} }
}); });
$(".style_select option[value='1']").text(sankoreLang.slate);
$(".style_select option[value='2']").text(sankoreLang.pad);
$(".style_select option[value='3']").text(sankoreLang.none);
$(".style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
// onViewMode // onViewMode
w.onViewMode = function() w.onViewMode = function()
...@@ -214,10 +218,10 @@ $(document).ready(function() ...@@ -214,10 +218,10 @@ $(document).ready(function()
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload"); $("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help"); $("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit"); $("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_display").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color"); $("#wgt_name").removeClass("pad_color");
$(".style_select").removeClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").addClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select option:first").attr('selected',true);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break; break;
case "2": case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back"); $(".b_top_left").addClass("btl_pad").removeClass("without_back");
...@@ -231,10 +235,10 @@ $(document).ready(function() ...@@ -231,10 +235,10 @@ $(document).ready(function()
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("pad_select").removeClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").removeClass("without_radius"); $("#style_select option:first").next().attr('selected',true);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break; break;
case "3": case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad"); $(".b_top_left").addClass("without_back").removeClass("btl_pad");
...@@ -248,10 +252,10 @@ $(document).ready(function() ...@@ -248,10 +252,10 @@ $(document).ready(function()
$("#wgt_help").addClass("pad_color").addClass("pad_help"); $("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload"); $("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit"); $("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_display").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color"); $("#wgt_name").addClass("pad_color");
$(".style_select").addClass("none_select").val(val); $("#wgt_display").removeClass("display_wood");
$("body, html").addClass("without_radius"); $("#style_select option:last").attr('selected',true);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break; break;
} }
} }
......
var sankoreLang = { var sankoreLang = {
view: "Display", view: "Close",
edit: "Edit", edit: "Edit",
example: "so*phis*ti*ca*ted", example: "so*phis*ti*ca*ted",
wgt_name: "Split a word", wgt_name: "Split a word",
...@@ -8,7 +8,8 @@ var sankoreLang = { ...@@ -8,7 +8,8 @@ var sankoreLang = {
pad: "Pad", pad: "Pad",
none: "None", none: "None",
help: "Help", help: "Help",
help_content: "This is an example of help content ..." help_content: "This is an example of help content ...",
theme: "Theme"
}; };
// if use the "view/edit" button or rely on the api instead // if use the "view/edit" button or rely on the api instead
......
...@@ -3,7 +3,7 @@ html, body{ ...@@ -3,7 +3,7 @@ html, body{
height: 100%; height: 100%;
margin: 0; margin: 0;
padding: 0; padding: 0;
border-radius: 50px; border-radius: 35px;
overflow: hidden; overflow: hidden;
} }
......
...@@ -111,57 +111,40 @@ ...@@ -111,57 +111,40 @@
margin: 10px 10px 0 10px; margin: 10px 10px 0 10px;
padding: 0; padding: 0;
float: left; float: left;
/*font-family: "Lobster13Regular";*/ font-family: Arial,Helvetica,sans-serif;
font-size: 24px; font-size: 24px;
color: #8c5730; color: #7F613F;
text-shadow: #FFDCA9 0 1px 0;
} }
#wgt_reload, #wgt_edit, #wgt_display, #wgt_help{ #wgt_reload, #wgt_edit, #wgt_display, #wgt_help{
cursor: pointer; cursor: pointer;
height: 44px;
margin: 10px 10px 0 0; margin: 10px 10px 0 0;
float: right; float: right;
/*font-family: "Lobster13Regular";*/ font-family: Arial,Helvetica,sans-serif;
font-size: 24px; font-size: 24px;
color: #8c5730; line-height: 32px;
} }
#wgt_display{ #wgt_display{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-edit.png); background: url(../img/toolbar-edit.png) left -32px no-repeat;
background-repeat: no-repeat; color: white;
background-position: top 0;
display: none; display: none;
} }
#wgt_edit{ #wgt_edit{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-edit.png); background: url(../img/slate-toolbar-edit.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
} }
#wgt_reload{ #wgt_reload{
padding-left: 40px; padding-left: 35px;
background-image: url(../img/slate-toolbar-reload.png); background: url(../img/slate-toolbar-reload.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
}
.style_select{
width: 120px;
/*font-family: "Lobster13Regular";*/
font-size: 24px;
float: right;
margin: 10px 20px 0 0;
border-radius: 10px;
background-image: url(../img/ar_down.png);
background-color: #d4aa79;
color: #8c5730;
background-position: 105px 11px;
background-repeat: no-repeat;
-webkit-appearance: menulist-text;
display: none;
} }
.btl_pad{ .btl_pad{
...@@ -196,52 +179,50 @@ ...@@ -196,52 +179,50 @@
background-image: url(../img/pad-bottom-right.png) !important; background-image: url(../img/pad-bottom-right.png) !important;
} }
.pad_color{ .without_radius{
color: white !important; border-radius: 0 !important;
} }
.pad_reload{ .without_back{
background-image: url(../img/slate-toolbar-reload-white.png) !important; background: none !important;
} }
.pad_edit{ .pad_color{
background-image: url(../img/slate-display.png) !important; color: #FC9 !important;
text-shadow: none !important;
} }
.pad_select{ .pad_reload{
background-color: black !important; background: url(../img/toolbar-reload.png) left top no-repeat !important;
color: white !important;
background-image: url(../img/ar_down_white.png) !important;
} }
.pad_edit{
.without_radius{ background: url(../img/toolbar-edit.png) left top no-repeat !important;
border-radius: 0 !important;
} }
.without_back{ .pad_help{
background: none !important; background: url(../img/toolbar-help.png) left top no-repeat !important;
} }
.none_select{ .help_wood{
background-color: #333 !important; background: url(../img/slate-toolbar-help.png) left -32px no-repeat !important;
color: white !important; color: white !important;
background-image: url(../img/ar_down_white.png) !important; text-shadow: #7F613F 0 -1px 0 !important;
} }
.pad_help{ .help_pad{
background-image: url(../img/slate-help-white.png) !important; background: url(../img/toolbar-help.png) left -32px no-repeat !important;
color: white !important;
} }
#wgt_help{ #wgt_help{
padding-left: 32px; padding-left: 35px;
background-image: url(../img/slate-help.png); background: url(../img/slate-toolbar-help.png) left top no-repeat;
background-repeat: no-repeat; color: #7F613F;
background-position: top 0; text-shadow: #FFDCA9 0 1px 0;
} }
#help{ #help{
width: 100%;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
display: none; display: none;
...@@ -250,5 +231,36 @@ ...@@ -250,5 +231,36 @@
} }
.open{ .open{
}
#parameters{
display: none;
padding: 10px 20px;
background: url("../img/parameters-bg.png");
border-radius: 4px 4px 0 0;
}
.inline{
display: inline-block;
font-family: "helvetica neue";
font-size: 14px;
color: #666;
}
#parameters label {
font-style: italic;
}
#style_select{
margin-left: 10px;
}
.display_wood{
background: url(../img/slate-toolbar-edit.png) left -32px no-repeat !important;
text-shadow: #7F613F 0 -1px 0;
}
.radius_ft{
border-radius: 45px !important;
} }
\ No newline at end of file
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <QSvgGenerator> #include <QSvgGenerator>
#include <QSvgRenderer> #include <QSvgRenderer>
#include <QPixmap> #include <QPixmap>
#include <QMap>
#include "core/UBPersistenceManager.h" #include "core/UBPersistenceManager.h"
...@@ -248,6 +249,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgRect(const QDomElement &elem ...@@ -248,6 +249,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgRect(const QDomElement &elem
painter.end(); painter.end();
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName()));
QString uuid = QUuid::createUuid().toString();
mRefToUuidMap.insert(element.attribute(aId), uuid);
svgItem->setUuid(QUuid(uuid));
QTransform transform; QTransform transform;
QString textTransform = element.attribute(aTransform); QString textTransform = element.attribute(aTransform);
...@@ -298,6 +304,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgEllipse(const QDomElement &e ...@@ -298,6 +304,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgEllipse(const QDomElement &e
painter.end(); painter.end();
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName()));
QString uuid = QUuid::createUuid().toString();
mRefToUuidMap.insert(element.attribute(aId), uuid);
svgItem->setUuid(QUuid(uuid));
QTransform transform; QTransform transform;
QString textTransform = element.attribute(aTransform); QString textTransform = element.attribute(aTransform);
...@@ -373,37 +384,65 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolygon(const QDomElement &e ...@@ -373,37 +384,65 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolygon(const QDomElement &e
brush.setColor(fillColor); brush.setColor(fillColor);
brush.setStyle(Qt::SolidPattern); brush.setStyle(Qt::SolidPattern);
QSvgGenerator *generator = createSvgGenerator(width + pen.width(), height + pen.width());
QPainter painter; QUuid itemUuid(element.attribute(aId).right(QUuid().toString().length()));
QUuid itemGroupUuid(element.attribute(aId).left(QUuid().toString().length()-1));
if (!itemUuid.isNull() && (itemGroupUuid!=itemUuid)) // reimported from UBZ
{
UBGraphicsPolygonItem *graphicsPolygon = mCurrentScene->polygonToPolygonItem(polygon);
painter.begin(generator); //drawing to svg tmp file graphicsPolygon->setBrush(brush);
painter.translate(pen.widthF() / 2 - x1, pen.widthF() / 2 - y1); QTransform transform;
painter.setBrush(brush); QString textTransform = element.attribute(aTransform);
painter.setPen(pen);
painter.drawPolygon(polygon);
painter.end(); graphicsPolygon->resetTransform();
if (!textTransform.isNull()) {
transform = transformFromString(textTransform, graphicsPolygon);
}
mCurrentScene->addItem(graphicsPolygon);
//add resulting svg file to scene graphicsPolygon->setUuid(itemUuid);
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); mRefToUuidMap.insert(element.attribute(aId), itemUuid);
QTransform transform;
QString textTransform = element.attribute(aTransform);
svgItem->resetTransform();
if (!textTransform.isNull()) {
transform = transformFromString(textTransform, svgItem);
} }
repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 - strokeWidth/2 + transform.m31(), y1 + strokeWidth/2 + transform.m32(), transform); else // single CFF
hashSceneItem(element, svgItem);
if (mGSectionContainer)
{ {
addItemToGSection(svgItem); QSvgGenerator *generator = createSvgGenerator(width + pen.width(), height + pen.width());
} QPainter painter;
delete generator; painter.begin(generator); //drawing to svg tmp file
painter.translate(pen.widthF() / 2 - x1, pen.widthF() / 2 - y1);
painter.setBrush(brush);
painter.setPen(pen);
painter.drawPolygon(polygon);
painter.end();
//add resulting svg file to scene
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName()));
QTransform transform;
QString textTransform = element.attribute(aTransform);
QUuid uuid = QUuid::createUuid().toString();
mRefToUuidMap.insert(element.attribute(aId), uuid);
svgItem->setUuid(uuid);
svgItem->resetTransform();
if (!textTransform.isNull()) {
transform = transformFromString(textTransform, svgItem);
}
repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 - strokeWidth/2 + transform.m31(), y1 + strokeWidth/2 + transform.m32(), transform);
hashSceneItem(element, svgItem);
if (mGSectionContainer)
{
addItemToGSection(svgItem);
}
delete generator;
}
return true; return true;
} }
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement &element) bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement &element)
...@@ -441,6 +480,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement & ...@@ -441,6 +480,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement &
//bounding rect lef top corner coordinates //bounding rect lef top corner coordinates
qreal x1 = polygon.boundingRect().topLeft().x(); qreal x1 = polygon.boundingRect().topLeft().x();
qreal y1 = polygon.boundingRect().topLeft().y(); qreal y1 = polygon.boundingRect().topLeft().y();
//bounding rect dimensions //bounding rect dimensions
qreal width = polygon.boundingRect().width(); qreal width = polygon.boundingRect().width();
qreal height = polygon.boundingRect().height(); qreal height = polygon.boundingRect().height();
...@@ -458,35 +498,72 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement & ...@@ -458,35 +498,72 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement &
pen.setColor(strokeColor); pen.setColor(strokeColor);
pen.setWidth(strokeWidth); pen.setWidth(strokeWidth);
QSvgGenerator *generator = createSvgGenerator(width + pen.width(), height + pen.width()); QBrush brush;
QPainter painter; brush.setColor(strokeColor);
brush.setStyle(Qt::SolidPattern);
painter.begin(generator); //drawing to svg tmp file QUuid itemUuid(element.attribute(aId).right(QUuid().toString().length()));
QUuid itemGroupUuid(element.attribute(aId).left(QUuid().toString().length()-1));
if (!itemUuid.isNull() && (itemGroupUuid!=itemUuid)) // reimported from UBZ
{
UBGraphicsPolygonItem *graphicsPolygon = new UBGraphicsPolygonItem(polygon);
painter.translate(pen.widthF()/2 - x1, pen.widthF()/2- y1); UBGraphicsStroke *stroke = new UBGraphicsStroke();
painter.setPen(pen); graphicsPolygon->setStroke(stroke);
painter.drawPolyline(polygon);
painter.end(); graphicsPolygon->setBrush(brush);
QTransform transform;
QString textTransform = element.attribute(aTransform);
//add resulting svg file to scene graphicsPolygon->resetTransform();
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); if (!textTransform.isNull()) {
QTransform transform; transform = transformFromString(textTransform, graphicsPolygon);
QString textTransform = element.attribute(aTransform); }
mCurrentScene->addItem(graphicsPolygon);
svgItem->resetTransform(); graphicsPolygon->setUuid(itemUuid);
if (!textTransform.isNull()) { mRefToUuidMap.insert(element.attribute(aId), itemUuid);
transform = transformFromString(textTransform, svgItem);
}
repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 + transform.m31() - strokeWidth/2, y1 + transform.m32() + strokeWidth/2, transform);
hashSceneItem(element, svgItem);
if (mGSectionContainer) }
else // simple CFF
{ {
addItemToGSection(svgItem); QSvgGenerator *generator = createSvgGenerator(width + pen.width(), height + pen.width());
QPainter painter;
painter.begin(generator); //drawing to svg tmp file
painter.translate(pen.widthF() / 2 - x1, pen.widthF() / 2 - y1);
painter.setBrush(brush);
painter.setPen(pen);
painter.drawPolygon(polygon);
painter.end();
//add resulting svg file to scene
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName()));
QString uuid = QUuid::createUuid().toString();
mRefToUuidMap.insert(element.attribute(aId), uuid);
svgItem->setUuid(QUuid(uuid));
QTransform transform;
QString textTransform = element.attribute(aTransform);
svgItem->resetTransform();
if (!textTransform.isNull()) {
transform = transformFromString(textTransform, svgItem);
}
repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 - strokeWidth/2 + transform.m31(), y1 + strokeWidth/2 + transform.m32(), transform);
hashSceneItem(element, svgItem);
if (mGSectionContainer)
{
addItemToGSection(svgItem);
}
delete generator;
} }
delete generator;
return true; return true;
} }
...@@ -621,6 +698,10 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgText(const QDomElement &elem ...@@ -621,6 +698,10 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgText(const QDomElement &elem
//add resulting svg file to scene //add resulting svg file to scene
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName())); UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName()));
QString uuid = QUuid::createUuid().toString();
mRefToUuidMap.insert(element.attribute(aId), uuid);
svgItem->setUuid(QUuid(uuid));
svgItem->resetTransform(); svgItem->resetTransform();
repositionSvgItem(svgItem, width, height, x + transform.m31(), y + transform.m32(), transform); repositionSvgItem(svgItem, width, height, x + transform.m31(), y + transform.m32(), transform);
hashSceneItem(element, svgItem); hashSceneItem(element, svgItem);
...@@ -734,6 +815,10 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgTextarea(const QDomElement & ...@@ -734,6 +815,10 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgTextarea(const QDomElement &
UBGraphicsTextItem *svgItem = mCurrentScene->addTextHtml(doc.toHtml()); UBGraphicsTextItem *svgItem = mCurrentScene->addTextHtml(doc.toHtml());
svgItem->resize(width, height); svgItem->resize(width, height);
QString uuid = QUuid::createUuid().toString();
mRefToUuidMap.insert(element.attribute(aId), uuid);
svgItem->setUuid(QUuid(uuid));
QTransform transform; QTransform transform;
QString textTransform = element.attribute(aTransform); QString textTransform = element.attribute(aTransform);
...@@ -783,6 +868,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgImage(const QDomElement &ele ...@@ -783,6 +868,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgImage(const QDomElement &ele
} }
UBGraphicsPixmapItem *pixItem = mCurrentScene->addPixmap(pix, NULL); UBGraphicsPixmapItem *pixItem = mCurrentScene->addPixmap(pix, NULL);
QString uuid = QUuid::createUuid().toString();
mRefToUuidMap.insert(element.attribute(aId), uuid);
pixItem->setUuid(QUuid(uuid));
QTransform transform; QTransform transform;
QString textTransform = element.attribute(aTransform); QString textTransform = element.attribute(aTransform);
...@@ -830,6 +920,10 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgFlash(const QDomElement &ele ...@@ -830,6 +920,10 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgFlash(const QDomElement &ele
UBGraphicsWidgetItem *flashItem = mCurrentScene->addW3CWidget(QUrl::fromLocalFile(flashUrl)); UBGraphicsWidgetItem *flashItem = mCurrentScene->addW3CWidget(QUrl::fromLocalFile(flashUrl));
flashItem->setSourceUrl(urlPath); flashItem->setSourceUrl(urlPath);
QString uuid = QUuid::createUuid().toString();
mRefToUuidMap.insert(element.attribute(aId), uuid);
flashItem->setUuid(QUuid(uuid));
QTransform transform; QTransform transform;
QString textTransform = element.attribute(aTransform); QString textTransform = element.attribute(aTransform);
...@@ -867,14 +961,15 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgAudio(const QDomElement &ele ...@@ -867,14 +961,15 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgAudio(const QDomElement &ele
concreteUrl = QUrl::fromLocalFile(audioPath); concreteUrl = QUrl::fromLocalFile(audioPath);
} }
QUuid uuid = QUuid::createUuid(); QString uuid = QUuid::createUuid().toString();
mRefToUuidMap.insert(element.attribute(aId), uuid);
QString destFile; QString destFile;
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument( bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(
mCurrentScene->document(), mCurrentScene->document(),
concreteUrl.toLocalFile(), concreteUrl.toLocalFile(),
UBPersistenceManager::audioDirectory, UBPersistenceManager::audioDirectory,
uuid, QUuid(uuid),
destFile); destFile);
if (!b) if (!b)
{ {
...@@ -883,6 +978,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgAudio(const QDomElement &ele ...@@ -883,6 +978,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgAudio(const QDomElement &ele
concreteUrl = QUrl::fromLocalFile(destFile); concreteUrl = QUrl::fromLocalFile(destFile);
UBGraphicsMediaItem *audioItem = mCurrentScene->addAudio(concreteUrl, false); UBGraphicsMediaItem *audioItem = mCurrentScene->addAudio(concreteUrl, false);
QTransform transform; QTransform transform;
QString textTransform = parentOfAudio.attribute(aTransform); QString textTransform = parentOfAudio.attribute(aTransform);
...@@ -920,15 +1016,15 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &ele ...@@ -920,15 +1016,15 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &ele
concreteUrl = QUrl::fromLocalFile(videoPath); concreteUrl = QUrl::fromLocalFile(videoPath);
} }
QUuid uuid = QUuid::createUuid(); QString uuid = QUuid::createUuid().toString();
mRefToUuidMap.insert(element.attribute(aId), uuid);
QString destFile; QString destFile;
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument( bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(
mCurrentScene->document(), mCurrentScene->document(),
concreteUrl.toLocalFile(), concreteUrl.toLocalFile(),
UBPersistenceManager::videoDirectory, UBPersistenceManager::videoDirectory,
uuid, QUuid(uuid),
destFile); destFile);
if (!b) if (!b)
{ {
...@@ -937,6 +1033,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &ele ...@@ -937,6 +1033,7 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &ele
concreteUrl = QUrl::fromLocalFile(destFile); concreteUrl = QUrl::fromLocalFile(destFile);
UBGraphicsMediaItem *videoItem = mCurrentScene->addVideo(concreteUrl, false); UBGraphicsMediaItem *videoItem = mCurrentScene->addVideo(concreteUrl, false);
QTransform transform; QTransform transform;
QString textTransform = element.attribute(aTransform); QString textTransform = element.attribute(aTransform);
...@@ -980,8 +1077,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgElement(const QDomElement &p ...@@ -980,8 +1077,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgElement(const QDomElement &p
{ {
QString tagName = parent.tagName(); QString tagName = parent.tagName();
if (parent.namespaceURI() != svgNS) { if (parent.namespaceURI() != svgNS) {
qDebug() << "Incorrect namespace, error at content file, line number" << parent.lineNumber(); qWarning() << "Incorrect namespace, error at content file, line number" << parent.lineNumber();
return false; //return false;
} }
if (tagName == tG && !parseGSection(parent)) return false; if (tagName == tG && !parseGSection(parent)) return false;
...@@ -1027,8 +1124,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPageset(const QDomElement &p ...@@ -1027,8 +1124,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPageset(const QDomElement &p
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbMeta(const QDomElement &element) bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbMeta(const QDomElement &element)
{ {
if (element.namespaceURI() != iwbNS) { if (element.namespaceURI() != iwbNS) {
qDebug() << "incorrect meta namespace, incorrect document"; qWarning() << "incorrect meta namespace, incorrect document";
return false; //return false;
} }
return true; return true;
...@@ -1036,8 +1133,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbMeta(const QDomElement &elem ...@@ -1036,8 +1133,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbMeta(const QDomElement &elem
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvg(const QDomElement &svgSection) bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvg(const QDomElement &svgSection)
{ {
if (svgSection.namespaceURI() != svgNS) { if (svgSection.namespaceURI() != svgNS) {
qDebug() << "incorrect svg namespace, incorrect document"; qWarning() << "incorrect svg namespace, incorrect document";
return false; // return false;
} }
parseSvgSectionAttr(svgSection); parseSvgSectionAttr(svgSection);
...@@ -1052,15 +1149,92 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvg(const QDomElement &svgSecti ...@@ -1052,15 +1149,92 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvg(const QDomElement &svgSecti
return true; return true;
} }
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbGroup(QDomElement &parent) UBGraphicsGroupContainerItem *UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbGroup(QDomElement &parent)
{ {
//TODO. Create groups from elements parsed by parseIwbElement() function //TODO. Create groups from elements parsed by parseIwbElement() function
if (parent.namespaceURI() != iwbNS) { if (parent.namespaceURI() != iwbNS) {
qDebug() << "incorrect iwb group namespace, incorrect document"; qWarning() << "incorrect iwb group namespace, incorrect document";
return false; // return false;
} }
return true; UBGraphicsGroupContainerItem *group = new UBGraphicsGroupContainerItem();
QMultiMap<QString, UBGraphicsPolygonItem *> strokesGroupsContainer;
QList<QGraphicsItem *> groupContainer;
QString currentStrokeIdentifier;
QDomElement currentStrokeElement = parent.firstChildElement();
while (!currentStrokeElement.isNull())
{
if (tGroup == currentStrokeElement.tagName())
group->addToGroup(parseIwbGroup(currentStrokeElement));
else
{
QString ref = currentStrokeElement.attribute(aRef);
QString uuid = mRefToUuidMap[ref];
if (!uuid.isEmpty())
{
if (ref.size() > QUuid().toString().length()) // create stroke group
{
currentStrokeIdentifier = ref.left(QUuid().toString().length()-1);
UBGraphicsPolygonItem *strokeByUuid = qgraphicsitem_cast<UBGraphicsPolygonItem *>(mCurrentScene->itemForUuid(QUuid(ref.right(QUuid().toString().length()))));
if (strokeByUuid)
strokesGroupsContainer.insert(currentStrokeIdentifier, strokeByUuid);
}
else // single elements in group
groupContainer.append(mCurrentScene->itemForUuid(QUuid(uuid)));
}
}
currentStrokeElement = currentStrokeElement.nextSiblingElement();
}
foreach (QString key, strokesGroupsContainer.keys().toSet())
{
UBGraphicsStrokesGroup* pStrokesGroup = new UBGraphicsStrokesGroup();
UBGraphicsStroke *currentStroke = new UBGraphicsStroke();
foreach(UBGraphicsPolygonItem* poly, strokesGroupsContainer.values(key))
{
if (poly)
{
mCurrentScene->removeItem(poly);
mCurrentScene->removeItemFromDeletion(poly);
poly->setStrokesGroup(pStrokesGroup);
poly->setStroke(currentStroke);
pStrokesGroup->addToGroup(poly);
}
}
if (currentStroke->polygons().empty())
delete currentStroke;
if (pStrokesGroup->childItems().count())
mCurrentScene->addItem(pStrokesGroup);
else
delete pStrokesGroup;
if (pStrokesGroup)
{
QGraphicsItem *strokeGroup = qgraphicsitem_cast<QGraphicsItem *>(pStrokesGroup);
groupContainer.append(strokeGroup);
}
}
foreach(QGraphicsItem* item, groupContainer)
group->addToGroup(item);
if (group->childItems().count())
{
mCurrentScene->addItem(group);
if (1 == group->childItems().count())
{
group->destroy(false);
}
}
return group;
} }
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::strToBool(QString str) bool UBCFFSubsetAdaptor::UBCFFSubsetReader::strToBool(QString str)
...@@ -1071,8 +1245,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::strToBool(QString str) ...@@ -1071,8 +1245,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::strToBool(QString str)
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbElement(QDomElement &element) bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbElement(QDomElement &element)
{ {
if (element.namespaceURI() != iwbNS) { if (element.namespaceURI() != iwbNS) {
qDebug() << "incorrect iwb element namespace, incorrect document"; qWarning() << "incorrect iwb element namespace, incorrect document";
return false; // return false;
} }
bool locked = false; bool locked = false;
......
...@@ -74,6 +74,7 @@ private: ...@@ -74,6 +74,7 @@ private:
QDomDocument mDOMdoc; QDomDocument mDOMdoc;
QDomNode mCurrentDOMElement; QDomNode mCurrentDOMElement;
QHash<QString, UBGraphicsItem*> persistedItems; QHash<QString, UBGraphicsItem*> persistedItems;
QMap<QString, QString> mRefToUuidMap;
QDir mTmpFlashDir; QDir mTmpFlashDir;
void addItemToGSection(QGraphicsItem *item); void addItemToGSection(QGraphicsItem *item);
...@@ -102,7 +103,7 @@ private: ...@@ -102,7 +103,7 @@ private:
inline bool parseSvgFlash(const QDomElement &element); inline bool parseSvgFlash(const QDomElement &element);
inline bool parseSvgAudio(const QDomElement &element); inline bool parseSvgAudio(const QDomElement &element);
inline bool parseSvgVideo(const QDomElement &element); inline bool parseSvgVideo(const QDomElement &element);
inline bool parseIwbGroup(QDomElement &parent); inline UBGraphicsGroupContainerItem *parseIwbGroup(QDomElement &parent);
inline bool parseIwbElement(QDomElement &element); inline bool parseIwbElement(QDomElement &element);
inline void parseTSpan(const QDomElement &parent, QPainter &painter inline void parseTSpan(const QDomElement &parent, QPainter &painter
, qreal &curX, qreal &curY, qreal &width, qreal &height, qreal &linespacing, QRectF &lastDrawnTextBoundingRect , qreal &curX, qreal &curY, qreal &width, qreal &height, qreal &linespacing, QRectF &lastDrawnTextBoundingRect
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
#include "frameworks/UBStringUtils.h" #include "frameworks/UBStringUtils.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/UBSettings.h" #include "core/UBSettings.h"
#include "core/UBSetting.h" #include "core/UBSetting.h"
...@@ -79,6 +80,7 @@ const QString UBSvgSubsetAdaptor::sFormerUniboardDocumentNamespaceUri = "http:// ...@@ -79,6 +80,7 @@ const QString UBSvgSubsetAdaptor::sFormerUniboardDocumentNamespaceUri = "http://
const QString tElement = "element"; const QString tElement = "element";
const QString tGroup = "group"; const QString tGroup = "group";
const QString tStrokeGroup = "strokeGroup";
const QString tGroups = "groups"; const QString tGroups = "groups";
const QString aId = "id"; const QString aId = "id";
...@@ -553,6 +555,10 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -553,6 +555,10 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if (polygonItem) if (polygonItem)
{ {
mScene->addItem(polygonItem);
polygonItem->setUuid(uuidFromSvg);
if (annotationGroup) if (annotationGroup)
{ {
polygonItem->setStroke(annotationGroup); polygonItem->setStroke(annotationGroup);
...@@ -989,31 +995,45 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -989,31 +995,45 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
UBGraphicsGroupContainerItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroup() UBGraphicsGroupContainerItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroup()
{ {
UBGraphicsGroupContainerItem *result = new UBGraphicsGroupContainerItem(); UBGraphicsGroupContainerItem *group = new UBGraphicsGroupContainerItem();
QMultiMap<QString, UBGraphicsPolygonItem *> strokesGroupsContainer;
QList<QGraphicsItem *> groupContainer;
QString currentStrokeIdentifier;
QUuid groupUuid = QUuid(mXmlReader.attributes().value(aId).toString()); QUuid groupUuid = QUuid(mXmlReader.attributes().value(aId).toString());
mXmlReader.readNext(); mXmlReader.readNext();
while (!mXmlReader.atEnd()) { while (!mXmlReader.atEnd())
{
if (mXmlReader.isEndElement()) { if (mXmlReader.isEndElement()) {
mXmlReader.readNext(); mXmlReader.readNext();
result->setUuid(groupUuid);
if (!result->childItems().count()) {
delete result;
result = 0;
}
break; break;
} else if (mXmlReader.isStartElement()) { } else if (mXmlReader.isStartElement())
if (mXmlReader.name() == tGroup) { {
if (mXmlReader.name() == tGroup)
{
qDebug() << "came across the group id is" << mXmlReader.attributes().value(aId); qDebug() << "came across the group id is" << mXmlReader.attributes().value(aId);
UBGraphicsGroupContainerItem *curGroup = readGroup(); UBGraphicsGroupContainerItem *curGroup = readGroup();
if (curGroup) { if (curGroup)
result->addToGroup(curGroup); groupContainer.append(curGroup);
} }
} else if (mXmlReader.name() == tElement) { else if (mXmlReader.name() == tElement)
{
QString id = mXmlReader.attributes().value(aId).toString();
QString itemId = id.right(QUuid().toString().size());
QString groupId = id.left(QUuid().toString().size());
QGraphicsItem *curItem = readElementFromGroup(); QGraphicsItem *curItem = readElementFromGroup();
if (curItem) {
result->addToGroup(curItem); UBGraphicsPolygonItem *curPolygon = qgraphicsitem_cast<UBGraphicsPolygonItem *>(curItem);
if (curPolygon && !groupId.isEmpty() && !itemId.isEmpty() && itemId != groupId)
{
strokesGroupsContainer.insert(groupId, curPolygon);
}
else // item
{
groupContainer.append(curItem);
} }
}else { }else {
mXmlReader.skipCurrentElement(); mXmlReader.skipCurrentElement();
...@@ -1023,7 +1043,49 @@ UBGraphicsGroupContainerItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroup() ...@@ -1023,7 +1043,49 @@ UBGraphicsGroupContainerItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroup()
} }
} }
return result; foreach (QString key, strokesGroupsContainer.keys().toSet())
{
UBGraphicsStrokesGroup* pStrokesGroup = new UBGraphicsStrokesGroup();
UBGraphicsStroke *currentStroke = new UBGraphicsStroke();
foreach(UBGraphicsPolygonItem* poly, strokesGroupsContainer.values(key))
{
if (poly)
{
mScene->removeItem(poly);
mScene->removeItemFromDeletion(poly);
poly->setStrokesGroup(pStrokesGroup);
poly->setStroke(currentStroke);
pStrokesGroup->addToGroup(poly);
}
}
if (currentStroke->polygons().empty())
delete currentStroke;
if (pStrokesGroup->childItems().count())
mScene->addItem(pStrokesGroup);
else
delete pStrokesGroup;
if (pStrokesGroup)
{
QGraphicsItem *strokeGroup = qgraphicsitem_cast<QGraphicsItem *>(pStrokesGroup);
groupContainer.append(strokeGroup);
}
}
foreach(QGraphicsItem* item, groupContainer)
group->addToGroup(item);
if (group->childItems().count())
{
mScene->addItem(group);
if (1 == group->childItems().count())
{
group->destroy(false);
}
}
return group;
} }
void UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroupRoot() void UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroupRoot()
...@@ -1051,8 +1113,9 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroupRoot() ...@@ -1051,8 +1113,9 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroupRoot()
QGraphicsItem *UBSvgSubsetAdaptor::UBSvgSubsetReader::readElementFromGroup() QGraphicsItem *UBSvgSubsetAdaptor::UBSvgSubsetReader::readElementFromGroup()
{ {
QGraphicsItem *result = 0; QGraphicsItem *result = 0;
QString id = mXmlReader.attributes().value(aId).toString();
result = mScene->itemForUuid(QUuid(mXmlReader.attributes().value(aId).toString())); QString uuid = id.right(QUuid().toString().size());
result = mScene->itemForUuid(QUuid(uuid));
mXmlReader.skipCurrentElement(); mXmlReader.skipCurrentElement();
mXmlReader.readNext(); mXmlReader.readNext();
...@@ -1152,25 +1215,42 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) ...@@ -1152,25 +1215,42 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
QGraphicsItem *item = items.takeFirst(); QGraphicsItem *item = items.takeFirst();
// Is the item a strokes group? // Is the item a strokes group?
UBGraphicsStrokesGroup* strokesGroupItem = qgraphicsitem_cast<UBGraphicsStrokesGroup*>(item); UBGraphicsStrokesGroup* strokesGroupItem = qgraphicsitem_cast<UBGraphicsStrokesGroup*>(item);
if(strokesGroupItem && strokesGroupItem->isVisible()){ if(strokesGroupItem && strokesGroupItem->isVisible()){
mXmlWriter.writeStartElement("g"); QDomElement newGroupElement;
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "uuid", UBStringUtils::toCanonicalUuid(strokesGroupItem->uuid())); if (!strokesGroupItem->parentItem() && strokesGroupItem->childItems().count()) {
newGroupElement = groupDomDocument.createElement(tGroup);
newGroupElement.setAttribute(aId, strokesGroupItem->uuid().toString());
groupRoot.appendChild(newGroupElement);
}
//disabling g section parsing as a group of elements. Use groups refs instead
// mXmlWriter.writeStartElement("g");
// mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "uuid", UBStringUtils::toCanonicalUuid(strokesGroupItem->uuid()));
QMatrix matrix = item->sceneMatrix(); QMatrix matrix = item->sceneMatrix();
if (!matrix.isIdentity()){ if (!matrix.isIdentity()){
mXmlWriter.writeAttribute("transform", toSvgTransform(matrix)); mXmlWriter.writeAttribute("transform", toSvgTransform(matrix));
} }
// Add the polygons // Add the polygons
foreach(QGraphicsItem* item, strokesGroupItem->childItems()){ foreach(QGraphicsItem* item, strokesGroupItem->childItems()){
UBGraphicsPolygonItem* poly = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item);
if(NULL != poly){ UBGraphicsPolygonItem* poly = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item);
polygonItemToSvgPolygon(poly, true); if(NULL != poly){
items.removeOne(poly); polygonItemToSvgPolygon(poly, true);
} if (!newGroupElement.isNull()) {
} QDomElement curPolygonElement = groupDomDocument.createElement(tElement);
curPolygonElement.setAttribute(aId, strokesGroupItem->uuid().toString()
+ poly->uuid().toString());
newGroupElement.appendChild(curPolygonElement);
}
items.removeOne(poly);
}
}
mXmlWriter.writeEndElement(); //g // mXmlWriter.writeEndElement(); //g
} }
// Is the item a polygon? // Is the item a polygon?
...@@ -1401,12 +1481,12 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) ...@@ -1401,12 +1481,12 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
QDomElement curElement = groupRoot.firstChildElement(); QDomElement curElement = groupRoot.firstChildElement();
while (!curElement.isNull()) { while (!curElement.isNull()) {
if (curElement.hasAttribute(aId)) { if (curElement.hasAttribute(aId)) {
mXmlWriter.writeStartElement(tGroup); mXmlWriter.writeStartElement(curElement.tagName());
mXmlWriter.writeAttribute(aId, curElement.attribute(aId)); mXmlWriter.writeAttribute(aId, curElement.attribute(aId));
QDomElement curSubElement = curElement.firstChildElement(); QDomElement curSubElement = curElement.firstChildElement();
while (!curSubElement.isNull()) { while (!curSubElement.isNull()) {
if (curSubElement.hasAttribute(aId)) { if (curSubElement.hasAttribute(aId)) {
mXmlWriter.writeStartElement(tElement); mXmlWriter.writeStartElement(curSubElement.tagName());
mXmlWriter.writeAttribute(aId, curSubElement.attribute(aId)); mXmlWriter.writeAttribute(aId, curSubElement.attribute(aId));
mXmlWriter.writeEndElement(); mXmlWriter.writeEndElement();
curSubElement = curSubElement.nextSiblingElement(); curSubElement = curSubElement.nextSiblingElement();
...@@ -1454,8 +1534,16 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro ...@@ -1454,8 +1534,16 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro
if (!tmpUuid.isNull()) { if (!tmpUuid.isNull()) {
if (item->type() == UBGraphicsGroupContainerItem::Type && item->childItems().count()) { if (item->type() == UBGraphicsGroupContainerItem::Type && item->childItems().count()) {
persistGroupToDom(item, curParent, groupDomDocument); persistGroupToDom(item, curParent, groupDomDocument);
} else if (item->type() == UBGraphicsStrokesGroup::Type) {
foreach (QGraphicsItem *polygonItem, item->childItems()) {
QDomElement curPolygonElement = groupDomDocument->createElement(tElement);
curPolygonElement.setAttribute(aId, tmpUuid.toString()
+ UBGraphicsItem::getOwnUuid(polygonItem).toString());
curGroupElement.appendChild(curPolygonElement);
}
} else { } else {
QDomElement curSubElement = groupDomDocument->createElement(tGroup); QDomElement curSubElement = groupDomDocument->createElement(tElement);
curSubElement.setAttribute(aId, tmpUuid); curSubElement.setAttribute(aId, tmpUuid);
curGroupElement.appendChild(curSubElement); curGroupElement.appendChild(curSubElement);
} }
...@@ -1464,6 +1552,27 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro ...@@ -1464,6 +1552,27 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro
} }
} }
void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistStrokeToDom(QGraphicsItem *strokeItem, QDomElement *curParent, QDomDocument *curDomDocument)
{
QUuid uuid = UBGraphicsScene::getPersonalUuid(strokeItem);
if (!uuid.isNull()) {
QDomElement curStrokesGroupElement = curDomDocument->createElement(tStrokeGroup);
curStrokesGroupElement.setAttribute(aId, uuid);
curParent->appendChild(curStrokesGroupElement);
foreach (QGraphicsItem *item, strokeItem->childItems()) {
QUuid tmpUuid = UBGraphicsScene::getPersonalUuid(item);
if (!tmpUuid.isNull()) {
if (item->type() == UBGraphicsPolygonItem::Type && item->childItems().count()) {
QDomElement curSubElement = curDomDocument->createElement(tElement);
curSubElement.setAttribute(aId, tmpUuid);
curStrokesGroupElement.appendChild(curSubElement);
}
}
}
}
}
void UBSvgSubsetAdaptor::UBSvgSubsetWriter::polygonItemToSvgLine(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo) void UBSvgSubsetAdaptor::UBSvgSubsetWriter::polygonItemToSvgLine(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo)
{ {
mXmlWriter.writeStartElement("line"); mXmlWriter.writeStartElement("line");
...@@ -1615,6 +1724,11 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::polygonItemToSvgPolygon(UBGraphicsPo ...@@ -1615,6 +1724,11 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::polygonItemToSvgPolygon(UBGraphicsPo
, "fill-on-light-background", polygonItem->colorOnLightBackground().name()); , "fill-on-light-background", polygonItem->colorOnLightBackground().name());
} }
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "uuid", UBStringUtils::toCanonicalUuid(polygonItem->uuid()));
if (polygonItem->parentItem()) {
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "parent", UBStringUtils::toCanonicalUuid(UBGraphicsItem::getOwnUuid(polygonItem->parentItem())));
}
mXmlWriter.writeEndElement(); mXmlWriter.writeEndElement();
} }
} }
......
...@@ -179,6 +179,7 @@ class UBSvgSubsetAdaptor ...@@ -179,6 +179,7 @@ class UBSvgSubsetAdaptor
private: private:
void persistGroupToDom(QGraphicsItem *groupItem, QDomElement *curParent, QDomDocument *curDomDocument); void persistGroupToDom(QGraphicsItem *groupItem, QDomElement *curParent, QDomDocument *curDomDocument);
void persistStrokeToDom(QGraphicsItem *strokeItem, QDomElement *curParent, QDomDocument *curDomDocument);
void polygonItemToSvgPolygon(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo); void polygonItemToSvgPolygon(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo);
void polygonItemToSvgLine(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo); void polygonItemToSvgLine(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo);
void strokeToSvgPolyline(UBGraphicsStroke* stroke, bool groupHoldsInfo); void strokeToSvgPolyline(UBGraphicsStroke* stroke, bool groupHoldsInfo);
......
...@@ -750,7 +750,7 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA ...@@ -750,7 +750,7 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA
file.write(pData); file.write(pData);
file.close(); file.close();
UBFeature downloadedFeature = UBFeature(dest.getFullVirtualPath() + "/" + fileName, getIcon( filePath ), UBFeature downloadedFeature = UBFeature(dest.getFullVirtualPath() + "/" + fileName, getIcon( filePath, fileTypeFromUrl(filePath)),
fileName, QUrl::fromLocalFile(filePath), FEATURE_ITEM); fileName, QUrl::fromLocalFile(filePath), FEATURE_ITEM);
if (downloadedFeature != UBFeature()) { if (downloadedFeature != UBFeature()) {
featuresModel->addItem(downloadedFeature); featuresModel->addItem(downloadedFeature);
......
...@@ -60,6 +60,13 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (const QLineF& pLine, qreal pWidth) ...@@ -60,6 +60,13 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (const QLineF& pLine, qreal pWidth)
void UBGraphicsPolygonItem::initialize() void UBGraphicsPolygonItem::initialize()
{ {
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::DrawingItem)); //Necessary to set if we want z value to be assigned correctly setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::DrawingItem)); //Necessary to set if we want z value to be assigned correctly
setUuid(QUuid::createUuid());
}
void UBGraphicsPolygonItem::setUuid(const QUuid &pUuid)
{
UBItem::setUuid(pUuid);
setData(UBGraphicsItemData::ItemUuid, QVariant(pUuid)); //store item uuid inside the QGraphicsItem to fast operations with Items on the scene
} }
void UBGraphicsPolygonItem::clearStroke() void UBGraphicsPolygonItem::clearStroke()
......
...@@ -39,6 +39,8 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem ...@@ -39,6 +39,8 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem
void initialize(); void initialize();
void setUuid(const QUuid &pUuid);
void setStrokesGroup(UBGraphicsStrokesGroup* group); void setStrokesGroup(UBGraphicsStrokesGroup* group);
UBGraphicsStrokesGroup* strokesGroup() const{return mpGroup;} UBGraphicsStrokesGroup* strokesGroup() const{return mpGroup;}
void setColor(const QColor& color); void setColor(const QColor& color);
......
...@@ -1713,6 +1713,7 @@ QRectF UBGraphicsScene::normalizedSceneRect(qreal ratio) ...@@ -1713,6 +1713,7 @@ QRectF UBGraphicsScene::normalizedSceneRect(qreal ratio)
QGraphicsItem *UBGraphicsScene::itemForUuid(QUuid uuid) QGraphicsItem *UBGraphicsScene::itemForUuid(QUuid uuid)
{ {
QGraphicsItem *result = 0; QGraphicsItem *result = 0;
QString ui = uuid.toString();
//simple search before implementing container for fast access //simple search before implementing container for fast access
foreach (QGraphicsItem *item, items()) { foreach (QGraphicsItem *item, items()) {
......
...@@ -302,6 +302,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem ...@@ -302,6 +302,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
static QUuid getPersonalUuid(QGraphicsItem *item); static QUuid getPersonalUuid(QGraphicsItem *item);
UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon);
public slots: public slots:
void initStroke(); void initStroke();
void hideEraser(); void hideEraser();
...@@ -338,7 +340,6 @@ public slots: ...@@ -338,7 +340,6 @@ public slots:
UBGraphicsPolygonItem* lineToPolygonItem(const QLineF& pLine, const qreal& pWidth); UBGraphicsPolygonItem* lineToPolygonItem(const QLineF& pLine, const qreal& pWidth);
UBGraphicsPolygonItem* arcToPolygonItem(const QLineF& pStartRadius, qreal pSpanAngle, qreal pWidth); UBGraphicsPolygonItem* arcToPolygonItem(const QLineF& pStartRadius, qreal pSpanAngle, qreal pWidth);
UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon);
void initPolygonItem(UBGraphicsPolygonItem*); void initPolygonItem(UBGraphicsPolygonItem*);
......
...@@ -621,6 +621,7 @@ void UBGraphicsWidgetItem::mainFrameLoadFinished (bool ok) ...@@ -621,6 +621,7 @@ void UBGraphicsWidgetItem::mainFrameLoadFinished (bool ok)
mInitialLoadDone = true; mInitialLoadDone = true;
mLoadIsErronous = !ok; mLoadIsErronous = !ok;
update(boundingRect()); update(boundingRect());
takeSnapshot();
} }
void UBGraphicsWidgetItem::wheelEvent(QGraphicsSceneWheelEvent *event) void UBGraphicsWidgetItem::wheelEvent(QGraphicsSceneWheelEvent *event)
......
...@@ -235,7 +235,7 @@ void UBFeaturesWidget::onDisplayMetadata( QMap<QString,QString> metadata ) ...@@ -235,7 +235,7 @@ void UBFeaturesWidget::onDisplayMetadata( QMap<QString,QString> metadata )
if (!imageGatherer) if (!imageGatherer)
imageGatherer = new UBDownloadHttpFile(0, this); imageGatherer = new UBDownloadHttpFile(0, this);
connect(imageGatherer, SIGNAL(downloadFinished(int, bool, QUrl, QString, QByteArray, QPointF, QSize, bool)), this, SLOT(onPreviewLoaded(int, bool, QUrl, QString, QByteArray, QPointF, QSize, bool))); connect(imageGatherer, SIGNAL(downloadFinished(int, bool, QUrl, QUrl, QString, QByteArray, QPointF, QSize, bool)), this, SLOT(onPreviewLoaded(int, bool, QUrl, QUrl, QString, QByteArray, QPointF, QSize, bool)));
// We send here the request and store its reply in order to be able to cancel it if needed // We send here the request and store its reply in order to be able to cancel it if needed
imageGatherer->get(QUrl(metadata["Url"]), QPoint(0,0), QSize(), false); imageGatherer->get(QUrl(metadata["Url"]), QPoint(0,0), QSize(), false);
...@@ -262,10 +262,11 @@ void UBFeaturesWidget::onDisplayMetadata( QMap<QString,QString> metadata ) ...@@ -262,10 +262,11 @@ void UBFeaturesWidget::onDisplayMetadata( QMap<QString,QString> metadata )
} }
void UBFeaturesWidget::onPreviewLoaded(int id, bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground) void UBFeaturesWidget::onPreviewLoaded(int id, bool pSuccess, QUrl sourceUrl, QUrl originalUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground)
{ {
Q_UNUSED(id); Q_UNUSED(id);
Q_UNUSED(pSuccess); Q_UNUSED(pSuccess);
Q_UNUSED(originalUrl);
Q_UNUSED(isBackground); Q_UNUSED(isBackground);
Q_UNUSED(pSize); Q_UNUSED(pSize);
Q_UNUSED(pPos); Q_UNUSED(pPos);
...@@ -1044,6 +1045,7 @@ void UBFeatureProperties::onAddToLib() ...@@ -1044,6 +1045,7 @@ void UBFeatureProperties::onAddToLib()
sDownloadFileDesc desc; sDownloadFileDesc desc;
desc.isBackground = false; desc.isBackground = false;
desc.modal = false; desc.modal = false;
desc.dest = sDownloadFileDesc::library;
desc.name = QFileInfo( mpElement->getFullPath().toString()).fileName(); desc.name = QFileInfo( mpElement->getFullPath().toString()).fileName();
qDebug() << desc.name; qDebug() << desc.name;
desc.srcUrl = mpElement->getFullPath().toString(); desc.srcUrl = mpElement->getFullPath().toString();
......
...@@ -79,7 +79,7 @@ signals: ...@@ -79,7 +79,7 @@ signals:
void sendFileNameList(const QStringList lst); void sendFileNameList(const QStringList lst);
private slots: private slots:
void onPreviewLoaded(int id, bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground); void onPreviewLoaded(int id, bool pSuccess, QUrl sourceUrl, QUrl originalUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground);
void currentSelected( const QModelIndex & ); void currentSelected( const QModelIndex & );
void searchStarted( const QString & ); void searchStarted( const QString & );
void createNewFolder(); void createNewFolder();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment