contentstorage/castorage/conf/castoragedb_templates/castoragedb_variant.sql
changeset 107 b34d53f6acdf
parent 106 e78d6e055a5b
child 116 305818acdca4
equal deleted inserted replaced
106:e78d6e055a5b 107:b34d53f6acdf
     1 SELECT "------------------------------------" AS " ";
     1 SELECT "------------------------------------" AS " ";
     2 SELECT "castoragedb_variant - BEGIN" AS " ";
     2 SELECT "castoragedb_variant - BEGIN" AS " ";
     3 
     3 
       
     4 {% for col in range(feat_tree.CaStorageDbSetting.OperatorCollections._value|length) -%}
       
     5     {%- set Name = feat_tree.CaStorageDbSetting.OperatorCollections.Name._value[col] or '' -%}
       
     6     {%- set ShortName = feat_tree.CaStorageDbSetting.OperatorCollections.ShortName._value[col] or '' -%}
       
     7     {%- set TitleName = feat_tree.CaStorageDbSetting.OperatorCollections.TitleName._value[col] or '' -%}
       
     8     {%- set GroupName = feat_tree.CaStorageDbSetting.OperatorCollections.GroupName._value[col] or '' -%}
       
     9     {%- set Locked = feat_tree.CaStorageDbSetting.OperatorCollections.Locked._value[col] or false -%}
       
    10     {%- set IconFileName = ( feat_tree.CaStorageDbSetting.OperatorCollections.Icon.localPath._value[col] or '' ) -%}
       
    11     {%- set IconSkinId = feat_tree.CaStorageDbSetting.OperatorCollections.IconSkinId._value[col] or '' -%}
       
    12     {% if IconSkinId == "" and IconFileName != "" and IconFileName != "dummy" -%}
       
    13         {% set IconFileName = "z:\\private\\20022F35\\customsvg\\" + IconFileName %}
       
    14     {% endif %}
       
    15 INSERT INTO COLLECTION (COLLECTION_NAME, COL_APP_GROUP_NAME, FLAGS {% if TitleName -%},  COL_TITLE_NAME{%- endif %} {% if ShortName -%}, COL_SHORT_NAME{%- endif %}, ICON_FILENAME, ICON_SKIN_ID) 
       
    16 VALUES ( '{{Name}}', '{{GroupName}}', {% if Locked -%} 12 {% else %} 8 {%- endif %} {% if TitleName -%}, "{{TitleName}}"{%- endif %} {% if ShortName -%}, "{{ShortName}}"{%- endif %}, "{{IconFileName}}", "{{IconSkinId}}");
       
    17 {% endfor %}
       
    18 
       
    19 {% for i in range(feat_tree.CaStorageDbSetting.OperatorURLs._value|length) -%}
       
    20     {% set URLTitle = feat_tree.CaStorageDbSetting.OperatorURLs.OperatorURLTitle._value[i] %}
       
    21     {%- set URLShortTitle = feat_tree.CaStorageDbSetting.OperatorURLs.OperatorURLShortTitle._value[i] or '' -%}
       
    22     {%- set URL = feat_tree.CaStorageDbSetting.OperatorURLs.OperatorURL._value[i] or '' -%}
       
    23     {%- set URLIcon = feat_tree.CaStorageDbSetting.OperatorURLs.OperatorURLIcon.localPath._value[i] or '' -%}
       
    24     {%- set IconSkinId = feat_tree.CaStorageDbSetting.OperatorURLs.IconSkinId._value[i] or '' -%}
       
    25     {% if IconSkinId == "" and URLIcon != "" and URLIcon != "dummy" -%}
       
    26         {% set URLIcon = "z:\\private\\20022F35\\customsvg\\" + URLIcon %}
       
    27     {% endif %}
       
    28     INSERT INTO URL ( URL_TITLE {% if URLShortTitle -%}, URL_SHORT_TITLE{%- endif %}, URL_DEST, ICON_FILENAME, ICON_SKIN_ID )
       
    29     VALUES ('{{URLTitle}}' {% if URLShortTitle -%}, "{{URLShortTitle}}"{%- endif %}, "{{URL}}", "{{URLIcon}}", "{{IconSkinId}}" );
       
    30 {% endfor %}
       
    31 
       
    32 {% for index in range(feat_tree.CaStorageDbSetting.OperatorCollectionItems._value|length) -%}
       
    33     {% set Collection = feat_tree.CaStorageDbSetting.OperatorCollections.Name._value[0] %}
       
    34     {%- set Type = feat_tree.CaStorageDbSetting.OperatorCollectionItems.Type._value[index] or '' -%}
       
    35     {%- set Application = feat_tree.CaStorageDbSetting.OperatorCollectionItems.Application._value[index] or '' -%}
       
    36     {%- set OperatorURLTitle = feat_tree.CaStorageDbSetting.OperatorCollectionItems.OperatorURL._value[index] or '' -%}
       
    37     {%- set HomescreenWidget = feat_tree.CaStorageDbSetting.OperatorCollectionItems.HomescreenWidget._value[index] or '' -%}
       
    38 {% if Type == "1" -%} INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
       
    39   VALUES ("application", '', {{Application}},  '{{Collection}}' );{%- endif %}
       
    40 {% if Type == "3" -%}
       
    41   {% for i in range(feat_tree.CaStorageDbSetting.OperatorURLs._value|length) if OperatorURLTitle == feat_tree.CaStorageDbSetting.OperatorURLs.OperatorURLTitle._value[i] -%}
       
    42     INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, COLLECTION_NAME)
       
    43     VALUES ( "url", '{{OperatorURLTitle}}',  '{{Collection}}' );
       
    44   {% endfor %}
       
    45 {%- endif %}
       
    46 {% if Type == "2" -%} INSERT INTO WIDGET_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ICON_FILENAME, ICON_SKIN_ID, URI, COLLECTION_NAME ) 
       
    47   VALUES ("widget", '', '', '', "{{HomescreenWidget}}", '{{Collection}}' ); {%- endif %}
       
    48 {% endfor %}
       
    49 
     4 {% for col in range(feat_tree.CaStorageDbSetting.Collections._value|length) -%}
    50 {% for col in range(feat_tree.CaStorageDbSetting.Collections._value|length) -%}
     5     {%- set Name = feat_tree.CaStorageDbSetting.Collections.Name._value[col] or '' -%}
    51     {%- set Name = feat_tree.CaStorageDbSetting.Collections.Name._value[col] or '' -%}
     6     {%- set ColShortName = feat_tree.CaStorageDbSetting.Collections.ColShortName._value[col] or '' -%}
    52     {% set LocalizeNames = feat_tree.CaStorageDbSetting.Collections.LocalizeNames._value[col] or false -%}
     7     {%- set ColTitleName = feat_tree.CaStorageDbSetting.Collections.ColTitleName._value[col] or '' -%}
    53     {%- set ShortName = feat_tree.CaStorageDbSetting.Collections.ShortName._value[col] or '' -%}
       
    54     {%- set TitleName = feat_tree.CaStorageDbSetting.Collections.TitleName._value[col] or '' -%}
     8     {%- set GroupName = feat_tree.CaStorageDbSetting.Collections.GroupName._value[col] or '' -%}
    55     {%- set GroupName = feat_tree.CaStorageDbSetting.Collections.GroupName._value[col] or '' -%}
     9     {%- set Flags = feat_tree.CaStorageDbSetting.Collections.Flags._value[col] or '' -%}
    56     {%- set Locked = feat_tree.CaStorageDbSetting.Collections.Locked._value[col] or false -%}
    10     {%- set LocName = feat_tree.CaStorageDbSetting.Collections.LocName._value[col] or ''-%}
    57     {%- set TranslationFile = feat_tree.CaStorageDbSetting.Collections.TranslationFile._value[col]|string|reverse|replace('_','',1)|reverse+'_' or ''-%}
    11     {%- set IconFileName = feat_tree.CaStorageDbSetting.Collections.IconFileName._value[col] or '' -%}
    58     {%- set IconFileName = feat_tree.CaStorageDbSetting.Collections.Icon.localPath._value[col] or '' -%}
    12     {%- set IconSkinId = feat_tree.CaStorageDbSetting.Collections.IconSkinId._value[col] or '' -%}
    59     {%- set IconSkinId = feat_tree.CaStorageDbSetting.Collections.IconSkinId._value[col] or '' -%}
    13 INSERT INTO COLLECTION (COLLECTION_NAME, COL_APP_GROUP_NAME, FLAGS {% if ColTitleName -%},  COL_TITLE_NAME{%- endif %}{% if LocName -%},  COL_LOCNAME{%- endif %}{% if ColShortName -%}, COL_SHORT_NAME{%- endif %}{% if IconFileName -%}, ICON_FILENAME{%- endif %}{% if IconSkinId -%}, ICON_SKIN_ID{%- endif %}) 
    60     {% if IconSkinId == "" and IconFileName != "" and IconFileName != "dummy" -%}
    14 VALUES ( '{{Name}}', '{{GroupName}}', {{Flags}} {% if ColTitleName -%}, "{{ColTitleName}}"{%- endif %}{% if LocName -%}, "{{LocName}}"{%- endif %}{% if ColShortName -%}, "{{ColShortName}}"{%- endif %}{% if IconFileName -%}, "{{IconFileName}}"{%- endif %}{% if IconSkinId -%}, "{{IconSkinId}}"{%- endif %});
    61         {% set IconFileName = "z:\\private\\20022F35\\customsvg\\" + IconFileName %}
       
    62     {% endif %}
       
    63 INSERT INTO COLLECTION (COLLECTION_NAME, COL_APP_GROUP_NAME, FLAGS {% if TitleName -%},  COL_TITLE_NAME{%- endif %}{% if LocalizeNames -%},  TRANSLATION_FILE{%- endif %}{% if ShortName -%}, COL_SHORT_NAME{%- endif %}, ICON_FILENAME, ICON_SKIN_ID) 
       
    64 VALUES ( '{{Name}}', '{{GroupName}}', {% if Locked -%} 12 {% else %} 8 {%- endif %} {% if TitleName -%}, "{{TitleName}}"{%- endif %}{% if LocalizeNames -%}, "{{TranslationFile}}"{%- endif %}{% if ShortName -%}, "{{ShortName}}"{%- endif %}, "{{IconFileName}}", "{{IconSkinId}}");
       
    65 {% endfor %}
    15 
    66 
       
    67 {% for i in range(feat_tree.CaStorageDbSetting.URLs._value|length) -%}
       
    68     {% set URLTitle = feat_tree.CaStorageDbSetting.URLs.URLTitle._value[i] %}
       
    69     {%- set URLShortTitle = feat_tree.CaStorageDbSetting.URLs.URLShortTitle._value[i] or '' -%}
       
    70     {%- set URL = feat_tree.CaStorageDbSetting.URLs.URL._value[i] or '' -%}
       
    71     {%- set URLIcon = feat_tree.CaStorageDbSetting.URLs.URLIcon.localPath._value[i] or '' -%}
       
    72     {%- set IconSkinId = feat_tree.CaStorageDbSetting.URLs.IconSkinId._value[i] or '' -%}
       
    73     {% if IconSkinId == "" and URLIcon != "" and URLIcon != "dummy" -%}
       
    74         {% set URLIcon = "z:\\private\\20022F35\\customsvg\\" + URLIcon %}
       
    75     {% endif %}
       
    76     INSERT INTO URL ( URL_TITLE {% if URLShortTitle -%}, URL_SHORT_TITLE{%- endif %}, URL_DEST, ICON_FILENAME, ICON_SKIN_ID ) 
       
    77     VALUES ( '{{URLTitle}}' {% if URLShortTitle -%}, "{{URLShortTitle}}"{%- endif %}, "{{URL}}", "{{URLIcon}}", "{{IconSkinId}}" );
    16 {% endfor %}
    78 {% endfor %}
    17 
    79 
    18 {% for index in range(feat_tree.CaStorageDbSetting.Items._value|length) -%}
    80 {% for index in range(feat_tree.CaStorageDbSetting.Items._value|length) -%}
    19     {%- set Type = feat_tree.CaStorageDbSetting.Items.Type._value[index] or '' -%}
    81     {%- set Type = feat_tree.CaStorageDbSetting.Items.Type._value[index] or '' -%}
    20     {%- set Name = feat_tree.CaStorageDbSetting.Items.Name._value[index] or '' -%}
    82     {%- set Application = feat_tree.CaStorageDbSetting.Items.Application._value[index] or '' -%}
    21     {%- set IconFileName = feat_tree.CaStorageDbSetting.Items.IconFileName._value[index] or '' -%}
    83     {%- set URLTitle = feat_tree.CaStorageDbSetting.Items.URL._value[index] or '' -%}
    22     {%- set IconSkinId = feat_tree.CaStorageDbSetting.Items.IconSkinId._value[index] or '' -%}
    84     {%- set HomescreenWidget = feat_tree.CaStorageDbSetting.Items.HomescreenWidget._value[index] or '' -%}
    23     {%- set ShortName = feat_tree.CaStorageDbSetting.Items.ShortName._value[index] or '' -%}
    85     {%- set Collection = feat_tree.CaStorageDbSetting.Items.ColName._value[index] or '' -%}
    24     {%- set DestinationUid = feat_tree.CaStorageDbSetting.Items.DestinationUid._value[index] or '' -%}
    86 {% if Type == "1" -%} INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
    25     {%- set DestinationUrl = feat_tree.CaStorageDbSetting.Items.DestinationUrl._value[index] or '' -%}
    87   VALUES ("application", '', {{Application}},  '{{Collection}}' );{%- endif %}
    26     {%- set DestinationWidgetUri = feat_tree.CaStorageDbSetting.Items.DestinationWidgetUri._value[index] or '' -%}
    88 {% if Type == "3" -%}
    27     {%- set Collection = feat_tree.CaStorageDbSetting.Items.Col_Name._value[index] or '' -%}
    89   {% for i in range(feat_tree.CaStorageDbSetting.URLs._value|length) if URLTitle == feat_tree.CaStorageDbSetting.URLs.URLTitle._value[i] -%}
    28 {% if Type == "application" -%} INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ITEM_DEST, COLLECTION_NAME) 
    90     INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, COLLECTION_NAME)
    29   VALUES ("{{Type}}", '{{Name}}', {{DestinationUid}},  '{{Collection}}' );{%- endif %}
    91     VALUES ( "url", '{{URLTitle}}',  '{{Collection}}' );
    30 {% if Type == "url" -%} INSERT INTO ITEM_TO_COLLECTION (ITEM_TYPE, ITEM_NAME {% if ShortName -%}, ITEM_SHORTNAME{%- endif %}, ITEM_DEST, ICON_FILENAME, ICON_SKIN_ID, COLLECTION_NAME) 
    92   {% endfor %}
    31   VALUES ("{{Type}}", '{{Name}}' {% if ShortName -%}, "{{ShortName}}"{%- endif %}, "{{DestinationUrl}}", "{{IconFileName}}", "{{IconSkinId}}",  '{{Collection}}' ); {%- endif %}
    93 {%- endif %}
    32 {% if Type == "widget" -%} INSERT INTO WIDGET_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ICON_FILENAME, ICON_SKIN_ID, URI, COLLECTION_NAME ) 
    94 {% if Type == "2" -%} INSERT INTO WIDGET_TO_COLLECTION (ITEM_TYPE, ITEM_NAME, ICON_FILENAME, ICON_SKIN_ID, URI, COLLECTION_NAME ) 
    33   VALUES ("{{Type}}", '{{Name}}', "{{IconFileName}}", "{{IconSkinId}}", "{{DestinationWidgetUri}}", '{{Collection}}' ); {%- endif %}
    95   VALUES ("widget", '{{HomescreenWidget}}', '', '', "{{HomescreenWidget}}", '{{Collection}}' ); {%- endif %}
    34 {% endfor %}
    96 {% endfor %}
    35 
    97 
    36 SELECT "castoragedb_variant - END" AS " ";
    98 SELECT "castoragedb_variant - END" AS " ";
    37 SELECT "------------------------------------" AS " ";
    99 SELECT "------------------------------------" AS " ";
    38 
   100