git-svn-id: https://msi/svn/firstRepo/Management/trunk@49 0f545695-f87b-41b6-9a03-7f16563b5454

This commit is contained in:
2016-01-15 17:04:16 +00:00
parent 4b9fa8baa4
commit fc837ca592
70 changed files with 9932 additions and 4090 deletions
+175 -27
View File
@@ -7,6 +7,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
//initialize template
template: _.template(editricettaViewTemplate),
addIngrDlg: null,
fullScrDlg: null,
initialize: function() {
EditRicetteView.__super__.initialize.call(this);
//this.header.title = "pippo";
@@ -36,6 +37,26 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
$("#listbox").jqxListBox({source: ricetta.ingredienti, itemHeight: 30, height: '90%', width: '100%', theme: 'arctic'});
var photoFields = [
{name: 'id_photo', type: 'int'},
{name: 'type_format', type: 'string'},
{name: 'from_profile_id', type: 'string'},
{name: 'uploaded_date', type: 'datetime'},
{name: 'profile_name', type: 'string'},
{name: 'published', type: 'bool'}
];
var photoAdapter = new $.jqx.dataAdapter({
datatype: "jsonp",
datafields: photoFields,
id: 'id_photo',
url: myManifest.Settings.DefaultURL + "/backend/ricetta/" + ricetta_id + "/photos",
data: {
}
});
$("#gridPhotos").jqxGrid({
source: photoAdapter});
// show the popup window.
$("#popupWindow").jqxWindow('open');
});
@@ -80,6 +101,31 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
cancelButton: this.$el.find("#Cancel"),
modalOpacity: 0.01,
initContent: function() {
$('#listbox').jqxListBox({
renderer: function(index, label, value) {
var datarecord = this.source[index];
if (datarecord)
{
datarecord.note = unescape(datarecord.note);
var div = '';
if (datarecord.id_tipo_ingredienti === "22")
{
div = '<div><b>' + datarecord.nome_ingrediente + '</b>: <i>' + datarecord.note + '</i></div>';
}
else
{
div = '<div><b>' + datarecord.nome_ingrediente + '</b>: ' + datarecord.quantita + ' ' + datarecord.unita + ' <i>' + datarecord.note + '</i></div>';
}
return div;
}
return "";
},
dragEnd: function(dragItem, dropItem) {
this.source.move(dragItem.index, dropItem.index);
return true;
}
});
$('#jqxTabs').jqxTabs({
width: '100%',
height: "90%",
@@ -223,29 +269,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
$('#listbox').jqxListBox({
//allowDrag: true,
source: dataAdapter, itemHeight: 30, height: '90%', width: '100%', theme: 'arctic',
renderer: function(index, label, value) {
var datarecord = this.source[index];
if (datarecord)
{
datarecord.note = unescape(datarecord.note);
var div = '';
if (datarecord.id_tipo_ingredienti === "22")
{
div = '<div><b>' + datarecord.nome_ingrediente + '</b>: <i>' + datarecord.note + '</i></div>';
}
else
{
div = '<div><b>' + datarecord.nome_ingrediente + '</b>: ' + datarecord.quantita + ' ' + datarecord.unita + ' <i>' + datarecord.note + '</i></div>';
}
return div;
}
return "";
},
dragEnd: function(dragItem, dropItem) {
this.source.move(dragItem.index, dropItem.index);
return true;
}
source: dataAdapter, itemHeight: 30, height: '90%', width: '100%', theme: 'arctic'
});
$('#listbox').on('select', function(event) {
@@ -285,6 +309,117 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
if (text)
$('#procedimento').jqxEditor('val', text);
}
else if (tab === 3)
{
var source =
{
datatype: "jsonp",
datafields: [
{name: 'id'},
{name: 'name'}
],
url: myManifest.Settings.DefaultURL + "/backend/profiles",
data: {
}
};
var dataAdapter = new $.jqx.dataAdapter(source);
$("#autorePhoto").jqxDropDownList(
{
width: "250px",
height: "25px",
source: dataAdapter,
//selectedIndex: -1,
displayMember: "name",
valueMember: "id"
});
$('#jqxFileUpload').jqxFileUpload({ width: '50%',
fileInputName: 'image',
multipleFilesUpload: false,
accept: 'image/*',
uploadUrl: myManifest.Settings.DefaultURL + '/backend/photos' });
$('#jqxFileUpload').on('uploadStart', function (event) {
var profileID = "10203753344023406";
if($("#autorePhoto").val() != 0)
profileID = $("#autorePhoto").val();
$('form[action="' + myManifest.Settings.DefaultURL + '/backend/photos' + '"]').
append('<input type="hidden" name="ricetta_id" value="' + self.ricettaEditing.ricetta_id +'" />').
append('<input type="hidden" name="keyStore" value="' + profileID + '" />');
});
$('#jqxFileUpload').on('uploadEnd', function (event) {
$("#gridPhotos").jqxGrid('updatebounddata');
});
$("#gridPhotos").jqxGrid({
width: "100%",
height: "100%",
//source: photoAdapter,
rowsheight: 100,
//filterable: true,
autoshowfiltericon: true,
columns: [
{text: 'Autore', dataField: 'profile_name', width: "170px"},
{text: 'Image', dataField: 'image', height: "100px",
cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
return '<center><img style="margin-left: 5px;height: 100px;" src="' + myManifest.Settings.DefaultURL + '/api/photos/thumbnail/' + rowdata.id_photo + '"/></center>';
}
},
{text: 'Published', editable: false, dataField: 'published', width: "70px",
cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
var valueBool = rowdata.published;
return "<div style='margin: 4px;' class='jqx-center-align'>" + valueBool + "</div>";
}
},
{text: '', datafield: 'FullView', columntype: 'button', width: '10%',
cellsrenderer: function() {
return "View Full";
},
buttonclick: function(row) {
var items = $("#gridPhotos").jqxGrid('source');
var item = items.records[row];
self.fullScrDlg.$el.find('#imgFullScr').attr('src', myManifest.Settings.DefaultURL + '/api/photos/' + item.id_photo);
self.fullScrDlg.open();
}
},
{text: '', datafield: 'Pubblica', columntype: 'button', width: '10%',
cellsrenderer: function() {
return "Pubblica";
},
buttonclick: function(row) {
var items = $("#gridPhotos").jqxGrid('source');
var item = items.records[row];
if(item.published === false)
{
$.ajax({
url: myManifest.Settings.DefaultURL + "/backend/photo/publish/" + item.id_photo,
//dataType: "json",
type: 'GET'
}).then(function (response) {
$("#gridPhotos").jqxGrid('updatebounddata');
});
}
}
},
{text: '', datafield: 'Cancella', columntype: 'button', width: '10%',
cellsrenderer: function() {
return "Cancella";
},
buttonclick: function(row) {
var items = $("#gridPhotos").jqxGrid('source');
var item = items.records[row];
$.ajax({
url: myManifest.Settings.DefaultURL + "/backend/photo/" + item.id_photo,
//dataType: "json",
type: 'DELETE'
}).then(function (response) {
$("#gridPhotos").jqxGrid('updatebounddata');
});
}
}
]
});
}
}
});
@@ -337,12 +472,25 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/editricetta/editricett
$("#Cancel").jqxButton({width: '48%', height: 40});
}
});
//
// $('#popupWindow').on('resized', function (event) {
// $('#procedimento').jqxEditor({width: '100%', height: 380});
// });
this.fullScrDlg = new Window({
title: "Foto Full Screen",
width: "600px",
height: "600px",
margin_top: "50px",
id: "fullScrDlg",
showCloseButton: true,
resizable: true,
isModal: true,
autoOpen: false,
content: "<img id='imgFullScr' style='margin-left: 5px;width: 565px;' src='' />",
initContentFn: null
});
self.$el.find("#content").append(this.fullScrDlg.$el);
this.fullScrDlg.render();
this.addIngrDlg = new AddIngrDlg();
this.$el.find("#content").append(this.addIngrDlg.$el);