|
|
Rank: Newbie
Joined: 9/8/2008 Posts: 2 Location: Pune
|
Hi, I have created a new User Table called City, and I want the Client to add new records to it using the admin panel, which one would the better solution to do the same??
Thanks in advance!!!
|
|
Rank: Newbie
Joined: 9/8/2008 Posts: 6 Location: thailand
|
Hi All,
I have the same problem as rah_135. I want new section on umbraco for admin of my site.
It likes adding new customer into CustomerTable in umbraco.
How to create it?
Thanks. -Toi
|
|
 Rank: Umbracoholic
Joined: 9/27/2007 Posts: 1,123 Location: Belgium
|
Hi, v4 has built-in support for creating new sections, but it will require some coding. I strongly suggest to have a look at the /presentation/umbraco/trees folder, as you'll find examples of how to build a new tree for a new section. Also, you'll have to add some extra records in the database to make umbraco aware of the new section. All sections and their configuration can be found in the umbracoAppTree table. Feel free to ask more questions when moving along. Regards, /Dirk
level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
|
|
Rank: Newbie
Joined: 9/8/2008 Posts: 6 Location: thailand
|
Hi Dirk,
Since v4 is currently Beta now so I can not use it for the implementation.
Is there any way to create the section or node to group my administration group for umbraco's admin?
It will be nice if I can create node like the package name Packager Creater.
Now I currently use v.3.0.5 and installed packager_1.0.5_beta.zip.
Thanks in advance, -Toi
|
|
Rank: Enthusiast
Joined: 1/7/2008 Posts: 39
|
If you want to add your node to the exising umbraco admin section - than you must create record in the table umbracoAppTree according your new node. You also need to specify assembly and type of the class, where you added logic for displaying node tree. In case if you want to add new section to th admin -look at the umbracoApp and umbracoUser2app tables.
|
|
Rank: Newbie
Joined: 9/8/2008 Posts: 6 Location: thailand
|
Thank you very much for any suggestions.
There are the right way for me to complete my purpose.
|
|
 Rank: Aficionado
Joined: 8/4/2008 Posts: 111 Location: Serbia
|
DeNY ???
where and how I can
"..... You also need to specify assembly and type of the class, where you added logic for displaying node tree. ..."
I add row in umbracoApp and umbracoUser2app but what is a next ?
any tips or examples
thanks
|
|
Rank: Enthusiast
Joined: 1/7/2008 Posts: 39
|
Hi lpastor, After you added rows to the umbracoApp and umbracoUser2app tables, you must have new created section at backend - correct? Now you need to fill this section by your content. Create new class library project and create class which inherits from umbraco.interfaces.ITree. Your implementation of the interface may look in this way: Code: public class MyTreeHandler : ITree { private string _app; private int _id;
#region ITree Members
public void Render(ref System.Xml.XmlDocument Tree) { //create sample node XmlNode root = Tree.DocumentElement;
XmlElement modulesTree = Tree.CreateElement("tree");
modulesTree.SetAttribute("action", "javascript:openModulesWindow();"); modulesTree.SetAttribute("menu", "D"); modulesTree.SetAttribute("src", ""); modulesTree.SetAttribute("text", "Modules"); modulesTree.SetAttribute("icon", "Modules.png"); modulesTree.SetAttribute("openIcon", "Modules.png");
root.AppendChild(modulesTree);
}
public void RenderJS(ref System.Text.StringBuilder Javascript) { Javascript.Append(@"function openModulesWindow() { parent.right.document.location.href = 'plugins/.../Components/modules.aspx'; }");
}
public string app { set { this._app = value; } }
public int id { set { this._id = value; } }
#endregion }
Next step is to register your treeHandler at the table umbracoAppTree. Set appAlias to new create admin section alias, treeHandlerAssembly and treeHandlerType according your tree Handler class. Thats all. After registering you can see you node in the new section. Now you can add your custom logic to this page. If you have more question feel free to ask.
|
|
 Rank: Aficionado
Joined: 8/4/2008 Posts: 111 Location: Serbia
|
I did it and it working but now I have a problem what next?
My idea was that I left panel (under tree) show all pdf files in some folder and user click on it in right panel he can see this pdf file in pdf viewer...
any idea or some tips how to build that ...???
Thanks a lot
|
|
Rank: Enthusiast
Joined: 1/7/2008 Posts: 39
|
So what a problem to add dynamically nodes with the pdf names and according js functions within treeHandler?.
|
|
 Rank: Aficionado
Joined: 8/4/2008 Posts: 111 Location: Serbia
|
HI I add a code for reading a pdf files from umraco folder BUT is there any possibility to NOT hard code this path Quote: public void Render(ref System.Xml.XmlDocument Tree) {
try {
DirectoryInfo dir = new DirectoryInfo(@"C:\Inetpub\dvv303\report\PDF"); /////BAD SOLUTION!!! FileInfo[] pfdFiles = dir.GetFiles("*.pdf");
string exportPath = ("../report/MemberActivity.rpt");
string path = Path.GetTempFileName(); FileInfo fi1 = new FileInfo(exportPath);
if (!System.IO.Directory.Exists(exportPath)) {
foreach (FileInfo f in pfdFiles) { XmlElement modulesTree = Tree.CreateElement("tree");
modulesTree.SetAttribute("action", "javascript:openModulesWindow();"); modulesTree.SetAttribute("menu", "D"); modulesTree.SetAttribute("src", ""); modulesTree.SetAttribute("text", f.Name); modulesTree.SetAttribute("icon", "docPic.gif"); modulesTree.SetAttribute("openIcon", "doc.gif"); root.AppendChild(modulesTree); } }
} catch (Exception e) { string mes = e.Message; }
}
|
|
 Rank: Umbracoholic
Joined: 9/27/2007 Posts: 1,123 Location: Belgium
|
Hi, Regular asp.net Server.MapPath() should suffice. Hope that helps. Regards, /dirk
level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
|
|
Rank: Enthusiast
Joined: 1/7/2008 Posts: 39
|
Hi, May be the best solution will be create parent folder at the admin Media section and show pdf files from it? Or you can use appsettings section of the web.config in order to set pdf container folder.
|
|
 Rank: Aficionado
Joined: 8/4/2008 Posts: 111 Location: Serbia
|
Dirk ...I try Server.MapPath() but it seems that he don't recognize Server in class :ITree
how can I still use the Server.MapPath()? it will be relay great , I know :-)
|
|
 Rank: Aficionado
Joined: 8/4/2008 Posts: 111 Location: Serbia
|
common gyes ...any suggestion..????
|
|
Rank: Enthusiast
Joined: 1/7/2008 Posts: 39
|
HttpContext.Current will help you to find the reference on the Server object.
|
|
 Rank: Aficionado
Joined: 8/4/2008 Posts: 111 Location: Serbia
|
I get some strange error message.. This is my class Quote: public class MyTreeHandler : ITree { private string _app; private int _id;
#region ITree Members
public void Render(ref System.Xml.XmlDocument Tree) {
try {
DirectoryInfo dir = new DirectoryInfo(@"C:\Inetpub\dvv303\report\PDF"); FileInfo[] pfdFiles = dir.GetFiles("*.pdf");
string exportPath = ("../report/MemberActivity.rpt");
string path = Path.GetTempFileName(); FileInfo fi1 = new FileInfo(exportPath); XmlNode root = Tree.DocumentElement;
if (!System.IO.Directory.Exists(exportPath)) {
foreach (FileInfo f in pfdFiles) { string fileName = f.Name.Substring(0,f.Name.LastIndexOf('.')); XmlElement modulesTree = Tree.CreateElement("tree");
modulesTree.SetAttribute("action", "javascript:openModulesWindow('" + fileName + "');"); modulesTree.SetAttribute("menu", "D"); modulesTree.SetAttribute("src", ""); modulesTree.SetAttribute("text", f.Name); modulesTree.SetAttribute("icon", "docPic.gif"); modulesTree.SetAttribute("openIcon", "doc.gif"); root.AppendChild(modulesTree); } }
} catch (Exception e) { string mes = e.Message; }
}
public void RenderJS(ref System.Text.StringBuilder Javascript) { Javascript.Append(@"function openModulesWindow(docName) { var tmpPath = ""plugins/pdfViewer/pdfViewer.aspx?path=""+docName; //parent.right.document.location.href = tmpPath; parent.right.document.location.href ='plugins/pdfViewer/pdfViewer.aspx?path=PortableDoc_rabo7' }" );
}
public string app { set { this._app = value; } }
public int id { set { this._id = value; } }
#endregion }
it populate pdf files from hard coded folder from disk (bad but work) when I click on pdf doc in tree it has to call jscript function openModulesWindow end set parametar filename that call a pdfViewer.aspx page and code in that page is simply Quote: <%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e) { String _path = Request.QueryString["path"];
_path = @"C:\Inetpub\dvv303\report\PDF\" + _path+".pdf"; Response.Clear(); Response.ContentType = "Application/PDF"; Response.WriteFile(_path); Response.Flush(); Response.Close(); } </script>
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> </div> </form> </body> </html>
AND when I click on pdf file link node in tree I get a message "No such interface supported " BUT it show pdf document BUT just first time ?!?!?!? HELP
|
|
 Rank: Addict
Joined: 7/29/2006 Posts: 513 Location: Sydney, Australia
|
hey all, I'm trying to add a custom section to my umbraco. I've got the icon appearing fine, and clicking it is bringing up a tree section. I've created a class that implements ITree (below), however i can't get it to display anything. Basically i get a 'Manufacturers' folder in the tree with a plus next to it, but clicking the plus just causes the plus to dissappear. Here's the code for the ITree class: Code: using System; using System.Collections.Generic; using System.Text; using System.Xml; // <--- I referencing System.Xml using umbraco; using umbraco.interfaces;
namespace MaxAdmin.UmbracoIntegration { public class ManufacturerTree : ITree { private int _id; private string _app;
public string app { set { _app = value; } }
public int id { set { _id = value; } }
public void Render(ref System.Xml.XmlDocument Tree) { // attach to the current Tree XmlNode root = Tree.DocumentElement; XmlElement treeElement = Tree.CreateElement("tree");
// internal node id, set this to a negative number // to avoid problems with existing node id's treeElement.SetAttribute("nodeID", "-2244"); treeElement.SetAttribute("menu", "menu");
// This will be the name of the tree node treeElement.SetAttribute("text", "Google Analytics");
// You can also set the "action"-attribute to an internal umbracopage treeElement.SetAttribute("action", "javascript:gotoURL('http://www.google-analytics.com');"); treeElement.SetAttribute("src", "test");
// the icon shown when not clicked treeElement.SetAttribute("icon", "settingDataType.gif"); // the icon shown when the current tree node is clicked on treeElement.SetAttribute("openIcon", "settingDataType.gif"); root.AppendChild(treeElement);
// if you need more nodes (pages), // just copy the lines above and insert them again // - except for line 28 & 29
}
public void RenderJS(ref StringBuilder Javascript) { // the dashboard (right side of the screen) is inside an IFRAME, // so we need to append some javascript to the page.
Javascript.Append(@" function gotoURL(url) { parent.right.document.location.href = url; } "); }
} }
(the code above is pretty much copied exactly from Simon Justesen's excellent guide here: http://www.simm.dk/umbraco-corner/articles/making-custom-sections-and-trees-inside-umbraco---part-ii.aspx ) The row in the database UmbracoAppTree table is as follows: False True 99 vehicles Manuf Manufacturers folder.gif folder_o.gif MaxAdmin.UmbracoIntegration ManufacturerTree I just can't seem to get it working. I can't get debugging working either - i try to attach to my IExplorer process and put a debug point, but it never fires. So very very frustrating.. hoping somebody can offer a suggestion as i'm really stuck. thanks heaps greg
|
|
 Rank: Addict
Joined: 7/29/2006 Posts: 513 Location: Sydney, Australia
|
So i'm still completely stuck on this.. i've started a new thread - if you can help, please i'd massively appreciate it. This problem is burning way too many hours, and i'm sure its something small i've missed: http://forum.umbraco.org/yaf_postsm35368_Totally-stuck-trying-to-implement-iTree-interface.aspx#35368
|
|
 Rank: Addict
Joined: 7/29/2006 Posts: 513 Location: Sydney, Australia
|
|
|
|
Guest |