Skip to content

Commit

Permalink
implement issue sassoftware#44 setting current folder as start
Browse files Browse the repository at this point in the history
Signed-off-by: Charter Li <[email protected]>
  • Loading branch information
tripleman11 committed Nov 15, 2024
1 parent 97de5f8 commit a818906
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 8 deletions.
1 change: 1 addition & 0 deletions sas/SASEnvironment/Files/localization/resources_de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
<string key="sasnavigatorFolderType">Ordner</string>
<string key="sasnavigatorStoredProcessType">Gespeicherter Prozess</string>
<string key="sasnavigatorReportType">Bericht</string>
<string key="sasnavigatorPathCheckbox">Setze den Anfangsordner auf den aktuell ausgewählten Ordner:</string>

<string key="portletEditNavigatorFolder">Ordner:</string>
<string key="portletEditNavigatorFolderRequired">FEHLER: Das Ordnerfeld ist erforderlich.</string>
Expand Down
1 change: 1 addition & 0 deletions sas/SASEnvironment/Files/localization/resources_en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
<string key="sasnavigatorFolderType">Folder</string>
<string key="sasnavigatorStoredProcessType">Stored Process</string>
<string key="sasnavigatorReportType">Report</string>
<string key="sasnavigatorPathCheckbox">Set the initial folder to the current selected folder:</string>

<string key="portletEditNavigatorFolder">Folder:</string>
<string key="portletEditNavigatorFolderRequired">ERROR: Folder field is required.</string>
Expand Down
1 change: 1 addition & 0 deletions sas/SASEnvironment/Files/localization/resources_ja.xml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
<string key="sasnavigatorFolderType">フォルダ</string>
<string key="sasnavigatorStoredProcessType">ストアドプロセス</string>
<string key="sasnavigatorReportType">報告</string>
<string key="sasnavigatorPathCheckbox">初期フォルダを現在選択されているフォルダに設定します:</string>

<string key="portletEditNavigatorFolder">フォルダ:</string>
<string key="portletEditNavigatorFolderRequired">エラー: フォルダー フィールドは必須です。</string>
Expand Down
27 changes: 25 additions & 2 deletions sas/SASEnvironment/Files/portlet/edit.sasnavigator.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<xsl:variable name="cancelButton" select="$localeXml/string[@key='cancelButton']/text()"/>
<xsl:variable name="portletEditNavigatorFolder" select="$localeXml/string[@key='portletEditNavigatorFolder']/text()"/>
<xsl:variable name="portletEditNavigatorFolderRequired" select="$localeXml/string[@key='portletEditNavigatorFolderRequired']/text()"/>
<xsl:variable name="sasnavigatorPathCheckbox" select="$localeXml/string[@key='sasnavigatorPathCheckbox']/text()"/>

<!-- Re-usable scripts -->

Expand Down Expand Up @@ -93,11 +94,21 @@
<td nowrap="">
<xsl:value-of select="$portletEditNavigatorFolder"/>
</td>
<td>&#160;</td>

<td class="celljustifyleft" nowrap="">
<input type="text" id="path" name="path" size="60"><xsl:attribute name="value"><xsl:value-of select="$portletPathFolder"/></xsl:attribute></input>
</td>
</tr>
<tr>
<td>&#160;</td>
<td>
<input type="checkbox" id="checkboxPath" name="checkboxPath"></input>
<label for="checkboxPath"><xsl:value-of select="$sasnavigatorPathCheckbox"/></label>
<label for="checkboxPath" id="labelPath"></label>

</td>
<td>&#160;</td>
</tr>
<tr>
<td nowrap="">
</td>
Expand All @@ -121,7 +132,7 @@
&#160;
</td>
<td>
<input class="button" type="submit" name="submit" onclick='if (validateForm()) return submitDisableAllForms(); else return false;'><xsl:attribute name="value"><xsl:value-of select="$saveButton"/></xsl:attribute></input>
<input class="button" type="submit" name="submit" onclick=' return onsubmitPath(); '><xsl:attribute name="value"><xsl:value-of select="$saveButton"/></xsl:attribute></input>
</td>
<td>
<input class="button" type="button" name="cancel" onclick="history.back()"><xsl:attribute name="value"><xsl:value-of select="$cancelButton"/></xsl:attribute></input>
Expand Down Expand Up @@ -150,6 +161,18 @@
<script>
var hasChanged=false;

document.getElementById('labelPath').textContent = localStorage.getItem("pathValue");

function onsubmitPath() {
if (validateForm()) {
var checkbox = document.getElementById('checkboxPath');
if (checkbox.checked) {
document.getElementById("path").value = localStorage.getItem("pathValue");
}

return submitDisableAllForms(); } else return false;
};

function setBooleanHidden(fldName) {
var checkboxField = document.getElementById(fldName);
var hiddenField = document.getElementById("selected" + fldName);
Expand Down
17 changes: 11 additions & 6 deletions sas/SASEnvironment/Files/portlet/render.sasnavigator.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<xsl:variable name="upOneLevel" select="replace($upOneLevelTemp,'//','/')"/>

<table border='0' cellspacing='0'>
<tr class='tableColumnHeaderRow'>
<tr class='tableColumnHeaderRow'>
<td class="none" nowrap='nowrap'><xsl:value-of select="$locationTitle"/>
<div class='dropdown'>
<button class='dropbtn'><img border='0'><xsl:attribute name="src" select="$folderNameImage"/></img><xsl:value-of select="$folderName"/></button>
Expand All @@ -114,15 +114,15 @@

<xsl:if test="$subFolderName">

<!-- Build the path for this parent folder -->
<!-- Build the path for this parent folder -->

<xsl:variable name="subFolderPathTemp">/<xsl:for-each select="$folderNames[position() &lt;= $currentDepth]"><xsl:if test="."><xsl:value-of select="."/>/</xsl:if></xsl:for-each></xsl:variable>
<xsl:variable name="subFolderPathTemp">/<xsl:for-each select="$folderNames[position() &lt;= $currentDepth]"><xsl:if test="."><xsl:value-of select="."/>/</xsl:if></xsl:for-each></xsl:variable>
<!-- depending on what syntax of path is passed in, we could end up with some double slashes in it, make sure
those are removed.
-->
<xsl:variable name="subFolderPath" select="replace($subFolderPathTemp,'//','/')"/>

<a><xsl:attribute name="href" select="concat($homeURL,$objectFilterEncoded,'&amp;_action=execute&amp;path=',$subFolderPath)"/>
<a><xsl:attribute name="href" select="concat($homeURL,$objectFilterEncoded,'&amp;_action=execute&amp;path=',$subFolderPath)"/>
<!-- indent for each layer of the path -->
<xsl:for-each select="1 to $currentDepth">&#160;</xsl:for-each>
<img border='0'><xsl:attribute name="src">/<xsl:value-of select="$sasthemeContextRoot"/>/themes/<xsl:value-of select="$sastheme"/>/images/Folder.gif</xsl:attribute></img>&#160;<xsl:value-of select="$subFolderName"/>
Expand Down Expand Up @@ -192,14 +192,19 @@
<xsl:variable name="folderMemberObject" select="$metadataContext/Multiple_Requests/GetMetadata[2]/Metadata/Tree"/>

<xsl:call-template name="listChildren">
<xsl:with-param name="childListParent" select="$folderMemberObject/Members"/>
<xsl:with-param name="childListParent" select="$folderMemberObject/Members"/>
</xsl:call-template>

</tbody>
</table>

</body>
<script >

var pathValue = "<xsl:value-of select='$path' />";
localStorage.setItem("pathValue", pathValue);

</script>
</xsl:template>

<xsl:template name="listChildren">
Expand Down Expand Up @@ -254,7 +259,7 @@
</xsl:variable>

<xsl:if test="not($childTypeString='')">

<xsl:if test="$path='/' and position()=1">
<tr>
<td><span><img style="vertical-align:baseline;" border="0">
Expand Down

0 comments on commit a818906

Please sign in to comment.