fixed orde images widget

preferencesAboutTextFull
unknown 13 years ago
parent 92323f105c
commit d09cfc1449
  1. 5
      resources/library/interactivities/Ordre images.wgt/index.html
  2. 37
      resources/library/interactivities/Ordre images.wgt/js/script.js
  3. 37
      resources/library/interactivities/Ordre images.wgt/locales/fr/js/script.js
  4. 38
      resources/library/interactivities/Ordre images.wgt/locales/ru/js/script.js

@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="css/basic.css"/> <link rel="stylesheet" type="text/css" href="css/basic.css"/>
<link rel="stylesheet" href="css/fonts/Lobster/stylesheet.css"> <link rel="stylesheet" href="css/fonts/Lobster/stylesheet.css">
<link rel="stylesheet" href="css/fonts/SF-Toontime/stylesheet.css"> <link rel="stylesheet" href="css/fonts/SF-Toontime/stylesheet.css">
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script> <script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.9.custom.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="js/script.js"></script> <script type="text/javascript" src="js/script.js"></script>
@ -17,7 +17,8 @@
} else } else
lang = "en"; lang = "en";
if(lang == "en"){ if(lang == "en"){
sankore.enableDropOnWidget(false); if(window.sankore)
sankore.enableDropOnWidget(false);
start(); start();
} }
else{ else{

@ -34,12 +34,21 @@ function start(){
//events //events
if (window.widget) { if (window.widget) {
window.widget.onleave = function(){ window.widget.onleave = function(){
//exportData(); exportData();
} }
} }
$("#wgt_reload").click(function(){ $("#wgt_reload").click(function(){
window.location.reload(); if($("#wgt_display").hasClass("selected")){
$("#wgt_edit").trigger("click");
$("#wgt_display").trigger("click");
} else {
$("#wgt_display").trigger("click");
}
});
$("#wgt_reload, #wgt_display, #wgt_edit").mouseover(function(){
exportData();
}); });
$(".style_select").change(function (event){ $(".style_select").change(function (event){
@ -204,6 +213,10 @@ function exportData(){
array_to_export.push(cont_obj); array_to_export.push(cont_obj);
} }
sankore.setPreference("odr_des_imgs", JSON.stringify(array_to_export)); sankore.setPreference("odr_des_imgs", JSON.stringify(array_to_export));
if($("#wgt_display").hasClass("selected"))
sankore.setPreference("odr_des_imgs_state", "display");
else
sankore.setPreference("odr_des_imgs_state", "edit");
} }
//import //import
@ -240,13 +253,19 @@ function importData(data){
img_block.append(hidden_input).append(img); img_block.append(hidden_input).append(img);
tmp_array.push(img_block); tmp_array.push(img_block);
} }
tmp_array = shuffle(tmp_array); if(sankore.preference("odr_des_imgs_state","")){
if(sankore.preference("odr_des_imgs_state","") == "edit")
tmp_array = shuffle(tmp_array);
} else
tmp_array = shuffle(tmp_array);
for(j = 0; j<tmp_array.length;j++) for(j = 0; j<tmp_array.length;j++)
tmp_array[j].appendTo(imgs_container); tmp_array[j].appendTo(imgs_container);
imgs_container.sortable( { imgs_container.sortable().bind('sortupdate', function(event, ui) {
update: checkResult checkResult(event);
} ); });
container.appendTo("#data"); container.appendTo("#data");
imgs_container.trigger("sortupdate")
} }
} }
} }
@ -286,9 +305,9 @@ function showExample(){
tmp_array = shuffle(tmp_array); tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++) for(var i = 0; i<tmp_array.length;i++)
tmp_array[i].appendTo(imgs_container); tmp_array[i].appendTo(imgs_container);
imgs_container.sortable( { imgs_container.sortable().bind('sortupdate', function(event, ui) {
update: checkResult checkResult(event);
} ); });
container.appendTo("#data"); container.appendTo("#data");
} }

@ -35,12 +35,21 @@ function start(){
//events //events
if (window.widget) { if (window.widget) {
window.widget.onleave = function(){ window.widget.onleave = function(){
//exportData(); exportData();
} }
} }
$("#wgt_reload").click(function(){ $("#wgt_reload").click(function(){
window.location.reload(); if($("#wgt_display").hasClass("selected")){
$("#wgt_edit").trigger("click");
$("#wgt_display").trigger("click");
} else {
$("#wgt_display").trigger("click");
}
});
$("#wgt_reload, #wgt_display, #wgt_edit").mouseover(function(){
exportData();
}); });
$(".style_select").change(function (event){ $(".style_select").change(function (event){
@ -205,6 +214,10 @@ function exportData(){
array_to_export.push(cont_obj); array_to_export.push(cont_obj);
} }
sankore.setPreference("odr_des_imgs", JSON.stringify(array_to_export)); sankore.setPreference("odr_des_imgs", JSON.stringify(array_to_export));
if($("#wgt_display").hasClass("selected"))
sankore.setPreference("odr_des_imgs_state", "display");
else
sankore.setPreference("odr_des_imgs_state", "edit");
} }
//import //import
@ -240,13 +253,19 @@ function importData(data){
img_block.append(hidden_input).append(img); img_block.append(hidden_input).append(img);
tmp_array.push(img_block); tmp_array.push(img_block);
} }
tmp_array = shuffle(tmp_array); if(sankore.preference("odr_des_imgs_state","")){
if(sankore.preference("odr_des_imgs_state","") == "edit")
tmp_array = shuffle(tmp_array);
} else
tmp_array = shuffle(tmp_array);
for(j = 0; j<tmp_array.length;j++) for(j = 0; j<tmp_array.length;j++)
tmp_array[j].appendTo(imgs_container); tmp_array[j].appendTo(imgs_container);
imgs_container.sortable( { imgs_container.sortable().bind('sortupdate', function(event, ui) {
update: checkResult checkResult(event);
} ); });
container.appendTo("#data"); container.appendTo("#data");
imgs_container.trigger("sortupdate")
} }
} }
} }
@ -286,9 +305,9 @@ function showExample(){
tmp_array = shuffle(tmp_array); tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++) for(var i = 0; i<tmp_array.length;i++)
tmp_array[i].appendTo(imgs_container); tmp_array[i].appendTo(imgs_container);
imgs_container.sortable( { imgs_container.sortable().bind('sortupdate', function(event, ui) {
update: checkResult checkResult(event);
} ); });
container.appendTo("#data"); container.appendTo("#data");
} }

@ -35,12 +35,21 @@ function start(){
//events //events
if (window.widget) { if (window.widget) {
window.widget.onleave = function(){ window.widget.onleave = function(){
//exportData(); exportData();
} }
} }
$("#wgt_reload").click(function(){ $("#wgt_reload").click(function(){
window.location.reload(); if($("#wgt_display").hasClass("selected")){
$("#wgt_edit").trigger("click");
$("#wgt_display").trigger("click");
} else {
$("#wgt_display").trigger("click");
}
});
$("#wgt_reload, #wgt_display, #wgt_edit").mouseover(function(){
exportData();
}); });
$(".style_select").change(function (event){ $(".style_select").change(function (event){
@ -205,6 +214,10 @@ function exportData(){
array_to_export.push(cont_obj); array_to_export.push(cont_obj);
} }
sankore.setPreference("odr_des_imgs", JSON.stringify(array_to_export)); sankore.setPreference("odr_des_imgs", JSON.stringify(array_to_export));
if($("#wgt_display").hasClass("selected"))
sankore.setPreference("odr_des_imgs_state", "display");
else
sankore.setPreference("odr_des_imgs_state", "edit");
} }
//import //import
@ -240,13 +253,19 @@ function importData(data){
img_block.append(hidden_input).append(img); img_block.append(hidden_input).append(img);
tmp_array.push(img_block); tmp_array.push(img_block);
} }
tmp_array = shuffle(tmp_array); if(sankore.preference("odr_des_imgs_state","")){
if(sankore.preference("odr_des_imgs_state","") == "edit")
tmp_array = shuffle(tmp_array);
} else
tmp_array = shuffle(tmp_array);
for(j = 0; j<tmp_array.length;j++) for(j = 0; j<tmp_array.length;j++)
tmp_array[j].appendTo(imgs_container); tmp_array[j].appendTo(imgs_container);
imgs_container.sortable( { imgs_container.sortable().bind('sortupdate', function(event, ui) {
update: checkResult checkResult(event);
} ); });
container.appendTo("#data"); container.appendTo("#data");
imgs_container.trigger("sortupdate")
} }
} }
} }
@ -286,9 +305,9 @@ function showExample(){
tmp_array = shuffle(tmp_array); tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++) for(var i = 0; i<tmp_array.length;i++)
tmp_array[i].appendTo(imgs_container); tmp_array[i].appendTo(imgs_container);
imgs_container.sortable( { imgs_container.sortable().bind('sortupdate', function(event, ui) {
update: checkResult checkResult(event);
} ); });
container.appendTo("#data"); container.appendTo("#data");
} }
@ -467,4 +486,3 @@ function onDropTarget(obj, event) {
} }
return false; return false;
} }

Loading…
Cancel
Save