Skip to content

Commit

Permalink
Add object API
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepwinter committed May 7, 2011
1 parent 5ae8fa7 commit 447119d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions application/config/objects.xml
Expand Up @@ -183,6 +183,14 @@
<link field="theLink" label="A Link for All"/>
</elements>
</template>


<template name="wildflowerTestObject" >
<elements>
<image field="image" label="Image of the Wildflower"/>
</elements>
</template>

</templates>

</configuration>
Binary file added modules/mopcms/classes/.mopcms.php.swp
Binary file not shown.
Binary file added modules/mopcms/classes/mop/.cms.php.swp
Binary file not shown.
2 changes: 2 additions & 0 deletions modules/mopcms/classes/mop/cms.php
Expand Up @@ -181,6 +181,8 @@ public function action_getPage($id){
}

public function action_addchild($id, $template_id){
Kohana::$log->add(Log::ERROR, var_export($_POST, true));
Kohana::$log->add(Log::ERROR, var_export($_FILES, true));
$data = $_POST;
$newId = mopcms::addObject($id, $template_id, $data);
$this->response->data($newId);
Expand Down
4 changes: 2 additions & 2 deletions modules/mopcms/classes/mopcms.php
Expand Up @@ -465,8 +465,8 @@ public static function addObject($parent_id, $template_ident, $data = array() ){
case 'image':
//need to get the file out of the FILES array

if(isset($_FILES[$_POST['field']])){
$file = mopcms::saveHttpPostFile($pageid, $_POST['field'], $_FILES[$_POST['field']]);
if(isset($_FILES[$_POST[$field]])){
$file = mopcms::saveHttpPostFile($pageid, $_POST[$field], $_FILES[$_POST[$field]]);
} else {
$file = ORM::Factory('file');
$file->filename = $value;
Expand Down

0 comments on commit 447119d

Please sign in to comment.