Sorry, I was about to reply when I accidently hit the Send button ;)

David Guerizec wrote:

> Tarjei Huse wrote:
> 
>> Jowza! (got tired of hi)
>> 
>> When this point was raised last time Emile thought of the idea of 
>> making a
>> way to easily integreate custom code into the admin interface. It 
>> could be
>> done by referencing a pageelement og snippet so that if it exists, the 
>> code
>> will be included.
>> How about creating a snippet/pageelement for the two situations:
>> (beware: I'm not to confident with files in php due to heavy use of 
>> midgard)
>> 1. when the file is in a variable (line 21 below)
>> 2. after the attachment has been created (so that the parameters can be
>> created, line 30 below)

looks good.

>> Is the mgd_snippet_exists(snippet) function in existence now? If not, we
>> could create two emptysnippets to be called. Then different users can put
>> code into them to suit their needs without messing about in the main 
>> code of
>> the admin interfaces.

This can be done, but we need to define exactly what will be in these snippets, what 
is allowed and what is forbiden.
I think defining empty functions in a single snippet instead of two empty snippets 
would be cleaner.

Example of snippet:
------------------------8<----------------------------------------
function asgard_get_blob_attr($name, $filename, $mimetype)
{
  $attr = array();
  $mt = explode("/", $mimetype);
  switch($mt[0]) {
/* below this line, you can modify the code to suit your needs */
    case "image":
      $attr["size"] = GetImageSize($filename);
      break;
    case "text": // here we can get the nimber of lines/chars...
/* do not modify below */
    default:
      return false;
  }
  return $attr;
}

function asgard_set_blob_attr($attachment, &$attr)
{
  $mt = explode("/", $attachment->mimetype);
  switch($mt[0]) {
/* below this line, you can modify the code to suit your needs */
    case "image":
      $attachment->parameter("size", "x", $attr["size"][0])
      $attachment->parameter("size", "y", $attr["size"][1])
      $attachment->parameter("size", "hw", $attr["size"][3])
      break;
    case "text": // here we can get the nimber of lines/chars...
/* do not modify below */
    default:
      return false;
  }
  return true;
}
------------------------8<----------------------------------------


Hope that helps... ;)

>> 
>> Tarjei
>> 


-- 
Best Regards,
David Guerizec           Free Software Developer
Aurora R&D               [EMAIL PROTECTED]
Midgard core developer   http://www.midgard-project.org/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to