Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
basic
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xrm
basic
Commits
6b66cce7
Commit
6b66cce7
authored
5 years ago
by
Johannes Hörmann
Browse files
Options
Downloads
Patches
Plain Diff
some objectrelationtree fixes
parent
fa9626b5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js
+41
-19
41 additions, 19 deletions
...bjectTree_entity/recordcontainers/jdito/contentProcess.js
with
41 additions
and
19 deletions
entity/ObjectTree_entity/recordcontainers/jdito/contentProcess.js
+
41
−
19
View file @
6b66cce7
...
...
@@ -8,6 +8,7 @@ import("system.logging");
import
(
"
ObjectRelation_lib
"
);
import
(
"
Context_lib
"
);
import
(
"
Sql_lib
"
);
import
(
"
system.tools
"
);
var
relationTypesCache
=
{};
var
tree
=
[]
...
...
@@ -21,12 +22,15 @@ if (filter)
selectedRelationType
=
filter
.
childs
[
0
].
value
;
}
}
_loadObjectRelationTree
(
vars
.
get
(
"
$param.ObjectId_param
"
)
,
vars
.
get
(
"
$param.ObjectType_param
"
),
selectedRelationType
);
var
originalObjectId
=
vars
.
get
(
"
$param.ObjectId_param
"
);
_loadObjectRelationTree
(
originalObjectId
,
vars
.
get
(
"
$param.ObjectType_param
"
),
selectedRelationType
);
result
.
object
(
tree
);
function
_loadObjectRelationTree
(
pObjectId
,
pObjectType
,
pObjectRelationTypeId
,
pNodeId
,
pLayer
)
function
_loadObjectRelationTree
(
pObjectId
,
pObjectType
,
pObjectRelationTypeId
,
pNodeId
,
pLayer
,
pObjectRelationId
)
{
if
(
pLayer
>
20
)
return
;
if
(
pLayer
==
undefined
)
pLayer
=
0
;
...
...
@@ -49,6 +53,7 @@ function _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId,
// use always reverse-type
relationTypeData
=
ObjectRelationUtils
.
getRelationType
(
relationTypeData
[
8
]);
currentObjectId
=
_getRootID
(
currentObjectId
,
relationTypeData
);
originalObjectId
=
currentObjectId
;
}
let
uids
=
_insertEntry
(
tree
,
[[
currentObjectId
,
""
,
""
,
""
,
""
]],
pNodeId
,
pLayer
,
pObjectType
,
relationTypeData
)
...
...
@@ -93,7 +98,6 @@ function _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId,
{
var
myData
=
_getEntryData
(
pNodeId
[
0
],
typeId
,
direction
,
relationType1
,
relationType2
)
// wenn typ-side 1 dann die eine Richtung, sonnst die andere?
let
uids
=
_insertEntry
(
tree
,
myData
,
pNodeId
,
pLayer
,
destObjectType
,
typeData
)
for
(
let
i
=
0
;
i
<
uids
.
length
;
i
++
)
{
...
...
@@ -102,12 +106,26 @@ function _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId,
}
else
{
// get ObjectRelationType from nodeId
//if (!pObjectRelationTypeId)
//{
_insertEntry
(
tree
,
_getEntryData
(
pNodeId
[
0
],
typeId
,
direction
,
relationType1
,
relationType2
),
pNodeId
,
pLayer
,
destObjectType
,
typeData
)
//}
// TODO: wenn relationtype selected
var
prevObjectId
;
if
(
pNodeId
[
4
]
!=
undefined
)
{
prevObjectId
=
pNodeId
[
4
][
0
];
}
var
entryData
=
_getEntryData
(
pNodeId
[
0
],
typeId
,
direction
,
relationType1
,
relationType2
,
prevObjectId
,
true
);
// add both sides. Only one will succeed, because the prevObjectId will be filtered and it will just return []
let
uids
=
_insertEntry
(
tree
,
entryData
,
pNodeId
,
pLayer
,
destObjectType
,
typeData
,
0
);
if
(
direction
==
"
same
"
)
{
var
otherEntryData
=
_getEntryData
(
pNodeId
[
0
],
typeId
,
"
normal
"
,
relationType1
,
relationType2
,
prevObjectId
,
true
);
uids
=
uids
.
concat
(
_insertEntry
(
tree
,
otherEntryData
,
pNodeId
,
pLayer
,
destObjectType
,
typeData
,
1
));
}
for
(
let
i
=
0
;
i
<
uids
.
length
;
i
++
)
{
_loadObjectRelationTree
(
uids
[
i
][
0
],
uids
[
i
][
3
],
pObjectRelationTypeId
,
uids
[
i
],
pLayer
+
1
,
uids
[
i
][
6
]);
}
}
}
}
...
...
@@ -117,11 +135,11 @@ function _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId,
* load data for a relation.
* OBJECT_ROWID, AB_OBJECTRELATIONID, OBJECT_TYPE, RELATION_TITLE
*/
function
_getEntryData
(
pObjectId
,
pRelationTypeId
,
pDirection
,
pRelationType1
,
pRelationType2
,
pRecursion
)
function
_getEntryData
(
pObjectId
,
pRelationTypeId
,
pDirection
,
pRelationType1
,
pRelationType2
,
pPrevId
,
pRecursion
)
{
if
(
pRelationType1
==
undefined
||
pRelationType2
==
undefined
)
return
[];
var
myNum
;
var
otherNum
;
...
...
@@ -141,12 +159,14 @@ function _getEntryData(pObjectId, pRelationTypeId, pDirection, pRelationType1, p
.
andPrepare
(
"
AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1
"
,
pRelationType1
)
.
andPrepare
(
"
AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2
"
,
pRelationType2
)
.
andPrepare
(
"
AB_OBJECTRELATION.OBJECT
"
+
myNum
+
"
_ROWID
"
,
pObjectId
);
// exclude previous node
if
(
!
p
RelationType
Id
)
if
(
!
p
Prev
Id
)
cond
.
and
(
"
AB_OBJECTRELATION.OBJECT
"
+
otherNum
+
"
_ROWID is not null
"
);
else
cond
.
andPrepare
(
"
AB_OBJECTRELATION.OBJECT
"
+
otherNum
+
"
_ROWID
"
,
pObjectId
,
"
# <> ?
"
);
{
cond
.
andPrepare
(
"
AB_OBJECTRELATION.OBJECT
"
+
otherNum
+
"
_ROWID
"
,
pPrevId
,
"
# <> ?
"
);
}
// TODO: BINDATA?
// var image = getImageObject("Beziehung");
...
...
@@ -156,10 +176,10 @@ function _getEntryData(pObjectId, pRelationTypeId, pDirection, pRelationType1, p
"
select OBJECT
"
+
otherNum
+
"
_ROWID, AB_OBJECTRELATIONID, OBJECT_TYPE, RELATION_TITLE
\n\
from AB_OBJECTRELATION
\n\
join AB_OBJECTRELATIONTYPE on AB_OBJECTRELATIONTYPEID = AB_OBJECTRELATIONTYPE
"
+
myNum
+
"
and
"
,
"
1=2
"
,
""
,
false
));
if
(
data
.
length
==
0
&&
pDirection
==
"
same
"
&&
!
pRecursion
)
{
return
_getEntryData
(
pObjectId
,
pRelationTypeId
,
"
normal
"
,
pRelationType1
,
pRelationType2
,
true
)
return
_getEntryData
(
pObjectId
,
pRelationTypeId
,
"
normal
"
,
pRelationType1
,
pRelationType2
,
pPrevId
,
true
)
}
// TODO: BINDATA?
...
...
@@ -176,7 +196,7 @@ function _getRelationTypes(pObjectType)
return
relationTypesCache
[
pObjectType
];
}
function
_insertEntry
(
pTree
,
pEntryData
,
pNodeId
,
pLayer
,
pObjectType
,
pRelationTypeData
)
function
_insertEntry
(
pTree
,
pEntryData
,
pNodeId
,
pLayer
,
pObjectType
,
pRelationTypeData
,
pNum
)
{
var
expanded
=
true
;
if
(
pLayer
>
10
)
expanded
=
false
;
...
...
@@ -186,7 +206,9 @@ function _insertEntry (pTree, pEntryData, pNodeId, pLayer, pObjectType, pRelatio
{
var
display
=
db
.
cell
(
ContextUtils
.
getNameSql
(
pObjectType
,
pEntryData
[
i
][
0
]));
// TODO: Icon
var
uid
=
[
pEntryData
[
i
][
0
],
i
,
pRelationTypeData
,
pObjectType
,
pNodeId
,
pEntryData
[
i
][
2
]]
var
uid
=
[
pEntryData
[
i
][
0
],
i
,
pRelationTypeData
,
pObjectType
,
pNodeId
,
pEntryData
[
i
][
2
],
pEntryData
[
i
][
1
]]
if
(
pNum
)
uid
.
push
(
pNum
);
uids
.
push
(
uid
);
pTree
.
push
([
JSON
.
stringify
(
uid
),
display
,
JSON
.
stringify
(
pNodeId
),
expanded
,
pEntryData
[
i
][
0
],
pObjectType
,
""
]);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment