Changeset 3515


Ignore:
Timestamp:
09/03/13 14:08:29 (11 years ago)
Author:
mwindhouwer
Message:

M various/import/csv2dcif.xsl

  • understand some more colums

-- definition-source
-- access-date

M mod-ISOcat-access-data/access/dc_touch.acc
M mod-ISOcat-access-data/access/dc_hug.acc

  • if dir is not specified the default is down, unless the DC is a simple one then hug both up (super simple DCs and closed DCs) and down (sub simple DCs)

M mod-ISOcat-manage-system/manage/import.acc

  • turn a user login into an id
Location:
cats/ISOcat/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cats/ISOcat/trunk/mod-ISOcat-access-data/access/dc_hug.acc

    r2724 r3515  
    2525                        <param/>
    2626                        <default>
    27                                 <string>down</string>
     27                                <string/>
    2828                        </default>
    2929                </source>
     
    161161                                                        <xsl:param name="what"/>
    162162                                                        <xsl:param name="id"/>
     163                                                        <xsl:param name="dir"/>
    163164                                                        <instr>
    164165                                                                <type>ISOcat.access.data.<xsl:value-of select="$what"/>.touch</type>
     
    175176                                                                <dir>
    176177                                                                        <string>
    177                                                                                 <xsl:value-of select="$dir"/>
     178                                                                                <xsl:value-of select="if ($dir='') then ('down') else ($dir)"/>
    178179                                                                        </string>
    179180                                                                </dir>
     
    183184                                                <xsl:template match="super">
    184185                                                        <xsl:comment>touch the super simple DC[<xsl:call-template name="dc-name"/>]</xsl:comment>
    185                                                         <xsl:copy-of select="isocat:touch('dc',@dc)"/>
     186                                                        <xsl:copy-of select="isocat:touch('dc',@dc,$dir)"/>
    186187                                                </xsl:template>
    187188                                                <xsl:template match="domain">
    188                                                         <xsl:if test="$dir='up'">
     189                                                        <xsl:if test="$dir='up' or ($dir='' and /dc/@type='simple')">
    189190                                                                <xsl:comment>touch the domain complex DC[<xsl:call-template name="dc-name"/>]</xsl:comment>
    190                                                                 <xsl:copy-of select="isocat:touch('dc',@dc)"/>
     191                                                                <xsl:copy-of select="isocat:touch('dc',@dc,'up')"/>
    191192                                                        </xsl:if>
    192193                                                </xsl:template>
    193194                                                <xsl:template match="value">
    194                                                         <xsl:if test="$dir='down'">
     195                                                        <xsl:if test="$dir=('','down')">
    195196                                                                <xsl:comment>touch the value simple DC[<xsl:call-template name="dc-name"/>]</xsl:comment>
    196                                                                 <xsl:copy-of select="isocat:touch('dc',@dc)"/>
     197                                                                <xsl:copy-of select="isocat:touch('dc',@dc,'down')"/>
    197198                                                        </xsl:if>
    198199                                                </xsl:template>
    199200                                                <xsl:template match="profile">
    200201                                                        <xsl:comment>touch the profile[<xsl:value-of select="@name"/>]</xsl:comment>
    201                                                         <xsl:copy-of select="isocat:touch('profile',@ref)"/>
     202                                                        <xsl:copy-of select="isocat:touch('profile',@ref,$dir)"/>
    202203                                                </xsl:template>
    203204                                                <xsl:template match="dcs">
    204205                                                        <xsl:comment>touch the DCS[<xsl:value-of select="@name"/>]</xsl:comment>
    205                                                         <xsl:copy-of select="isocat:touch('dcs',@ref)"/>
     206                                                        <xsl:copy-of select="isocat:touch('dcs',@ref,$dir)"/>
    206207                                                </xsl:template>
    207208                                                <xsl:template match="/">
  • cats/ISOcat/trunk/mod-ISOcat-access-data/access/dc_touch.acc

    r3458 r3515  
    1 <accessor debug="true">
     1<accessor debug="false">
    22        <name>ISOcat.access.data.dc.touch</name>
    33        <descr>Touch a DC.</descr>
     
    2525                        <param/>
    2626                        <default>
    27                                 <string>down</string>
     27                                <string/>
    2828                        </default>
    2929                </source>
     
    106106                                <dc>var:dc</dc>
    107107                                <check>var:check</check>
     108                                <dir>var:dir</dir>
    108109                                <target>var:void</target>
    109110                        </instr>
  • cats/ISOcat/trunk/mod-ISOcat-manage-system/manage/import.acc

    r2584 r3515  
    3636        </param>
    3737        <param>
     38                <name>owner</name>
     39                <descr>user id</descr>
     40                <type canonical="true">string</type>
     41                <source>
     42                        <nvp/>
     43                        <default>
     44                                <string/>
     45                        </default>
     46                </source>
     47        </param>
     48        <param>
    3849                <name>external</name>
    3950                <descr>external DCs</descr>
     
    128139                                <!-- lookup the owner id -->
    129140                                <instr>
     141                                        <type>ISOcat.access.data.user.id</type>
     142                                        <user>var:owner</user>
     143                                        <target>var:owner</target>
     144                                </instr>
     145                                <instr>
    130146                                        <type>sloot.xquery</type>
    131147                                        <operator>
    132                                                 <xquery>
    133                                                         declare variable $params as node() external;
    134                                                         &lt;sql>
    135                                                                 SELECT
    136                                                                         view_owner.id,
    137                                                                         name,
    138                                                                         login,
    139                                                                         CASE
    140                                                                                 WHEN (login IS NULL)
    141                                                                                 THEN 'TDG'
    142                                                                                 ELSE 'user'
    143                                                                         END AS type
    144                                                                 FROM
    145                                                                         view_owner
    146                                                                 LEFT JOIN
    147                                                                         core_user
    148                                                                 ON
    149                                                                         view_owner.id = core_user.id
    150                                                                 WHERE
    151                                                                         view_owner.id = {string($params//owner)}
    152                                                         ;
    153                                                         &lt;/sql>
    154                                                 </xquery>
    155                                         </operator>
    156                                         <params>var:params</params>
     148                                                <sql>
     149                                                        SELECT
     150                                                                view_owner.id,
     151                                                                name,
     152                                                                login,
     153                                                                CASE
     154                                                                        WHEN (login IS NULL)
     155                                                                        THEN 'TDG'
     156                                                                        ELSE 'user'
     157                                                                END AS type
     158                                                        FROM
     159                                                                view_owner
     160                                                        LEFT JOIN
     161                                                                core_user
     162                                                        ON
     163                                                                view_owner.id = core_user.id
     164                                                        WHERE
     165                                                                view_owner.id = {string($owner)}
     166                                                ;
     167                                                </sql>
     168                                        </operator>
     169                                        <owner>var:owner</owner>
    157170                                        <target>var:sql</target>
    158171                                </instr>
  • cats/ISOcat/trunk/various/import/csv2dcif.xsl

    r2029 r3515  
    273273                                <xsl:otherwise>
    274274                                    <xsl:message>WRN: multiple columns for definition in a language section, will use only the first one!</xsl:message>
     275                                </xsl:otherwise>
     276                            </xsl:choose>
     277                        </xsl:for-each>
     278                        <xsl:for-each select="dcif:colLookups($ss,('definition source'),(),$row)[. ge $col][. lt $nxt]">
     279                            <xsl:choose>
     280                                <xsl:when test="position() eq 1">
     281                                    <definition-source col="{.}"/>
     282                                </xsl:when>
     283                                <xsl:otherwise>
     284                                    <xsl:message>WRN: multiple columns for definition source in a language section, will use only the first one!</xsl:message>
     285                                </xsl:otherwise>
     286                            </xsl:choose>
     287                        </xsl:for-each>
     288                        <xsl:for-each select="dcif:colLookups($ss,('access date'),(),$row)[. ge $col][. lt $nxt]">
     289                            <xsl:choose>
     290                                <xsl:when test="position() eq 1">
     291                                    <access-date col="{.}"/>
     292                                </xsl:when>
     293                                <xsl:otherwise>
     294                                    <xsl:message>WRN: multiple columns for access date in a language section, will use only the first one!</xsl:message>
    275295                                </xsl:otherwise>
    276296                            </xsl:choose>
     
    491511                                        <dcif:source>
    492512                                            <xsl:choose>
     513                                                <xsl:when test="not(normalize-space($lang/definition-source/@col)=('','UNK'))">
     514                                                    <xsl:variable name="src" select="normalize-space($line/value[f:int($lang/definition-source/@col)])"/>
     515                                                    <xsl:if test="$src!=''">
     516                                                        <xsl:value-of select="$src"/>
     517                                                        <xsl:if test="not(normalize-space($lang/access-date/@col)=('','UNK'))">
     518                                                            <xsl:variable name="access" select="normalize-space($line/value[f:int($lang/access-date/@col)])"/>
     519                                                            <xsl:if test="$access!=''">
     520                                                                <xsl:text> (</xsl:text>
     521                                                                <xsl:value-of select="$access"/>
     522                                                                <xsl:text>)</xsl:text>
     523                                                            </xsl:if>
     524                                                        </xsl:if>
     525                                                    </xsl:if>
     526                                                </xsl:when>
    493527                                                <xsl:when test="not(normalize-space($map/source)=('','UNK'))">
    494528                                                    <xsl:value-of select="$map/source"/>
Note: See TracChangeset for help on using the changeset viewer.