Sign Up! Login: Password: New User? Forgot? Support
Top Mods!
Wowhead Search
by sonofsamedi
Digital Clock
by Wolfar15
Admin Forums
Welcome to the GuildPortal Help Community! These forums are for admin-to-admin help.
Available Forums
Forums : Feature Discussion > HTML upload interface...
Arleon (Guild Admin) 6/9/2004 6:44 PM EST : HTML upload interface...

Arleon
Posts: 410
Fingers of Fury!

There are pages of our guild site that are maintained offline. For example, our loot page, which is built offline using a homegrown tool for tracking raids, mobs, loots..

I would like to add a “publish“ feature to the tool, so that predefined reports could be sent to specific content areas of the site. I could probably hack it out using the current interface, but it would be tough. Ideally, a Web Service, or SOAP approach would be very convienent. But, a normal post with username, password, guildID, contentID and content to a special upload interface page would probably be quicker.

Thanks!

Hunter Arleon
Garden Stalker of Tholuxe Paells
Through The Never
"I am the would behind the arrow..."
TopBottom

Arleon (Guild Admin) 6/23/2004 3:52 AM EST : RE: HTML upload interface...

Arleon
Posts: 410
Fingers of Fury!

name="2845672">

Edit: I wrote a poster add on to my tool, which I was having some issues with. Then I came here in a state of extreme exhaustion and posted way too long a post going into detail that probably didn't make sense..
 
Hence the edit.

Thanks

Hunter Arleon
Garden Stalker of Tholuxe Paells
Through The Never
"I am the would behind the arrow..."
TopBottom

Arleon (Guild Admin) 6/24/2004 1:22 AM EST : RE: HTML upload interface...

Arleon
Posts: 410
Fingers of Fury!

Aha! I figured it out.

If anyone else is trying this, I have two important notes: 2 logins/cookies, and __VIEWSTATE.

Now if only it will work once I clean up my code from all the testing, I will be a happy camper. Perhaps even a dangerous camper.
Hunter Arleon
Garden Stalker of Tholuxe Paells
Through The Never
"I am the would behind the arrow..."
TopBottom

Aaron Lewis (Blue Collar) 6/24/2004 4:24 AM EST : RE: HTML upload interface...
GuildPortal Dev
Aaron Lewis
Posts: 1979
Zomgawsh Poster

Hmmm... So what you're working on will inject a cookie with authentication information into the header, then programmatically populate ViewState to automate publishing of data?  Sounds tricksy!

Web services for content publishing actually already exist, though they're not exposed publicly... The site uses them, though they were created initially for an offline forum viewing Windows client.  I can look at exposing them, but I'd rather hear exactly what you'd like the class interfaces for the web services to look like for the different content types, so that it makes sense from an end-programmer point of view (as opposed to my point of view, which is always focused on the underlying schema). 

If some decent requirements can be thought up, it might open the door to content publishing from an array of third-party tools like FrontPage or even Word/Excel.
Aaron Lewis, GuildPortal.com
TopBottom

Arleon (Guild Admin) 7/3/2004 5:41 PM EST : RE: HTML upload interface...

Arleon
Posts: 410
Fingers of Fury!

Web services are yummy.

IMO, the only real valid content for external upload would be free form content. Unless you plan on opening up the ability to store .csv files or something like that which could be used to generate local views on data.

And yes, I had to handle the cookie validation.. here's the general technique - visit the login page (admin login), and grab a session cookie, then grab the viewstate from the returned content. The other asp variables are not needed, since there are no com objects on the page (I think I send them anyway though). Then it posts the application encoded form data (username and password) back, and grabs any new cookies. Then, it loads up the content editor page (only to get the viewstate information again - it's a lot of overhead to download what you are going to overwrite, but it won't work without the viewstate). Then submit the new content with the viewstate to the proper URL with the proper contentInstance id.. The only way I know of to easily get the contentInstance ID is to go into the editor for the content in a real session then right click and read it from the end of the url.

But it works nicely. I just feel kind of bad for the extra overhead that it takes to get the state right.

Here are two examples of content that the program generates and automatically uploads (with a button press).

Raid loot - this comes from the database, the tool allows entering/editing loot received... This is something that is probably only important to us, because of the way we distribute loot.

Magelo Scraped Roster - this is generated from a few clicks - import latest eq roster, import any new magelo ID's from eqrankings, import magelo information from magelo (this takes a while since there is a delay between each scrape, so that it doesn't spike magelo), then another click to generate the report, and a final one to post it. This would work for anyone as is, but the tool isn't really ready for general consumption. Besides, I am seriously considering putting a jsp front end on it.

I know they are not real pretty. I am working on making the report editor more generic so that it can store a dynamic hierarchical report format in the database. Right now, they are hardcoded in. I have the objects to load/store and build reports from the dynamic reports, but nothing to actually edit the reports.

Plus, there is another cooler report coming along. Maybe two. I would like to be able to display EP/Time flag progress based on magelo profiles.

Another interesting note... the tool I am writing is in java, and the normal java.net. stuff doesn't work right for this, so I had to write my own background client for it.
Hunter Arleon
Garden Stalker of Tholuxe Paells
Through The Never
"I am the would behind the arrow..."
TopBottom

Aaron Lewis (Blue Collar) 7/4/2004 6:42 AM EST : RE: HTML upload interface...
GuildPortal Dev
Aaron Lewis
Posts: 1979
Zomgawsh Poster

Alright, let's get to work on the service. 

Location would probably be: 

     http://www.guildportal.com
     /Services
     /Publisher.asmx

Namespace:

     GuildPortal.Services

Class:

     Publisher

First method:

     Publish
          (
          string userName, 
          string password,
          ContentData contentData
          )

ContentData would be the base class that instances of content would inherit from, so for the first one that'd be available (FreeForm Text/Html), the definition of the class and the base class would look like the code below (these are just signatures, the properties would have accessors/mutators instead of just being public fields like the definition would make it appear):

     public class ContentData
     {
          public int ContentInstanceID; 
          public string Title;
     }

     public class FreeForm : ContentData
     {
          public string Html;
     }

So, once you've got a reference to the service, calling code could look like this:

GuildPortal.Services.ContentData cData = new ContentData(12514);
GuildPortal.Services.FreeForm myFreeForm = (FreeForm)cData;
myFreeForm.Html = “whatever I want here“;
GuildPortal.Services.Publisher.Publish(“myname“, “mypass“, myFreeForm);

I'm not sure how that would look in Java, but I know it's possible.

Other services could be added to get lists of instances of content on your pages, so that you wouldn't have to know beforehand where the content you were editing was located.  Additionally, other types of content (that inherit from ContentData) could be added, each with their own properties that make sense for the particular type of content being worked with.  Any volunteers to write a FrontPage plug-in?  *cackle*
Aaron Lewis, GuildPortal.com
TopBottom

Arleon (Guild Admin) 7/14/2004 1:15 AM EST : RE: HTML upload interface...

Arleon
Posts: 410
Fingers of Fury!

name="2992950">

I like it.

Would it be good to add GuildID to the Publish method for extra verification? I was first thinking that a single person might admin multiple guilds, but it seems like a good idea even if not.

Off the top of my head, the java for this would be something like:

public class ContentData
{
    public int ContentInstanceID;
    public String Title;
    public ContentData(int ContentInstanceID, String Title)
    {
        this.contentInstanceID = ContentInstanceID;
        this.Title = title;
}

public class FreeForm extends ContentData
{
    public string Html;
    public FreeForm(int ContentInstanceID, String Title, String Html)
    {
        super(ContentInstanceID, Title);
        this.Html = Html;
    }
}

Then, to call something like:

String method = "Publish";
String endpoint = " http://www.guildportal.com/Services/Publisher.asmx";

Service  service = new Service();
Call  call = (Call) service.createCall();

call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("http://soapinterop.org/", method));

String ret = "Error";

String content = “Some HTML content“;

FreeForm freeForm = new FreeForm(123456, “Some Title“, content);

try
{
   ret = (String)call.invoke( new Object[] { “myname”, “mypass”,  freeForm } );
}
catch(Exception e)
{
     System.out.println("Publishing: Remote exception: "+e);
    throw e;
}

Hunter Arleon
Garden Stalker of Tholuxe Paells
Through The Never
"I am the would behind the arrow..."
TopBottom

Arleon (Guild Admin) 7/14/2004 1:19 AM EST : RE: HTML upload interface...

Arleon
Posts: 410
Fingers of Fury!

Another thought... this functionality could have some real use in the new dkp loot system, especially for guilds like ours that go by raw hours instead of events.

But even beside that, it could be nice to have an offline tool to organize update items/mobs/zones, etc..
Hunter Arleon
Garden Stalker of Tholuxe Paells
Through The Never
"I am the would behind the arrow..."
TopBottom

Aaron Lewis (Blue Collar) 7/14/2004 5:09 AM EST : RE: HTML upload interface...
GuildPortal Dev
Aaron Lewis
Posts: 1979
Zomgawsh Poster

Yeah, the publish method does all the security checking automatically.  It'll take the content instance id, trace that back up to the page, and from the page, it gets the guild.  From there, since you're passing in your credentials, it checks the guild-to-user record for the access level to make sure you have the proper administrative rights.
Aaron Lewis, GuildPortal.com
TopBottom

Aaron Lewis (Blue Collar) 7/14/2004 5:19 AM EST : RE: HTML upload interface...
GuildPortal Dev
Aaron Lewis
Posts: 1979
Zomgawsh Poster

OK, the service is up.  Take a look at the Publish method -- Title and some other things have been added so you can change the content title as well.  The expected SOAP packets are shown in the Publish method definition.

http://www.guildportal.com/Services/Publisher.asmx
Aaron Lewis, GuildPortal.com
TopBottom

Admins Online
There are   members online.
So-and-so has logged on!
%title%
%message%