Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1036

    luc
    Keymaster

    If you want to start a new project from scratch, you need to set very few configuration stuff.

    • css/ should only contain custom.css (can be first empty)
    • html/ should contain sidemenu.html and usermenu.html
    • images/ may contains only background.jpg if login is needed
    • js/ should contain config.js, sidemenu.js and usermenu.js files, and lang subdirectory
    • js/lang/ may contain at least your lang strings as your default langage set in config.js, i.e en.js
    • index.html and CYJS/ must be there without any change

     

    What the files should contain

     

    • js/config.js file must be set like that, we will assume that no authentication is needed at this point :
    debug = 0;
    cyMinWindowWidth = 800;
    CYLoginFct = function()
    {
        CYLoadPage('myfirstpage', 'IDmain'); // myfirstpage.html must exists in html/
        CYLogin('John Doe'); // fake user name, can be empty
    };
    cyPath = ''; // empty if your app is hosted at virtual host root level
    //cyPath = '/cyjs'; if your app is hosted in cyjs directory at virtual host root level

    As explained is introduction page, both sidemenu.js and usermenu.js file must contain an initial function. Just copy the file from the package, or set the minimum as so  :

    • js/sidemenu.js
    function CyInit_sidemenu()
    {
       $("#IDsidemenucontent").menu().show()
       $("#IDsidemenucontent li").click(function ()
       {
         $("#IDusermenu").hide("slide", { direction: "right" }, 500);
         if ($(window).width() < cyMinWindowWidth || $("#IDmain").css('left') == '0px')
           CYOpenSideMenu(false, false, true);
         url = $(this).attr('page');
         CYLoadPage(url, 'IDmain');
       }
     );
    }
    • js/usermenu.js
    function CyInit_usermenu()
    {
       $("#IDusermenucontent").menu();
       $("#IDusermenucontent li").click(function()
       {
         $("usermenu").toggle("fast", "swing");
         src = $(this).attr('src');
         switch (src)
         {
           case 'logoff':
             CYConfirm('', 'LOGOFF', 'sign-out', 0, CYLogoff);
             break;
         }
       }
     );
    }
    • js/lang/en.js file can be set like that :
    // to set custom strings used by framework
    cyString['PROJECT'] = "MY CYJS APP"; 
    cyString['FOOTER'] = "MY CYJS FOOTER APP"; 
    // to set custom strings in login page (refer to html/login.html)
    cyString['LANGAGE'] = "Language";
    cyString['Francais'] = "French";
    cyString['Anglais'] = "English";
    cyString['USERNAME'] = "Username";
    cyString['PASSWORD'] = "Password";
    cyString['PLEASE LOGIN'] = "Please login";

    If you want to declare all needed files to avoid all Javascript error message, you should also create 2 empty files according to introduction specs :

    • css/sidemenu.css
    • css/usermenu.css

    That’s enough to have something working 😉

    Next step..

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.