Skip to content

Commit

Permalink
#93: Vorschaubild mit Großansicht in Fundsuche, Ablage- und Kontextfo…
Browse files Browse the repository at this point in the history
…rmular integriert
  • Loading branch information
Robert Grüning committed Dec 2, 2020
1 parent 187847f commit 2dd03ae
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 36 deletions.
32 changes: 24 additions & 8 deletions src/js/views/Ablage/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,20 @@ function setCountOfFunde(funde) {
//#endregion

//#region Funde
var IconField = function(config) {
var ImageField = function(config) {
jsGrid.Field.call(this, config);
}

IconField.prototype = new jsGrid.Field({
ImageField.prototype = new jsGrid.Field({
itemTemplate: function(value) {
return $("<i>").addClass(value);
if (value == null) {
return "kein Bild vorhanden";
}

return $("<img>")
.attr("src", value)
.attr("width", "70px")
.attr("onclick", "imageModal_open(this)");
}
});

Expand All @@ -247,7 +254,7 @@ function InitGridFunde()
_viewModelFormAblage.register("funde", new GuiClient(UpdateGridData, showErrorMessages));

jsGrid.locale("de");
jsGrid.fields.icon = IconField;
jsGrid.fields.image = ImageField;
jsGrid.fields.linkToFundFormField = LinkToFundFormField;

$("#gridFunde").jsGrid({
Expand All @@ -268,9 +275,9 @@ function InitGridFunde()
},
{
title: "",
name: "Icon",
type: "icon",
width: 27
name: "PreviewImage",
type: "image",
width: 50
},
{
name: "Anzahl",
Expand Down Expand Up @@ -306,7 +313,16 @@ function UpdateGridData(funde) {

funde.forEach(fund => {
var copy = JSON.parse(JSON.stringify(fund));
copy.Icon = IconConfig.getCssClasses("Fund");

if (fund.Kontext != null &&
fund.FileName != null) {

let kontextPath = fund.Kontext.Path;
let previewFileName = fund.FileName.substr(0, fund.FileName.lastIndexOf(".")) + ".preview" + fund.FileName.substr(fund.FileName.lastIndexOf("."));
let relativePreviewFilePath = kontextPath + "/" + previewFileName;
copy.PreviewImage = "https://localhost/munins-archiv-file-service/file.php?relativePath=/" + relativePreviewFilePath;
}

copy.Anzahl = fund.Anzahl.replace("-", ">");
copy.FundAttributAnzeigeTexte = "<ul>"

Expand Down
32 changes: 24 additions & 8 deletions src/js/views/Begehung/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,20 @@ function setCountOfFunde(funde) {
//#endregion

//#region Funde
var IconField = function(config) {
var ImageField = function(config) {
jsGrid.Field.call(this, config);
}

IconField.prototype = new jsGrid.Field({
ImageField.prototype = new jsGrid.Field({
itemTemplate: function(value) {
return $("<i>").addClass(value);
if (value == null) {
return "kein Bild vorhanden";
}

return $("<img>")
.attr("src", value)
.attr("width", "70px")
.attr("onclick", "imageModal_open(this)");
}
});

Expand All @@ -363,7 +370,7 @@ function InitGridFunde()
_viewModelFormBegehung.register("funde", new GuiClient(UpdateGridData, showErrorMessages));

jsGrid.locale("de");
jsGrid.fields.icon = IconField;
jsGrid.fields.image = ImageField;
jsGrid.fields.linkToFundFormField = LinkToFundFormField;

$("#gridFunde").jsGrid({
Expand All @@ -384,9 +391,9 @@ function InitGridFunde()
},
{
title: "",
name: "Icon",
type: "icon",
width: 27
name: "PreviewImage",
type: "image",
width: 50
},
{
name: "Anzahl",
Expand Down Expand Up @@ -422,7 +429,16 @@ function UpdateGridData(funde) {

funde.forEach(fund => {
var copy = JSON.parse(JSON.stringify(fund));
copy.Icon = IconConfig.getCssClasses("Fund");

if (fund.Kontext != null &&
fund.FileName != null) {

let kontextPath = fund.Kontext.Path;
let previewFileName = fund.FileName.substr(0, fund.FileName.lastIndexOf(".")) + ".preview" + fund.FileName.substr(fund.FileName.lastIndexOf("."));
let relativePreviewFilePath = kontextPath + "/" + previewFileName;
copy.PreviewImage = "https://localhost/munins-archiv-file-service/file.php?relativePath=/" + relativePreviewFilePath;
}

copy.Anzahl = fund.Anzahl.replace("-", ">");
copy.FundAttributAnzeigeTexte = "<ul>"

Expand Down
13 changes: 6 additions & 7 deletions src/js/views/Fund/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,22 +496,21 @@ function InitFieldFileName() {
_viewModelFormFund.setFileName($("#textboxFileName").val())
});

$("img.preview").click(function ()
$("img.preview").click(function()
{
imageModal_open(this);
});
}

function setFileName(fileName) {
$("#textboxFileName").val(fileName);
let kontext = _viewModelFormFund.getKontext();
let kontextPath = kontext == null ? null : kontext.Path;
let relativeFilePath = kontextPath == null ? null : kontextPath + "/" + fileName;

let previewFileName = fileName.substr(0, fileName.lastIndexOf(".")) + ".preview" + fileName.substr(fileName.lastIndexOf("."));
let relativePreviewFilePath = kontextPath == null ? null : kontextPath + "/" + previewFileName;
if (_viewModelFormFund.getKontext() != null &&
fileName != null) {

if (relativeFilePath != null) {
let kontextPath = _viewModelFormFund.getKontext().Path;
let previewFileName = fileName.substr(0, fileName.lastIndexOf(".")) + ".preview" + fileName.substr(fileName.lastIndexOf("."));
let relativePreviewFilePath = kontextPath + "/" + previewFileName;
$("img.preview").attr("src", "https://localhost/munins-archiv-file-service/file.php?relativePath=/" +
relativePreviewFilePath);
}
Expand Down
35 changes: 26 additions & 9 deletions src/js/views/Fund/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,21 @@ function markSelectedItem(selectedItemIndex) {
row.addClass("selected-row");
}
}
var IconField = function(config) {

var ImageField = function(config) {
jsGrid.Field.call(this, config);
}

IconField.prototype = new jsGrid.Field({
ImageField.prototype = new jsGrid.Field({
itemTemplate: function(value) {
return $("<i>").addClass(value);
if (value == null) {
return "kein Bild vorhanden";
}

return $("<img>")
.attr("src", value)
.attr("width", "70px")
.attr("onclick", "imageModal_open(this)");
}
});

Expand All @@ -109,7 +117,7 @@ LinkToFundFormField.prototype = new jsGrid.Field({
function InitGrid()
{
jsGrid.locale("de");
jsGrid.fields.icon = IconField;
jsGrid.fields.image = ImageField;
jsGrid.fields.linkToFundFormField = LinkToFundFormField;

$("#gridContainer").jsGrid({
Expand All @@ -130,9 +138,9 @@ function InitGrid()
},
{
title: "",
name: "Icon",
type: "icon",
width: 27
name: "PreviewImage",
type: "image",
width: 50
},
{
name: "Anzahl",
Expand Down Expand Up @@ -173,7 +181,7 @@ function InitGrid()

window.open("/Munins Archiv/src/pages/Fund/Form.html?Id=" + args.item.Id, "_self");
}
});
});
}

function UpdateGridData(funde) {
Expand All @@ -185,7 +193,16 @@ function UpdateGridData(funde) {

funde.forEach(fund => {
var copy = JSON.parse(JSON.stringify(fund));
copy.Icon = IconConfig.getCssClasses("Fund");

if (fund.Kontext != null &&
fund.FileName != null) {

let kontextPath = fund.Kontext.Path;
let previewFileName = fund.FileName.substr(0, fund.FileName.lastIndexOf(".")) + ".preview" + fund.FileName.substr(fund.FileName.lastIndexOf("."));
let relativePreviewFilePath = kontextPath + "/" + previewFileName;
copy.PreviewImage = "https://localhost/munins-archiv-file-service/file.php?relativePath=/" + relativePreviewFilePath;
}

copy.Anzahl = fund.Anzahl.replace("-", ">");
copy.FundAttributAnzeigeTexte = "<ul>"

Expand Down
9 changes: 8 additions & 1 deletion src/pages/Ablage/Form.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<script type="text/javascript" src="../../js/controls/control.Headline.js"></script>
<script type="text/javascript" src="../../js/controls/control.MessageBox.js"></script>
<script type="text/javascript" src="../../js/controls/control.ErrorMessageBox.js"></script>
<script type="text/javascript" src="../../js/controls/control.ImageModal.js"></script>
<!-- basic page functions -->
<script type="text/javascript" src="../../js/page.js"></script>
<script type="text/javascript" src="../../js/ui/IconConfig.js"></script>
Expand All @@ -42,8 +43,9 @@

<!-- javascript frameworks etc. -->
<link rel="stylesheet" type="text/css" href="../../js/ui/jquery-ui/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="../../css/solid.css" />
<link rel="stylesheet" type="text/css" href="../../css/w3.css" />
<link rel="stylesheet" type="text/css" href="../../css/fontawesome.min.css" />
<link rel="stylesheet" type="text/css" href="../../css/solid.css" />
<!-- page -->
<link rel="stylesheet" type="text/css" href="../../css/page.css" />
<!-- controls -->
Expand All @@ -61,6 +63,11 @@
</head>

<body>
<div class="w3-container">
<div class="w3-modal image-modal w3-animate-zoom" onclick="$(this).hide()">
<img class="w3-modal-content" src="">
</div>
</div>
<div id=navigation class="notToPrint"></div>
<div id=content>
<div id=form class=form>
Expand Down
9 changes: 8 additions & 1 deletion src/pages/Begehung/Form.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<script type="text/javascript" src="../../js/controls/control.Headline.js"></script>
<script type="text/javascript" src="../../js/controls/control.MessageBox.js"></script>
<script type="text/javascript" src="../../js/controls/control.ErrorMessageBox.js"></script>
<script type="text/javascript" src="../../js/controls/control.ImageModal.js"></script>
<!-- basic page functions -->
<script type="text/javascript" src="../../js/page.js"></script>
<script type="text/javascript" src="../../js/ui/IconConfig.js"></script>
Expand Down Expand Up @@ -45,8 +46,9 @@

<!-- javascript frameworks etc. -->
<link rel="stylesheet" type="text/css" href="../../js/ui/jquery-ui/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="../../css/solid.css" />
<link rel="stylesheet" type="text/css" href="../../css/w3.css" />
<link rel="stylesheet" type="text/css" href="../../css/fontawesome.min.css" />
<link rel="stylesheet" type="text/css" href="../../css/solid.css" />
<!-- page -->
<link rel="stylesheet" type="text/css" href="../../css/page.css" />
<!-- controls -->
Expand All @@ -64,6 +66,11 @@
</head>

<body>
<div class="w3-container">
<div class="w3-modal image-modal w3-animate-zoom" onclick="$(this).hide()">
<img class="w3-modal-content" src="">
</div>
</div>
<div id=navigation class="notToPrint"></div>
<div id=content>
<div id=form class=form>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Fund/Form.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

<!-- javascript frameworks etc. -->
<link rel="stylesheet" type="text/css" href="../../js/ui/jquery-ui/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="../../css/w3.css" />
<link rel="stylesheet" type="text/css" href="../../css/fontawesome.min.css" />
<link rel="stylesheet" type="text/css" href="../../css/solid.css" />
<!-- page -->
Expand All @@ -54,7 +55,6 @@
<link rel="stylesheet" type="text/css" href="../../js/controls/jsgrid/jsgrid.min.css" />
<link rel="stylesheet" type="text/css" href="../../js/controls/jsgrid/jsgrid-theme.min.css" />
<link rel="stylesheet" type="text/css" href="../../css/jquery.toast.min.css" />
<link rel="stylesheet" type="text/css" href="../../css/w3.css" />
<link rel="stylesheet" type="text/css" href="../../css/form.css" />
<link rel="stylesheet" type="text/css" href="../../css/explorer.css" />
<link rel="stylesheet" type="text/css" href="../../css/grid.css" />
Expand Down
9 changes: 8 additions & 1 deletion src/pages/Fund/Search.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<script type="text/javascript" src="../../js/controls/control.Headline.js"></script>
<script type="text/javascript" src="../../js/controls/control.MessageBox.js"></script>
<script type="text/javascript" src="../../js/controls/control.ErrorMessageBox.js"></script>
<script type="text/javascript" src="../../js/controls/control.ImageModal.js"></script>
<!-- basic page functions -->
<script type="text/javascript" src="../../js/page.js"></script>
<script type="text/javascript" src="../../js/ui/IconConfig.js"></script>
Expand All @@ -34,8 +35,9 @@

<!-- javascript frameworks etc. -->
<link rel="stylesheet" type="text/css" href="../../js/ui/jquery-ui/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="../../css/solid.css" />
<link rel="stylesheet" type="text/css" href="../../css/w3.css" />
<link rel="stylesheet" type="text/css" href="../../css/fontawesome.min.css" />
<link rel="stylesheet" type="text/css" href="../../css/solid.css" />
<!-- page -->
<link rel="stylesheet" type="text/css" href="../../css/page.css" />
<!-- controls -->
Expand All @@ -53,6 +55,11 @@
</head>

<body>
<div class="w3-container">
<div class="w3-modal image-modal w3-animate-zoom" onclick="$(this).hide()">
<img class="w3-modal-content" src="">
</div>
</div>
<div id=navigation class="notToPrint"></div>
<div id=content>
<div class=form>
Expand Down

0 comments on commit 2dd03ae

Please sign in to comment.