public ActionResult Browse() { var type = Request.QueryString["Type"]; var isImage = !string.IsNullOrEmpty(type) && type.Equals("Images", StringComparison.InvariantCultureIgnoreCase); ViewBag.IsImg = isImage; return View(); }
@{ Layout = null; }Browse @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/modernizr") <script src="/SHTracker/Scripts/TreeView/jquery.treeview.pack.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $("body>aside>ul").treeview({ animated: true, persist: "location", collapsed: true, unique: false }); }); </script>
#region = SafeAddQueryToURL = ////// Add a query to an URL. /// if the URL has not any query,then append the query key and value to it. /// if the URL has some queries, then check it if exists the query key already,replace the value, or append the key and value /// if the URL has any fragment, append fragments to the URL end. /// ////// string s = "http://blog.csdn.net/leewhoee/?a=1&b=2&c=3#tag"; /// WL(SafeRemoveQueryFromURL("a",s)); /// WL(SafeRemoveQueryFromURL("b",s)); /// WL(SafeRemoveQueryFromURL("c",s)); /// WL(SafeAddQueryToURL("d","new",s)); /// WL(SafeAddQueryToURL("a","newvalue",s)); /// 輸出如下: /// http://blog.csdn.net/leewhoee/?b=2&c=3#tag /// http://blog.csdn.net/leewhoee/?a=1&c=3#tag /// http://blog.csdn.net/leewhoee/?a=1&b=2#tag /// http://blog.csdn.net/leewhoee/?a=1&b=2&c=3&d=new#tag /// http://blog.csdn.net/leewhoee/?a=newvalue&b=2&c=3#tag /// public static string SafeAddQueryToURL(string key, string value, string url) { int fragPos = url.LastIndexOf("#"); string fragment = string.Empty; if (fragPos > -1) { fragment = url.Substring(fragPos); url = url.Substring(0, fragPos); } int querystart = url.IndexOf("?"); if (querystart < 0) { url += "?" + key + "=" + value; } else { Regex reg = new Regex(@"(?<=[&\?])" + key + @"=[^\s&#]*", RegexOptions.Compiled); if (reg.IsMatch(url)) url = reg.Replace(url, key + "=" + value); else url += "&" + key + "=" + value; } return url + fragment; } #endregion #region = SafeRemoveQueryFromURL = ////// Remove a query from url /// /// /// ///public static string SafeRemoveQueryFromURL(string key, string url) { Regex reg = new Regex(@"[&\?]" + key + @"=[^\s&#]*&?", RegexOptions.Compiled); return reg.Replace(url, new MatchEvaluator(PutAwayGarbageFromURL)); } private static string PutAwayGarbageFromURL(Match match) { string value = match.Value; if (value.EndsWith("&")) return value.Substring(0, 1); else return string.Empty; } #endregion
/** * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.editorConfig = function (config) { config.extraPlugins = "autogrow,imagebrowser,filebrowser"; /*config autogrow*/ config.autoGrow_maxHeight = 400; /*config autogrow end*/ /*config imagebrowser*/ //config.imageBrowser_listUrl = ""; /*config imagebrowser end*/ /*config filebrowser*/ config.filebrowserImageBrowseUrl = '/SHTracker/CKEditor/Browse?type=Images'; config.filebrowserImageUploadUrl = '/SHTracker/CKEditor/FileUpload?type=Images'; config.filebrowserBrowseUrl = '/SHTracker/CKEditor/Browse?type=docs'; config.filebrowserUploadUrl = '/SHTracker/CKEditor/FileUpload?type=docs'; config.filebrowserImageWindowWidth = 640; config.filebrowserImageWindowHeight = 480; /*config filebrowser end*/ // Define changes to default configuration here. For example: // config.language = 'fr'; // config.uiColor = '#AADC6E'; config.skin = 'Moono'; config.disableNativeSpellChecker = false; };
config.filebrowserImageBrowseUrl = '/SHTracker/CKEditor/Browse?type=Images'; config.filebrowserImageUploadUrl = '/SHTracker/CKEditor/FileUpload?type=Images'; config.filebrowserBrowseUrl = '/SHTracker/CKEditor/Browse?type=docs'; config.filebrowserUploadUrl = '/SHTracker/CKEditor/FileUpload?type=docs';