Changeset 21163 in main
- Timestamp:
- 07/28/20 18:47:02 (6 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ibisph-view/src/main/webapp/WEB-INF/config/spring/common.xml
r20981 r21163 608 608 </bean> 609 609 --> 610 611 610 </beans> -
trunk/ibisph-view/src/main/webapp/WEB-INF/config/spring/query-definition.xml
r21145 r21163 95 95 </bean> 96 96 97 <bean id="queryDefinitionMiscDetailsModelMap" class="org.ibisph.querydefinition.modelmap.MiscQueryDefinitionDetailsFromHTTPRequest">98 <description>99 Adds a session QM title and sticky QD title to the model map so that100 the UI can make decisions and display approp actions.101 </description>102 <property name="queryModuleSessionName" value="#{queryModuleSessionName.string}"/>103 <property name="queryModuleModelMapKey" value="#{commonXMLModelMapKey.string}"/>104 <property name="sessionQueryModuleTitleMapKey" value="SessionQueryModuleTitle"/>105 <!--106 <property name="stickyQueryDefinitionSessionName" value="#{queryStickyDefinitionDefinitionSessionName.string}"/>107 <property name="stickyQueryDefinitionModelMapKey" value="StickyQueryDefinition"/>108 -->109 </bean>110 111 97 112 98 <!-- C O N T R O L L E R S --> … … 139 125 <list> 140 126 <ref bean="queryDefinitionsFromHTTPRequestModelMap"/> 141 <ref bean="queryDefinitionMiscDetailsModelMap"/>142 127 </list> 143 128 </property> … … 312 297 <bean class="org.ibisph.web.HTTPRequestParameterNameToXMLElementName"><constructor-arg value="privateFlag"/><constructor-arg value="PRIVATE_FLAG"/></bean> 313 298 <bean class="org.ibisph.web.HTTPRequestParameterNameToXMLElementName"><constructor-arg value="requestPath"/><constructor-arg value="REQUEST_PATH_PREFIX"/></bean> 314 <bean class="org.ibisph.web.HTTPRequestParameterNameToXMLElementName"><constructor-arg value=" configurationPath"/><constructor-arg value="CONFIGURATION_PATH"/></bean>299 <bean class="org.ibisph.web.HTTPRequestParameterNameToXMLElementName"><constructor-arg value="modifiedDate"/><constructor-arg value="MODIFIED_DATE"/></bean> 315 300 </list> 316 301 </property> … … 325 310 </list> 326 311 </property> 312 <property name="view" value="/WEB-INF/jsp/blank.jsp"/> 327 313 </bean> 328 314 … … 334 320 <property name="modelMapList"> 335 321 <list> 336 <bean id="queryDefinitionDeleteQueryDefinitionFromHTTPRequestModelMap" 337 class="org.ibisph.querydefinition.modelmap.DeleteQueryDefinitionFromHTTPRequest" 322 <bean class="org.ibisph.querydefinition.modelmap.DeleteQueryDefinitionFromHTTPRequest" 338 323 parent="queryDefinitionModelMapProperties" 339 324 > … … 346 331 <property name="modelMapKey" value="#{commonXMLModelMapKey.string}"/> 347 332 </bean> 348 <ref bean="queryDefinitionMiscDetailsModelMap"/>349 333 </list> 350 334 </property> … … 363 347 <property name="XSLTPathAndFilename" value="html/query/definition/detail/DetailPage.xslt"/> 364 348 </bean> 365 366 349 </beans> -
trunk/ibisph-view/src/main/webapp/WEB-INF/config/spring/secure.xml
r20915 r21163 203 203 <ref bean="queryDefinitionFromHTTPRequestModelMap"/> 204 204 <ref bean="secureQueryDefinitionQueryModuleFromQueryDefinitionModelMap"/> 205 <ref bean="queryDefinitionMiscDetailsModelMap"/>206 205 </list> 207 206 </property> -
trunk/ibisph-view/src/main/webapp/xsd/query_definitions.xsd
r9852 r21163 39 39 --> 40 40 <xsd:element name="REQUEST_PATH_PREFIX" type="xsd:string" minOccurs="0" maxOccurs="1"/> 41 42 <!-- element added by java service when the def is retrieved so43 that the UI can access to determine if the QD is there's or not.44 -->45 <xsd:element ref="QUERY_DEFINITIONS_NAME" minOccurs="0" maxOccurs="1"/>46 41 </xsd:all> 47 42 <xsd:attribute name="name" type="xsd:string" use="optional"/> -
trunk/ibisph-view/src/main/webapp/xslt/html/query/definition/HelpContent.xslt
r21145 r21163 120 120 <xsl:param name="HelpContent.viewOverviewContent"> 121 121 You are viewing the details of one of 122 <xsl:value-of select="$QueryDefinition.queryDefinition /QUERY_DEFINITIONS_NAME"/>'s122 <xsl:value-of select="$QueryDefinition.queryDefinitions/NAME"/>'s 123 123 saved query defintion. Please see the 124 124 <a href="{$HelpContent.savedQueryHelpRequestPath}">Saved Query Help</a> … … 150 150 <li> 151 151 Apply the query definition's criteria to the current query dataset 152 (<xsl:value-of select="SessionQueryModuleTitle"/>) and return 153 to the query builder page for further refinement and then to 154 submit the query to view the results. 152 and return to the query builder page for further refinement and 153 then to submit the query to view the results. 155 154 </li> 156 155 </ul> -
trunk/ibisph-view/src/main/webapp/xslt/html/query/definition/QueryDefinition.xslt
r21145 r21163 17 17 18 18 <xsl:param name="QueryDefinitions" 19 ibis:doc="Main model for the index page requests. Put in this param and20 the code below to handleever injected."19 ibis:doc="Main model XML for the index page requests (ie param not used 20 for this). This param and the code below to handle if ever injected." 21 21 /> 22 22 <xsl:param name="QueryDefinition.queryDefinitions" … … 40 40 <xsl:param name="QueryDefinition.isMyQueryDefinitions" select=" 41 41 boolean($ibis.userProfile) and 42 ($QueryDefinition.queryDefinition /QUERY_DEFINITIONS_NAME = $ibis.userProfile/ID)42 ($QueryDefinition.queryDefinitions/NAME = $ibis.userProfile/ID) 43 43 " 44 44 /> … … 83 83 </xsl:call-template> 84 84 </div> 85 <button type="button" onclick="save ModuleDefinition();">Save</button>85 <button type="button" onclick="saveDefinition();">Save</button> 86 86 <button type="button" onclick="queryDefinitionEditIdentityDialog.close()" title="Closes the edit without saving.">Cancel</button> 87 87 </div> … … 98 98 <xsl:param name="configuration" select="$queryModule/CONFIGURATIONS/CONFIGURATION[NAME = $request/CONFIGURATION_NAME]"/> 99 99 <form name="form" id="identityForm" method="post" action="{$QueryDefinition.baseRequestPath}save" autocomplete="on"> 100 <input type="hidden" id="configurationPath" name="configurationPath" value="{$request/CONFIGURATION_PATH}"/>101 100 <input type="hidden" id="requestBasePath" name="requestBasePath" 102 101 value="{if( string-length($QueryDefinition.queryDefinition/REQUEST_PATH_PREFIX) != 0) … … 126 125 value="{concat(replace($request/CONFIGURATION_PATH, '/', '_'), '_', $queryModule/REQUEST/SERIAL_NUMBER)}" 127 126 /> 128 <input id="newQueryDefinitionFlag" name="newQueryDefinitionFlag" type="hidden" value="x"/>129 127 </xsl:if> 130 128 <xsl:if test="not($QueryDefinition.isBlankQueryDefinition)"> 131 <!-- this isn't needed. If existing then the MODIFIED_DATE is populated new is blank.132 129 <input id="name" name="name" type="hidden" value="{$QueryDefinition.queryDefinition/NAME}"/> 133 -->134 130 <xsl:value-of select="$QueryDefinition.queryDefinition/NAME"/> 135 131 </xsl:if> … … 183 179 </th> 184 180 <td class="Title" title="Enter the main title for this query definition."> 185 <input type="checkbox" name="privateFlag" id="privateFlag" value=" private">181 <input type="checkbox" name="privateFlag" id="privateFlag" value="x"> 186 182 <xsl:if test="$QueryDefinition.queryDefinition/PRIVATE_FLAG"> 187 183 <xsl:attribute name="checked" select="'checked'"/> … … 206 202 else $QueryDefinition.queryDefinition/MODIFIED_DATE 207 203 "/> 204 <input id="modifiedDate" name="modifiedDate" type="hidden" value="{$QueryDefinition.queryDefinition/MODIFIED_DATE}"/> 208 205 </td> 209 206 </tr> … … 221 218 <script type="text/javascript"> 222 219 // <![CDATA[ 223 var queryDefinitionEditIdentityDialog ;220 var queryDefinitionEditIdentityDialog = null; 224 221 $(document).ready(function() 225 222 { … … 232 229 ,modal: true 233 230 }).data("kendoWindow"); 231 232 $(function() 233 { 234 $("#identityForm").submit(function(event) 235 { 236 event.preventDefault(); // Prevent the form from submitting via the browser 237 var form = $(this); 238 $.ajax 239 ({ 240 type: form.attr("method") 241 ,url: form.attr("action") 242 ,data: form.serialize() 243 ,success: function(data) { alert("Successfully Saved."); } 244 ,error: function(data) 245 { 246 alert("Save Failed!"); 247 console.log("Query Definition Save Failed. Data: "); 248 console.log(data); 249 console.log(data.responseText); 250 } 251 }); 252 253 }); 254 }); 255 234 256 }); //~~~~~~~~~~~~~~~~~~~~ End of Ready Function ~~~~~~~~~~~~~~~~~~~ 235 236 257 function showIdentityDialog() 237 258 { 238 259 queryDefinitionEditIdentityDialog.center().open(); 239 document. form.name.focus();260 document.getElementById("name").focus(); 240 261 } //~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~ 241 262 … … 261 282 return(false); 262 283 } 263 document.form.submit(); 284 $("#identityForm").trigger("submit"); 285 queryDefinitionEditIdentityDialog.close(); 286 location.reload(); 264 287 } 265 /*266 https://stackoverflow.com/questions/1960240/jquery-ajax-submit-form267 see hijax - 3rd down268 269 $("button").click(function(){270 $.post("demo_test_post.asp",271 {272 name: "Donald Duck",273 city: "Duckburg"274 },275 function(data, status){276 alert("Data: " + data + "\nStatus: " + status);277 });278 });279 280 $("#theForm").ajaxForm({url: 'server.php', type: 'post'})281 or282 $("#theForm").ajaxSubmit({url: 'server.php', type: 'post'})283 284 $.ajax({285 type: "POST",286 url: url,287 data: form.serialize(), // serializes the form's elements.288 success: function(data)289 {290 alert(data); // show response from the php script.291 }292 });293 294 295 $.ajax({296 url: "<xsl:value-of select="ibis:getRequestURL($sourceContentURL)"/>"297 ,type: "GET"298 ,success: function(data)299 {300 alert(successfully saved);301 $("<xsl:value-of select="$destContentJQuerySelector"/>").html( $(data).find("<xsl:value-of select="$sourceContentJQuerySelector"/>").html() );302 }303 ,error: function (data) {304 console.log('An error occurred.');305 console.log(data);306 },307 });308 */309 288 // ]]> 310 289 </script> -
trunk/ibisph-view/src/main/webapp/xslt/html/query/definition/detail/Page.xslt
r21145 r21163 30 30 </xsl:when> 31 31 <xsl:otherwise> 32 Viewing <xsl:value-of select="$QueryDefinition.queryDefinition /QUERY_DEFINITIONS_NAME"/>'s32 Viewing <xsl:value-of select="$QueryDefinition.queryDefinitions/NAME"/>'s 33 33 "<xsl:value-of select="$QueryDefinition.queryDefinition/TITLE"/>" 34 34 Saved Query Definition Details … … 59 59 60 60 <xsl:param name="Page.viewSavedQueryOverviewContent"> 61 Viewing <xsl:value-of select="$QueryDefinition.queryDefinition /QUERY_DEFINITIONS_NAME"/>'s61 Viewing <xsl:value-of select="$QueryDefinition.queryDefinitions/NAME"/>'s 62 62 "<xsl:value-of select="$QueryDefinition.queryDefinition/TITLE"/>" 63 63 Saved Query Definition Details. This page allows you to see the the … … 103 103 <xsl:param name="configuration" select="$queryModule/CONFIGURATIONS/CONFIGURATION[NAME = $request/CONFIGURATION_NAME]"/> 104 104 105 <xsl:variable name="definitionURLSuffix" select="concat($QueryDefinition.queryDefinition /QUERY_DEFINITIONS_NAME, '/', $QueryDefinition.queryDefinition/NAME, '.html')"/>105 <xsl:variable name="definitionURLSuffix" select="concat($QueryDefinition.queryDefinitions/NAME, '/', $QueryDefinition.queryDefinition/NAME, '.html')"/> 106 106 107 107 <xsl:call-template name="Page.contentOptions"> … … 137 137 </th> 138 138 <td class="Title" title="Creating user's ID"> 139 <xsl:value-of select="$QueryDefinition.queryDefinition /QUERY_DEFINITIONS_NAME"/>139 <xsl:value-of select="$QueryDefinition.queryDefinitions/NAME"/> 140 140 </td> 141 141 </tr> … … 292 292 </tr> 293 293 </table> 294 295 294 </xsl:with-param> 296 295 </xsl:call-template> … … 330 329 <xsl:with-param name="helpPopupContent" select="$HelpContent.listLink"/> 331 330 <xsl:with-param name="urlDescription" select="'copy this value for a basic definitions list link.'"/> 332 <xsl:with-param name="urlRequestCommand" select="concat('list/', $QueryDefinition.queryDefinition /QUERY_DEFINITIONS_NAME, '.html')"/>331 <xsl:with-param name="urlRequestCommand" select="concat('list/', $QueryDefinition.queryDefinitions/NAME, '.html')"/> 333 332 </xsl:call-template> 334 333 <xsl:call-template name="Page.shareTableRow"> … … 338 337 <xsl:with-param name="helpPopupContent" select="$HelpContent.indexLink"/> 339 338 <xsl:with-param name="urlDescription" select="'copy this value for a basic definitions list link.'"/> 340 <xsl:with-param name="urlRequestCommand" select="concat('index/', $QueryDefinition.queryDefinition /QUERY_DEFINITIONS_NAME, '.html')"/>339 <xsl:with-param name="urlRequestCommand" select="concat('index/', $QueryDefinition.queryDefinitions/NAME, '.html')"/> 341 340 </xsl:call-template> 342 341 … … 347 346 <xsl:with-param name="helpPopupContent" select="$HelpContent.builderLink"/> 348 347 <xsl:with-param name="urlDescription" select="'copy this value for a query builder request link.'"/> 349 <xsl:with-param name="urlRequestCommand" select="concat('builder/', $QueryDefinition.queryDefinition /QUERY_DEFINITIONS_NAME, '/', $QueryDefinition.queryDefinition/NAME, '.html')"/>348 <xsl:with-param name="urlRequestCommand" select="concat('builder/', $QueryDefinition.queryDefinitions/NAME, '/', $QueryDefinition.queryDefinition/NAME, '.html')"/> 350 349 </xsl:call-template> 351 350 <xsl:call-template name="Page.shareTableRow"> … … 355 354 <xsl:with-param name="helpPopupContent" select="$HelpContent.resultLink"/> 356 355 <xsl:with-param name="urlDescription" select="'copy this value for a query builder request link.'"/> 357 <xsl:with-param name="urlRequestCommand" select="concat('result/', $QueryDefinition.queryDefinition /QUERY_DEFINITIONS_NAME, '/', $QueryDefinition.queryDefinition/NAME, '.html')"/>356 <xsl:with-param name="urlRequestCommand" select="concat('result/', $QueryDefinition.queryDefinitions/NAME, '/', $QueryDefinition.queryDefinition/NAME, '.html')"/> 358 357 </xsl:call-template> 359 358 <xsl:call-template name="Page.shareTableRow"> … … 363 362 <xsl:with-param name="helpPopupContent" select="$HelpContent.detailLink"/> 364 363 <xsl:with-param name="urlDescription" select="'copy this value for a query builder request link.'"/> 365 <xsl:with-param name="urlRequestCommand" select="concat('detail/', $QueryDefinition.queryDefinition /QUERY_DEFINITIONS_NAME, '/', $QueryDefinition.queryDefinition/NAME, '.html')"/>364 <xsl:with-param name="urlRequestCommand" select="concat('detail/', $QueryDefinition.queryDefinitions/NAME, '/', $QueryDefinition.queryDefinition/NAME, '.html')"/> 366 365 </xsl:call-template> 367 366 </tbody> … … 408 407 409 408 <button id="indexButton" type="button" accesskey="I" font-icon="" 410 onclick="location.href='{$baseRequestPath}index/{$QueryDefinition.queryDefinition /QUERY_DEFINITIONS_NAME}.html'"409 onclick="location.href='{$baseRequestPath}index/{$QueryDefinition.queryDefinitions/NAME}.html'" 411 410 title="Display list of query definitions" 412 411 > 413 <xsl:value-of select="if($QueryDefinition.isMyQueryDefinitions) then 'My' else $QueryDefinition.queryDefinition /QUERY_DEFINITIONS_NAME"/>412 <xsl:value-of select="if($QueryDefinition.isMyQueryDefinitions) then 'My' else $QueryDefinition.queryDefinitions/NAME"/> 414 413 Saved Query Definitions Index 415 414 <!-- -
trunk/ibisph-view/src/main/webapp/xslt/html/query/definition/index/Page.xslt
r21106 r21163 135 135 </style> 136 136 137 <xsl:variable name="queryDefinitionCount" select="count($QueryDefinition.queryDefinitions/QUERY_DEFINITION)"/> 137 <xsl:variable name="queryDefinitions" select="$QueryDefinition.queryDefinitions/QUERY_DEFINITION[not(PRIVATE_FLAG) or $QueryDefinition.isMyQueryDefinitions]"/> 138 <xsl:variable name="queryDefinitionCount" select="count($queryDefinitions)"/> 138 139 <xsl:if test="0 = $queryDefinitionCount"> 139 140 <xsl:copy-of select="$HelpContent.noSavedDefinitionsMessageContent"/> … … 211 212 <tbody> 212 213 <!-- loop for all definitions --> 213 <xsl:for-each select="$ QueryDefinition.queryDefinitions/QUERY_DEFINITION[not(PRIVATE_FLAG) or $QueryDefinition.isMyQueryDefinitions]">214 <xsl:for-each select="$queryDefinitions"> 214 215 <xsl:sort select="TITLE"/> 215 216 -
trunk/ibisph-view/src/main/webapp/xslt/html/query/module/builder/Builder.xslt
r20990 r21163 149 149 </xsl:otherwise> 150 150 </xsl:choose> 151 151 <!-- 152 152 <xsl:call-template name="StickyQueryDefinitionToggle.inputAndScript"/> 153 153 --> 154 154 </xsl:template> 155 155 -
trunk/ibisph/src/main/java/org/ibisph/querydefinition/modelmap/AbstractQueryDefinitionModelMap.java
r4116 r21163 13 13 protected QueryDefinitionXML queryDefinitionService = null; 14 14 protected CurrentUser currentUserService = null; 15 16 15 17 16 public void setQueryDefinitionService(QueryDefinitionXML queryDefinitionService) { -
trunk/ibisph/src/main/java/org/ibisph/querydefinition/modelmap/QueryDefinitionFromHTTPRequest.java
r9048 r21163 1 1 package org.ibisph.querydefinition.modelmap; 2 3 import java.util.HashMap; 4 import java.util.Map; 2 5 3 6 import javax.servlet.http.HttpServletRequest; 4 7 5 8 import org.dom4j.Node; 6 import org.ibisph.modelmap.GetModelMapFromHTTPRequest;7 9 import org.ibisph.util.IOPath; 8 import org.ibisph.util.StrLib;9 10 10 11 /** 11 12 * Loads either current user's query definition or a specified user's query 12 13 * definition based on request URL (and the forceUseCurrentUserIfEquals list). 13 * The query defs and definition are loaded via the injected service. Typical14 * URLs are of the form:15 * /query/definition/[result, builder, apply,detail/[Defs name]/Def name].html14 * The query defs comes from super with both QDs and QD being loaded via the 15 * injected QD service. Typical URLs are of the form: 16 * /query/definition/[result, builder, detail/[Defs name]/Def name].html 16 17 * 17 18 * @author Garth Braithwaite, STG … … 19 20 public class QueryDefinitionFromHTTPRequest 20 21 extends QueryDefinitionsFromHTTPRequest 21 implements GetModelMapFromHTTPRequest22 22 { 23 String queryDefinitionsModelMapKey = "QueryDefinitions"; 24 25 26 public void setQueryDefinitionsModelMapKey(String queryDefinitionsModelMapKey) { 27 this.queryDefinitionsModelMapKey = queryDefinitionsModelMapKey; 28 } //-------------------------- End of Method ------------------------------ 23 29 24 30 /** 25 * Returns a query def XML doc via the HTTP request and query defs service. 26 * First check if the request is MyDefinitions ("force current user") type 27 * request. If so then get the current user's id and use for the query defs. 28 * If not then use the request's 2nd to last segment for the query defs name. 29 * The last segment is the def name. 31 * Puts both the QDs and QD XML docs into the model map. The last segment or 32 * request filename (sans extension) should be the QD name. The QDs are put 33 * into the map because the detail page needs to know if the def is theirs or 34 * different user's so it can allow edits. 30 35 * @param request HttpServletRequest that the configuration path is retrieved from. 31 36 * @return the fully loaded query definition xml document object. 32 37 */ 33 protected Object getModel(HttpServletRequest request) throws Exception { 34 String[] pathSegment = IOPath.getPathSegments(IOPath.getFilePathAndNameWithoutExtension(request.getRequestURI())); 35 String queryDefinitionName = pathSegment[pathSegment.length-1]; 36 String queryDefinitionsName = pathSegment[pathSegment.length-2]; 37 if((null != this.forceUseCurrentUserIfEquals) 38 && this.forceUseCurrentUserIfEquals.contains(queryDefinitionsName) 39 ) { 40 queryDefinitionsName = this.currentUserService.getUserDetailsUsername(request); 41 if(!StrLib.isSomething(queryDefinitionsName)) return(null); 42 } 43 Node queryDefinition = this.queryDefinitionService.getQueryDefinition(queryDefinitionsName, queryDefinitionName); 44 return(queryDefinition); 38 39 public Map<String, Object> getModelMap(HttpServletRequest request) throws Exception { 40 Map<String, Object> modelMap = new HashMap<String, Object>(); 41 42 // use all the code of the QDs modelmap to determine the path and load the 43 // QDs. QDs are needed for the UI to know if the QDs are the logged user's 44 // QDs or some other user's QDs. The QDs are needed to be loaded anyway to 45 // retrieve the desired QD so might as well put into the modelmap for the UI. 46 // This also allows for future UI enhancements and validations. 47 Node queryDefinitions = (Node)super.getModel(request); 48 modelMap.put(this.queryDefinitionsModelMapKey, queryDefinitions); 49 50 // for detail requests the QD name is always the last segment. Get it and 51 // put into the map. 52 String queryDefinitionName = IOPath.getFilenameWithoutExtension(request.getRequestURI()); 53 Node queryDefinition = this.queryDefinitionService.getQueryDefinition(queryDefinitions, queryDefinitionName); 54 modelMap.put(this.modelMapKey, queryDefinition); 55 56 return(modelMap); 45 57 } //-------------------------- End of Method ------------------------------ 46 58 -
trunk/ibisph/src/main/java/org/ibisph/querydefinition/modelmap/QueryDefinitionsFromHTTPRequest.java
r9126 r21163 13 13 14 14 /** 15 * Loads either current user's query definitions or a specified user's query 16 * definitions based on request URL (and the forceUseCurrentUserIfEquals list). 17 * The query defs are loaded via the injected service and the defs name. This 18 * model map is used by all the list type query def controllers. 15 * Loads either the current logged in user's query definitions or another user's 16 * query definitions based on request URL (the forceUseCurrentUserIfEquals list 17 * is used to identify the "My" definitions). 18 * The query defs are loaded via the injected service and the defs name from the 19 * request URL. This model map is used by all the list and detail query def 20 * controllers. 19 21 * 20 22 * @author Garth Braithwaite, STG … … 24 26 implements GetModelMapFromHTTPRequest 25 27 { 28 protected String[] pathPrefixesToRemove = new String[] { 29 "query/definition/list", "query/definition/index", 30 "query/definition/detail", "query/definition/result", 31 "query/definition/builder","query/definition/contentblocks" 32 }; 26 33 protected List<String> forceUseCurrentUserIfEquals; 34 35 36 /** 37 * Sets the Query Def Path prefixes to search for and remove all path info up 38 * to and including that value to retrieve the actual path. 39 * @param pathPrefixesToRemove array of strings to be looped through. 40 */ 41 public void setPathPrefixesToRemove(String[] pathPrefixesToRemove) {this.pathPrefixesToRemove = pathPrefixesToRemove;} 27 42 28 43 /** … … 43 58 /** 44 59 * Returns a query defs XML doc via the HTTP request and query defs service. 45 * First check if the request is MyDefinitions ("force current user") type 46 * request. If so then get the current user's id and use for the query defs. 47 * If not then use the request's last segment for the query defs name to be 48 * opened and returned. 60 * First remove the path prefixes. For list and index type requests the defs 61 * name is the last request segment. For detail requests (which inherit and 62 * use this code) the defs is the 2nd to last segment. This code at one point 63 * simply used the request's filename w/o extension. However, the newer approach 64 * allows for secure saved query paths and the use for the detail type requests. 65 * Next need to check if the request is MyDefinitions ("force current user") type 66 * request. If so then get the current user's id and use for the query defs 67 * name. 49 68 * @param request HttpServletRequest that the configuration path is retrieved from. 50 69 * @return query definitions xml document object. 51 70 */ 52 71 protected Object getModel(HttpServletRequest request) throws Exception { 53 String queryDefinitionsName = IOPath.getFilenameWithoutExtension(request.getRequestURI()); 72 // get rid of path prefixes to gain access to the actual defs name. 73 String requestPath = IOPath.getFilePathAndNameWithoutExtension(request.getRequestURI()); 74 String pathSuffix = null; 75 for(String pathPrefixToRemove : this.pathPrefixesToRemove) { 76 int i = requestPath.indexOf(pathPrefixToRemove); 77 if(i > -1) { 78 pathSuffix = requestPath.substring(i + pathPrefixToRemove.length() + 1); 79 break; 80 } 81 } 82 83 // check if the requested defs name is a special MyDefinitions type request. 84 // if so then use the current, logged in user's ID as the defs name. 85 String[] pathSegments = IOPath.getPathSegments(pathSuffix); 86 String queryDefinitionsName = pathSegments[0]; 54 87 if((null != this.forceUseCurrentUserIfEquals) 55 88 && this.forceUseCurrentUserIfEquals.contains(queryDefinitionsName) … … 62 95 if(!StrLib.isSomething(queryDefinitionsName)) return(null); 63 96 97 // use the service to load the query defs XML doc. 64 98 Node queryDefinitions = null; 65 99 try { -
trunk/ibisph/src/main/java/org/ibisph/querydefinition/modelmap/SaveQueryDefinitionFromHTTPRequest.java
r21145 r21163 4 4 5 5 import org.dom4j.Node; 6 import org.ibisph.modelmap.GetModelMapFromHTTPRequest; 6 7 import org.ibisph.querydefinition.service.QueryModuleXMLToQueryDefinitionXML; 7 8 import org.ibisph.util.StrLib; … … 14 15 * @author Garth Braithwaite, STG 15 16 */ 16 public class SaveQueryDefinitionFromHTTPRequest extends AbstractQueryDefinitionModelMap { 17 public class SaveQueryDefinitionFromHTTPRequest 18 extends AbstractQueryDefinitionModelMap 19 implements GetModelMapFromHTTPRequest 20 { 17 21 protected HTTPRequestParametersToContainerElementService httpRequestParametersToContainerElementService; 18 22 19 23 protected String queryModuleSessionName = null; 20 24 protected QueryModuleXMLToQueryDefinitionXML queryModuleXMLToQueryDefinitionXMLService; 21 25 26 protected String modelMapKey = "XML"; 22 27 23 28 /** … … 61 66 Node queryDefinition; 62 67 String userDetailsUsername = this.currentUserService.getUserDetailsUsername(request); 63 Node queryDefinitions = this.queryDefinitionService.getQueryDefinitions(userDetailsUsername);64 68 65 69 Node requestQueryDefinitionNode = this.httpRequestParametersToContainerElementService.load(request); … … 73 77 ); 74 78 } 75 XMLLib.replaceNode(queryDefinition, "TITLE", XMLLib.getNode(queryDefinition, "TITLE"));76 XMLLib.replaceNode(queryDefinition, "DESCRIPTION", XMLLib.getNode(queryDefinition, "DESCRIPTION"));77 XMLLib.replaceNode(queryDefinition, "PRIVATE_FLAG", XMLLib.getNode( queryDefinition, "PRIVATE_FLAG"));79 XMLLib.replaceNode(queryDefinition, "TITLE", XMLLib.getNode(requestQueryDefinitionNode, "TITLE")); 80 XMLLib.replaceNode(queryDefinition, "DESCRIPTION", XMLLib.getNode(requestQueryDefinitionNode, "DESCRIPTION")); 81 XMLLib.replaceNode(queryDefinition, "PRIVATE_FLAG", XMLLib.getNode(requestQueryDefinitionNode, "PRIVATE_FLAG")); 78 82 } 79 83 … … 86 90 87 91 // save the definition in the definitions XML file (updates the modified date). 88 queryDefinitions =this.queryDefinitionService.saveQueryDefinition(userDetailsUsername, queryDefinition);92 this.queryDefinitionService.saveQueryDefinition(userDetailsUsername, queryDefinition); 89 93 90 94 return(queryDefinition); -
trunk/ibisph/src/main/java/org/ibisph/querydefinition/service/QueryDefinitionXML.java
r21145 r21163 98 98 ); 99 99 } 100 101 // add the USER_ID to the QD so that XSLT can access etc.102 XMLLib.addNode(queryDefinition, XMLLib.newNode("QUERY_DEFINITIONS_NAME", queryDefinitionsName));103 104 100 return(queryDefinition); 105 101 } //-------------------------- End of Method ------------------------------ -
trunk/ibisph/src/main/java/org/ibisph/querydefinition/service/QueryModuleXMLToQueryDefinitionXML.java
r21145 r21163 49 49 XMLLib.setText(queryDefinition, "PRIVATE_FLAG", queryDefinitionPrivateFlag); 50 50 XMLLib.setText(queryDefinition, "REQUEST_PATH_PREFIX", queryDefinitionRequestPathPrefix); 51 XMLLib.setText(queryDefinition, "QUERY_DEFINITIONS_NAME", queryDefinitionsName);52 51 53 52 XMLLib.setText(queryDefinition, "MODIFIED_DATE", (new Date()).toString()); -
trunk/ibisph/src/main/java/org/ibisph/querymodule/modelmap/QueryModuleFromHTTPRequest.java
r21106 r21163 28 28 protected String reloadRequestParameterName = "Reload"; // request param name used to start new query. 29 29 protected String configurationPathParameterName = null; // request param name for the qm configuration path. 30 protected String[] configurationPathRequestPathPrefixes=30 protected String[] pathPrefixesToRemove = 31 31 new String[] { "query/builder", "query/submit", "query/result", "query/configuration"}; 32 32 … … 82 82 * remove all path info up to and including that value to retrieve the actual 83 83 * config path. 84 * @param configurationPathPrefixToRemove array of strings to be looped through.84 * @param pathPrefixesToRemove array of strings to be looped through. 85 85 */ 86 public void set ConfigurationPathRequestPathPrefixes(String[] configurationPathRequestPathPrefixes) {this.configurationPathRequestPathPrefixes = configurationPathRequestPathPrefixes;}86 public void setPathPrefixesToRemove(String[] pathPrefixesToRemove) {this.pathPrefixesToRemove = pathPrefixesToRemove;} 87 87 88 88 … … 131 131 if(!StrLib.isSomething(configurationPath)) { 132 132 String requestPath = IOPath.getFilePathAndNameWithoutExtension(request.getRequestURI()); 133 for (String pathPrefix : configurationPathRequestPathPrefixes) {134 int i = requestPath.indexOf(pathPrefix );133 for (String pathPrefixToRemove : this.pathPrefixesToRemove) { 134 int i = requestPath.indexOf(pathPrefixToRemove); 135 135 if(i > -1) { 136 configurationPath = requestPath.substring(i + pathPrefix .length() + 1);136 configurationPath = requestPath.substring(i + pathPrefixToRemove.length() + 1); 137 137 break; 138 138 } -
trunk/ibisph/src/main/java/org/ibisph/web/springmvc/ModelMapListProcessingController.java
r9203 r21163 110 110 Map<String, Object> newModelMap = null; 111 111 112 if(modelMapService instanceof GetModelMap )113 newModelMap = ((GetModelMap )modelMapService).getModelMap();112 if(modelMapService instanceof GetModelMapFromModelMapAndHTTPRequest) 113 newModelMap = ((GetModelMapFromModelMapAndHTTPRequest)modelMapService).getModelMap(modelMap, request); 114 114 else if(modelMapService instanceof GetModelMapFromHTTPRequest) 115 115 newModelMap = ((GetModelMapFromHTTPRequest)modelMapService).getModelMap(request); 116 116 else if(modelMapService instanceof GetModelMapFromModelMap) 117 117 newModelMap = ((GetModelMapFromModelMap)modelMapService).getModelMap(modelMap); 118 else if(modelMapService instanceof GetModelMap FromModelMapAndHTTPRequest)119 newModelMap = ((GetModelMap FromModelMapAndHTTPRequest)modelMapService).getModelMap(modelMap, request);118 else if(modelMapService instanceof GetModelMap) 119 newModelMap = ((GetModelMap)modelMapService).getModelMap(); 120 120 121 121 else { 122 if(modelMapService instanceof ProcessModelMap) 122 if(modelMapService instanceof ProcessModelMapFromHTTPRequest) 123 ((ProcessModelMapFromHTTPRequest)modelMapService).processModelMap(modelMap, request); 124 else if(modelMapService instanceof ProcessModelMap) 123 125 ((ProcessModelMap)modelMapService).processModelMap(modelMap); 124 else if(modelMapService instanceof ProcessModelMapFromHTTPRequest)125 ((ProcessModelMapFromHTTPRequest)modelMapService).processModelMap(modelMap, request);126 126 } 127 127
Note: See TracChangeset
for help on using the changeset viewer.