I am working on a spring MVC with hibernate project. Below is the database schema for the project. This project is basically about making 'notes' which are divided in various sections and saving them. Also the user can have various 'canvases', thus the column 'canvas number'.
The problem I am facing is, there is public homepage, which is built using HTML, java-script and is used before login. Any user can add,edit,delete on public homepage, but cannot save it in database or the canvas. He/She is redirected to login/registration page. But we want to save all the notes in some sort of buffer so it can be saved directly in database once user logsin/registers completely. Any idea what I can use for the buffer mechanism??
Related
I am trying to restrict access to Moodle course activities based on a user profile field. The profile field tracks eligibility based on other criteria such as whether they have filled in certain important information about their business.
The field is required, locked and set to a default value, although setting it to unlocked made no difference. It is hidden from view in the user profile and signup screen using CSS (because Moodle user profile fields that aren't displayed in the sign up screen don't get a mdl_user_info_data row created when the user is created - but that's another issue). The relevant row in mdl_user_info_data is updated when the user submits a form that I've created. This part works absolutely fine, except that the user still needs to log out and back in again in order for the change to trickle down to the course page (i.e. for them to be able to access the course activities).
It appears that the user profile fields are being cached when the user logs in, and are not being updated. Does anyone know if this is so? And the obvious follow up questions would be - Can I force this cache to be updated and, if I can, how would I go about triggering this?
I'm using Moodle 2.7.3.
The data is cached in the $USER global object (which is, itself, cached on the session data), in the $USER->profile field. You should be able to update the value there or call a function to reload it (I can't remember the function off the top of my head, but it will be in user/profile/lib.php).
I am new to programming, especially to MVC. I have designed a blog in MVC 3 ASP.NET for a client. The blog also have user account for admin for content management.
Once logged in, Admin can create new post. Sometimes the post can be long text. Therefore, I want to create a session to temporarily save the content within the text box as the user types it in automatically. Once the user click the submit button, the sessions ends and the text will be permanently saved.
This allows the users to leave the post half way through, come back and carry on from where they left. Also, if the browser close accidently, the user does not loose the text already typed in.
I have been trying find tutorial on this, but was unable to find a useful tutorial so far.
Any help, or point to useful tutorial would be greatly appreciated.
Thanks
It sounds like you need some sort of autosave feature. One option is the Sisyphus.js jQuery Autosave plugin that saves the form state in LocalStorage. No changes to your server side ocde is needed, so it should work for any existing ASP.NET MVC application.
https://github.com/simsalabim/sisyphus
I've got a form that has, among other things, a preview button and a submit button. Let's say that the form contains a person's data. Clicking preview will submit the form to example.com/preview and get it opened in a new tab. The preview controller will insert the person's data in a table and, based on the value of LAST_INSERT_ID(), it will redirect to example.com/person/ID. When the redirect occurs, all session data is lost. I want to be able to keep session data so that, upon checking the example.com/person/ID page, the admin user can close it and do some changes to the form or submit it.
I've noticed that storing the session id in a flashdata item won't work, it won't get past the redirect. Also, if i somehow manage to get the session_id past the redirect (although adding it to the url is not what my client wants), I still don't know a way to regenerate the Codeigniter session with it. Another option I've looked into is using Codeigniter Native Session class, but the version I've found on the site is not for Codeigniter 2.0.0.3, and I'm afraid that using it might break something.
Any advice is much appreciated.
The solution was to change my ci_sessions database table fields' collations to utf8_general_ci (the default was latin1_swedish_ci)
I am rewriting a client's application from a crappy built as one huge blob of a project into a MVC application for obvious reasons.
In doing a view for pieces of it I am noticing the original programmer has plenty of statements where they change up images or put in different links based on the logged in user.
How does everybody that writes MVC applications handle this? Do you pass the username from the controller to the view to do this simple logic or should the controller handle all of that?
This should be set up either in the controller or the session, with generic place holders for the links.
i.e. if in Session
$_SESSION['userLink1']= "URL";
//Later in the views create it as this
<a href="<?php echo $_SESSION['userLink1'];">
Keep in mind this assumes that these images/links will consistently be there regardless of the user, only that the link content itself will change. If its on the user level as you described, load all the links into the session once at log in and the views will yank them out appropriately.
To actually get them in the session use your login controller to set them up upon the successful log in and when starting the session populate in some default place holders if non authorized users can also view the given pages.
is it possible to cache form contents on client side? Like maintaining state even if the form is un-saved and the user moves to a new page then returns back to the form?
The best way to do this would be by using Javascript/AJAX to talk to the server, saving each form field as the user went off it. Then, when you load the page, you'd see if there was any content for each form already saved.