From 3d4e045345a7f672ef01bfa3deb0eb950066ebdd Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Mon, 8 Oct 2007 15:24:06 +0000 Subject: [PATCH] arbeite daran ueber zu und aufklappen die bereiche zu de/aktivieren --- js/personAdmin/person.js | 22 ++++++- js/personAdmin/personInUp.js | 81 ++++++++++++++++-------- js/personAdmin/personSearch1.js | 6 +- templates/personAdmin/personInUp.tpl.php | 32 ++-------- 4 files changed, 87 insertions(+), 54 deletions(-) diff --git a/js/personAdmin/person.js b/js/personAdmin/person.js index 02113bb..0571548 100644 --- a/js/personAdmin/person.js +++ b/js/personAdmin/person.js @@ -22,7 +22,7 @@ function c_person (personId, photographerId, ownerId, firstname, surname, this.personForm = personForm; } - this.reset = function () + this.empty = function () { if (this.personId != -1) { @@ -45,6 +45,26 @@ function c_person (personId, photographerId, ownerId, firstname, surname, } } + this.reset = function () + { + this.personId = -1; + this.photographerId = -1; + this.ownerId = -1; + this.firstname = ''; + this.surname = ''; + this.company = ''; + this.email = ''; + this.url = ''; + this.cameraId = -1; + this.wmWidth = ''; + this.wmHeight = ''; + this.wmXPos = ''; + this.wmYPos = ''; + + if (this.personForm != null) + this.personForm.updateForm (); + } + this.update = function (p) { if (this.personId != p.personId) diff --git a/js/personAdmin/personInUp.js b/js/personAdmin/personInUp.js index 08d0464..e978b5e 100644 --- a/js/personAdmin/personInUp.js +++ b/js/personAdmin/personInUp.js @@ -28,6 +28,57 @@ function personInUp ( person.connect (this); + this.showHideBlock = function (titleId) + { + var titleElement = document.getElementById (titleId); + var imgElement = titleElement.getElementsByTagName ('img')[0]; + var blockElement = titleElement.parentNode; + var dataElement = blockElement.getElementsByTagName ('div')[1]; + + if (dataElement.style.display == 'none') + { + dataElement.style.display = 'block'; + imgElement.src = arrDown.getImgUrl (titleElement); + + switch (titleId) + { + case 'title_photographer': + if (this.person._photographerId != -1) + this.person.photographerId = this.person._photographerId; + else + this.person.photographerId = 0; + break; + + case 'title_owner': + if (this.person._ownerId != -1) + this.person.ownerId = this.person._ownerId; + else + this.person.ownerId = 0; + } + } + else + { + dataElement.style.display = 'none'; + imgElement.src = arrRight.getImgUrl (titleElement); + + switch (titleId) + { + case 'title_photographer': + if (this.person._photographerId != -1) + this.person.photographerId = this.person._photographerId; + else + this.person.photographerId = 0; + break; + + case 'title_owner': + if (this.person._ownerId != -1) + this.person.ownerId = this.person._ownerId; + else + this.person.ownerId = 0; + } + } + } + this.de_activate = function (field) { var updBox = document.getElementById (this.updBox); @@ -166,46 +217,26 @@ function personInUp ( this.setCameraId = function (value) { - var person = this.selectPerson (); - - person.cameraId = value; - if (person == this.newPerson) - person.photographerId = 0; + this.selectPerson ().cameraId = value; } this.setWmWidth = function (value) { - var person = this.selectPerson (); - - person.wmWidth = value; - if (person == this.newPerson) - person.ownerId = 0; + this.selectPerson ().wmWidth = value; } this.setWmHeight = function (value) { - var person = this.selectPerson (); - - person.wmHeight = value; - if (person == this.newPerson) - person.ownerId = 0; + this.selectPerson ().wmHeight = value; } this.setWmXPos = function (value) { - var person = this.selectPerson (); - - person.wmXPos = value; - if (person == this.newPerson) - person.ownerId = 0; + this.selectPerson ().wmXPos = value; } this.setWmYPos = function (value) { - var person = this.selectPerson (); - - person.wmYPos = value; - if (person == this.newPerson) - person.ownerId = 0; + this.selectPerson ().wmYPos = value; } } diff --git a/js/personAdmin/personSearch1.js b/js/personAdmin/personSearch1.js index 90e19db..17c80bc 100644 --- a/js/personAdmin/personSearch1.js +++ b/js/personAdmin/personSearch1.js @@ -138,13 +138,13 @@ function c_personSearch1 (fname, sname, fnameAlt, snameAlt, names, person) this.person.update ( this.persons[this.sNameBest[2]][this.fNameBest[2]]); else - this.person.reset (); + this.person.empty (); } else { this.fNameBest = new Array (-1, -1, null); if (this.person != null) - this.person.reset (); + this.person.empty (); } return false; @@ -172,7 +172,7 @@ function c_personSearch1 (fname, sname, fnameAlt, snameAlt, names, person) this.person.update ( this.persons[this.sNameBest[2]][this.fNameBest[2]]); else - this.person.reset (); + this.person.empty (); return false; } diff --git a/templates/personAdmin/personInUp.tpl.php b/templates/personAdmin/personInUp.tpl.php index b287f21..bfa8086 100644 --- a/templates/personAdmin/personInUp.tpl.php +++ b/templates/personAdmin/personInUp.tpl.php @@ -3,30 +3,11 @@ pInUp = new personInUp ( 'update', 'insert', 'submit', person, newPerson, arrRight, arrDown); - function showHideBlock (titleId) - { - var titleElement = document.getElementById (titleId); - var imgElement = titleElement.getElementsByTagName ('img')[0]; - var blockElement = titleElement.parentNode; - var dataElement = blockElement.getElementsByTagName ('div')[1]; - - if (dataElement.style.display == 'none') - { - dataElement.style.display = 'block'; - imgElement.src = arrDown.getImgUrl (titleElement); - } - else - { - dataElement.style.display = 'none'; - imgElement.src = arrRight.getImgUrl (titleElement); - } - } - function personInUpInit () { - var tCam = document.getElementById ('_title_camera'); + var tCam = document.getElementById ('title_photographer'); var tCamImg = tCam.getElementsByTagName ('img')[0]; - var tWat = document.getElementById ('_title_watermark'); + var tWat = document.getElementById ('title_owner'); var tWatImg = tWat.getElementsByTagName ('img')[0]; tCamImg.src = arrRight.getImgUrl (tCam); @@ -111,13 +92,14 @@
-
+
+ onClick="pInUp.showHideBlock ('title_photographer')" />
@@ -135,13 +117,13 @@
+ id="title_owner"> + onClick="pInUp.showHideBlock ('title_owner')" />