revjim.net

January 15th, 2004:

inklog: wow!

Inklog is really fleshing out now. After yet another long talk with Matt yesterday, I’ve decided to revamp the internals of Inklog to have better names for each Object (that better describe what they do) and to break apart the function of each class a bit better. I believe I’ve got something that will work very well.

However, before I get into that, since I’m renaming classes and moving functionality into new places, it’s high time Inklog had a new name. Or maybe not. You tell me. The name Inklog was originally chosen because it was being designed to be a weblog system. Hence, I took "log" from weblog and used the word Ink, you know that primative matierial that was used eons ago to write with before computers were invented. Inklog is still heavily centered around content and writing. Therefore, the "Ink" part of the name can stand. And, it still is a "log" of this Ink or content.. so that part can still stand. However, "log" really gives me that "weblog" feel, and it is now so much more than that. It’s a full blown CMS and application server with customizable EVERYTHING and extensible EVERYTHING. Much more than a weblog. So, if you have any ideas for a better name, I’d love to hear them in the comments.

And now, what you’ve been waiting for. The Inklog object structure. This isn’t set in stone, but, I think it’s pretty good. I used a Javaish syntax because it provides more data than a PHPish syntax would. PHP doesn’t really care what type of anything returns what, but it’s good for developers to understand what will be expected and what they can expect to be returned.

class DB {
  // From PEAR.
  // Genereric Interface to SQL DBs

}

class NODEFACTORY {
  uses AUTHDATASTORE
  uses NODEDATASTORE
  uses METADATASTORE
  uses NODE

  private AUTHDATASTORE $authds
  private NODEDATASTORE $nodeds
  private METADATASTORE $metads
  private Array $nodes
  private String $loggedinuser
  private Array $identities

  public void __constructor(Array $params) 

  public Boolean haspem(Int $id, String $perm)
  public Boolean setperm(Int $id, Array $perms)
  public void login(String $username, String $password)
  private void setlogin(String $loggedinuser)
  private void setidentity(Array $identities)
  public NODE getnodebyid(Int $id)
  public NODE createnodein(Int $id, String $type)
  public Array getchildren(Int $id)
  public Array getchildrenwhere(Int $id, Array $where)
  public Array getmetadata(Int $id)
  public void setmetadata(Int $id, Array $md)
  public void closenodes()

}

class METADATASTORE {
  uses DB

  private DB $db

  public void __constructor(Array $params)

  public Array getmetadata(Int $id)
  public void setmetadata(Int $id, Array $md)
}

class NODEDATASTORE {
  uses DB

  private DB $db

  public void __constructor(Array $params) 

  public Int getidbypath(Array $path)
  public Array(Int) getchildren(Int $id)
  public Array(Int) getchildrenwhere(Int $id, Array $where)
  public void closenodes()
  private void setnodedatabyid(Int $id, Array $nodedata)
  private Array(Mixed) getnodedatabyid(Int $id)
}

class AUTHDATASTORE {
  uses DB

  private DB $db
  private String $loggedinuser
  private Array $identities

  public void __constructor(Array $params)

  public Array verifylogin(String $username, String $password)
  public Array getgroups()
  public void setpermofnode(Int $id, Array $perms)
  public Array getpermofnode(Int $id)
}

class NODE {
  private Int $id
  private Byte $data
  private String $name
  private Timestamp $createdate
  private Timestamp $modifydate
  private String $type = 'generic'
  private String $format
  private Int $parent

  public void __constructor(DATASTORE $ds)

  public Array getchildren()
  public Int getparent()
  public Array getchildrenwhere(Array $where)
  public void setdata(Byte $data)
  public void setname(String $name)
  public void setcreatedate(Timestamp $createdate)
  private void setmodifydate(Timestamp $modifydate)
  public void setformat(String $format)
  private void freeze()
  public void setparent(Int $id)
  public Byte getdata()
  public String getname()
  public Timestamp getcreatedate()
  public Timestamp getmodifydate()
  public String gettype()
  public String getformat()
  private void thaw(Array $data)
  public void setmetadata(Array $md)
  public Array getmetadata()
  public void postthaw()
  public void prefreeze()

  public OBJECTRENDERING action_view(String $format, Array $params)
}

class WHATEVERTHEHELLYOUWANT extends NODE {

}

class SMARTY {
  // Prewritten class to handle templates

}

class THEME {
  uses SMARTY
  uses OBJECTRENDERING

  public void __constructor(DATASTORE $ds)

  public void assigndata(String $varname, Mixed $vardata)
  public void setoutputformat(String $format)
  private String gettemplate()
  public OBJECTRENDERING render()
}

class OBJECTRENDERING {
  private String $contenttype
  private Byte $rendering
  private Timestamp $lastmodified
  private Boolean $iserror
  private String $errormsg

  public Boolean iserror()
  public String gettype()
  public Byte getdata()
  public Timestamp getlastmodified()
  public void settype(String $contenttype)
  public void setdata(Byte $data)
  public void setlastmodified(Timestamp $lastmodified)
  public String geterrormsg()
  public void seterrormsg(String $errormsg)
}

Comments, suggestions, corrections, and ideas are always welcome.