Skip to content

Commit 6b372a8

Browse files
authored
Merge pull request #41 from valadas/issue-24
Making folder paths to relative
2 parents 254be02 + ebd5452 commit 6b372a8

3 files changed

Lines changed: 14 additions & 38 deletions

File tree

Helpers.cs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -409,23 +409,9 @@ public void SetRepositoryFolders(int ModuleId)
409409
g_UserFolders = true;
410410
}
411411

412-
if (!string.IsNullOrEmpty(Convert.ToString(settings["folderlocation"]))) {
413-
g_ApprovedFolder = Convert.ToString(settings["folderlocation"]);
414-
} else {
415-
g_ApprovedFolder = HttpContext.Current.Server.MapPath(_portalSettings.HomeDirectory) + "Repository";
416-
}
417-
418-
if (!string.IsNullOrEmpty(Convert.ToString(settings["pendinglocation"]))) {
419-
g_UnApprovedFolder = Convert.ToString(settings["pendinglocation"]);
420-
} else {
421-
g_UnApprovedFolder = HttpContext.Current.Server.MapPath(_portalSettings.HomeDirectory) + "Repository\\Pending";
422-
}
423-
424-
if (!string.IsNullOrEmpty(Convert.ToString(settings["anonymouslocation"]))) {
425-
g_AnonymousFolder = Convert.ToString(settings["anonymouslocation"]);
426-
} else {
427-
g_AnonymousFolder = HttpContext.Current.Server.MapPath(_portalSettings.HomeDirectory) + "Repository\\Anonymous";
428-
}
412+
g_ApprovedFolder = HttpContext.Current.Server.MapPath(_portalSettings.HomeDirectory) + "Repository";
413+
g_UnApprovedFolder = HttpContext.Current.Server.MapPath(_portalSettings.HomeDirectory) + "Repository\\Pending";
414+
g_AnonymousFolder = HttpContext.Current.Server.MapPath(_portalSettings.HomeDirectory) + "Repository\\Anonymous";
429415

430416
// make sure the Repository folder exists
431417
if (!Directory.Exists(g_ApprovedFolder)) {

Settings.ascx.cs

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -688,29 +688,22 @@ private void Page_Load(System.Object sender, System.EventArgs e)
688688
// default value
689689
}
690690

691-
if (!string.IsNullOrEmpty(Convert.ToString(settings["folderlocation"]))) {
692-
txtFolderLocation.Text = Convert.ToString(settings["folderlocation"]);
693-
} else {
694-
txtFolderLocation.Text = Request.MapPath(_portalSettings.HomeDirectory) + "Repository";
695-
}
691+
txtFolderLocation.Text = Request.MapPath(_portalSettings.HomeDirectory) + "Repository";
692+
txtFolderLocation.ReadOnly = true;
693+
696694

697695
if (!string.IsNullOrEmpty(Convert.ToString(settings["userfolders"]))) {
698696
cbUserFolders.Checked = bool.Parse(settings["userfolders"].ToString());
699697
} else {
700698
cbUserFolders.Checked = false;
701699
}
702700

703-
if (!string.IsNullOrEmpty(Convert.ToString(settings["pendinglocation"]))) {
704-
txtPendingLocation.Text = Convert.ToString(settings["pendinglocation"]);
705-
} else {
706-
txtPendingLocation.Text = Request.MapPath(_portalSettings.HomeDirectory) + "Repository";
707-
}
701+
txtPendingLocation.Text = Request.MapPath(_portalSettings.HomeDirectory) + "Repository\\Pending";
702+
txtPendingLocation.ReadOnly = true;
708703

709-
if (!string.IsNullOrEmpty(Convert.ToString(settings["anonymouslocation"]))) {
710-
txtAnonymousLocation.Text = Convert.ToString(settings["anonymouslocation"]);
711-
} else {
712-
txtAnonymousLocation.Text = Request.MapPath(_portalSettings.HomeDirectory) + "Repository";
713-
}
704+
txtAnonymousLocation.Text = Request.MapPath(_portalSettings.HomeDirectory) + "Repository\\Anonymous";
705+
txtAnonymousLocation.ReadOnly = true;
706+
714707

715708
// only HOST account can modify file locations
716709
if (UserInfo.IsSuperUser) {
@@ -935,10 +928,7 @@ public override void UpdateSettings()
935928

936929
// double check to make sure the person submitting the Update is indeed a SuperUser
937930
if (UserInfo.IsSuperUser) {
938-
objModules.UpdateModuleSetting(ModuleId, "folderlocation", txtFolderLocation.Text.Trim());
939931
objModules.UpdateModuleSetting(ModuleId, "userfolders", cbUserFolders.Checked.ToString());
940-
objModules.UpdateModuleSetting(ModuleId, "pendinglocation", txtPendingLocation.Text.Trim());
941-
objModules.UpdateModuleSetting(ModuleId, "anonymouslocation", txtAnonymousLocation.Text.Trim());
942932
}
943933

944934
objModules.UpdateModuleSetting(ModuleId, "noimage", ctlURL.Url.ToString());

Upgrade.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ public static string CustomUpgrade315()
145145
if (!string.IsNullOrEmpty(Convert.ToString(settings["userfolders"]))) {
146146
// then get the base folder name
147147
if (!string.IsNullOrEmpty(Convert.ToString(settings["folderlocation"]))) {
148-
m_foldername = Convert.ToString(settings["folderlocation"]);
148+
m_foldername = HttpContext.Current.Server.MapPath(_portalSettings.HomeDirectory) + "Repository";
149149

150-
// look in the base folder for any user folders
151-
m_Folders = Directory.GetDirectories(m_foldername);
150+
// look in the base folder for any user folders
151+
m_Folders = Directory.GetDirectories(m_foldername);
152152

153153
foreach (string m_Folder_loopVariable in m_Folders) {
154154
m_Folder = m_Folder_loopVariable;

0 commit comments

Comments
 (0)