How do I accomplish this on JSF? - jsf

So I'm trying to find the best approach to solve the following problem.
I have the following pages:
1.insert.xhtml(Where I have a form to register a client)
2.find.xhtml(Where I have a table for the registered clients, where I can edit and exclude them)
In the find.xhtml page I have a context menu with the edit option, if I click on it, it'll open a <p:dialog> with the same insert.xhtml registration form, except for the submit button that have a different name and action-listener.
I also have other registrations that needs a client reference on it, ex.: registering a car sell to a registered client. The way I select an already registered client to add it to the sell form is by calling a popup with the same code in the find.xhtml table and select a client there, except this table have a button on its footer called select.
So what I'm asking is a way to reuse those forms/table codes being able to add a few components on them as needed. Is there a way to do it?
EDIT: Just like a template
EDIT2: Nevermind, I just solved it by using <ui:decorate>.

I am not sure if <ui:decorate> is the best solution. I have seen many examples of templating where it is used a composition. I like a lot this tutorial from IBM:
http://www.ibm.com/developerworks/java/library/j-jsf2fu2/index.html
they explain in detail how to create a template.

Related

Add a comments section to post/pages on apostrophe cms

I need to build a comments section on my apostrophe for users to be able and leave comments/feedback around content that someone will create in pages. That would require to create collections in the database as well as allow users to comment only but not to remove any the module/widget. Also, comments need to, of course, be linked to pages.
Not really sure, how I can approach this task. Whether, to build a separate microservice or a widget to handle this. I have read the tutorial for building a contact form in apostrophe, also tested. However, I don't really need to have an option on the Admin Bar as comments are linked to each page, I need the form to be static (don't want any users to remove them or add more than one on a single page), also want the comments to appear below the form once they have been submitted.
Any idea of how I can do this?
Thank you for your time.
Dcram
EDIT
Well, before I needed to do this for pages and I even managed to post the comments specific for each page where it should be. However, needed to make a few changes on my site and now this comment widget appears in pieces like blogposts! However, haven't being able to display the specific comments for each piece. Is there any way I can find the piece page url similar to data.page._url so that I can compare with the one attached to each comment?
Thanks!
We almost always use Disqus for this purpose, but if you need a commenting functionality that is internal to your site, there is the apostrophe-pieces-submit-widgets module that can be extended for this purpose.
You would definitely want the comments to be an instance of an apostrophe-piece in the docs collection, which would mean it would by default be included as an item in the admin bar. Easy enough to hide that, however.
Following this pattern would result in creating / configuring 3 project-level modules:
comments - extends apostrophe-pieces, defines the comment piece type
comments-widgets - extends apostrophe-pieces-widgets, a widget to display comments on a template (you could also hard code this behavior into a template instead of making it a widget)
comments-submit-widgets - extends apostrophe-pieces-submit-widgets, a widget to display the front-end form that users use to submit their comments
Building this sort of functionality directly into a piece and its widget player is not too difficult, check out this project for more
https://github.com/stuartromanek/apostrophe-comment-system
Steps:
Checkout project / install / create user / get up and running
Create a Comment piece from the admin bad (Home Page Comments, for example)
Add the new piece to singleton widget on the homepage
Comment!
This code should give you a pretty clear guide for creating backend functionality that can be interacted with on the frontend.
Permissions for interacting with the widget itself should be managed through apostrophe-permissions http://apostrophecms.org/docs/tutorials/intermediate/permissions.html

SharePoint 2013 KnockoutJS Lookup columns

I have a basic knockoutjs project loading data from a SharePoint 2013 list scenario. Getting data and displaying data is easy, the problem that I'm running into is on the edit mode displaying the proper control. Everything should not be a textbox. This means the people picker control to dropdownmenus to calendar controls.
MSFT has some pretty good documentation on using the client side people picker control here"http://msdn.microsoft.com/en-us/library/office/jj713593.aspx
The problem that I have is calling this control inside my viewmodel.
Setting the value of the control doesn't look difficult courtesy of this blog post: http://www.sharepointcolumn.com/sp2013-setting-people-picker-value-in-newform-aspx/
I attempted to looking into computed values, but that doesn't seem to work. Does anyone have a blog post that I skipped over? The closest related post that I can find: http://yetanothersharepointblog.wordpress.com/2012/12/11/working-with-sharepoint-lookup-columns-in-knockout-js/
Lastly since it seems that I'm the only one doing this, does anyone think that I should not be reinventing the wheel with my forms and should just link each item to the appropriate SharePoint list item in edit or display view? I suppose that would be easier.
From a SharePoint Professional to another, I would highly recommend you to do that.
Just redirect the user to the item edit/display item page an let SharePoint take the leash of how to handle UI form elements.
Because, assume that you implement your custom form, what if the user decides to add one more site column to the list? Will you update your code to support another field?
From my personal experience with the beast I've come to the conclusion that structural implementation over already existent functionality tends to go wrong.
Also, if you have some kind of listing of items custom made and you want to provide editing, try to do something opening a pretty SP.UI.ModalDialog, its elegant and you use the sharepoint to do the work for you.
But it's just an advise.

Editable TableView with Core Data

I'm working on my first app at the moment and I'm very, very confused at the moment. I bet this is too much to ask for (and too specific), but I'm trying to make an app with folders, and when the user taps on an edit button, a separate view would come up that would contain a tableview that would already have editing enabled. (The view is a UITableViewController to let the user manage their folders)
Also the user would be able to both add, delete, and rearrange his/her folders without tapping another button. When the add button is pressed a new view would come up in which the user types in the name of the new folder. For now I don't care if the folders display in another part of the app or that that they can hold things, just about what I said above.
To make this already confusing request even MORE confusing, I want everything to be saved with Core Data. You can probably see why I'm confused...
NOTE: I have already worked out how to add items (and save them), just not with custom names giving by user.
I know this is a lot, but can someone help? Any sort of help or links to tutorials is appreciated.
You will have to make everything custom. I dont know of any example or tutorials that demonstrate how to create "folders".
You can always programmatically create folders in the Documents directory of your app, and show them virtually in a UITableView. And if the user creates a "file", store that file in the respective folder. I am not sure how you would implement CoreData into that method though.
Apple has quite a few examples on how to use UITableView as well as CoreData. You can try source code sites like Github or BitBucket.

Multiple Sharepoint Forms

I am trying to split out what I originally wanted in a single form. The downside was that I wanted to keep multiple lists and I found that I could not use a single form with multiple lists.
What I am trying to do is to keep my customer information in a separate list/form so I can re-use it in a different application as well.
What I would like to do is give a picker to pick the customer from a list, and if the customer is not listed to allow the creation of a new one.
What I am wondering is how I can leave the main form, create the new customer, and then return to the main form but with the new customer information passed to the new form as selected. In ASP.NET one of the ways I would do this is through the querystring, but I am not sure if that is doable or preferred in Sharepoint.
Any thoughts or links to tutorials would be great.
Please keep in mind that due to access/security limitations I am trying to do this strictly through the browser and Sharepoint Designer.
Thanks!
With your access limitations, I don't see a solution that will allow the refresh of the original form to get the new data. You may be able to hack in some JQuery stuff to do this, but I just don't see it being an easy/value-for-time thing to do.
You may just have to allow the form user to save the form without customer info and come back to it.
A list view can then highlight forms with no customer info. This all depends on the usage scenario.
You can use the Source query string parameter to get you back to the original form after completing the new customer form. However, unless you add some code (either javascript or server side) you won't get the id of the new customer.
The best option is probably using jquery and the sharepoint web services. It's quite easy if you start with the right scripts, and you can do something like your original plan - make a simple form in a jquery ui popup.
You can also use javascript to manage linking between multiple forms, but you need to be careful about clearing out already entered form data.
Another option would be to edit dispform.aspx and add dataviews for other lists, along with appropriate add buttons, and add javascript to the new customer form that sets the value of a connecting lookup field. However, that tends to require quite a bit of messing about with list guids and other undocumented bits.

Change template html in sharepoint discussion reply box

I have a wss 3.0 install which needs an "anonymous" discussion board. I can modify the view so no usernames are displayed, however when I click on "reply", the message I'm replying to shows up in the rich text box with the username of the previous poster.
Is there a way to remove that username? or Remove the previous posted text altogether? I've found the schema.xml file with lots of relevant info under the ..12\TEMPLATE\FEATURES\DiscussionsList\Discuss folder, but not sure if this is the easiest way to adjust this setting.
Any comments appreciated.
Best practice says that you should always create a custom list definition instead of trying to modify the OOB assets.
The easiest way to do this is take a copy of the 12\TEMPLATE\FEATURES\DiscussionsList\Discuss folder, modify the feature Ids and names so that its unique. Then your free to change the schema render template (i.e view schema) and modify the edit and display forms.
If you need to modfify the actual entry form you may consider a custom control template : http://msdn.microsoft.com/en-us/library/aa543922.aspx
Custom list definition : http://msdn.microsoft.com/en-us/library/ms466023.aspx
Agrothe,
I have a similar requirement (hide or mask the author inside the reply thread.). What exactly inside of schema.xml do you think will allow you to do accomplish that?
Not sure if the list forms are exposed to xslt. If so, then perhaps this is another approach.
FWIW, the other solutions I have investigated:
(1) A custom event handler. Unfortunately, I can't pinpoint which event fires when someone click reply.
(2) Anonymous blog comments (http://blogs.msdn.com/sharepoint/archive/2007/08/06/anonymous-comment-feature-for-sharepoint-blog-now-available-on-codeplex.aspx).
(3) the other thing I am considering, is to introduce a global anonymous active directory login, which users can use to post anonymously. Not ideal, but for the amount of time I have spent researching a solution, might be my last hope.

Resources