123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- define(function () {
- "use strict";
- function PageModule() {
- };
-
- function buttonActionFetchPromptSelections(oPage) {
-
-
-
- var aPromptControls = oPage.getAllPromptControls();
-
- var loadedValues = false;
-
- for (var i = 0; i < aPromptControls.length; i++) {
-
- var currentPrompt = aPromptControls[i];
-
- var cookieName = "cog" + currentPrompt.name;
-
- var JSONEncodedPromptSelections = fetchCookie(cookieName);
- if (JSONEncodedPromptSelections) {
- if (JSONEncodedPromptSelections.length > 0) {
-
- currentPrompt.setValues(JSONEncodedPromptSelections);
- loadedValues = true;
- };
- };
- };
- if (loadedValues) {
- alert("Your personal default prompt selections have been loaded. You may now edit them as required and press the Save Prompt Selections button.");
- }
-
- return false;
- };
-
- function fetchCookie(passedCookieName) {
-
- var aCookies = document.cookie.split(";");
-
- var cookie = "";
-
- for (var i = 0; i < aCookies.length; i++) {
- var currentCookie = aCookies[i];
-
- var signLocation = currentCookie.indexOf("=");
- var currentCookieName = currentCookie.substr(0, signLocation);
- var regexPattern = passedCookieName.valueOf();
- if (currentCookieName.match(regexPattern)) {
- cookie = currentCookie.substr(signLocation + 1, currentCookie.length);
- }
- }
-
- cookie = eval(cookie);
- return cookie;
- };
- PageModule.prototype.load = function (oPage) {
-
- buttonActionFetchPromptSelections(oPage);
-
- };
- return PageModule;
- });
|