Nokia S40 Theme Packaging PHP Class

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

Anyone know if this, or similar DOCTYPE documents are available anywhere ?

Code: [ Select ]
<!DOCTYPE theme PUBLIC "-//NOKIA//DTD THEME 1.1//EN" "theme.dtd">


Seems that Nokia stores them on the, hmmm, phone, but I can't seem to find one easily viewable online anywhere.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

I ran the theme_descriptor.xml configuration file produced by one of Nokias' Theme Studios through Hit Softwares' XML Document To DTD Utility after modifying every single thing I could in the Theme Studio & got this,

Code: [ Select ]
<!ELEMENT background EMPTY >
<!ATTLIST background src NMTOKEN #REQUIRED >

<!ELEMENT background-mini EMPTY >
<!ATTLIST background-mini src NMTOKEN #REQUIRED >

<!ELEMENT colorscheme EMPTY >
<!ATTLIST colorscheme color NMTOKEN #REQUIRED >

<!ELEMENT colorscheme-mini EMPTY >
<!ATTLIST colorscheme-mini color NMTOKEN #REQUIRED >

<!ELEMENT icon EMPTY >
<!ATTLIST icon item_id ID #REQUIRED >
<!ATTLIST icon size NMTOKEN #FIXED "large" >
<!ATTLIST icon src ( Deep.jpg | Mystery.jpg | Sea.jpg | Sunset.jpg ) #REQUIRED >

<!ELEMENT ringtone EMPTY >
<!ATTLIST ringtone src CDATA #REQUIRED >

<!ELEMENT screensaver EMPTY >
<!ATTLIST screensaver src NMTOKEN #REQUIRED >

<!ELEMENT theme ( wallpaper, screensaver, ringtone, colorscheme, icon+, wallpaper-mini, colorscheme-mini, background, background-mini ) >
<!ATTLIST theme name CDATA #REQUIRED >
<!ATTLIST theme version NMTOKEN #REQUIRED >

<!ELEMENT wallpaper EMPTY >
<!ATTLIST wallpaper src NMTOKEN #REQUIRED >

<!ELEMENT wallpaper-mini EMPTY >
<!ATTLIST wallpaper-mini src NMTOKEN #REQUIRED >
  1. <!ELEMENT background EMPTY >
  2. <!ATTLIST background src NMTOKEN #REQUIRED >
  3. <!ELEMENT background-mini EMPTY >
  4. <!ATTLIST background-mini src NMTOKEN #REQUIRED >
  5. <!ELEMENT colorscheme EMPTY >
  6. <!ATTLIST colorscheme color NMTOKEN #REQUIRED >
  7. <!ELEMENT colorscheme-mini EMPTY >
  8. <!ATTLIST colorscheme-mini color NMTOKEN #REQUIRED >
  9. <!ELEMENT icon EMPTY >
  10. <!ATTLIST icon item_id ID #REQUIRED >
  11. <!ATTLIST icon size NMTOKEN #FIXED "large" >
  12. <!ATTLIST icon src ( Deep.jpg | Mystery.jpg | Sea.jpg | Sunset.jpg ) #REQUIRED >
  13. <!ELEMENT ringtone EMPTY >
  14. <!ATTLIST ringtone src CDATA #REQUIRED >
  15. <!ELEMENT screensaver EMPTY >
  16. <!ATTLIST screensaver src NMTOKEN #REQUIRED >
  17. <!ELEMENT theme ( wallpaper, screensaver, ringtone, colorscheme, icon+, wallpaper-mini, colorscheme-mini, background, background-mini ) >
  18. <!ATTLIST theme name CDATA #REQUIRED >
  19. <!ATTLIST theme version NMTOKEN #REQUIRED >
  20. <!ELEMENT wallpaper EMPTY >
  21. <!ATTLIST wallpaper src NMTOKEN #REQUIRED >
  22. <!ELEMENT wallpaper-mini EMPTY >
  23. <!ATTLIST wallpaper-mini src NMTOKEN #REQUIRED >


I'm determining which elements are required/optional, tweeking the attribute deffinitions, & commenting everything as its' use is determined.

I'll post what I end up with here by the end of the night, just trying to keep track of what I'm doing for now. ;)
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

Didn't notice there was a scrollbar in the Icons menu of the Theme Studio.

Had a bad deffinition for icon elements.
Code: [ Select ]
<!ELEMENT icon EMPTY >
<!ATTLIST icon item_id NMTOKEN #REQUIRED >
<!ATTLIST icon size NMTOKEN #REQUIRED >
<!ATTLIST icon src NMTOKEN #REQUIRED >
  1. <!ELEMENT icon EMPTY >
  2. <!ATTLIST icon item_id NMTOKEN #REQUIRED >
  3. <!ATTLIST icon size NMTOKEN #REQUIRED >
  4. <!ATTLIST icon src NMTOKEN #REQUIRED >
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

Nice little DTD Tutorial.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

This should to do it for version 1.1

//Edit - Changed all data types for "src" attributes to "URI"

Code: [ Select ]
<!--
    <!DOCTYPE theme PUBLIC "-//NOKIA//DTD THEME 1.1//EN" "theme.dtd">
    This is a re-creation of theme DTD based on "theme_descriptor.xml"
    that is produced by "Nokia S40 Theme Studio 1.2"
    
    -- REQUIRED ELEMENTS
        theme (main container, all other elements go inside this one)
        colorscheme
        ringtone
        screensaver
        wallpaper
        
    -- OPTIONAL ELEMENTS
        background
        background-mini
        colorscheme-mini
        icon
        wallpaper-mini
    
    May not be entirely accurate in terms of data-types, sticking to it is working for me though.
-->
<!-- a Uniform Resource Identifier, see [RFC2396] -->
<!ENTITY % URI "CDATA">
<!-- Color Values -->
<!ENTITY % Color             "blue|black|red|orange|gray|green|brown|pink">
<!-- Icon Sizes -->
<!ENTITY % IconSize        "large|small">
<!-- Icon item_id references -->
<!ENTITY % MenuItem     "callregister|settings|organizer|gallery|services|media|applications|
                                    contacts|simatk|push_to_talk|wireless_village|number_entry|messages|
                                    goto|amsmessages|default">

<!--
    Image used for
    menu backgrounds in the
    main screen.
-->
<!ELEMENT background EMPTY>
<!--
    src    filename of image (jpg, jpeg, gif, png, bmp, wbmp, m3g)
-->
<!ATTLIST background
 src        URI        #REQUIRED
 >


<!--
    Image used for
    menu backgrounds in the
    mini screen.
-->
<!ELEMENT background-mini EMPTY>
<!--
    src        filename of image (jpg, jpeg, gif, png, bmp, wbmp, m3g)
-->
<!ATTLIST background-mini
 src        URI        #REQUIRED
 >


<!--
    Color used for symbols
    and indicators on the main screen
-->
<!ELEMENT colorscheme EMPTY>
<!--
    color        name of color to use
-->
<!ATTLIST colorscheme
 color        %Color;        #REQUIRED
 >


<!--
    Color used for symbols
    and indicators on the mini screen
-->
<!ELEMENT colorscheme-mini EMPTY>
<!--
    color        name of color to use
-->
<!ATTLIST colorscheme-mini
 color        %Color;        #REQUIRED
 >


<!--
    Menu item icon
-->
<!ELEMENT icon EMPTY>
<!--
    item_id        menu item to associate icon with
    size            large for list view, small for grid view (yes, two icon elements are required to cover both)
    src            filename of image to use (jpg, jpeg, gif, png, bmp, wbmp, m3g)
-->
<!ATTLIST icon
 item_id        %MenuItem;        #REQUIRED
 size            %IconSize;        #REQUIRED
 src                URI            #REQUIRED
 >


<!--
    Ringtone to use
-->
<!ELEMENT ringtone EMPTY>
<!--
    src        filename of audio to use (mid, midi, amr, awb, mp3, mp4, aac)
-->
<!ATTLIST ringtone
 src        URI        #REQUIRED
 >


<!--
    Screensaver for the main screen
-->
<!ELEMENT screensaver EMPTY>
<!--
    src        filename of image to use (jpg, jpeg, gif, png, bmp, wbmp, m3g)
-->
<!ATTLIST screensaver
 src        URI        #REQUIRED
 >


<!--
    Main container
-->
<!ELEMENT theme (background?, background-mini?, colorscheme, colorscheme-mini?, icon*, ringtone, screensaver, wallpaper, wallpaper-mini?)>
<!--
    name        name that will show in the menu for the theme
    version        theme version number
-->
<!ATTLIST theme
 name        CDATA        #REQUIRED
 version    NMTOKEN    #REQUIRED
 >


<!--
    Wallpaper image to use on the main screen
-->
<!ELEMENT wallpaper EMPTY>
<!--
    src        filename of image to use (jpg, jpeg, gif, png, bmp, wbmp, m3g)
-->
<!ATTLIST wallpaper
 src        URI        #REQUIRED
 >


<!--
    Wallpaper image to use on the mini screen
-->
<!ELEMENT wallpaper-mini EMPTY>
<!--
    src        filename of image to use (jpg, jpeg, gif, png, bmp, wbmp, m3g)
-->
<!ATTLIST wallpaper-mini
 src        URI        #REQUIRED
 >
  1. <!--
  2.     <!DOCTYPE theme PUBLIC "-//NOKIA//DTD THEME 1.1//EN" "theme.dtd">
  3.     This is a re-creation of theme DTD based on "theme_descriptor.xml"
  4.     that is produced by "Nokia S40 Theme Studio 1.2"
  5.     
  6.     -- REQUIRED ELEMENTS
  7.         theme (main container, all other elements go inside this one)
  8.         colorscheme
  9.         ringtone
  10.         screensaver
  11.         wallpaper
  12.         
  13.     -- OPTIONAL ELEMENTS
  14.         background
  15.         background-mini
  16.         colorscheme-mini
  17.         icon
  18.         wallpaper-mini
  19.     
  20.     May not be entirely accurate in terms of data-types, sticking to it is working for me though.
  21. -->
  22. <!-- a Uniform Resource Identifier, see [RFC2396] -->
  23. <!ENTITY % URI "CDATA">
  24. <!-- Color Values -->
  25. <!ENTITY % Color             "blue|black|red|orange|gray|green|brown|pink">
  26. <!-- Icon Sizes -->
  27. <!ENTITY % IconSize        "large|small">
  28. <!-- Icon item_id references -->
  29. <!ENTITY % MenuItem     "callregister|settings|organizer|gallery|services|media|applications|
  30.                                     contacts|simatk|push_to_talk|wireless_village|number_entry|messages|
  31.                                     goto|amsmessages|default">
  32. <!--
  33.     Image used for
  34.     menu backgrounds in the
  35.     main screen.
  36. -->
  37. <!ELEMENT background EMPTY>
  38. <!--
  39.     src    filename of image (jpg, jpeg, gif, png, bmp, wbmp, m3g)
  40. -->
  41. <!ATTLIST background
  42.  src        URI        #REQUIRED
  43.  >
  44. <!--
  45.     Image used for
  46.     menu backgrounds in the
  47.     mini screen.
  48. -->
  49. <!ELEMENT background-mini EMPTY>
  50. <!--
  51.     src        filename of image (jpg, jpeg, gif, png, bmp, wbmp, m3g)
  52. -->
  53. <!ATTLIST background-mini
  54.  src        URI        #REQUIRED
  55.  >
  56. <!--
  57.     Color used for symbols
  58.     and indicators on the main screen
  59. -->
  60. <!ELEMENT colorscheme EMPTY>
  61. <!--
  62.     color        name of color to use
  63. -->
  64. <!ATTLIST colorscheme
  65.  color        %Color;        #REQUIRED
  66.  >
  67. <!--
  68.     Color used for symbols
  69.     and indicators on the mini screen
  70. -->
  71. <!ELEMENT colorscheme-mini EMPTY>
  72. <!--
  73.     color        name of color to use
  74. -->
  75. <!ATTLIST colorscheme-mini
  76.  color        %Color;        #REQUIRED
  77.  >
  78. <!--
  79.     Menu item icon
  80. -->
  81. <!ELEMENT icon EMPTY>
  82. <!--
  83.     item_id        menu item to associate icon with
  84.     size            large for list view, small for grid view (yes, two icon elements are required to cover both)
  85.     src            filename of image to use (jpg, jpeg, gif, png, bmp, wbmp, m3g)
  86. -->
  87. <!ATTLIST icon
  88.  item_id        %MenuItem;        #REQUIRED
  89.  size            %IconSize;        #REQUIRED
  90.  src                URI            #REQUIRED
  91.  >
  92. <!--
  93.     Ringtone to use
  94. -->
  95. <!ELEMENT ringtone EMPTY>
  96. <!--
  97.     src        filename of audio to use (mid, midi, amr, awb, mp3, mp4, aac)
  98. -->
  99. <!ATTLIST ringtone
  100.  src        URI        #REQUIRED
  101.  >
  102. <!--
  103.     Screensaver for the main screen
  104. -->
  105. <!ELEMENT screensaver EMPTY>
  106. <!--
  107.     src        filename of image to use (jpg, jpeg, gif, png, bmp, wbmp, m3g)
  108. -->
  109. <!ATTLIST screensaver
  110.  src        URI        #REQUIRED
  111.  >
  112. <!--
  113.     Main container
  114. -->
  115. <!ELEMENT theme (background?, background-mini?, colorscheme, colorscheme-mini?, icon*, ringtone, screensaver, wallpaper, wallpaper-mini?)>
  116. <!--
  117.     name        name that will show in the menu for the theme
  118.     version        theme version number
  119. -->
  120. <!ATTLIST theme
  121.  name        CDATA        #REQUIRED
  122.  version    NMTOKEN    #REQUIRED
  123.  >
  124. <!--
  125.     Wallpaper image to use on the main screen
  126. -->
  127. <!ELEMENT wallpaper EMPTY>
  128. <!--
  129.     src        filename of image to use (jpg, jpeg, gif, png, bmp, wbmp, m3g)
  130. -->
  131. <!ATTLIST wallpaper
  132.  src        URI        #REQUIRED
  133.  >
  134. <!--
  135.     Wallpaper image to use on the mini screen
  136. -->
  137. <!ELEMENT wallpaper-mini EMPTY>
  138. <!--
  139.     src        filename of image to use (jpg, jpeg, gif, png, bmp, wbmp, m3g)
  140. -->
  141. <!ATTLIST wallpaper-mini
  142.  src        URI        #REQUIRED
  143.  >
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

Version 2.0

Got the required elements done.
Some of the required attributes done.
An ENTITY list for the available menu items.
There's alot in 2.0, I might come back to it if I ever get a phone that supports it or get bored. :shock:

Code: [ Select ]
<!--
    <!DOCTYPE theme PUBLIC "-//NOKIA//DTD THEME 2.0//EN" "theme.dtd">
    This is a re-creation of theme DTD based on "theme_descriptor.xml"
    that is produced by "Nokia S40 Theme Studio 2.1"
    
    --REQUIRED
        wallpaper
        screensaver

    -- OPTIONAL
        everything else
-->

<!ENTITY % MenuItem    "applications|ams_messages|brew|callregister|camera|
                                    cdmacust|contacts|extras|gallery|goto|media|messages|
                                    number_entry|organizer|push_to_talk|services|settings|
                                    simatk|sport|voiceportal|wireless_village">

<!ENTITY % Colors.Display    "main|second">

<!ELEMENT background EMPTY >
<!ATTLIST background
    grid_menu_bg            NMTOKEN        #IMPLIED
    main_default_bg         NMTOKEN         #IMPLIED
    note_bg                    NMTOKEN        #IMPLIED
    second_default_bg        NMTOKEN        #IMPLIED
    >

<!ELEMENT colors EMPTY >
<!ATTLIST colors
    active_idle_active_font_color                    NMTOKEN                #IMPLIED
    active_idle_content_background_color        NMTOKEN                #IMPLIED
    calendar_highlight_color                            NMTOKEN                #IMPLIED
    display                                                    %Colors.Display;    #REQUIRED
    grid_highlight_color                                NMTOKEN                #IMPLIED
    grid_menu_font_color                                NMTOKEN                #IMPLIED
    grid_menu_highlight_font_color                NMTOKEN                #IMPLIED
    header_font_color                                    NMTOKEN                #IMPLIED
    idle_font_color                                        NMTOKEN                #IMPLIED
    menu_font_color                                    NMTOKEN                #IMPLIED
    menu_highlight_font_color                        NMTOKEN                #IMPLIED
    reorder_highlight_color                            NMTOKEN                #IMPLIED
    reorder_highlight_font_color                    NMTOKEN                #IMPLIED
    shortcut_bar_popup_background_color    NMTOKEN                #IMPLIED
    shortcut_bar_popup_font_color                NMTOKEN                #IMPLIED
    softkey_font_color                                    NMTOKEN                #IMPLIED
    status_area_font_color                            NMTOKEN                #IMPLIED
    >

<!ELEMENT highlight EMPTY >
<!ATTLIST highlight
    active_idle_row                    NMTOKEN        #IMPLIED
    active_idle_shortcut_bar        NMTOKEN        #IMPLIED
    grid                                    NMTOKEN        #IMPLIED
    list                                    NMTOKEN        #IMPLIED
    reorder                                NMTOKEN        #IMPLIED
    tab                                    NMTOKEN        #IMPLIED
    >

<!ELEMENT menu_item EMPTY >
<!ATTLIST menu_item
    animating_grid        NMTOKEN        #IMPLIED
    app_specific_bg        NMTOKEN        #IMPLIED
    grid_view_icon        NMTOKEN        #IMPLIED
    item_id                    %MenuItem;    #REQUIRED
    list_view_icon        NMTOKEN        #IMPLIED
    >

<!ELEMENT radio_audio_bg EMPTY >
<!ATTLIST radio_audio_bg
    audio_bg        NMTOKEN        #IMPLIED
    radio_bg        NMTOKEN        #IMPLIED
    >

<!ELEMENT screensaver EMPTY >
<!ATTLIST screensaver
    main_display_graphics        NMTOKEN        #REQUIRED
    second_display_graphics        NMTOKEN        #IMPLIED
    >

<!ELEMENT shutdown EMPTY >
<!ATTLIST shutdown
    main_display_graphics        NMTOKEN        #IMPLIED
    second_display_graphics        NMTOKEN        #IMPLIED
    tone                                    NMTOKEN        #IMPLIED
    >

<!ELEMENT softkey_bg EMPTY >
<!ATTLIST softkey_bg
    left            NMTOKEN        #IMPLIED
    middle        NMTOKEN        #IMPLIED
    right            NMTOKEN        #IMPLIED
    >

<!ELEMENT startup EMPTY >
<!ATTLIST startup
    main_display_graphics        NMTOKEN        #IMPLIED
    second_display_graphics        NMTOKEN        #IMPLIED
    tone                                    NMTOKEN        #IMPLIED
    >

<!ELEMENT theme
    (colors*, menu_item*, wallpaper, screensaver, background?, radio_audio_bg?, softkey_bg?, wait_graphics?, highlight?, tones?, startup?, shutdown?, transformation_open?, transformation_close?)>
<!ATTLIST theme
    name        CDATA            #IMPLIED
    version        NMTOKEN        #IMPLIED
    >

<!ELEMENT tones EMPTY >
<!ATTLIST tones
    cal_alert        NMTOKEN        #IMPLIED
    msg_alert        NMTOKEN        #IMPLIED
    ringtone        NMTOKEN        #IMPLIED
    >

<!ELEMENT transformation_close EMPTY >
<!ATTLIST transformation_close
    main_display_graphics        NMTOKEN        #IMPLIED
    second_display_graphics        NMTOKEN        #IMPLIED
    tone                                    NMTOKEN        #IMPLIED
    >

<!ELEMENT transformation_open EMPTY >
<!ATTLIST transformation_open
    main_display_graphics        NMTOKEN        #IMPLIED
    second_display_graphics        NMTOKEN        #IMPLIED
    tone                                    NMTOKEN        #IMPLIED
    >

<!ELEMENT wait_graphics EMPTY >
<!ATTLIST wait_graphics
    src        NMTOKEN        #IMPLIED
    >

<!ELEMENT wallpaper EMPTY >
<!ATTLIST wallpaper
    main_display_graphics        NMTOKEN        #REQUIRED
    second_display_graphics        NMTOKEN        #IMPLIED
    >
  1. <!--
  2.     <!DOCTYPE theme PUBLIC "-//NOKIA//DTD THEME 2.0//EN" "theme.dtd">
  3.     This is a re-creation of theme DTD based on "theme_descriptor.xml"
  4.     that is produced by "Nokia S40 Theme Studio 2.1"
  5.     
  6.     --REQUIRED
  7.         wallpaper
  8.         screensaver
  9.     -- OPTIONAL
  10.         everything else
  11. -->
  12. <!ENTITY % MenuItem    "applications|ams_messages|brew|callregister|camera|
  13.                                     cdmacust|contacts|extras|gallery|goto|media|messages|
  14.                                     number_entry|organizer|push_to_talk|services|settings|
  15.                                     simatk|sport|voiceportal|wireless_village">
  16. <!ENTITY % Colors.Display    "main|second">
  17. <!ELEMENT background EMPTY >
  18. <!ATTLIST background
  19.     grid_menu_bg            NMTOKEN        #IMPLIED
  20.     main_default_bg         NMTOKEN         #IMPLIED
  21.     note_bg                    NMTOKEN        #IMPLIED
  22.     second_default_bg        NMTOKEN        #IMPLIED
  23.     >
  24. <!ELEMENT colors EMPTY >
  25. <!ATTLIST colors
  26.     active_idle_active_font_color                    NMTOKEN                #IMPLIED
  27.     active_idle_content_background_color        NMTOKEN                #IMPLIED
  28.     calendar_highlight_color                            NMTOKEN                #IMPLIED
  29.     display                                                    %Colors.Display;    #REQUIRED
  30.     grid_highlight_color                                NMTOKEN                #IMPLIED
  31.     grid_menu_font_color                                NMTOKEN                #IMPLIED
  32.     grid_menu_highlight_font_color                NMTOKEN                #IMPLIED
  33.     header_font_color                                    NMTOKEN                #IMPLIED
  34.     idle_font_color                                        NMTOKEN                #IMPLIED
  35.     menu_font_color                                    NMTOKEN                #IMPLIED
  36.     menu_highlight_font_color                        NMTOKEN                #IMPLIED
  37.     reorder_highlight_color                            NMTOKEN                #IMPLIED
  38.     reorder_highlight_font_color                    NMTOKEN                #IMPLIED
  39.     shortcut_bar_popup_background_color    NMTOKEN                #IMPLIED
  40.     shortcut_bar_popup_font_color                NMTOKEN                #IMPLIED
  41.     softkey_font_color                                    NMTOKEN                #IMPLIED
  42.     status_area_font_color                            NMTOKEN                #IMPLIED
  43.     >
  44. <!ELEMENT highlight EMPTY >
  45. <!ATTLIST highlight
  46.     active_idle_row                    NMTOKEN        #IMPLIED
  47.     active_idle_shortcut_bar        NMTOKEN        #IMPLIED
  48.     grid                                    NMTOKEN        #IMPLIED
  49.     list                                    NMTOKEN        #IMPLIED
  50.     reorder                                NMTOKEN        #IMPLIED
  51.     tab                                    NMTOKEN        #IMPLIED
  52.     >
  53. <!ELEMENT menu_item EMPTY >
  54. <!ATTLIST menu_item
  55.     animating_grid        NMTOKEN        #IMPLIED
  56.     app_specific_bg        NMTOKEN        #IMPLIED
  57.     grid_view_icon        NMTOKEN        #IMPLIED
  58.     item_id                    %MenuItem;    #REQUIRED
  59.     list_view_icon        NMTOKEN        #IMPLIED
  60.     >
  61. <!ELEMENT radio_audio_bg EMPTY >
  62. <!ATTLIST radio_audio_bg
  63.     audio_bg        NMTOKEN        #IMPLIED
  64.     radio_bg        NMTOKEN        #IMPLIED
  65.     >
  66. <!ELEMENT screensaver EMPTY >
  67. <!ATTLIST screensaver
  68.     main_display_graphics        NMTOKEN        #REQUIRED
  69.     second_display_graphics        NMTOKEN        #IMPLIED
  70.     >
  71. <!ELEMENT shutdown EMPTY >
  72. <!ATTLIST shutdown
  73.     main_display_graphics        NMTOKEN        #IMPLIED
  74.     second_display_graphics        NMTOKEN        #IMPLIED
  75.     tone                                    NMTOKEN        #IMPLIED
  76.     >
  77. <!ELEMENT softkey_bg EMPTY >
  78. <!ATTLIST softkey_bg
  79.     left            NMTOKEN        #IMPLIED
  80.     middle        NMTOKEN        #IMPLIED
  81.     right            NMTOKEN        #IMPLIED
  82.     >
  83. <!ELEMENT startup EMPTY >
  84. <!ATTLIST startup
  85.     main_display_graphics        NMTOKEN        #IMPLIED
  86.     second_display_graphics        NMTOKEN        #IMPLIED
  87.     tone                                    NMTOKEN        #IMPLIED
  88.     >
  89. <!ELEMENT theme
  90.     (colors*, menu_item*, wallpaper, screensaver, background?, radio_audio_bg?, softkey_bg?, wait_graphics?, highlight?, tones?, startup?, shutdown?, transformation_open?, transformation_close?)>
  91. <!ATTLIST theme
  92.     name        CDATA            #IMPLIED
  93.     version        NMTOKEN        #IMPLIED
  94.     >
  95. <!ELEMENT tones EMPTY >
  96. <!ATTLIST tones
  97.     cal_alert        NMTOKEN        #IMPLIED
  98.     msg_alert        NMTOKEN        #IMPLIED
  99.     ringtone        NMTOKEN        #IMPLIED
  100.     >
  101. <!ELEMENT transformation_close EMPTY >
  102. <!ATTLIST transformation_close
  103.     main_display_graphics        NMTOKEN        #IMPLIED
  104.     second_display_graphics        NMTOKEN        #IMPLIED
  105.     tone                                    NMTOKEN        #IMPLIED
  106.     >
  107. <!ELEMENT transformation_open EMPTY >
  108. <!ATTLIST transformation_open
  109.     main_display_graphics        NMTOKEN        #IMPLIED
  110.     second_display_graphics        NMTOKEN        #IMPLIED
  111.     tone                                    NMTOKEN        #IMPLIED
  112.     >
  113. <!ELEMENT wait_graphics EMPTY >
  114. <!ATTLIST wait_graphics
  115.     src        NMTOKEN        #IMPLIED
  116.     >
  117. <!ELEMENT wallpaper EMPTY >
  118. <!ATTLIST wallpaper
  119.     main_display_graphics        NMTOKEN        #REQUIRED
  120.     second_display_graphics        NMTOKEN        #IMPLIED
  121.     >
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

A bit of an update on my //Threads Merged, since I just noticed it's been viewed over 2,000 times so far. :D

I'd written this to package themes for my cellphone last year but never really did much with it, I plan to do a rewrite to include more phones now so I figure I should post this before I clean it off my drive. :D

Basicly Nokia S40 themes are zipfiles containing an XML descriptor file, some images, & maybe an SWF screensaver in the Version-3 S40 themes.

If you rename a *.nth file to .zip it will will open in any application that handles zipfiles, somthing like 7-zip doesn't even require renaming it.

When I wrote this the only zip functionalty access I had was via a script posted by camperjohn64 in this post.
This theme packager requires the script in that post & that is the include required as seen in the first lines of the packager.
Code: [ Select ]
// File packaging/compression
require('zipfile.class.php');
  1. // File packaging/compression
  2. require('zipfile.class.php');


First I'll post the class, followed by example usage in the next post since it's a tad lengthy.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

nokia-s40theme.php

Code: [ Select ]
<?php

// File packaging/compression
require('zipfile.class.php');

class s40theme
{
    var $file_list = Array();
    var $theme = Array('name' => 'New Theme', 'version' => '0.0');
    var $theme_descriptor;
    var $theme_elements;
    var $descriptor_template = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE theme PUBLIC \"-//NOKIA//DTD THEME {VERSION}//EN\" \"theme.dtd\">
<theme name=\"{THEME_NAME}\" version=\"{VERSION}\">\n{ELEMENTS}\n</theme>";

// Convience Functions
    function set_name($name){$this -> theme['name'] = $name;}
    function set_version($version){$this -> theme['version'] = $version;}
    function sanitized_filename($filename){return preg_replace( "/[^\w\.-]+/", "_", preg_replace( '/^.+[\\\\\\/]/', '', $filename ));}

// Main Functions
    function update_files($filename)
    {
        if( ! is_file($filename)){ return false;}
        array_push($this -> file_list, $filename);
        $this -> file_list = array_unique($this -> file_list);
        return true;
    }

    function get_theme_descriptor()
    {
        $xml = '';
        foreach($this -> theme_elements as $element => $details)
        {
            if( ! $details['inuse'])
            {
                continue;
            }
            if( ! $details['repeatable'])
            {
                $node = "\t<$element";
                foreach($details['attributes'] as $attribute => $deffinition)
                {
                    $node .= "\n\t\t" . $attribute . '="' . $deffinition['value'] . '"';
                }
                $xml .= "$node />\n";
            }
            else
            {
                foreach($details['clones'] as $clone => $clone_details)
                {
                    $node = "\t<$element";
                    foreach($clone_details as $attribute => $deffinition)
                    {
                        $node .= "\n\t\t" . $attribute . '="' . $deffinition['value'] . '"';
                    }
                    $xml .= "$node />\n";
                }
            }
        }
        $this -> theme_descriptor = str_replace(
            Array('{VERSION}', '{THEME_NAME}', '{ELEMENTS}'),
            Array($this -> theme['version'], $this -> theme['name'], $xml),
            $this -> descriptor_template
        );
        return $this -> theme_descriptor;
    }
    
    function set_element($element, $attributes)
    {
        if( ! array_key_exists($element, $this -> theme_elements)
            or
            ! is_array($attributes))
        {
            return false;
        }
        $this -> theme_elements[$element]['inuse'] = true;
        if($this -> theme_elements[$element]['repeatable'])
        {
            $clone_id = count($this -> theme_elements[$element]['clones']);
            foreach($attributes as $attribute => $value)
            {
                if( ! array_key_exists($attribute, $this -> theme_elements[$element]['attributes']))
                {
                    continue;
                }
                if($this -> theme_elements[$element]['attributes'][$attribute]['isfile'])
                {
                    if( ! $this -> update_files($value))
                    {
                        if($clone_id < count($this -> theme_elements[$element]['clones']))
                        {
                            array_pop($this -> theme_elements[$element]['clones']);
                            if($clone_id == 0)
                            {
                                $this -> theme_elements[$element]['inuse'] = false;
                            }
                        }
                        return false;
                    }
                    $value = $this -> sanitized_filename($value);
                }
                $this -> theme_elements[$element]['clones'][$clone_id][$attribute]['value'] = utf8_encode($value);
            }
        }
        else
        {
            foreach($attributes as $attribute => $value)
            {
                if( ! array_key_exists($attribute, $this -> theme_elements[$element]['attributes']))
                {
                    continue;
                }
                if($this -> theme_elements[$element]['attributes'][$attribute]['isfile'])
                {
                    if( ! $this -> update_files($value))
                    {
                        $this -> theme_elements[$element]['inuse'] = false;
                        return false;
                    }
                    $value = $this -> sanitized_filename($value);
                }
                $this -> set_elements_attribute($element, $attribute, $value);
            }
        }
        return true;
    }
    function set_elements_attribute($element, $attribute, $value)
    {
        if( ! array_key_exists($attribute, $this -> theme_elements[$element]['attributes']))
        {
            return false;
        }
        $this -> theme_elements[$element]['attributes'][$attribute]['value'] = utf8_encode($value);
        return true;
    }

// Packaging
    function packaged()
    {
        $zip = new zipfile();
        $zip -> add_file($this -> get_theme_descriptor(), 'theme_descriptor.xml');
        
        foreach($this -> file_list as $a_file)
        {
            $file_handle = fopen($a_file, 'rb');
            $file_data = fread($file_handle, filesize($a_file));
            fclose($file_handle);
            $zip -> add_file($file_data, $this -> sanitized_filename($a_file));
        }
        
        return $zip -> file();
    }
}
class s40theme1_1 extends s40theme
{
// Available Menu Items
    var $menu_items = Array(
        'callregister','settings','organizer','gallery','services','media','applications',
        'contacts','simatk','push_to_talk','wireless_village','number_entry','messages',
        'goto','amsmessages','default'
    );

    function s40theme1_1()
    {
        $this -> set_version('1.1');
        $this -> theme_elements = Array(
            'background' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'src' => Array('isfile' => true, 'value' => false)
                )
            ),
            'background-mini' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'src' => Array('isfile' => true, 'value' => false)
                )
            ),
            'colorscheme' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'color' => Array('isfile' => false, 'value' => false)
                )
            ),
            'icon' => Array(
                'inuse' => false,
                'repeatable' => true,
                'clones' => Array(),
                'attributes' => Array(
                    'src' => Array('isfile' => true),
                    'item_id' => Array('isfile' => false),
                    'size' => Array('isfile' => false),
                )
            ),
            'ringtone' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'src' => Array('isfile' => true, 'value' => false)
                )
            ),
            'screensaver' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'src' => Array('isfile' => true, 'value' => false)
                )
            ),
            'wallpaper' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'src' => Array('isfile' => true, 'value' => false)
                )
            ),
            'colorscheme-mini' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'color' => Array('isfile' => false, 'value' => false)
                )
            ),
            'wallpaper-mini' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'src' => Array('isfile' => true, 'value' => false)
                )
            )
        );
    }
}

class s40theme2_0 extends s40theme
{
    function s40theme2_0()
    {
        $this -> set_version('2.0');
        $this -> theme_elements = Array(
            'colors' => Array(
                'inuse' => false,
                'repeatable' => true,
                'clones' => Array(),
                'attributes' => Array(
                    'display' => Array('isfile' => false, 'value' => false),
                    'header_font_color' => Array('isfile' => false, 'value' => false),
                    'status_area_font_color' => Array('isfile' => false, 'value' => false),
                    'softkey_font_color' => Array('isfile' => false, 'value' => false),
                    'calendar_highlight_color' => Array('isfile' => false, 'value' => false),
                    'idle_font_color' => Array('isfile' => false, 'value' => false),
                    'active_idle_active_font_color' => Array('isfile' => false, 'value' => false),
                    'active_idle_content_background_color' => Array('isfile' => false, 'value' => false),
                    'shortcut_bar_popup_font_color' => Array('isfile' => false, 'value' => false),
                    'shortcut_bar_popup_background_color' => Array('isfile' => false, 'value' => false),
                    'menu_font_color' => Array('isfile' => false, 'value' => false),
                    'menu_highlight_font_color' => Array('isfile' => false, 'value' => false),
                    'grid_menu_font_color' => Array('isfile' => false, 'value' => false),
                    'grid_menu_highlight_font_color' => Array('isfile' => false, 'value' => false),
                    'reorder_highlight_font_color' => Array('isfile' => false, 'value' => false),
                    'grid_highlight_color' => Array('isfile' => false, 'value' => false),
                    'reorder_highlight_color' => Array('isfile' => false, 'value' => false)
                )
            ),
            'menu_item' => Array(
                'inuse' => false,
                'repeatable' => true,
                'clones' => Array(),
                'attributes' => Array(
                    'item_id' => Array('isfile' => false, 'value' => false),
                    'list_view_icon' => Array('isfile' => true, 'value' => false),
                    'grid_view_icon' => Array('isfile' => true, 'value' => false),
                    'animating_grid' => Array('isfile' => true, 'value' => false),
                    'app_specific_bg' => Array('isfile' => true, 'value' => false)
                )
            ),
            'wallpaper' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'main_display_graphics' => Array('isfile' => true, 'value' => false),
                    'second_display_graphics' => Array('isfile' => true, 'value' => false)
                )
            ),
            'screensaver' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'main_display_graphics' => Array('isfile' => true, 'value' => false),
                    'second_display_graphics' => Array('isfile' => true, 'value' => false)
                )
            ),
            'background' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'main_default_bg' => Array('isfile' => true, 'value' => false),
                    'second_default_bg' => Array('isfile' => true, 'value' => false),
                    'grid_menu_bg' => Array('isfile' => true, 'value' => false),
                    'note_bg' => Array('isfile' => true, 'value' => false)
                )
            ),
            'radio_audio_bg' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'radio_bg' => Array('isfile' => true, 'value' => false),
                    'audio_bg' => Array('isfile' => true, 'value' => false)
                )
            ),
            'softkey_bg' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'left' => Array('isfile' => true, 'value' => false),
                    'middle' => Array('isfile' => true, 'value' => false),
                    'right' => Array('isfile' => true, 'value' => false)
                )
            ),
            'wait_graphics' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'src' => Array('isfile' => true, 'value' => false)
                )
            ),
            'highlight' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'tab' => Array('isfile' => true, 'value' => false),
                    'list' => Array('isfile' => true, 'value' => false),
                    'grid' => Array('isfile' => true, 'value' => false),
                    'active_idle_row' => Array('isfile' => true, 'value' => false),
                    'active_idle_shortcut_bar' => Array('isfile' => true, 'value' => false),
                    'reorder' => Array('isfile' => true, 'value' => false)
                )
            ),
            'tones' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'ringtone' => Array('isfile' => true, 'value' => false),
                    'msg_alert' => Array('isfile' => true, 'value' => false),
                    'cal_alert' => Array('isfile' => true, 'value' => false)
                )
            ),
            'startup' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'main_display_graphics' => Array('isfile' => true, 'value' => false),
                    'second_display_graphics' => Array('isfile' => true, 'value' => false),
                    'tone' => Array('isfile' => true, 'value' => false)
                )
            ),
            'shutdown' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'main_display_graphics' => Array('isfile' => true, 'value' => false),
                    'second_display_graphics' => Array('isfile' => true, 'value' => false),
                    'tone' => Array('isfile' => true, 'value' => false)
                )
            ),
            'transformation_open' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'main_display_graphics' => Array('isfile' => true, 'value' => false),
                    'second_display_graphics' => Array('isfile' => true, 'value' => false),
                    'tone' => Array('isfile' => true, 'value' => false)
                )
            ),
            'transformation_close' => Array(
                'inuse' => false,
                'repeatable' => false,
                'attributes' => Array(
                    'main_display_graphics' => Array('isfile' => true, 'value' => false),
                    'second_display_graphics' => Array('isfile' => true, 'value' => false),
                    'tone' => Array('isfile' => true, 'value' => false)
                )
            )
        );
    }
}
?>
  1. <?php
  2. // File packaging/compression
  3. require('zipfile.class.php');
  4. class s40theme
  5. {
  6.     var $file_list = Array();
  7.     var $theme = Array('name' => 'New Theme', 'version' => '0.0');
  8.     var $theme_descriptor;
  9.     var $theme_elements;
  10.     var $descriptor_template = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
  11. <!DOCTYPE theme PUBLIC \"-//NOKIA//DTD THEME {VERSION}//EN\" \"theme.dtd\">
  12. <theme name=\"{THEME_NAME}\" version=\"{VERSION}\">\n{ELEMENTS}\n</theme>";
  13. // Convience Functions
  14.     function set_name($name){$this -> theme['name'] = $name;}
  15.     function set_version($version){$this -> theme['version'] = $version;}
  16.     function sanitized_filename($filename){return preg_replace( "/[^\w\.-]+/", "_", preg_replace( '/^.+[\\\\\\/]/', '', $filename ));}
  17. // Main Functions
  18.     function update_files($filename)
  19.     {
  20.         if( ! is_file($filename)){ return false;}
  21.         array_push($this -> file_list, $filename);
  22.         $this -> file_list = array_unique($this -> file_list);
  23.         return true;
  24.     }
  25.     function get_theme_descriptor()
  26.     {
  27.         $xml = '';
  28.         foreach($this -> theme_elements as $element => $details)
  29.         {
  30.             if( ! $details['inuse'])
  31.             {
  32.                 continue;
  33.             }
  34.             if( ! $details['repeatable'])
  35.             {
  36.                 $node = "\t<$element";
  37.                 foreach($details['attributes'] as $attribute => $deffinition)
  38.                 {
  39.                     $node .= "\n\t\t" . $attribute . '="' . $deffinition['value'] . '"';
  40.                 }
  41.                 $xml .= "$node />\n";
  42.             }
  43.             else
  44.             {
  45.                 foreach($details['clones'] as $clone => $clone_details)
  46.                 {
  47.                     $node = "\t<$element";
  48.                     foreach($clone_details as $attribute => $deffinition)
  49.                     {
  50.                         $node .= "\n\t\t" . $attribute . '="' . $deffinition['value'] . '"';
  51.                     }
  52.                     $xml .= "$node />\n";
  53.                 }
  54.             }
  55.         }
  56.         $this -> theme_descriptor = str_replace(
  57.             Array('{VERSION}', '{THEME_NAME}', '{ELEMENTS}'),
  58.             Array($this -> theme['version'], $this -> theme['name'], $xml),
  59.             $this -> descriptor_template
  60.         );
  61.         return $this -> theme_descriptor;
  62.     }
  63.     
  64.     function set_element($element, $attributes)
  65.     {
  66.         if( ! array_key_exists($element, $this -> theme_elements)
  67.             or
  68.             ! is_array($attributes))
  69.         {
  70.             return false;
  71.         }
  72.         $this -> theme_elements[$element]['inuse'] = true;
  73.         if($this -> theme_elements[$element]['repeatable'])
  74.         {
  75.             $clone_id = count($this -> theme_elements[$element]['clones']);
  76.             foreach($attributes as $attribute => $value)
  77.             {
  78.                 if( ! array_key_exists($attribute, $this -> theme_elements[$element]['attributes']))
  79.                 {
  80.                     continue;
  81.                 }
  82.                 if($this -> theme_elements[$element]['attributes'][$attribute]['isfile'])
  83.                 {
  84.                     if( ! $this -> update_files($value))
  85.                     {
  86.                         if($clone_id < count($this -> theme_elements[$element]['clones']))
  87.                         {
  88.                             array_pop($this -> theme_elements[$element]['clones']);
  89.                             if($clone_id == 0)
  90.                             {
  91.                                 $this -> theme_elements[$element]['inuse'] = false;
  92.                             }
  93.                         }
  94.                         return false;
  95.                     }
  96.                     $value = $this -> sanitized_filename($value);
  97.                 }
  98.                 $this -> theme_elements[$element]['clones'][$clone_id][$attribute]['value'] = utf8_encode($value);
  99.             }
  100.         }
  101.         else
  102.         {
  103.             foreach($attributes as $attribute => $value)
  104.             {
  105.                 if( ! array_key_exists($attribute, $this -> theme_elements[$element]['attributes']))
  106.                 {
  107.                     continue;
  108.                 }
  109.                 if($this -> theme_elements[$element]['attributes'][$attribute]['isfile'])
  110.                 {
  111.                     if( ! $this -> update_files($value))
  112.                     {
  113.                         $this -> theme_elements[$element]['inuse'] = false;
  114.                         return false;
  115.                     }
  116.                     $value = $this -> sanitized_filename($value);
  117.                 }
  118.                 $this -> set_elements_attribute($element, $attribute, $value);
  119.             }
  120.         }
  121.         return true;
  122.     }
  123.     function set_elements_attribute($element, $attribute, $value)
  124.     {
  125.         if( ! array_key_exists($attribute, $this -> theme_elements[$element]['attributes']))
  126.         {
  127.             return false;
  128.         }
  129.         $this -> theme_elements[$element]['attributes'][$attribute]['value'] = utf8_encode($value);
  130.         return true;
  131.     }
  132. // Packaging
  133.     function packaged()
  134.     {
  135.         $zip = new zipfile();
  136.         $zip -> add_file($this -> get_theme_descriptor(), 'theme_descriptor.xml');
  137.         
  138.         foreach($this -> file_list as $a_file)
  139.         {
  140.             $file_handle = fopen($a_file, 'rb');
  141.             $file_data = fread($file_handle, filesize($a_file));
  142.             fclose($file_handle);
  143.             $zip -> add_file($file_data, $this -> sanitized_filename($a_file));
  144.         }
  145.         
  146.         return $zip -> file();
  147.     }
  148. }
  149. class s40theme1_1 extends s40theme
  150. {
  151. // Available Menu Items
  152.     var $menu_items = Array(
  153.         'callregister','settings','organizer','gallery','services','media','applications',
  154.         'contacts','simatk','push_to_talk','wireless_village','number_entry','messages',
  155.         'goto','amsmessages','default'
  156.     );
  157.     function s40theme1_1()
  158.     {
  159.         $this -> set_version('1.1');
  160.         $this -> theme_elements = Array(
  161.             'background' => Array(
  162.                 'inuse' => false,
  163.                 'repeatable' => false,
  164.                 'attributes' => Array(
  165.                     'src' => Array('isfile' => true, 'value' => false)
  166.                 )
  167.             ),
  168.             'background-mini' => Array(
  169.                 'inuse' => false,
  170.                 'repeatable' => false,
  171.                 'attributes' => Array(
  172.                     'src' => Array('isfile' => true, 'value' => false)
  173.                 )
  174.             ),
  175.             'colorscheme' => Array(
  176.                 'inuse' => false,
  177.                 'repeatable' => false,
  178.                 'attributes' => Array(
  179.                     'color' => Array('isfile' => false, 'value' => false)
  180.                 )
  181.             ),
  182.             'icon' => Array(
  183.                 'inuse' => false,
  184.                 'repeatable' => true,
  185.                 'clones' => Array(),
  186.                 'attributes' => Array(
  187.                     'src' => Array('isfile' => true),
  188.                     'item_id' => Array('isfile' => false),
  189.                     'size' => Array('isfile' => false),
  190.                 )
  191.             ),
  192.             'ringtone' => Array(
  193.                 'inuse' => false,
  194.                 'repeatable' => false,
  195.                 'attributes' => Array(
  196.                     'src' => Array('isfile' => true, 'value' => false)
  197.                 )
  198.             ),
  199.             'screensaver' => Array(
  200.                 'inuse' => false,
  201.                 'repeatable' => false,
  202.                 'attributes' => Array(
  203.                     'src' => Array('isfile' => true, 'value' => false)
  204.                 )
  205.             ),
  206.             'wallpaper' => Array(
  207.                 'inuse' => false,
  208.                 'repeatable' => false,
  209.                 'attributes' => Array(
  210.                     'src' => Array('isfile' => true, 'value' => false)
  211.                 )
  212.             ),
  213.             'colorscheme-mini' => Array(
  214.                 'inuse' => false,
  215.                 'repeatable' => false,
  216.                 'attributes' => Array(
  217.                     'color' => Array('isfile' => false, 'value' => false)
  218.                 )
  219.             ),
  220.             'wallpaper-mini' => Array(
  221.                 'inuse' => false,
  222.                 'repeatable' => false,
  223.                 'attributes' => Array(
  224.                     'src' => Array('isfile' => true, 'value' => false)
  225.                 )
  226.             )
  227.         );
  228.     }
  229. }
  230. class s40theme2_0 extends s40theme
  231. {
  232.     function s40theme2_0()
  233.     {
  234.         $this -> set_version('2.0');
  235.         $this -> theme_elements = Array(
  236.             'colors' => Array(
  237.                 'inuse' => false,
  238.                 'repeatable' => true,
  239.                 'clones' => Array(),
  240.                 'attributes' => Array(
  241.                     'display' => Array('isfile' => false, 'value' => false),
  242.                     'header_font_color' => Array('isfile' => false, 'value' => false),
  243.                     'status_area_font_color' => Array('isfile' => false, 'value' => false),
  244.                     'softkey_font_color' => Array('isfile' => false, 'value' => false),
  245.                     'calendar_highlight_color' => Array('isfile' => false, 'value' => false),
  246.                     'idle_font_color' => Array('isfile' => false, 'value' => false),
  247.                     'active_idle_active_font_color' => Array('isfile' => false, 'value' => false),
  248.                     'active_idle_content_background_color' => Array('isfile' => false, 'value' => false),
  249.                     'shortcut_bar_popup_font_color' => Array('isfile' => false, 'value' => false),
  250.                     'shortcut_bar_popup_background_color' => Array('isfile' => false, 'value' => false),
  251.                     'menu_font_color' => Array('isfile' => false, 'value' => false),
  252.                     'menu_highlight_font_color' => Array('isfile' => false, 'value' => false),
  253.                     'grid_menu_font_color' => Array('isfile' => false, 'value' => false),
  254.                     'grid_menu_highlight_font_color' => Array('isfile' => false, 'value' => false),
  255.                     'reorder_highlight_font_color' => Array('isfile' => false, 'value' => false),
  256.                     'grid_highlight_color' => Array('isfile' => false, 'value' => false),
  257.                     'reorder_highlight_color' => Array('isfile' => false, 'value' => false)
  258.                 )
  259.             ),
  260.             'menu_item' => Array(
  261.                 'inuse' => false,
  262.                 'repeatable' => true,
  263.                 'clones' => Array(),
  264.                 'attributes' => Array(
  265.                     'item_id' => Array('isfile' => false, 'value' => false),
  266.                     'list_view_icon' => Array('isfile' => true, 'value' => false),
  267.                     'grid_view_icon' => Array('isfile' => true, 'value' => false),
  268.                     'animating_grid' => Array('isfile' => true, 'value' => false),
  269.                     'app_specific_bg' => Array('isfile' => true, 'value' => false)
  270.                 )
  271.             ),
  272.             'wallpaper' => Array(
  273.                 'inuse' => false,
  274.                 'repeatable' => false,
  275.                 'attributes' => Array(
  276.                     'main_display_graphics' => Array('isfile' => true, 'value' => false),
  277.                     'second_display_graphics' => Array('isfile' => true, 'value' => false)
  278.                 )
  279.             ),
  280.             'screensaver' => Array(
  281.                 'inuse' => false,
  282.                 'repeatable' => false,
  283.                 'attributes' => Array(
  284.                     'main_display_graphics' => Array('isfile' => true, 'value' => false),
  285.                     'second_display_graphics' => Array('isfile' => true, 'value' => false)
  286.                 )
  287.             ),
  288.             'background' => Array(
  289.                 'inuse' => false,
  290.                 'repeatable' => false,
  291.                 'attributes' => Array(
  292.                     'main_default_bg' => Array('isfile' => true, 'value' => false),
  293.                     'second_default_bg' => Array('isfile' => true, 'value' => false),
  294.                     'grid_menu_bg' => Array('isfile' => true, 'value' => false),
  295.                     'note_bg' => Array('isfile' => true, 'value' => false)
  296.                 )
  297.             ),
  298.             'radio_audio_bg' => Array(
  299.                 'inuse' => false,
  300.                 'repeatable' => false,
  301.                 'attributes' => Array(
  302.                     'radio_bg' => Array('isfile' => true, 'value' => false),
  303.                     'audio_bg' => Array('isfile' => true, 'value' => false)
  304.                 )
  305.             ),
  306.             'softkey_bg' => Array(
  307.                 'inuse' => false,
  308.                 'repeatable' => false,
  309.                 'attributes' => Array(
  310.                     'left' => Array('isfile' => true, 'value' => false),
  311.                     'middle' => Array('isfile' => true, 'value' => false),
  312.                     'right' => Array('isfile' => true, 'value' => false)
  313.                 )
  314.             ),
  315.             'wait_graphics' => Array(
  316.                 'inuse' => false,
  317.                 'repeatable' => false,
  318.                 'attributes' => Array(
  319.                     'src' => Array('isfile' => true, 'value' => false)
  320.                 )
  321.             ),
  322.             'highlight' => Array(
  323.                 'inuse' => false,
  324.                 'repeatable' => false,
  325.                 'attributes' => Array(
  326.                     'tab' => Array('isfile' => true, 'value' => false),
  327.                     'list' => Array('isfile' => true, 'value' => false),
  328.                     'grid' => Array('isfile' => true, 'value' => false),
  329.                     'active_idle_row' => Array('isfile' => true, 'value' => false),
  330.                     'active_idle_shortcut_bar' => Array('isfile' => true, 'value' => false),
  331.                     'reorder' => Array('isfile' => true, 'value' => false)
  332.                 )
  333.             ),
  334.             'tones' => Array(
  335.                 'inuse' => false,
  336.                 'repeatable' => false,
  337.                 'attributes' => Array(
  338.                     'ringtone' => Array('isfile' => true, 'value' => false),
  339.                     'msg_alert' => Array('isfile' => true, 'value' => false),
  340.                     'cal_alert' => Array('isfile' => true, 'value' => false)
  341.                 )
  342.             ),
  343.             'startup' => Array(
  344.                 'inuse' => false,
  345.                 'repeatable' => false,
  346.                 'attributes' => Array(
  347.                     'main_display_graphics' => Array('isfile' => true, 'value' => false),
  348.                     'second_display_graphics' => Array('isfile' => true, 'value' => false),
  349.                     'tone' => Array('isfile' => true, 'value' => false)
  350.                 )
  351.             ),
  352.             'shutdown' => Array(
  353.                 'inuse' => false,
  354.                 'repeatable' => false,
  355.                 'attributes' => Array(
  356.                     'main_display_graphics' => Array('isfile' => true, 'value' => false),
  357.                     'second_display_graphics' => Array('isfile' => true, 'value' => false),
  358.                     'tone' => Array('isfile' => true, 'value' => false)
  359.                 )
  360.             ),
  361.             'transformation_open' => Array(
  362.                 'inuse' => false,
  363.                 'repeatable' => false,
  364.                 'attributes' => Array(
  365.                     'main_display_graphics' => Array('isfile' => true, 'value' => false),
  366.                     'second_display_graphics' => Array('isfile' => true, 'value' => false),
  367.                     'tone' => Array('isfile' => true, 'value' => false)
  368.                 )
  369.             ),
  370.             'transformation_close' => Array(
  371.                 'inuse' => false,
  372.                 'repeatable' => false,
  373.                 'attributes' => Array(
  374.                     'main_display_graphics' => Array('isfile' => true, 'value' => false),
  375.                     'second_display_graphics' => Array('isfile' => true, 'value' => false),
  376.                     'tone' => Array('isfile' => true, 'value' => false)
  377.                 )
  378.             )
  379.         );
  380.     }
  381. }
  382. ?>
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

Example usage

Code: [ Select ]
<?php
    include("nokia-s40theme.php");
    
    $theme_name = 'Silky Smooth';

    $theme = new s40theme1_1();
    $theme -> set_name($theme_name);
            
    $theme -> set_element('ringtone', Array(
        'src' => 'Enigmate-Asim_Kha-2032.mp3'));
        
    $theme -> set_element('wallpaper', Array(
        'src' => 'wallpaper.png'));
    $theme -> set_element('wallpaper-mini', Array(
        'src' => 'wallpaper-mini.png'));
    
    $theme -> set_element('background', Array(
        'src' => 'wallpaper.png'));
    $theme -> set_element('background-mini', Array(
        'src' => 'wallpaper-mini.png'));
    
    $theme -> set_element('colorscheme', Array(
        'color' => 'blue'));
    $theme -> set_element('colorscheme-mini', Array(
        'color' => 'blue'));
    
    $theme -> set_element('screensaver', Array(
        'src' => 'screensaver.gif'));
    
    $menu_items = Array('callregister','settings','organizer','gallery','media','applications','contacts','wireless_village','messages','amsmessages','services');
    
    foreach($menu_items as $icon){
        $theme -> set_element('icon', Array(
            'src' => "icons/$icon.png",
            'item_id' => $icon,
            'size' => 'small'));
        $theme -> set_element('icon', Array(
            'src' => "icons/$icon.png",
            'item_id' => $icon,
            'size' => 'large'));
    }
    
    
    ob_start();
    $package = $theme -> packaged();
    $package_size = strlen($package);
    header('Last-Modified: '.date('r'));
    header('Accept-Ranges: bytes');
    header('Content-Length: ' . $package_size);
    header('Content-Type: application/vnd.nok-s40theme');
    header('Content-Disposition: attachment; filename="' . $theme_name . '.nth"');
    print($package);
    ob_end_flush();

?>
  1. <?php
  2.     include("nokia-s40theme.php");
  3.     
  4.     $theme_name = 'Silky Smooth';
  5.     $theme = new s40theme1_1();
  6.     $theme -> set_name($theme_name);
  7.             
  8.     $theme -> set_element('ringtone', Array(
  9.         'src' => 'Enigmate-Asim_Kha-2032.mp3'));
  10.         
  11.     $theme -> set_element('wallpaper', Array(
  12.         'src' => 'wallpaper.png'));
  13.     $theme -> set_element('wallpaper-mini', Array(
  14.         'src' => 'wallpaper-mini.png'));
  15.     
  16.     $theme -> set_element('background', Array(
  17.         'src' => 'wallpaper.png'));
  18.     $theme -> set_element('background-mini', Array(
  19.         'src' => 'wallpaper-mini.png'));
  20.     
  21.     $theme -> set_element('colorscheme', Array(
  22.         'color' => 'blue'));
  23.     $theme -> set_element('colorscheme-mini', Array(
  24.         'color' => 'blue'));
  25.     
  26.     $theme -> set_element('screensaver', Array(
  27.         'src' => 'screensaver.gif'));
  28.     
  29.     $menu_items = Array('callregister','settings','organizer','gallery','media','applications','contacts','wireless_village','messages','amsmessages','services');
  30.     
  31.     foreach($menu_items as $icon){
  32.         $theme -> set_element('icon', Array(
  33.             'src' => "icons/$icon.png",
  34.             'item_id' => $icon,
  35.             'size' => 'small'));
  36.         $theme -> set_element('icon', Array(
  37.             'src' => "icons/$icon.png",
  38.             'item_id' => $icon,
  39.             'size' => 'large'));
  40.     }
  41.     
  42.     
  43.     ob_start();
  44.     $package = $theme -> packaged();
  45.     $package_size = strlen($package);
  46.     header('Last-Modified: '.date('r'));
  47.     header('Accept-Ranges: bytes');
  48.     header('Content-Length: ' . $package_size);
  49.     header('Content-Type: application/vnd.nok-s40theme');
  50.     header('Content-Disposition: attachment; filename="' . $theme_name . '.nth"');
  51.     print($package);
  52.     ob_end_flush();
  53. ?>
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

If you generate themes & save them to files rather than serve them immediately as in the example, & you're also using Apache, it's worth sticking this following code in an .htaccess file so the server sends the right mime-type.
Nokia phones are kinda picky about that & will save a *.nth file as a *.txt file if it doesn't get the right mime-type.

Code: [ Select ]
AddType application/vnd.nok-s40theme .nth
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

Excellent resource for Flash lite in 3rd Edition s40 themes.
http://www.adobe.com/devnet/devices/art ... print.html
  • pmoch
  • Born
  • Born
  • pmoch
  • Posts: 1

Post 3+ Months Ago

Que tal,
I have a problem and can not find answers anywhere. I've been testing and modifying themes for a nokia 6085. All items listed as S40 v2, and programming as it is described at the beginning. I could modify and make all sections of the topic but one startup.

For some reason the startup is not working, either in subjects or downloaded from the network in which I edit in etmas down some missing lines in the startup and shutdown as the second graph, and without this sequence does not work lina. But even so the startup has not worked and I can not find the answer to that is not working.

You can help me with that?

Thanks in advance.

Post Information

  • Total Posts in this topic: 12 posts
  • Users browsing this forum: No registered users and 111 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.