contract ARK_TROGLOg_1_00 {
    /* TROGLOg is part of ARK Endowment, all the documents are property of the relative ARK BOTs owners */
    ARK Ark;
     
    address owner;

    mapping(uint => string)troglogs;

////////////////////////////////////////////////
    log[] logs;

    struct log{
    address admin;
    string action;
    address addr;
    uint docu;
    }
////////////////////////////////////////////////

    function ARK_TROGLOg_1_00() {
    owner=msg.sender;
    }

    //change TROGLOg controller
    function setOwner(address a) {
    if(msg.sender!=owner)throw;
    owner=a;
    logs.push(log(owner,"setOwner",a,0));
    }

    //point TROGLOg to ARK
    function setSource(address a) {
    if(msg.sender!=owner)throw;
    Ark=ARK(a);
    logs.push(log(owner,"setSource",a,0));
    }

    function readLog(uint i)constant returns(address,string,address,uint){
    log l=logs[i];
    return(l.admin,l.action,l.addr,l.docu);
    }

    
    function submitCoding(string s,uint i){
    var(own,dat,a,b) = Ark.getBot(i);
    if((own==msg.sender)){troglogs[i]=s;logs.push(log(msg.sender,"setDocument",0x0,i));}else{throw;}
    }
        
    

    function getLOg(uint i) constant returns(string){  
    if(!(Ark.getOwnedBot(msg.sender,0)>0))throw;
    return (troglogs[i]);}


}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function setSource(address a) {
if(msg.sender!=owner)throw;
Ark=ARK(a);
logs.push(log(owner,"setSource",a,0));
}

//point TROGLOg to ARK