Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
erp5
Commits
7573a676
Commit
7573a676
authored
Apr 24, 2019
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_only_office] olap_wizard.js: filter used hierarchies instead used dimensions
parent
dc1f33e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
173 additions
and
49 deletions
+173
-49
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice.gadget.js.js
...tem/portal_skins/erp5_only_office/onlyoffice.gadget.js.js
+12
-0
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/olap_wizard.js.js
...ortal_skins/erp5_only_office/onlyoffice/olap_wizard.js.js
+81
-49
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/xmla_client.js.js
...ortal_skins/erp5_only_office/onlyoffice/xmla_client.js.js
+80
-0
No files found.
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice.gadget.js.js
View file @
7573a676
...
@@ -434,6 +434,18 @@ DocsAPI.DocEditor.version = function () {
...
@@ -434,6 +434,18 @@ DocsAPI.DocEditor.version = function () {
console
.
error
(
err
);
console
.
error
(
err
);
});
});
})
})
.
allowPublicAcquisition
(
"
xmla_getDimension
"
,
function
(
arr
)
{
return
this
.
getDeclaredGadget
(
"
xmla_client
"
)
.
push
(
function
(
g
)
{
return
g
.
getDimension
(
arr
[
0
],
arr
[
1
]);
});
})
.
allowPublicAcquisition
(
"
xmla_getHierarchies
"
,
function
(
arr
)
{
return
this
.
getDeclaredGadget
(
"
xmla_client
"
)
.
push
(
function
(
g
)
{
return
g
.
getHierarchies
(
arr
[
0
],
arr
[
1
]);
});
})
// methods emulating Gateway used for connection with ooffice begin.
// methods emulating Gateway used for connection with ooffice begin.
.
declareMethod
(
'
appReady
'
,
function
()
{
.
declareMethod
(
'
appReady
'
,
function
()
{
...
...
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/olap_wizard.js.js
View file @
7573a676
...
@@ -4,19 +4,19 @@
...
@@ -4,19 +4,19 @@
(
function
(
window
,
rJS
)
{
(
function
(
window
,
rJS
)
{
"
use strict
"
;
"
use strict
"
;
function
get_used_
dimension
s
(
g
)
{
function
get_used_
hierarchie
s
(
g
)
{
return
g
.
getContent
()
return
g
.
getContent
()
.
push
(
function
(
v
)
{
.
push
(
function
(
v
)
{
var
dimension
s
=
[],
var
hierarchie
s
=
[],
key
,
key
,
dimension
;
hierarchy
;
if
(
v
)
{
if
(
v
)
{
if
(
v
.
columns
)
{
if
(
v
.
columns
)
{
for
(
key
in
v
.
columns
)
{
for
(
key
in
v
.
columns
)
{
if
(
v
.
columns
.
hasOwnProperty
(
key
))
{
if
(
v
.
columns
.
hasOwnProperty
(
key
))
{
dimension
=
v
.
columns
[
key
].
dimension
;
hierarchy
=
v
.
columns
[
key
].
hierarchy
;
if
(
dimension
)
{
if
(
hierarchy
)
{
dimensions
.
push
(
dimension
);
hierarchies
.
push
(
hierarchy
);
}
}
}
}
}
}
...
@@ -24,19 +24,45 @@
...
@@ -24,19 +24,45 @@
if
(
v
.
rows
)
{
if
(
v
.
rows
)
{
for
(
key
in
v
.
rows
)
{
for
(
key
in
v
.
rows
)
{
if
(
v
.
rows
.
hasOwnProperty
(
key
))
{
if
(
v
.
rows
.
hasOwnProperty
(
key
))
{
dimension
=
v
.
rows
[
key
].
dimension
;
hierarchy
=
v
.
rows
[
key
].
hierarchy
;
if
(
dimension
)
{
if
(
hierarchy
)
{
dimensions
.
push
(
dimension
);
hierarchies
.
push
(
hierarchy
);
}
}
}
}
}
}
}
}
}
}
return
dimension
s
;
return
hierarchie
s
;
});
});
}
}
function
discoverDimensions
(
g
,
connection_name
,
used_dimensions
)
{
function
discoverDimensions
(
g
,
connection_name
,
used_hierarchies
)
{
return
g
.
request
(
"
discoverMDDimensions
"
,
connection_name
)
return
g
.
getHierarchies
(
connection_name
)
.
push
(
undefined
,
function
(
error
)
{
console
.
log
(
error
);
})
.
push
(
function
(
response
)
{
var
dimensions
=
{},
i
,
row
,
uname
,
tasks
=
[];
for
(
i
=
0
;
i
<
response
.
length
;
i
+=
1
)
{
row
=
response
[
i
];
uname
=
row
.
DIMENSION_UNIQUE_NAME
;
if
(
!
dimensions
.
hasOwnProperty
(
uname
)
&&
used_hierarchies
.
indexOf
(
row
.
HIERARCHY_UNIQUE_NAME
)
<
0
&&
row
.
DIMENSION_TYPE
!==
2
// !measure
)
{
dimensions
[
uname
]
=
true
;
}
}
for
(
i
in
dimensions
)
{
if
(
dimensions
.
hasOwnProperty
(
i
))
{
tasks
.
push
(
g
.
getDimension
(
connection_name
,
i
))
}
}
return
RSVP
.
all
(
tasks
);
})
.
push
(
undefined
,
function
(
error
)
{
.
push
(
undefined
,
function
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
})
})
...
@@ -46,19 +72,16 @@
...
@@ -46,19 +72,16 @@
row
;
row
;
for
(
i
=
0
;
i
<
response
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
response
.
length
;
i
+=
1
)
{
row
=
response
[
i
];
row
=
response
[
i
];
if
(
row
[
"
DIMENSION_TYPE
"
]
!==
2
&&
arr
.
push
({
used_dimensions
.
indexOf
(
row
[
"
DIMENSION_UNIQUE_NAME
"
])
<
0
)
{
const
:
row
.
DIMENSION_UNIQUE_NAME
||
undefined
,
arr
.
push
({
title
:
row
.
DIMENSION_NAME
||
undefined
const
:
row
[
"
DIMENSION_UNIQUE_NAME
"
]
||
undefined
,
});
title
:
row
[
"
DIMENSION_NAME
"
]
||
undefined
});
}
}
}
return
arr
;
return
arr
;
});
});
}
}
function
discoverHierarchies
(
g
,
connection_name
,
opt
)
{
function
discoverHierarchies
(
g
,
connection_name
,
used_hierarchies
,
opt
)
{
return
g
.
request
(
"
discoverMDHierarchies
"
,
connection_name
,
opt
)
return
g
.
request
(
"
discoverMDHierarchies
"
,
connection_name
,
opt
)
.
push
(
undefined
,
function
(
error
)
{
.
push
(
undefined
,
function
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
...
@@ -66,13 +89,17 @@
...
@@ -66,13 +89,17 @@
.
push
(
function
(
response
)
{
.
push
(
function
(
response
)
{
var
arr
=
[],
var
arr
=
[],
i
,
i
,
row
;
row
,
uname
;
for
(
i
=
0
;
i
<
response
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
response
.
length
;
i
+=
1
)
{
row
=
response
[
i
];
row
=
response
[
i
];
arr
.
push
({
uname
=
row
.
HIERARCHY_UNIQUE_NAME
;
const
:
row
[
"
HIERARCHY_UNIQUE_NAME
"
]
||
undefined
,
if
(
used_hierarchies
.
indexOf
(
uname
)
<
0
)
{
title
:
row
[
"
HIERARCHY_NAME
"
]
||
undefined
arr
.
push
({
});
const
:
uname
||
undefined
,
title
:
row
.
HIERARCHY_NAME
||
undefined
});
}
}
}
return
arr
;
return
arr
;
});
});
...
@@ -103,13 +130,13 @@
...
@@ -103,13 +130,13 @@
});
});
}
}
function
generateChoiceSchema
(
g
,
connection_name
,
used_
dimension
s
,
choice_settings
)
{
function
generateChoiceSchema
(
g
,
connection_name
,
used_
hierarchie
s
,
choice_settings
)
{
var
schema
=
{
var
schema
=
{
"
type
"
:
"
object
"
,
"
type
"
:
"
object
"
,
"
additionalProperties
"
:
false
,
"
additionalProperties
"
:
false
,
"
properties
"
:
{}
"
properties
"
:
{}
},
},
current_
dimension
;
current_
hierarchy
;
if
(
!
connection_name
)
{
if
(
!
connection_name
)
{
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
...
@@ -119,25 +146,28 @@
...
@@ -119,25 +146,28 @@
if
(
!
choice_settings
)
{
if
(
!
choice_settings
)
{
choice_settings
=
{};
choice_settings
=
{};
}
}
current_dimension
=
choice_settings
.
dimension
;
if
(
current_dimension
)
{
current_hierarchy
=
choice_settings
.
hierarchy
;
used_dimensions
=
used_dimensions
if
(
current_hierarchy
)
{
.
filter
(
function
(
d
)
{
used_hierarchies
=
used_hierarchies
return
d
!==
current_dimension
;
.
filter
(
function
(
h
)
{
return
h
!==
current_hierarchy
;
});
});
}
}
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
var
tasks
=
[
discoverDimensions
(
g
,
connection_name
,
used_
dimension
s
)];
var
tasks
=
[
discoverDimensions
(
g
,
connection_name
,
used_
hierarchie
s
)];
if
(
choice_settings
.
dimension
)
{
if
(
choice_settings
.
dimension
)
{
tasks
.
push
(
tasks
.
push
(
discoverHierarchies
(
g
,
connection_name
,{
prop
:
{
discoverHierarchies
(
g
,
connection_name
,
restrictions
:
{
used_hierarchies
,
DIMENSION_UNIQUE_NAME
:
choice_settings
.
dimension
{
prop
:
{
}
restrictions
:
{
}})
DIMENSION_UNIQUE_NAME
:
choice_settings
.
dimension
}
}})
);
);
}
}
if
(
choice_settings
.
hierarchy
)
{
if
(
choice_settings
.
hierarchy
)
{
...
@@ -187,6 +217,8 @@
...
@@ -187,6 +217,8 @@
})
})
.
declareAcquiredMethod
(
"
getRemoteSettings
"
,
"
getRemoteSettings
"
)
.
declareAcquiredMethod
(
"
getRemoteSettings
"
,
"
getRemoteSettings
"
)
.
declareAcquiredMethod
(
"
request
"
,
"
xmla_request
"
)
.
declareAcquiredMethod
(
"
request
"
,
"
xmla_request
"
)
.
declareAcquiredMethod
(
"
getDimension
"
,
"
xmla_getDimension
"
)
.
declareAcquiredMethod
(
"
getHierarchies
"
,
"
xmla_getHierarchies
"
)
.
declareAcquiredMethod
(
"
getLevels
"
,
"
xmla_getLevels
"
)
.
declareAcquiredMethod
(
"
getLevels
"
,
"
xmla_getLevels
"
)
.
allowPublicAcquisition
(
"
notifyValid
"
,
function
(
arr
,
scope
)
{
.
allowPublicAcquisition
(
"
notifyValid
"
,
function
(
arr
,
scope
)
{
})
})
...
@@ -222,7 +254,7 @@
...
@@ -222,7 +254,7 @@
scope
=
arr
[
0
].
scope
,
scope
=
arr
[
0
].
scope
,
relPath
=
arr
[
0
].
rel_path
,
relPath
=
arr
[
0
].
rel_path
,
action
=
arr
[
0
].
action
,
action
=
arr
[
0
].
action
,
used_
diemensions
,
used_
hierarchy
,
url
=
arr
[
0
].
ref
,
url
=
arr
[
0
].
ref
,
allRerender
,
allRerender
,
y
;
y
;
...
@@ -230,10 +262,10 @@
...
@@ -230,10 +262,10 @@
function
rerender
(
sub_scope
)
{
function
rerender
(
sub_scope
)
{
var
queue
,
var
queue
,
gadget_settings
;
gadget_settings
;
if
(
!
used_
diemensions
)
{
if
(
!
used_
hierarchy
)
{
queue
=
get_used_
dimension
s
(
g
)
queue
=
get_used_
hierarchie
s
(
g
)
.
push
(
function
(
v
)
{
.
push
(
function
(
v
)
{
used_
diemensions
=
v
;
used_
hierarchy
=
v
;
});
});
}
else
{
}
else
{
queue
=
RSVP
.
Queue
();
queue
=
RSVP
.
Queue
();
...
@@ -242,7 +274,7 @@
...
@@ -242,7 +274,7 @@
function
rerender_once
(
connection_name
,
sub_gadget
)
{
function
rerender_once
(
connection_name
,
sub_gadget
)
{
return
sub_gadget
.
getContent
()
return
sub_gadget
.
getContent
()
.
push
(
function
(
content
)
{
.
push
(
function
(
content
)
{
return
generateChoiceSchema
(
g
,
connection_name
,
used_
diemensions
,
content
);
return
generateChoiceSchema
(
g
,
connection_name
,
used_
hierarchy
,
content
);
})
})
.
push
(
function
(
schema
)
{
.
push
(
function
(
schema
)
{
return
gadget_settings
.
rerender
({
return
gadget_settings
.
rerender
({
...
@@ -270,7 +302,7 @@
...
@@ -270,7 +302,7 @@
return
rerender_once
(
connection_name
,
sub_gadget
)
return
rerender_once
(
connection_name
,
sub_gadget
)
.
push
(
function
(
changed
)
{
.
push
(
function
(
changed
)
{
if
(
changed
&&
changed
.
length
>
0
)
{
if
(
changed
&&
changed
.
length
>
0
)
{
if
(
changed
.
indexOf
(
'
/
dimension
'
)
>=
0
)
{
if
(
changed
.
indexOf
(
'
/
hierarchy
'
)
>=
0
)
{
return
allRerender
();
return
allRerender
();
}
}
return
rerender_once
(
connection_name
,
sub_gadget
);
return
rerender_once
(
connection_name
,
sub_gadget
);
...
@@ -285,9 +317,9 @@
...
@@ -285,9 +317,9 @@
}
}
allRerender
=
function
()
{
allRerender
=
function
()
{
return
get_used_
dimension
s
(
g
)
return
get_used_
hierarchie
s
(
g
)
.
push
(
function
(
v
)
{
.
push
(
function
(
v
)
{
used_
diemensions
=
v
;
used_
hierarchy
=
v
;
return
RSVP
.
all
(
g
.
props
.
choices
.
map
(
function
(
q
)
{
return
RSVP
.
all
(
g
.
props
.
choices
.
map
(
function
(
q
)
{
return
rerender
(
q
);
return
rerender
(
q
);
}));
}));
...
@@ -314,7 +346,7 @@
...
@@ -314,7 +346,7 @@
g
.
props
.
choices
.
splice
(
y
,
1
);
g
.
props
.
choices
.
splice
(
y
,
1
);
return
allRerender
();
return
allRerender
();
}
}
if
(
relPath
===
"
/
dimension
"
)
{
if
(
relPath
===
"
/
hierarchy
"
)
{
return
allRerender
();
return
allRerender
();
}
}
return
rerender
(
s
)
return
rerender
(
s
)
...
@@ -353,8 +385,8 @@
...
@@ -353,8 +385,8 @@
.
push
(
function
()
{
.
push
(
function
()
{
return
RSVP
.
all
([
return
RSVP
.
all
([
g
.
getContent
(
"
/connection_name
"
),
g
.
getContent
(
"
/connection_name
"
),
g
.
getContent
(
path
),
g
et_used_hierarchies
(
g
),
g
et_used_dimensions
(
g
)
g
.
getContent
(
path
)
]);
]);
})
})
.
push
(
function
(
arr
)
{
.
push
(
function
(
arr
)
{
...
...
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/xmla_client.js.js
View file @
7573a676
...
@@ -16,6 +16,22 @@
...
@@ -16,6 +16,22 @@
return
cache
[
key
];
return
cache
[
key
];
}
}
function
cached_queue
(
cache
,
key
,
func
)
{
if
(
cache
.
hasOwnProperty
(
key
))
{
return
getFromCache
(
cache
,
key
);
}
var
queue
=
func
()
.
push
(
undefined
,
function
(
err
)
{
delete
cache
[
key
];
console
.
error
(
err
);
})
.
push
(
function
(
value
)
{
cache
[
key
]
=
value
;
});
cache
[
key
]
=
queue
;
return
queue
;
}
function
xmla_request
(
func
,
prop
)
{
function
xmla_request
(
func
,
prop
)
{
var
xmla
=
new
Xmla
({
async
:
true
});
var
xmla
=
new
Xmla
({
async
:
true
});
prop
=
JSON
.
parse
(
JSON
.
stringify
(
prop
));
prop
=
JSON
.
parse
(
JSON
.
stringify
(
prop
));
...
@@ -141,6 +157,7 @@
...
@@ -141,6 +157,7 @@
console
.
log
(
"
xmla_client
"
);
console
.
log
(
"
xmla_client
"
);
g
.
props
=
{
g
.
props
=
{
cache
:
{},
cache
:
{},
cache_flags
:
{},
connections
:
{}
connections
:
{}
};
};
})
})
...
@@ -179,10 +196,13 @@
...
@@ -179,10 +196,13 @@
delete
g
.
props
.
connections
[
key
];
delete
g
.
props
.
connections
[
key
];
if
(
m_dict
[
key
]
!==
null
)
{
if
(
m_dict
[
key
]
!==
null
)
{
g
.
props
.
cache
[
key
]
=
{
g
.
props
.
cache
[
key
]
=
{
dimensions
:
{},
hierarchies
:
{},
members
:
{},
members
:
{},
levels
:
{},
levels
:
{},
membersOnLevel
:
{}
membersOnLevel
:
{}
};
};
g
.
props
.
cache_flags
[
key
]
=
{};
g
.
props
.
connections
[
key
]
=
JSON
.
parse
(
m_dict
[
key
]);
g
.
props
.
connections
[
key
]
=
JSON
.
parse
(
m_dict
[
key
]);
}
}
}
}
...
@@ -202,6 +222,66 @@
...
@@ -202,6 +222,66 @@
console
.
error
(
error
);
console
.
error
(
error
);
});
});
})
})
.
declareMethod
(
"
getDimension
"
,
function
(
connection_name
,
uname
)
{
var
g
=
this
;
return
cached_queue
(
g
.
props
.
cache
[
connection_name
].
dimensions
,
uname
,
function
()
{
return
request
(
g
,
"
discoverMDDimensions
"
,
{
prop
:
{
restrictions
:
{
DIMENSION_UNIQUE_NAME
:
uname
}
}
},
connection_name
)
.
push
(
function
(
r
)
{
if
(
r
.
rowCount
()
===
0
)
{
throw
new
Error
(
"
dimension
"
+
uname
+
"
not found
"
);
}
return
r
.
readAsObject
();
});
});
})
.
declareMethod
(
"
getHierarchies
"
,
function
(
connection_name
,
restrictions
)
{
var
g
=
this
,
arr
,
cache
=
g
.
props
.
cache
[
connection_name
].
hierarchies
,
key
;
if
(
!
restrictions
&&
g
.
props
.
cache_flags
[
connection_name
].
all_hierarchies
)
{
arr
=
[];
for
(
key
in
cache
)
{
if
(
cache
.
hasOwnProperty
(
key
))
{
arr
.
push
(
cache
[
key
]);
}
}
return
arr
;
}
return
request
(
g
,
"
discoverMDHierarchies
"
,
{
prop
:
{
restrictions
:
restrictions
}
},
connection_name
)
.
push
(
function
(
response
)
{
var
row
,
ret
=
[],
uname
;
if
(
response
&&
response
.
numRows
>
0
)
{
while
(
response
.
hasMoreRows
())
{
row
=
response
.
readAsObject
();
uname
=
row
.
HIERARCHY_UNIQUE_NAME
;
if
(
!
cache
.
hasOwnProperty
(
uname
))
{
cache
[
uname
]
=
row
;
}
ret
.
push
(
row
);
response
.
nextRow
();
}
}
if
(
!
restrictions
)
{
g
.
props
.
cache_flags
[
connection_name
].
all_hierarchies
=
true
;
}
return
ret
;
});
})
.
declareMethod
(
"
getLevel
"
,
function
(
connection_name
,
level_uname
)
{
.
declareMethod
(
"
getLevel
"
,
function
(
connection_name
,
level_uname
)
{
var
g
=
this
,
var
g
=
this
,
cache
=
g
.
props
.
cache
[
connection_name
],
cache
=
g
.
props
.
cache
[
connection_name
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment