// BEGIN FLOCK GPL
//
// Copyright Flock Inc. 2005-2009
// http://flock.com
//
// This file may be used under the terms of the
// GNU General Public License Version 2 or later (the "GPL"),
// http://www.gnu.org/licenses/gpl.html
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
//
// END FLOCK GPL

function testHostingServices() {
	var bloggerHostingService = Components.classes['@flock.com/blog/hostingservice/blogger;1']
	.createInstance(Components.interfaces.flockIBlogHostingService);
	var wordpressHostingService = Components.classes['@flock.com/blog/hostingservice/wordpress;1']
	.createInstance(Components.interfaces.flockIBlogHostingService);
	
	dump("Got a bloggerHostingService: " + bloggerHostingService + "\n");
	dump("Got a wordpressHostingService: " + wordpressHostingService + "\n");
	dump ("It's service type is " + wordpressHostingService.serviceType + "\n");
}


function _____flock_blogTest() {
//    var blogSettings =  flock_blogGetSettings();
//    var blogAccount =  blogSettings.getAccount()();
    
}

function __flock_blogTest()
{
    var ds = flock_blogGetDS();
    var dsource = flock_blogGetDS().getRawDataSource();

    //ds.deleteDescendents(BLOG_ALLPOSTS_FOLDER);
    var node = ds.getNode(BLOG_ALLPOSTS_FOLDER).source;
    //ds.deleteSpecial(allPosts,2);

    var props=ds.getRawDataSource().ArcLabelsOut(node);
    while(props.hasMoreElements()){
        var prop=props.getNext();
        var target=dsource.GetTarget(node,prop,true);
        dsource.Unassert(node,prop,target)
    }

    window.close();
}

function flock_blogTest()
{
    var stringBundle = flock_getStringBundle("chrome://editor/locale/blog.properties");
    //alert(stringBundle.GetStringFromName("test"));
    return;
    var name = "Jes";
    var url = "http://antatr2.blogspot.com";
    var appKey = "";
    var apiLink = "http://an9.org/wp4anthony/xmlrpc.php";
//    var apiLink = "https://www.blogger.com/atom/13882908";
    var blogID = "1";
    var username = "anthony";
    var password = "password";
    var B = new MovableTypeAPI();

    B.init(name, appKey, apiLink, blogID, false, username, password);
    var listener = new BlogAPIListener();
    listener.onResult = function(aResult) {
        alert(aResult);
    };
    listener.onError = function(aError) {
        alert(aError);
    };
    listener.onFault = function(aFault) {
        alert(aFault);
    };
    B.getCategoryList(listener);
}

/*
function flock_testLoad()
{
    flock_testSetupCommands();
}

function flock_testSetupCommands()
{
    var controller = new CommandController();
    controller.cmd_flock_test = flock_testCommand;

    top.controllers.appendController(controller);
    top.focus();
    return;
}

var flock_testCommand =
{
    isEnabled: function()
    {
        alert("here");
        dump("flock_testCommand\n");
        return false;
    },
    exec: function()
    {
    },
}

function flock_goUpdateTestCommandSet(aSet)
{
    for(var i=0;i<aSet.childNodes.length;++i)
    {
        var command = aSet.childNodes.item(i);
        var controller = window.document.commandDispatcher.getControllerForCommand(command.id);
        dump("flock_goUpdateNormalCommandSet(aSet) " + command.id + "<>" + controller + "\n");
        if(!controller) continue;
        if(controller.isCommandEnabled(command.id))
        {
            dump("Enabling: " + command.parentNode.parentNode.id + "\n");
            command.removeAttribute("disabled");
        }
        else
        {
            dump("Disabling: " + command.parentNode.parentNode.id + "\n");
            command.setAttribute("disabled", true);
        }
    }
}
*/
