R
ragtek
Guest
I've created a own content type, where i want to use the uploader.
On the page, i'm having the editor and the upload button, after the upload it shows 100%, but then nothing happens.

The console shows:

My files:
installcode:
controller
my attachment handler
On the page, i'm having the editor and the upload button, after the upload it shows 100%, but then nothing happens.

The console shows:

My files:
installcode:
PHP:
public function _install1(){
$query = array();
$query[]= "INSERT INTO xf_content_type
(content_type, addon_id, fields)
VALUES
('ragtek_article', 'ragtekAS', '')";
$query[] = "
INSERT INTO xf_content_type_field
(content_type, field_name, field_value)
VALUES
('ragtek_article', 'news_feed_handler_class', 'Ragtek_AS_NewsFeedHandler_Article'),
('ragtek_article', 'alert_handler_class', 'Ragtek_AS_AlertHandler_Article'),
('ragtek_article', 'search_handler_class', 'Ragtek_AS_Search_DataHandler_Article'),
('ragtek_article', 'attachment_handler_class', 'Ragtek_AS_AttachmentHandler_Article'),
('ragtek_article', 'like_handler_class', 'Ragtek_AS_LikeHandler_Article')";
$query[] = "
CREATE TABLE `xf`.`ragtek_article` (
`article_id` INT( 10 ) NOT NULL AUTO_INCREMENT ,
`user_id` INT( 10 ) NOT NULL ,
`date` INT( 10 ) NOT NULL ,
`message` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`attachcount` SMALLINT( 5 ) NOT NULL ,
`likes` INT( 10 ) NOT NULL ,
`likeusers` BLOB NOT NULL ,
PRIMARY KEY ( `article_id` )
) ENGINE = MYISAM ;";
XenForo_Model::create('XenForo_Model_ContentType')->rebuildContentTypeCache();
controller
PHP:
class Ragtek_AS_ControllerPublic_Index extends XenForo_ControllerPublic_Abstract {
public function actionIndex() {
$articleModel = $this->getArticleModel();
$id = 1;
$article = $articleModel->getArticleFromId($id);
die(print_r($article));
}
public function actionCreateArticle() {
$articleModel = $this->getArticleModel();
$attachmentParams = $articleModel->getAttachmentParams(array(
));
$viewParams = array(
'attachmentParams' => $attachmentParams,
'attachmentConstraints' => $this->getModelFromCache('XenForo_Model_Attachment')->getAttachmentConstraints(),
);
return $this->responseView('Ragtek_AS_View_Create', 'article_create', $viewParams);
}
my attachment handler
PHP:
<?php
class Ragtek_AS_AttachmentHandler_Article extends XenForo_AttachmentHandler_Abstract{
protected $articleModel = null;
protected $contentIdKey = 'article_id';
protected function _canUploadAndManageAttachments(array $contentData, array $viewingUser){
return true;
}
public function _canViewAttachment(array $attachment, array $viewingUser){
return true;
}
public function attachmentPostDelete(array $attachment, Zend_Db_Adapter_Abstract $db){
}
}