Out side the Package – Page scripts Model, Flow and CMS support

Discussion in 'Subrion CMS Packages Discussions' started by piagent, Nov 17, 2012.

  1. piagent

    piagent New Member

    I’m still learning the Package and CMS environment. Lately I’m stuck in several places. I have been able to create a Package admin page script based on my understanding and cloning of the auto’s Make&Model code. The retooled script set when from categories to section_types_categories. No longer for cars but used for ad (listing) type, boat type and boat sub-type. Using the package I described the new table, primary fields, grouped fields, the initial package directed import dump data and table drop. All is working nicely with the admin CMS code for manage fields and Database. And now it gets ugly.

    1)<adminpages>[FONT=&quot]<page block="boats" name="boats_section_types_categories" filename="boat_section_types_categories" menus="menu" url="manage/boats/categories/">Manage Categories</page> scripts are clones of working code, which we keep in our package to see if we break something. The code set is admin/boats_section_types_categories.php , templates/admin/boats_section_types_categories.tpl and includes/classes/ia_admin_ boats_section_types_categories.php[/FONT]
    [FONT=&quot] [/FONT]
    [FONT=&quot]I think this is Package definition related I get undefined item, section and statuses.[/FONT]

    2)In another script cloned of “autos” script now boats for add a boat listing, we have had some luck but need to understand the flow after the page has been presented. These are the parts we see admin/boats.php and includes/classes/ia_admin_boats.

    2A)Is there a tpl that autos uses?

    2B)When the add page from auto is constructed the model selection has javascript and a path back to scripts to display a new child selection. What and where are these scripts embedded into the page from the code set, is there a tpl?

    2C)The path back to get children on the select event uses a path to get to the code for the JSON response. It looks like it is sending the request back to a script manage. Can you explain the flow, how and where the path is interpreted? How we put our own code in to control the child? We get the parent, then after selection we get a child but it’s a car model and not the child of our record.
  2. Gleb_S.

    Gleb_S. Subrion Designer Staff Member

    Hello piagent,

    Probably, you have a function that includes your class wrong in boats_section_types_categories.php. Please check if you have kind of this code:
    PHP:

    $iaCategory = $iaCore->factoryPackage('autos_categ', IA_CURRENT_PACKAGE, iaCore::ADMIN);
    [php]

    This code includes the next file: autos/includes/classes/ia.admin.autos_categ.php where
    IA_CURRENT_PACKAGE = autos = name of the packages folder
    iaCore::ADMIN = admin = the part of the included file's name that goes after "ia."
    autos_categ = the third part of the incuded file'
    s name that goes before ".php"

    So in order to include your class you should rename the file with the class to
    [B]ia.admin.boats_section_types_categories.php[/B] and in [I]boats_section_types_categories.php[/I] use this code:
    [php]
    $iaCategory = $iaCore->factoryPackage('boats_section_types_categories', IA_CURRENT_PACKAGE, iaCore::ADMIN);
     
    The part of the code in admin/boats.php that is placed within the code:
    PHP:

    if ($iaView->getRequestType() == iaView::REQUEST_HTML)
    {
    ...
    }
     
    uses templates/admin/manage.tpl file. if you are going to rename the file you should also edit the code in admin/boats.php:
    PHP:

    $iaView->display('manage');
    [php]

    where[B] 'manage'[/B] is the name of the file.

    [QUOTE]2B)When the add page from auto is constructed the model selection has javascript and a path back to scripts to display a new child selection. What and where are these scripts embedded into the page from the code set, is there a tpl?[/QUOTE]

    The selector of categories (makes/models) is built just within the js code. You can find it in [I]js/common/manage.js[/I]

    [QUOTE]2C)The path back to get children on the select event uses a path to get to the code for the JSON response. It looks like it is sending the request back to a script manage. Can you explain the flow, how and where the path is interpreted? How we put our own code in to control the child? We get the parent, then after selection we get a child but it’s a car model and not the child of our record.[/QUOTE]

    Probably, in [I]js/common/manage.js[/I] you script calls wrong file to get children, please check the js code. You should find this code:
    [code]
    url: intelli.config.packages.autos.url + 'models.json',
    [/code]

    You should replace "autos" with your package's name. Instead of "models.json" you can write anything with ".json" suffix.
  3. piagent

    piagent New Member

    I'm sure this has happen to someone out there playing with packages. I did an install via xml with a <extras name="boats">, I did an uninstall without error, I then loaded up the autos package to test something from our discussion. The the unaltered package installed without error but no package block showing. When I looked into the DB all the records were there plus boats. An uninstall deleted the auto extra records with the boats remaining. Do you have a package cleanup? I thought I could just run an uninstall against this
    Code (Text):

    <?xml version="1.0" encoding="utf-8" ?>
    <extras name="boats">
        <title>Kill boat stuff</title>
        <summary>This package kills boats stuff.</summary>
        <author>Intelliants LLC</author>
        <contributor> Making Systems Work</contributor>
        <version>2.2.3.10</version>
        <date>2012-11-19</date>
        <compatibility>2.2.3</compatibility>
        <comments>This is the URL Root Directory for the FrontEnd</comment>
        <url>boats</url>
    </extras>
     
    Did not work to delete all records with extras boats.
    Last edited by a moderator: Nov 19, 2012
  4. Vasily_B.

    Vasily_B. Project Manager

    Hi,

    Your way should do the trick for table records where you have extras set to 'boats' but it will not remove any tables like 'boats', etc. This should be done manually using <uninstall> sql way.
    I think the only way now for you is to reinstall the core version to get rid of inconsistent obsolete records and tables :(
  5. piagent

    piagent New Member

    Tried it again and it did the cleanup. Not sure why it did not work the first time for me. The only thing I changed was to place it in it's own directory with a clean auto package in it's own directory. Both showed up and I did the boats uninstall.
  6. Vasily_B.

    Vasily_B. Project Manager

    Ohh, no ideas why it didn't work for the first time. I suppose there was a parsing error or anything like that. Anyway, it makes no sense as it finally worked :)

Share This Page