Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4c07472e
authored
Feb 11, 2012
by
Tuukka Kivilahti, TKffTK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
something
1 parent
8ed3df2c
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
49 additions
and
14 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/NewsBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PermissionBean.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/News.java
code/LanBortalWeb/.metadata/WebContent/WEB-INF/faces-config.pageflow
code/LanBortalWeb/WebContent/WEB-INF/faces-config.xml
code/LanBortalWeb/WebContent/news/editNews.xhtml
code/LanBortalWeb/WebContent/news/listAll.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n.properties
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/content/NewsgroupView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/NewsBean.java
View file @
4c07472
...
@@ -9,6 +9,7 @@ import javax.ejb.EJB;
...
@@ -9,6 +9,7 @@ import javax.ejb.EJB;
import
javax.ejb.LocalBean
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
javax.ejb.Stateless
;
import
fi.insomnia.bortal.enums.apps.ContentPermission
;
import
fi.insomnia.bortal.facade.NewsFacade
;
import
fi.insomnia.bortal.facade.NewsFacade
;
import
fi.insomnia.bortal.facade.NewsGroupFacade
;
import
fi.insomnia.bortal.facade.NewsGroupFacade
;
import
fi.insomnia.bortal.model.News
;
import
fi.insomnia.bortal.model.News
;
...
@@ -19,7 +20,7 @@ import fi.insomnia.bortal.model.NewsGroup;
...
@@ -19,7 +20,7 @@ import fi.insomnia.bortal.model.NewsGroup;
*/
*/
@Stateless
@Stateless
@LocalBean
@LocalBean
@DeclareRoles
({
"NEWS/MANAGE"
})
@DeclareRoles
({
ContentPermission
.
S_MANAGE_NEWS
})
public
class
NewsBean
implements
NewsBeanLocal
{
public
class
NewsBean
implements
NewsBeanLocal
{
@EJB
@EJB
...
@@ -38,26 +39,26 @@ public class NewsBean implements NewsBeanLocal {
...
@@ -38,26 +39,26 @@ public class NewsBean implements NewsBeanLocal {
}
}
@Override
@Override
@RolesAllowed
(
"NEWS/MANAGE"
)
@RolesAllowed
(
ContentPermission
.
S_MANAGE_NEWS
)
public
List
<
NewsGroup
>
findAll
()
{
public
List
<
NewsGroup
>
findAll
()
{
return
ngfacade
.
findNews
();
return
ngfacade
.
findNews
();
}
}
@Override
@Override
@RolesAllowed
(
"NEWS/MANAGE"
)
@RolesAllowed
(
ContentPermission
.
S_MANAGE_NEWS
)
public
NewsGroup
findById
(
int
newsgroupid
)
{
public
NewsGroup
findById
(
int
newsgroupid
)
{
return
ngfacade
.
find
(
newsgroupid
);
return
ngfacade
.
find
(
newsgroupid
);
}
}
@Override
@Override
@RolesAllowed
(
"NEWS/MANAGE"
)
@RolesAllowed
(
ContentPermission
.
S_MANAGE_NEWS
)
public
NewsGroup
merge
(
NewsGroup
newsgroup
)
{
public
NewsGroup
merge
(
NewsGroup
newsgroup
)
{
return
ngfacade
.
merge
(
newsgroup
);
return
ngfacade
.
merge
(
newsgroup
);
}
}
@Override
@Override
@RolesAllowed
(
"NEWS/MANAGE"
)
@RolesAllowed
(
ContentPermission
.
S_MANAGE_NEWS
)
public
void
createNewsgroup
(
NewsGroup
newsgroup
)
{
public
void
createNewsgroup
(
NewsGroup
newsgroup
)
{
newsgroup
.
setEvent
(
eventbean
.
getCurrentEvent
());
newsgroup
.
setEvent
(
eventbean
.
getCurrentEvent
());
ngfacade
.
create
(
newsgroup
);
ngfacade
.
create
(
newsgroup
);
...
@@ -70,7 +71,7 @@ public class NewsBean implements NewsBeanLocal {
...
@@ -70,7 +71,7 @@ public class NewsBean implements NewsBeanLocal {
{
{
newsgroup
.
setNews
(
new
ArrayList
<
News
>());
newsgroup
.
setNews
(
new
ArrayList
<
News
>());
}
}
News
ret
=
new
News
(
newsgroup
);
News
ret
=
new
News
(
newsgroup
,
permbean
.
getCurrentUser
()
);
newsgroup
.
getNews
().
add
(
ret
);
newsgroup
.
getNews
().
add
(
ret
);
return
ret
;
return
ret
;
}
}
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PermissionBean.java
View file @
4c07472
...
@@ -61,7 +61,7 @@ import fi.insomnia.bortal.model.User;
...
@@ -61,7 +61,7 @@ import fi.insomnia.bortal.model.User;
SpecialPermission
.
S_SUPERADMIN
,
SpecialPermission
.
S_SUPERADMIN
,
SpecialPermission
.
S_USER
,
SpecialPermission
.
S_USER
,
SpecialPermission
.
S_ANONYMOUS
,
SpecialPermission
.
S_ANONYMOUS
})
})
public
class
PermissionBean
implements
PermissionBeanLocal
{
public
class
PermissionBean
implements
PermissionBeanLocal
{
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/News.java
View file @
4c07472
...
@@ -82,8 +82,9 @@ public class News extends GenericEntity {
...
@@ -82,8 +82,9 @@ public class News extends GenericEntity {
this
.
priority
=
priority
;
this
.
priority
=
priority
;
}
}
public
News
(
NewsGroup
newsgroup
)
{
public
News
(
NewsGroup
newsgroup
,
User
creator
)
{
super
();
super
();
this
.
creator
=
creator
;
group
=
newsgroup
;
group
=
newsgroup
;
}
}
...
...
code/LanBortalWeb/.metadata/WebContent/WEB-INF/faces-config.pageflow
View file @
4c07472
...
@@ -2,9 +2,14 @@
...
@@ -2,9 +2,14 @@
<pageflow:Pageflow
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:pageflow=
"http://www.sybase.com/suade/pageflow"
id=
"pf13012981621060"
configfile=
"/LanBortalWeb/WebContent/WEB-INF/faces-config.xml"
>
<pageflow:Pageflow
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:pageflow=
"http://www.sybase.com/suade/pageflow"
id=
"pf13012981621060"
configfile=
"/LanBortalWeb/WebContent/WEB-INF/faces-config.xml"
>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"*"
x=
"120"
y=
"60"
id=
"pf131682121330014"
referenceLink=
"//@navigationRule.0/@fromViewId|"
outlinks=
"pf131682121330015 pf13196506256640"
path=
"*"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"*"
x=
"120"
y=
"60"
id=
"pf131682121330014"
referenceLink=
"//@navigationRule.0/@fromViewId|"
outlinks=
"pf131682121330015 pf13196506256640"
path=
"*"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"auth/logoutResponse"
x=
"288"
y=
"60"
id=
"pf131682121330016"
referenceLink=
"//@navigationRule.0/@navigationCase.0/@toViewId|"
inlinks=
"pf131682121330015"
path=
"/auth/logoutResponse"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"auth/logoutResponse"
x=
"288"
y=
"60"
id=
"pf131682121330016"
referenceLink=
"//@navigationRule.0/@navigationCase.0/@toViewId|"
inlinks=
"pf131682121330015"
path=
"/auth/logoutResponse"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"place/placemap"
x=
"276"
y=
"228"
id=
"pf13168224196920"
referenceLink=
"//@navigationRule.1/@navigationCase.0/@toViewId|"
outlinks=
"pf13168224196921"
inlinks=
"pf13168224196921"
path=
"/place/placemap"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"place/placemap"
x=
"264"
y=
"204"
id=
"pf13168224196920"
referenceLink=
"//@navigationRule.2/@navigationCase.0/@toViewId|"
outlinks=
"pf13168224196921"
inlinks=
"pf13168224196921"
path=
"/place/placemap"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"user/sendPicture"
id=
"pf13196506256641"
referenceLink=
"//@navigationRule.0/@navigationCase.1/@toViewId|"
inlinks=
"pf13196506256640"
path=
"/user/sendPicture"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"user/sendPicture"
x=
"12"
y=
"192"
id=
"pf13196506256641"
referenceLink=
"//@navigationRule.0/@navigationCase.1/@toViewId|"
inlinks=
"pf13196506256640"
path=
"/user/sendPicture"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"news/edit"
x=
"248"
y=
"312"
id=
"pf13241645918110"
path=
"/news/edit.xhtml"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"news/listAll"
x=
"480"
y=
"269"
id=
"pf13241645918111"
path=
"/news/listAll.xhtml"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"news/editNews"
id=
"pf13241648116130"
referenceLink=
"//@navigationRule.1/@fromViewId|"
outlinks=
"pf13241648116141"
path=
"news/editNews"
/>
<nodes
xsi:type=
"pageflow:PFPage"
name=
"news/listAll"
id=
"pf13241648116142"
referenceLink=
"//@navigationRule.1/@navigationCase.0/@toViewId|"
inlinks=
"pf13241648116141"
path=
"news/listAll"
/>
<links
id=
"pf131682121330015"
target=
"pf131682121330016"
source=
"pf131682121330014"
outcome=
"logoutDone"
redirect=
"true"
/>
<links
id=
"pf131682121330015"
target=
"pf131682121330016"
source=
"pf131682121330014"
outcome=
"logoutDone"
redirect=
"true"
/>
<links
id=
"pf13168224196921"
target=
"pf13168224196920"
source=
"pf13168224196920"
outcome=
"placesReserved"
redirect=
"true"
/>
<links
id=
"pf13168224196921"
target=
"pf13168224196920"
source=
"pf13168224196920"
outcome=
"placesReserved"
redirect=
"true"
/>
<links
id=
"pf13196506256640"
target=
"pf13196506256641"
source=
"pf131682121330014"
outcome=
"redirToUserimage"
redirect=
"true"
/>
<links
id=
"pf13196506256640"
target=
"pf13196506256641"
source=
"pf131682121330014"
outcome=
"redirToUserimage"
redirect=
"true"
/>
<links
id=
"pf13241648116141"
target=
"pf13241648116142"
source=
"pf13241648116130"
outcome=
"news/listAll"
redirect=
"true"
/>
</pageflow:Pageflow>
</pageflow:Pageflow>
code/LanBortalWeb/WebContent/WEB-INF/faces-config.xml
View file @
4c07472
...
@@ -63,6 +63,16 @@
...
@@ -63,6 +63,16 @@
</navigation-rule>
</navigation-rule>
<navigation-rule>
<from-view-id>
news/editNews
</from-view-id>
<navigation-case>
<from-outcome>
news/listAll
</from-outcome>
<to-view-id>
news/listAll
</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
<!-- </navigation-rule> -->
<!-- </navigation-rule> -->
<!-- <navigation-rule> -->
<!-- <navigation-rule> -->
<!-- <from-view-id>/role/edit.xhtml</from-view-id> -->
<!-- <from-view-id>/role/edit.xhtml</from-view-id> -->
...
...
code/LanBortalWeb/WebContent/news/editNews.xhtml
View file @
4c07472
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:metadata>
<f:viewParam
name=
"newsid"
value=
"#{newsgroupView.newsid}"
/>
<f:viewParam
name=
"newsid"
value=
"#{newsgroupView.newsid}"
/>
<f:viewParam
name=
"newsgroupid"
value=
"#{newsgroupView.newsgroupid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{newsgroupView.initNews}"
/>
<f:event
type=
"preRenderView"
listener=
"#{newsgroupView.initNews}"
/>
</f:metadata>
</f:metadata>
<ui:param
name=
"thispage"
value=
"page.user.edit"
/>
<ui:param
name=
"thispage"
value=
"page.user.edit"
/>
...
@@ -18,7 +19,6 @@
...
@@ -18,7 +19,6 @@
<h:outputScript
target=
"head"
library=
"script"
name=
"jquery.min.js"
/>
<h:outputScript
target=
"head"
library=
"script"
name=
"jquery.min.js"
/>
<h:outputScript
target=
"head"
library=
"script"
name=
"textinputs_jquery.js"
/>
<h:outputScript
target=
"head"
library=
"script"
name=
"textinputs_jquery.js"
/>
<h:button
onclick=
"var sel = $('#newsform:editor').getSelection(); alert(sel.start +', ' + sel.end);"
value=
"Click me"
/>
<h:form
id=
"newsform"
>
<h:form
id=
"newsform"
>
...
...
code/LanBortalWeb/WebContent/news/listAll.xhtml
View file @
4c07472
...
@@ -41,10 +41,17 @@
...
@@ -41,10 +41,17 @@
<h:outputText
value=
"#{newsgroup.writerRole.name}"
/>
<h:outputText
value=
"#{newsgroup.writerRole.name}"
/>
</h:column>
</h:column>
<h:column>
<h:column>
<h:link
outcome=
"/news/edit"
value=
"#{i18n['newsgroup.edit']}"
>
<h:link
outcome=
"/news/edit"
value=
"#{i18n['newsgroup.edit']}"
>
<f:param
name=
"newsgroupid"
value=
"#{newsgroup.id}"
/>
<f:param
name=
"newsgroupid"
value=
"#{newsgroup.id}"
/>
</h:link>
</h:link>
</h:column>
</h:column>
<h:column>
<h:link
outcome=
"/news/editNews"
value=
"#{i18n['newsgroup.create_news']}"
>
<f:param
name=
"newsgroupid"
value=
"#{newsgroup.id}"
/>
</h:link>
</h:column>
</h:dataTable>
</h:dataTable>
</ui:define>
</ui:define>
</ui:composition>
</ui:composition>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n.properties
View file @
4c07472
...
@@ -99,5 +99,7 @@ page.poll.answer.pagegroup=poll
...
@@ -99,5 +99,7 @@ page.poll.answer.pagegroup=poll
page.poll.answered.pagegroup
=
poll
page.poll.answered.pagegroup
=
poll
poll.edit
=
edit
#Bill number
#Bill number
# Validationmessages
# Validationmessages
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/content/NewsgroupView.java
View file @
4c07472
...
@@ -4,6 +4,8 @@ import javax.ejb.EJB;
...
@@ -4,6 +4,8 @@ import javax.ejb.EJB;
import
javax.enterprise.context.ConversationScoped
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.inject.Named
;
import
javax.inject.Named
;
import
com.sun.imageio.plugins.common.I18N
;
import
fi.insomnia.bortal.beans.NewsBeanLocal
;
import
fi.insomnia.bortal.beans.NewsBeanLocal
;
import
fi.insomnia.bortal.enums.apps.ContentPermission
;
import
fi.insomnia.bortal.enums.apps.ContentPermission
;
import
fi.insomnia.bortal.model.News
;
import
fi.insomnia.bortal.model.News
;
...
@@ -38,7 +40,13 @@ public class NewsgroupView extends GenericCDIView {
...
@@ -38,7 +40,13 @@ public class NewsgroupView extends GenericCDIView {
public
void
initNews
()
{
public
void
initNews
()
{
if
(
super
.
requirePermissions
(
permbean
.
hasPermission
(
ContentPermission
.
MANAGE_NEWS
))
&&
getNews
()
==
null
)
{
if
(
super
.
requirePermissions
(
permbean
.
hasPermission
(
ContentPermission
.
MANAGE_NEWS
))
&&
getNews
()
==
null
)
{
super
.
beginConversation
();
super
.
beginConversation
();
news
=
newsbean
.
findNews
(
newsid
);
if
(
newsid
==
null
)
{
newsgroup
=
newsbean
.
findById
(
newsgroupid
);
createNews
();
}
else
news
=
newsbean
.
findNews
(
newsid
);
}
}
}
}
...
@@ -53,7 +61,7 @@ public class NewsgroupView extends GenericCDIView {
...
@@ -53,7 +61,7 @@ public class NewsgroupView extends GenericCDIView {
public
String
createNew
()
{
public
String
createNew
()
{
this
.
addFaceMessage
(
"newsgroup.created"
);
this
.
addFaceMessage
(
"newsgroup.created"
);
newsbean
.
createNewsgroup
(
newsgroup
);
newsbean
.
createNewsgroup
(
newsgroup
);
return
"/news/edit
.xhtml
"
;
return
"/news/edit"
;
}
}
public
String
saveNewsgroup
()
{
public
String
saveNewsgroup
()
{
...
@@ -70,8 +78,9 @@ public class NewsgroupView extends GenericCDIView {
...
@@ -70,8 +78,9 @@ public class NewsgroupView extends GenericCDIView {
public
String
saveNews
()
public
String
saveNews
()
{
{
newsbean
.
saveNews
(
getNews
(
));
setNews
(
newsbean
.
saveNews
(
getNews
()
));
newsgroup
=
getNews
().
getGroup
();
newsgroup
=
getNews
().
getGroup
();
super
.
addFaceMessage
(
"news_save_success"
);
return
null
;
return
null
;
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment