diff --git a/application/modules/default/controllers/ExploreController.php b/application/modules/default/controllers/ExploreController.php index a87ea8202..e7bee9b77 100644 --- a/application/modules/default/controllers/ExploreController.php +++ b/application/modules/default/controllers/ExploreController.php @@ -1,589 +1,596 @@ . **/ class ExploreController extends Local_Controller_Action_DomainSwitch { const DEFAULT_ORDER = 'latest'; const TAG_ISORIGINAL = 'original-product'; /** @var string */ protected $_browserTitlePrepend; public function init() { parent::init(); $this->_auth = Zend_Auth::getInstance(); } public function categoriesAction() { // Filter-Parameter $inputFilterParams['category'] = (int)$this->getParam('cat', null); $inputFilterParams['filter'] = (int)$this->getParam('fil', null); $inputFilterParams['order'] = preg_replace('/[^-a-zA-Z0-9_]/', '', $this->getParam('ord', self::DEFAULT_ORDER)); $inputFilterParams['selected'] = (int)$this->getParam('sel', $inputFilterParams['category']); $modelCategories = new Default_Model_DbTable_ProjectCategory(); $children = $modelCategories->fetchImmediateChildren($inputFilterParams['selected']); $selChild = $modelCategories->fetchElement($inputFilterParams['filter']); $response = $this->generateResponseMsg($children, $inputFilterParams, $selChild); $this->_helper->json($response); } private function generateResponseMsg($children, $inputParams, $selChild) { $result = array(); if (count($children) == 0) { return $result; } $helperBuildExploreUrl = new Default_View_Helper_BuildExploreUrl(); foreach ($children as $child) { $nodeSelectedState = ($inputParams['filter'] == $child['project_category_id']) ? true : false; if (1 == ($child['rgt'] - $child['lft'])) { $result[] = array( 'title' => $child['title'], 'key' => $child['project_category_id'], 'href' => $helperBuildExploreUrl->buildExploreUrl($inputParams['category'], $child['project_category_id'], $inputParams['order']), 'target' => '_top', 'selected' => $nodeSelectedState ); } else { $nodeHasChildren = (1 == ($child['rgt'] - $child['lft'])) ? false : true; $nodeIsSelectedSubCat = (($selChild['lft'] > $child['lft']) AND ($selChild['rgt'] < $child['rgt'])) ? true : false; $nodeExpandedState = false; $nodeChildren = null; if ($nodeHasChildren AND $nodeIsSelectedSubCat) { $nodeExpandedState = true; $modelCategories = new Default_Model_DbTable_ProjectCategory(); $immChildren = $modelCategories->fetchImmediateChildren($child['project_category_id']); $nodeChildren = $this->generateResponseMsg($immChildren, $inputParams, $selChild); } $result[] = array( 'title' => $child['title'], 'key' => $child['project_category_id'], 'folder' => true, 'lazy' => true, 'selected' => $nodeSelectedState, 'expanded' => $nodeExpandedState, 'href' => $helperBuildExploreUrl->buildExploreUrl($inputParams['category'], $child['project_category_id'], $inputParams['order']), 'target' => '_top', 'children' => $nodeChildren ); } } return $result; } /** * @throws Zend_Cache_Exception * @throws Zend_Db_Select_Exception * @throws Zend_Exception * @throws Zend_Loader_PluginLoader_Exception * @throws Zend_Paginator_Exception */ public function indexAction() { // Filter-Parameter /*$inputFilterOriginal = $this->getParam('filteroriginal', $this->getFilterOriginalFromCookie()); $this->storeFilterOriginalInCookie($inputFilterOriginal); $this->view->inputFilterOriginal = $inputFilterOriginal; */ $isShowOnlyFavs = (int)$this->getParam('fav', 0); $inputCatId = (int)$this->getParam('cat', null); if ($inputCatId) { // $this->view->isFilterCat = true; // $this->view->filterCat = $inputCatId; $this->view->catabout = $this->getCategoryAbout($inputCatId); $helperFetchCategory = new Default_View_Helper_CatTitle(); $catTitle = $helperFetchCategory->catTitle($inputCatId); //$this->view->headTitle($catTitle . ' - ' . $_SERVER['HTTP_HOST'], 'SET'); $this->view->headTitle($catTitle . ' - ' . $this->getHeadTitle(), 'SET'); } $this->view->cat_id = $inputCatId; $this->view->showAddProduct = 1; $storeCatIds = Zend_Registry::isRegistered('store_category_list') ? Zend_Registry::get('store_category_list') : null; $filter = array(); $filter['category'] = $inputCatId ? $inputCatId : $storeCatIds; $filter['order'] = preg_replace('/[^-a-zA-Z0-9_]/', '', $this->getParam('ord', self::DEFAULT_ORDER)); // removed filter original 20191007 //$filter['original'] = $inputFilterOriginal == 1 ? self::TAG_ISORIGINAL : null; if($isShowOnlyFavs == 1) { if($this->_authMember->member_id) { $filter['favorite'] = $this->_authMember->member_id; $this->view->authMember = $this->_authMember; }else{ $this->redirect('/browse'); } }else { $isShowOnlyFavs = 0; } $filter['tag'] = Zend_Registry::isRegistered('config_store_tags') ? Zend_Registry::get('config_store_tags') : null; if (APPLICATION_ENV == "development") { Zend_Registry::get('logger')->debug(__METHOD__ . ' - ' . json_encode($filter)); } $tagFilter = Zend_Registry::isRegistered('config_store_tags') ? Zend_Registry::get('config_store_tags') : null; $tagGroupFilter = Zend_Registry::isRegistered('config_store_taggroups') ? Zend_Registry::get('config_store_taggroups') : null; if(!empty($tagGroupFilter)) { $filterArray = array(); foreach ($tagGroupFilter as $tagGroupId) { $inputFilter = $this->getFilterTagFromCookie($tagGroupId); $filterArray[$tagGroupId] = $inputFilter; if(!empty($inputFilter)) { $filter['tag'][] = $inputFilter; } } $this->view->tag_group_filter = $filterArray; } $storeConfig = Zend_Registry::isRegistered('store_config') ? Zend_Registry::get('store_config') : null; $page = (int)$this->getParam('page', 1); $index = null; $browseListType = null; //Old: index as Param $index = $this->getParam('index'); if($index) { - if($index == 2) { - $browseListType = 'picture'; - } - if($index == 3) { - $browseListType = 'music'; - } - if($index == 4) { - $browseListType = 'phone-pictures'; - } - + switch ($index) { + case 2: + $browseListType = 'picture'; + break; + case 3: + $browseListType = 'picture'; + break; + case 4: + $browseListType = 'phone-pictures'; + break; + case 8: + $browseListType = 'apps'; + break; + case 9: + $browseListType = 'icons'; + break; + } } if($storeConfig->browse_list_type) { $listTypeTable = new Default_Model_DbTable_BrowseListType(); $listType = $listTypeTable->findBrowseListType($storeConfig->browse_list_type); if(isset($listType)) { $browseListType = $listType['name']; $index = 2; } } //Browse List config in Category set? if(!$index) { //Now the list type is in backend categories set $tableCat = new Default_Model_DbTable_ProjectCategory(); $cat = $tableCat->findCategory($this->view->cat_id); if(isset($cat) && isset($cat['browse_list_type'])) { $indexListType = $cat['browse_list_type']; $listTypeTable = new Default_Model_DbTable_BrowseListType(); $listType = $listTypeTable->findBrowseListType($indexListType); if(isset($listType)) { $browseListType = $listType['name']; $index = 2; } } } // my favourite list filter & list layout if($isShowOnlyFavs == 1) { $index=7; $browseListType = 'myfav'; } if($index) { // only switch view via index=2 parameter $pageLimit = 50; if($index==7) $pageLimit = 10; $requestedElements = $this->fetchRequestedElements($filter, $pageLimit, ($page - 1) * $pageLimit); $this->view->productsJson = Zend_Json::encode($requestedElements['elements']); $this->view->filtersJson = Zend_Json::encode($filter); $this->view->cat_idJson = Zend_Json::encode($inputCatId); $modelInfo = new Default_Model_Info(); $topprods = $modelInfo->getMostDownloaded(100, $inputCatId, $tagFilter); $this->view->topprodsJson = Zend_Json::encode($topprods); $comments = $modelInfo->getLatestComments(5, $inputCatId, $tagFilter); $this->view->commentsJson = Zend_Json::encode($comments); $modelCategory = new Default_Model_ProjectCategory(); $this->view->categoriesJson = Zend_Json::encode($modelCategory->fetchTreeForView()); $this->view->browseListType = $browseListType; $this->view->pageLimit = $pageLimit; /* // temperately when index=3 return product files too... in the future could be replaced by category parameter. if($index==3 || $browseListType == 'music') { $modelProject = new Default_Model_Project(); $files = $modelProject->fetchFilesForProjects($requestedElements['elements']); $salt = PPLOAD_DOWNLOAD_SECRET; foreach ($files as &$file) { $timestamp = time() + 3600; // one hour valid $hash = hash('sha512',$salt . $file['collection_id'] . $timestamp); // order isn't important at all... just do the same when verifying $url = PPLOAD_API_URI . 'files/download/id/' . $file['id'] . '/s/' . $hash . '/t/' . $timestamp; if(null != $this->_authMember) { $url .= '/u/' . $this->_authMember->member_id; } $url .= '/lt/filepreview/' . $file['name']; $file['url'] = urlencode($url); } } else { $modelProject = new Default_Model_Project(); $files = $modelProject->fetchFilesForProjects($requestedElements['elements']); $salt = PPLOAD_DOWNLOAD_SECRET; foreach ($files as &$file) { $timestamp = time() + 3600; // one hour valid $hash = hash('sha512',$salt . $file['collection_id'] . $timestamp); // order isn't important at all... just do the same when verifying $url = PPLOAD_API_URI . 'files/download/id/' . $file['id'] . '/s/' . $hash . '/t/' . $timestamp; if(null != $this->_authMember) { $url .= '/u/' . $this->_authMember->member_id; } $url .= '/lt/filepreview/' . $file['name']; $file['url'] = urlencode($url); } } * */ $this->_helper->viewRenderer('index-react'.$index); } else if ($storeConfig->layout_explore && $storeConfig->isRenderReact()) { $pageLimit = 50; $requestedElements = $this->fetchRequestedElements($filter, $pageLimit, ($page - 1) * $pageLimit); $this->view->productsJson = Zend_Json::encode($requestedElements['elements']); $this->view->filtersJson = Zend_Json::encode($filter); $this->view->cat_idJson = Zend_Json::encode($inputCatId); $modelInfo = new Default_Model_Info(); $topprods = $modelInfo->getMostDownloaded(100, $inputCatId, $tagFilter); $this->view->topprodsJson = Zend_Json::encode($topprods); $comments = $modelInfo->getLatestComments(5, $inputCatId, $tagFilter); $this->view->commentsJson = Zend_Json::encode($comments); $modelCategory = new Default_Model_ProjectCategory(); $this->view->categoriesJson = Zend_Json::encode($modelCategory->fetchTreeForView()); $this->_helper->viewRenderer('index-react'); $this->view->pageLimit = $pageLimit; } else { $pageLimit = 10; $requestedElements = $this->fetchRequestedElements($filter, $pageLimit, ($page - 1) * $pageLimit); $this->view->pageLimit = $pageLimit; } if($storeConfig) { $this->view->storeabout = $this->getStoreAbout($storeConfig->store_id); } $paginator = Local_Paginator::factory($requestedElements['elements']); $paginator->setItemCountPerPage($pageLimit); $paginator->setCurrentPageNumber($page); $paginator->setTotalItemCount($requestedElements['total_count']); $this->view->products = $paginator; $this->view->totalcount = $requestedElements['total_count']; $this->view->filters = $filter; $this->view->page = $page; $this->view->package_type = Zend_Registry::isRegistered('config_store_tags') ? Zend_Registry::get('config_store_tags') : null; $this->view->tags = $tagFilter; } /** * @param $inputCatId * * @return string|null * @throws Zend_Exception */ protected function getCategoryAbout($inputCatId) { $config = Zend_Registry::get('config'); $static_config = $config->settings->static; $include_path_cat = $static_config->include_path . 'category_about/' . $inputCatId . '.phtml'; if (file_exists($include_path_cat)) { return $include_path_cat; } return null; } /** * @param array $inputFilterParams * @param int $limit * @param int $offset * * @return array * @throws Zend_Cache_Exception * @throws Zend_Db_Select_Exception * @throws Zend_Exception */ private function fetchRequestedElements($inputFilterParams, $limit = null, $offset = null) { $modelProject = new Default_Model_Project(); $requestedElements = $modelProject->fetchProjectsByFilter($inputFilterParams, $limit, $offset); return $requestedElements; } /** * @throws Zend_Exception * @throws Zend_Paginator_Exception */ public function searchAction() { ini_set('memory_limit', '3072M'); $allDomainCatIds = Zend_Registry::isRegistered('store_category_list') ? Zend_Registry::get('store_category_list') : null; if (count($allDomainCatIds) == 0) { $allDomainCatIds = null; } if (isset($allDomainCatIds)) { $this->view->categories = $allDomainCatIds; } else { $modelCategories = new Default_Model_DbTable_ProjectCategory(); $this->view->categories = $modelCategories->fetchMainCatIdsOrdered(); } // Filter-Parameter $filterInput = new Zend_Filter_Input(array('*' => 'StringTrim', 'projectSearchText' => 'StripTags', 'page' => 'digits'), array( 'projectSearchText' => array( new Zend_Validate_StringLength(array('min' => 3, 'max' => 100)), 'presence' => 'required' ), 'page' => 'digits' ), $this->getAllParams()); if ($filterInput->hasInvalid()) { $this->_helper->viewRenderer('searchError'); $this->view->messages = $filterInput->getMessages(); return; } $inputFilterParams['projectSearchText'] = $filterInput->getUnescaped('projectSearchText'); $page = (int)$filterInput->getEscaped('page'); $config = Zend_Registry::get('config'); Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8'); Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive()); $dataPath = $config->settings->search->path; $dataPath .= $this->getNameForStoreClient() . DIRECTORY_SEPARATOR; $index = Zend_Search_Lucene::open($dataPath); try { $hits = $index->find($inputFilterParams['projectSearchText'] . '*'); } catch (Zend_Search_Lucene_Exception $e) { Zend_Registry::get('logger')->err(__METHOD__ . ' - ' . $e->getMessage() . PHP_EOL . $e->getTraceAsString()); $hits = array(); } if (count($hits) == 0) { $this->_helper->viewRenderer('searchError'); $this->view->inputFilter = $inputFilterParams; $this->view->searchText = $inputFilterParams['projectSearchText']; return; } $results = $this->copyToArray($hits); $paginator = Zend_Paginator::factory($results); $paginator->setDefaultItemCountPerPage(10); $paginator->setCurrentPageNumber($page); $this->view->hitsCount = count($hits); $this->view->hits = $paginator; $this->view->page = $page; $this->view->inputFilter = $inputFilterParams; $this->view->searchText = $inputFilterParams['projectSearchText']; } /** * @param array $hits * * @return array */ protected function copyToArray($hits) { $returnArray = array(); /** @var $hit Zend_Search_Lucene_Search_QueryHit */ foreach ($hits as $hit) { $returnArray[] = $hit->getDocument(); } return $returnArray; } protected function _initResponseHeader() { $duration = 1800; // in seconds $expires = gmdate("D, d M Y H:i:s", time() + $duration) . " GMT"; $this->getResponse() ->setHeader('X-FRAME-OPTIONS', 'ALLOWALL', true) // ->setHeader('Last-Modified', $modifiedTime, true) ->setHeader('Expires', $expires, true)->setHeader('Pragma', 'no-cache', true) ->setHeader('Cache-Control', 'private, no-cache, must-revalidate', true) ; } /** * @param Zend_Config $static_config * @return string|null */ protected function getStoreAbout($storeId) { $config = Zend_Registry::get('config'); $static_config = $config->settings->static; $include_path_cat = $static_config->include_path . 'store_about/' . $storeId . '.phtml'; if (file_exists($include_path_cat)) { return $include_path_cat; } return null; } /** * @param array $elements * * @return array with additional info's * @deprecated */ private function fetchAdditionalData($elements) { $modelProject = new Default_Model_Project(); $requestedElements = Array(); foreach ($elements as $project) { $info = $modelProject->fetchProductInfo($project['project_id']); $requestedElements[] = $info; } return $requestedElements; } protected function setLayout() { $layoutName = 'flat_ui_template'; $storeConfig = Zend_Registry::isRegistered('store_config') ? Zend_Registry::get('store_config') : null; if($storeConfig && $storeConfig->layout_explore) { $this->_helper->layout()->setLayout($storeConfig->layout_explore); }else{ $this->_helper->layout()->setLayout($layoutName); } } /* private function storeFilterOriginalInCookie($inputFilterOriginal) { $storedInCookie = $this->getFilterOriginalFromCookie(); if (isset($inputFilterOriginal) AND ($inputFilterOriginal != $storedInCookie)) { $config = Zend_Registry::get('config'); $cookieName = $config->settings->session->filter_browse_original; $remember_me_seconds = $config->settings->session->remember_me->cookie_lifetime; $cookieExpire = time() + $remember_me_seconds; setcookie($cookieName, $inputFilterOriginal, $cookieExpire, '/'); } } private function getFilterOriginalFromCookie() { $config = Zend_Registry::get('config'); $cookieName = $config->settings->session->filter_browse_original; $storedInCookie = isset($_COOKIE[$cookieName]) ? $_COOKIE[$cookieName] : NULL; return $storedInCookie; }*/ private function storeFilterTagInCookie($group, $tag) { $storedInCookie = $this->getFilterTagFromCookie($group); if (isset($tag) AND ($tag != $storedInCookie)) { $config = Zend_Registry::get('config'); $cookieName = $config->settings->session->filter_browse_original.$group; $remember_me_seconds = $config->settings->session->remember_me->cookie_lifetime; $cookieExpire = time() + $remember_me_seconds; setcookie($cookieName, $tag, $cookieExpire, '/'); } } private function getFilterTagFromCookie($group) { $config = Zend_Registry::get('config'); $cookieName = $config->settings->session->filter_browse_original.$group; $storedInCookie = isset($_COOKIE[$cookieName]) ? $_COOKIE[$cookieName] : NULL; return $storedInCookie; } public function savetaggroupfilterAction() { // Filter-Parameter $tagGroupId = (int)$this->getParam('group_id', null); $tagId = (int)$this->getParam('tag_id', null); $this->storeFilterTagInCookie($tagGroupId, $tagId); $response = array(); $response['Result'] = 'OK'; $this->_helper->json($response); } } \ No newline at end of file diff --git a/application/modules/default/controllers/ProductController.php b/application/modules/default/controllers/ProductController.php index 52ecf3012..710494b69 100644 --- a/application/modules/default/controllers/ProductController.php +++ b/application/modules/default/controllers/ProductController.php @@ -1,3194 +1,3223 @@ . **/ class ProductController extends Local_Controller_Action_DomainSwitch { const IMAGE_SMALL_UPLOAD = 'image_small_upload'; const IMAGE_BIG_UPLOAD = 'image_big_upload'; /** * Zend_Controller_Request_Abstract object wrapping the request environment * * @var Zend_Controller_Request_Http */ protected $_request = null; /** @var int */ protected $_projectId; /** @var int */ protected $_collectionId; /** @var Zend_Auth */ protected $_auth; /** @var string */ protected $_browserTitlePrepend; public function init() { parent::init(); $this->_projectId = (int)$this->getParam('project_id'); $this->_collectionId = (int)$this->getParam('collection_id'); $this->_auth = Zend_Auth::getInstance(); $this->_browserTitlePrepend = $this->templateConfigData['head']['browser_title_prepend']; $action = $this->getRequest()->getActionName(); $title = $action; if($action =='add') { $title = 'add product'; }else { $title = $action; } $this->view->headTitle($title . ' - ' . $this->getHeadTitle(), 'SET'); } public function ratingAction() { $this->_helper->layout()->disableLayout(); if (array_key_exists($this->_projectId, $this->_authMember->projects)) { return; } $userRating = (int)$this->getParam('rate', 0); $modelRating = new Default_Model_DbTable_ProjectRating(); $modelRating->rateForProject($this->_projectId, $this->_authMember->member_id, $userRating); } public function pploadAction() { $this->_helper->layout->disableLayout(); $modelProduct = new Default_Model_Project(); $productInfo = $modelProduct->fetchProductInfo($this->_projectId); //create ppload download hash: secret + collection_id + expire-timestamp $salt = PPLOAD_DOWNLOAD_SECRET; $collectionID = $productInfo->ppload_collection_id; $timestamp = time() + 3600; // one hour valid //20181009 ronald: change hash from MD5 to SHA512 //$hash = md5($salt . $collectionID . $timestamp); // order isn't important at all... just do the same when verifying $hash = hash('sha512',$salt . $collectionID . $timestamp); // order isn't important at all... just do the same when verifying $this->view->download_hash = $hash; $this->view->download_timestamp = $timestamp; $this->view->product = $productInfo; $this->_helper->viewRenderer('/partials/pploadajax'); } public function gettaggroupsforcatajaxAction() { $this->_helper->layout()->disableLayout(); $catId = null; $fileId = null; if($this->hasParam('file_id')) { $fileId = $this->getParam('file_id'); } if($this->hasParam('project_cat_id')) { $catId = $this->getParam('project_cat_id'); $catTagModel = new Default_Model_Tags(); $catTagGropuModel = new Default_Model_TagGroup(); $tagGroups = $catTagGropuModel->fetchTagGroupsForCategory($catId); $tableTags = new Default_Model_DbTable_Tags(); $result = array(); $resultGroup = array(); foreach ($tagGroups as $group) { $tags = $tableTags->fetchForGroupForSelect($group['tag_group_id']); $selectedTags = null; if(!empty($fileId)) { $selectedTags = $catTagModel->getTagsArray($fileId, Default_Model_DbTable_Tags::TAG_TYPE_FILE,$group['tag_group_id']); } $group['tag_list'] = $tags; $group['selected_tags'] = $selectedTags; $result[] = $group; } $this->_helper->json(array('status' => 'ok', 'ResultSize' => count($tagGroups), 'tag_groups' => $result)); return; } $this->_helper->json(array('status' => 'error')); } private function getTagGroupsForCat($fileId) { $modelProduct = new Default_Model_Project(); $productInfo = $modelProduct->fetchProductInfo($this->_projectId); $catId = $productInfo->project_category_id; if(!empty($catId)) { $catTagModel = new Default_Model_Tags(); $catTagGropuModel = new Default_Model_TagGroup(); $tagGroups = $catTagGropuModel->fetchTagGroupsForCategory($catId); $tableTags = new Default_Model_DbTable_Tags(); $result = array(); foreach ($tagGroups as $group) { $tags = $tableTags->fetchForGroupForSelect($group['tag_group_id']); $selectedTags = null; if(!empty($fileId)) { $selectedTags = $catTagModel->getTagsArray($fileId, Default_Model_DbTable_Tags::TAG_TYPE_FILE,$group['tag_group_id']); } $group['tag_list'] = $tags; $group['selected_tags'] = $selectedTags; $result[] = $group; } return $result; } return null; } private function getFileDownloadCount($collection_id, $fileId) { $modelFiles = new Default_Model_DbTable_PploadFiles(); $countAll = $modelFiles->fetchCountDownloadsForFileAllTime($collection_id, $fileId); $countToday = $modelFiles->fetchCountDownloadsForFileToday($collection_id, $fileId); $count = (int)$countAll+ (int)$countToday; return $count; } public function listsamesourceurlAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $modelProduct = new Default_Model_Project(); $productInfo = $modelProduct->fetchProductInfo($this->_projectId); $result = $modelProduct->getSourceUrlProjects($productInfo->source_url); $r = '
'; foreach ($result as $value) { $r=$r.'
' .'
'.$value['title'].'
' .'' .'
'.$value['created_at'].'
' .'
'.$value['changed_at'].'
' .'
'; } $r = $r.'
'; /*$response='';*/ echo $r; } public function getfilesajaxAction() { $this->_helper->layout()->disableLayout(); $collection_id = null; $file_status = null; $ignore_status_code = null; $helperUserRole = new Backend_View_Helper_UserRole(); $userRoleName = $helperUserRole->userRole(); if($this->hasParam('status')) { $file_status = $this->getParam('status'); } if($this->hasParam('ignore_status_code')) { $ignore_status_code = $this->getParam('ignore_status_code'); } $filesTable = new Default_Model_DbTable_PploadFiles(); if($this->hasParam('collection_id')) { $collection_id = $this->getParam('collection_id'); $result = array(); $isForAdmin = false; if ($userRoleName == Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN) { $isForAdmin = true; } //Load files from DB if($ignore_status_code == 0 && $file_status == 'active') { $files = $filesTable->fetchAllActiveFilesForProject($collection_id, $isForAdmin); } else { $files = $filesTable->fetchAllFilesForProject($collection_id, $isForAdmin); } //Check, if the project category has tag-grous $modelProduct = new Default_Model_Project(); $productInfo = $modelProduct->fetchProductInfo($this->_projectId); $catTagGropuModel = new Default_Model_TagGroup(); $tagGroups = $catTagGropuModel->fetchTagGroupsForCategory($productInfo->project_category_id); foreach ($files as $file) { //add tag grous, if needed if(!empty($tagGroups)) { $groups = $this->getTagGroupsForCat($file['id']); $file['tag_groups'] = $groups; } //Download Counter //new counter IP based $counterUkAll = $file['count_dl_all_uk']; $counterNoUkAll = $file['count_dl_all_nouk']; $counterUkToday = $file['count_dl_uk_today']; $counterNew = 0; if(!empty($counterUkAll)) { $counterNew = $counterNew + $counterUkAll; } if(!empty($counterUkToday)) { $counterNew = $counterNew + $counterUkToday; } if(!empty($counterNoUkAll)) { $counterNew = $counterNew + $counterNoUkAll; } $file['downloaded_count_uk'] = $counterNew; if ($userRoleName == Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN) { //$file['downloaded_count_live'] = $this->getFileDownloadCount($collection_id, $file['id']); $counterToday = $file['count_dl_today']; $counterAll = $file['count_dl_all']; $counter = 0; if(!empty($counterToday)) { $counter = $counterToday; } if(!empty($counterAll)) { $counter = $counter + $counterAll; } $file['downloaded_count_live'] = $counter; } else { unset($file['count_dl_all']); unset($file['count_dl_all_nouk']); unset($file['count_dl_all_uk']); unset($file['count_dl_uk_today']); unset($file['count_dl_today']); unset($file['downloaded_count']); } $result[] = $file; } $this->_helper->json(array('status' => 'success', 'ResultSize' => count($result), 'files' => $result)); return; } $this->_helper->json(array('status' => 'error')); } public function getfiletagsajaxAction() { $this->_helper->layout()->disableLayout(); $fileId = null; if($this->hasParam('file_id')) { $fileId = $this->getParam('file_id'); $tagModel = new Default_Model_Tags(); $fileTags = $tagModel->getFileTags($fileId); $this->_helper->json(array('status' => 'ok', 'ResultSize' => count($fileTags), 'file_tags' => $fileTags)); return; } $this->_helper->json(array('status' => 'error')); } public function initJsonForReact(){ $modelProduct = new Default_Model_Project(); $productInfo = $modelProduct->fetchProductInfo($this->_projectId); $this->view->product = $productInfo; if (empty($this->view->product)) { throw new Zend_Controller_Action_Exception('This page does not exist', 404); } if(null != $this->_authMember) { $this->view->authMemberJson = Zend_Json::encode( Default_Model_Member::cleanAuthMemberForJson($this->_authMember) ); } $helpAddDefaultScheme = new Default_View_Helper_AddDefaultScheme(); $this->view->product->title = Default_Model_HtmlPurify::purify($this->view->product->title); $this->view->product->description = Default_Model_BBCode::renderHtml(Default_Model_HtmlPurify::purify($this->view->product->description)); $this->view->product->version = Default_Model_HtmlPurify::purify($this->view->product->version); $this->view->product->link_1 = Default_Model_HtmlPurify::purify($helpAddDefaultScheme->addDefaultScheme($this->view->product->link_1),Default_Model_HtmlPurify::ALLOW_URL); $this->view->product->source_url = Default_Model_HtmlPurify::purify($this->view->product->source_url,Default_Model_HtmlPurify::ALLOW_URL); $this->view->product->facebook_code = Default_Model_HtmlPurify::purify($this->view->product->facebook_code,Default_Model_HtmlPurify::ALLOW_URL); $this->view->product->twitter_code = Default_Model_HtmlPurify::purify($this->view->product->twitter_code,Default_Model_HtmlPurify::ALLOW_URL); $this->view->product->google_code = Default_Model_HtmlPurify::purify($this->view->product->google_code,Default_Model_HtmlPurify::ALLOW_URL); $this->view->productJson = Zend_Json::encode(Default_Model_Collection::cleanProductInfoForJson($this->view->product) ); $fmodel =new Default_Model_DbTable_PploadFiles(); $files = $fmodel->fetchFilesForProject($this->view->product->ppload_collection_id); $salt = PPLOAD_DOWNLOAD_SECRET; $filesList = array(); foreach ($files as $file) { $timestamp = time() + 3600; // one hour valid $hash = hash('sha512',$salt . $file['collection_id'] . $timestamp); // order isn't important at all... just do the same when verifying $url = PPLOAD_API_URI . 'files/download/id/' . $file['id'] . '/s/' . $hash . '/t/' . $timestamp; if(null != $this->_authMember) { $url .= '/u/' . $this->_authMember->member_id; } $url .= '/lt/filepreview/' . $file['name']; $file['url'] = urlencode($url); $filesList[] = $file; } $this->view->filesJson = Zend_Json::encode($filesList); $this->view->filesCntJson = Zend_Json::encode($fmodel->fetchFilesCntForProject($this->view->product->ppload_collection_id)); $tableProjectUpdates = new Default_Model_ProjectUpdates(); $this->view->updatesJson = Zend_Json::encode($tableProjectUpdates->fetchProjectUpdates($this->_projectId)); $tableProjectRatings = new Default_Model_DbTable_ProjectRating(); $ratings = $tableProjectRatings->fetchRating($this->_projectId); $cntRatingsActive = 0; foreach ($ratings as $p) { if($p['rating_active']==1) $cntRatingsActive =$cntRatingsActive+1; } $this->view->ratingsJson = Zend_Json::encode($ratings); $this->view->cntRatingsActiveJson = Zend_Json::encode($cntRatingsActive); $identity = Zend_Auth::getInstance()->getStorage()->read(); if (Zend_Auth::getInstance()->hasIdentity()){ $ratingOfUserJson = $tableProjectRatings->getProjectRateForUser($this->_projectId,$identity->member_id); $this->view->ratingOfUserJson = Zend_Json::encode($ratingOfUserJson); }else{ $this->view->ratingOfUserJson = Zend_Json::encode(null); } $tableProjectFollower = new Default_Model_DbTable_ProjectFollower(); $likes = $tableProjectFollower->fetchLikesForProject($this->_projectId); $this->view->likeJson = Zend_Json::encode($likes); $projectplings = new Default_Model_ProjectPlings(); $plings = $projectplings->fetchPlingsForProject($this->_projectId); $this->view->projectplingsJson = Zend_Json::encode($plings); $tableProject = new Default_Model_Project(); $galleryPictures = $tableProject->getGalleryPictureSources($this->_projectId); $this->view->galleryPicturesJson = Zend_Json::encode($galleryPictures); $tagmodel = new Default_Model_Tags(); $tagsuser = $tagmodel->getTagsUser($this->_projectId, Default_Model_Tags::TAG_TYPE_PROJECT); $tagssystem = $tagmodel->getTagsSystemList($this->_projectId); $this->view->tagsuserJson = Zend_Json::encode($tagsuser); $this->view->tagssystemJson = Zend_Json::encode($tagssystem); $modelComments = new Default_Model_ProjectComments(); $offset = 0; $testComments = $modelComments->getCommentTreeForProjectList($this->_projectId); $this->view->commentsJson = Zend_Json::encode($testComments); $modelClone = new Default_Model_ProjectClone(); $origins = $modelClone->fetchOrigins($this->_projectId); $this->view->originsJson = Zend_Json::encode($origins); $related = $modelClone->fetchRelatedProducts($this->_projectId); $this->view->relatedJson = Zend_Json::encode($related); $moreProducts = $tableProject->fetchMoreProjects($this->view->product, 8); $this->view->moreProductsJson = Zend_Json::encode($moreProducts); $moreProducts = $tableProject->fetchMoreProjectsOfOtherUsr($this->view->product, 8); $this->view->moreProductsOfOtherUsrJson = Zend_Json::encode($moreProducts); } public function indexAction() { if (!empty($this->_collectionId)) { $modelProduct = new Default_Model_Project(); $productInfo = $modelProduct->fetchProductForCollectionId($this->_collectionId); $this->_projectId = $productInfo->project_id; } if (empty($this->_projectId)) { $this->redirect('/explore'); } $this->view->paramPageId = (int)$this->getParam('page'); $this->view->member_id = null; if(null != $this->_authMember && null != $this->_authMember->member_id) { $this->view->member_id = $this->_authMember->member_id; } // $this->fetchDataForIndexView(); $modelProduct = new Default_Model_Project(); $productInfo = $modelProduct->fetchProductInfo($this->_projectId); if (empty($productInfo)) { throw new Zend_Controller_Action_Exception('This page does not exist', 404); } //Check if this is a collection if($productInfo->type_id == $modelProduct::PROJECT_TYPE_COLLECTION) { $this->redirect('/c/'.$this->_projectId); } $this->view->product = $productInfo; $this->view->headTitle($productInfo->title . ' - ' . $this->getHeadTitle(), 'SET'); $this->view->cat_id = $this->view->product->project_category_id; //create ppload download hash: secret + collection_id + expire-timestamp $salt = PPLOAD_DOWNLOAD_SECRET; $collectionID = $this->view->product->ppload_collection_id; $timestamp = time() + 3600; // one hour valid //20181009 ronald: change hash from MD5 to SHA512 //$hash = md5($salt . $collectionID . $timestamp); // order isn't important at all... just do the same when verifying $hash = hash('sha512',$salt . $collectionID . $timestamp); // order isn't important at all... just do the same when verifying $this->view->download_hash = $hash; $this->view->download_timestamp = $timestamp; $helperUserRole = new Backend_View_Helper_UserRole(); $userRoleName = $helperUserRole->userRole(); $isAdmin = false; if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) { $isAdmin = true; } $helperUserIsOwner = new Default_View_Helper_UserIsOwner(); $helperIsProjectActive = new Default_View_Helper_IsProjectActive(); if (!$isAdmin AND (false === $helperIsProjectActive->isProjectActive($this->view->product->project_status)) AND (false === $helperUserIsOwner->UserIsOwner($this->view->product->member_id)) ) { throw new Zend_Controller_Action_Exception('This page does not exist', 404); } if (APPLICATION_ENV != 'searchbotenv') { $tablePageViews = new Default_Model_DbTable_StatPageViews(); $tablePageViews->savePageView($this->_projectId, $this->getRequest()->getClientIp(), $this->_authMember->member_id); } $fmodel =new Default_Model_DbTable_PploadFiles(); $filesList = array(); if(isset($this->view->product->ppload_collection_id)) { $files = $fmodel->fetchFilesForProject($this->view->product->ppload_collection_id); if(!empty($files)) { foreach ($files as $file) { $timestamp = time() + 3600; // one hour valid $hash = hash('sha512',$salt . $file['collection_id'] . $timestamp); // order isn't important at all... just do the same when verifying $url = PPLOAD_API_URI . 'files/download/id/' . $file['id'] . '/s/' . $hash . '/t/' . $timestamp; if(null != $this->_authMember) { $url .= '/u/' . $this->_authMember->member_id; } $url .= '/lt/filepreview/' . $file['name']; $file['url'] = urlencode($url); //If this file is a video, we have to convert it for preview if(!empty($file['type']) && in_array($file['type'], Backend_Commands_ConvertVideo::$VIDEO_FILE_TYPES) && empty($file['ppload_file_preview_id'])) { $queue = Local_Queue_Factory::getQueue(); $command = new Backend_Commands_ConvertVideo($file['collection_id'], $file['id'], $file['type']); $queue->send(serialize($command)); } if(!empty($file['url_preview'])) { $file['url_preview'] = urlencode($file['url_preview']); } if(!empty($file['url_thumb'])) { $file['url_thumb'] = urlencode($file['url_thumb']); } $filesList[] = $file; } } } $this->view->filesJson = Zend_Json::encode($filesList); //gitlab if($this->view->product->is_gitlab_project) { $gitProject = $this->fetchGitlabProject($this->view->product->gitlab_project_id); if(null == $gitProject) { $this->view->product->is_gitlab_project = 0; $this->view->product->show_gitlab_project_issues = 0; $this->view->product->use_gitlab_project_readme = 0; $this->view->product->gitlab_project_id = null; } else { $this->view->gitlab_project = $gitProject; //show issues? if($this->view->product->show_gitlab_project_issues) { $issues = $this->fetchGitlabProjectIssues($this->view->product->gitlab_project_id); $this->view->gitlab_project_issues = $issues; $this->view->gitlab_project_issues_url = $this->view->gitlab_project['web_url'] . '/issues/'; } //show readme.md? if($this->view->product->use_gitlab_project_readme && null != $this->view->gitlab_project['readme_url']) { $config = Zend_Registry::get('config')->settings->server->opencode; $readme = $this->view->gitlab_project['web_url'].'/raw/master/README.md?inline=false'; $httpClient = new Zend_Http_Client($readme, array('keepalive' => true, 'strictredirects' => true)); $httpClient->resetParameters(); $httpClient->setUri($readme); $httpClient->setHeaders('Private-Token', $config->private_token); $httpClient->setHeaders('Sudo', $config->user_sudo); $httpClient->setHeaders('User-Agent', $config->user_agent); $httpClient->setMethod(Zend_Http_Client::GET); $response = $httpClient->request(); $body = $response->getRawBody(); if (count($body) == 0) { return array(); } include_once('Parsedown.php'); $Parsedown = new Parsedown(); $this->view->readme = $Parsedown->text($body); } else { $this->view->readme = null; } } } + // products related + $pc = new Default_Model_ProjectClone(); + $cntRelatedProducts=0; + $ancesters = $pc->fetchAncestersIds($this->_projectId); + $siblings = $pc->fetchSiblings($this->_projectId); + $parents = $pc->fetchParentIds($this->_projectId); + $childrens = $pc->fetchChildrensIds($this->_projectId); + $this->view->related_ancesters = null; + $this->view->related_siblings = null; + $this->view->related_parents = null; + $this->view->related_children = null; + if($ancesters && strlen($ancesters)>0){ + $this->view->related_ancesters = $modelProduct->fetchProjects($ancesters); + $cntRelatedProducts+= sizeof($this->view->related_ancesters); + } + if($siblings && strlen($siblings)>0){ + $this->view->related_siblings = $modelProduct->fetchProjects($siblings); + $cntRelatedProducts+= sizeof($this->view->related_siblings); + } + if($parents && strlen($parents)>0){ + $this->view->related_parents = $modelProduct->fetchProjects($parents); + $cntRelatedProducts+= sizeof($this->view->related_parents); + } + if($childrens && strlen($childrens)>0){ + $this->view->related_children = $modelProduct->fetchProjects($childrens); + $cntRelatedProducts+= sizeof($this->view->related_children); + } + $this->view->cntRelatedProducts = $cntRelatedProducts; + $storeConfig = Zend_Registry::isRegistered('store_config') ? Zend_Registry::get('store_config') : null; if($storeConfig->layout_pagedetail && $storeConfig->isRenderReact()){ $this->initJsonForReact(); $this->_helper->viewRenderer('index-react'); } } public function showAction() { $this->view->authMember = $this->_authMember; $this->_helper->viewRenderer('index'); $this->indexAction(); } public function addAction() { $this->view->member = $this->_authMember; $this->view->mode = 'add'; if($this->getParam('catId')){ $this->view->catId = $this->getParam('catId'); } $form = new Default_Form_Product(array('member_id' => $this->view->member->member_id)); $this->view->form = $form; if ($this->_request->isGet()) { return; } $helperUserRole = new Backend_View_Helper_UserRole(); $userRoleName = $helperUserRole->userRole(); $isAdmin = false; if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) { $isAdmin = true; } if (isset($_POST['cancel'])) { // user cancel function $this->redirect('/member/' . $this->_authMember->member_id . '/news/'); } if (false === $form->isValid($_POST)) { // form not valid $this->view->form = $form; $this->view->error = 1; return; } $values = $form->getValues(); $imageModel = new Default_Model_DbTable_Image(); try { $values['image_small'] = $imageModel->saveImage($form->getElement(self::IMAGE_SMALL_UPLOAD)); } catch (Exception $e) { Zend_Registry::get('logger')->err(__METHOD__ . ' - ERROR upload productPicture - ' . print_r($e, true)); } // form was valid, so we can set status to active $values['status'] = Default_Model_DbTable_Project::PROJECT_ACTIVE; // save new project $modelProject = new Default_Model_Project(); Zend_Registry::get('logger')->info(__METHOD__ . ' - $post: ' . print_r($_POST, true)); Zend_Registry::get('logger')->info(__METHOD__ . ' - $files: ' . print_r($_FILES, true)); Zend_Registry::get('logger')->info(__METHOD__ . ' - input values: ' . print_r($values, true)); $newProject = null; try { if (isset($values['project_id'])) { $newProject = $modelProject->updateProject($values['project_id'], $values); } else { $newProject = $modelProject->createProject($this->_authMember->member_id, $values, $this->_authMember->username); //$this->createSystemPlingForNewProject($newProject->project_id); } } catch (Exception $exc) { Zend_Registry::get('logger')->warn(__METHOD__ . ' - traceString: ' . $exc->getTraceAsString()); } if (!$newProject) { $this->_helper->flashMessenger->addMessage('

You did not choose a Category in the last level.

'); $this->forward('add'); return; } //update the gallery pics $mediaServerUrls = $this->saveGalleryPics($form->gallery->upload->upload_picture); $modelProject->updateGalleryPictures($newProject->project_id, $mediaServerUrls); //If there is no Logo, we take the 1. gallery pic if (!isset($values['image_small']) || $values['image_small'] == '') { $values['image_small'] = $mediaServerUrls[0]; $newProject = $modelProject->updateProject($newProject->project_id, $values); } //New Project in Session, for AuthValidation (owner) $this->_auth->getIdentity()->projects[$newProject->project_id] = array('project_id' => $newProject->project_id); $modelTags = new Default_Model_Tags(); if ($values['tagsuser']) { $modelTags->processTagsUser($newProject->project_id, implode(',', $values['tagsuser']),Default_Model_Tags::TAG_TYPE_PROJECT); } else { $modelTags->processTagsUser($newProject->project_id, null, Default_Model_Tags::TAG_TYPE_PROJECT); } $modelTags->processTagProductOriginalOrModification($newProject->project_id,$values['is_original_or_modification'][0]); //set license, if needed $licenseTag = $form->getElement('license_tag_id')->getValue(); //only set/update license tags if something was changed if ($licenseTag && count($licenseTag) > 0) { $modelTags->saveLicenseTagForProject($newProject->project_id, $licenseTag); $activityLog = new Default_Model_ActivityLog(); $activityLog->logActivity($newProject->project_id, $newProject->project_id, $this->_authMember->member_id,Default_Model_ActivityLog::PROJECT_LICENSE_CHANGED, array('title' => 'Set new License Tag', 'description' => 'New TagId: ' . $licenseTag)); } $isGitlabProject = $form->getElement('is_gitlab_project')->getValue(); $gitlabProjectId = $form->getElement('gitlab_project_id')->getValue(); if ($isGitlabProject && $gitlabProjectId == 0) { $values['gitlab_project_id'] = null; } $activityLog = new Default_Model_ActivityLog(); $activityLog->writeActivityLog($newProject->project_id, $newProject->member_id, Default_Model_ActivityLog::PROJECT_CREATED, $newProject->toArray()); // ppload $this->processPploadId($newProject); try { if (100 < $this->_authMember->roleId) { if (Default_Model_Spam::hasSpamMarkers($newProject->toArray())) { $tableReportComments = new Default_Model_DbTable_ReportProducts(); $tableReportComments->save(array('project_id' => $newProject->project_id, 'reported_by' => 24, 'text' => "System: automatic spam detection")); } Default_Model_DbTable_SuspicionLog::logProject($newProject, $this->_authMember, $this->getRequest()); } } catch (Zend_Exception $e) { Zend_Registry::get('logger')->err($e->getMessage()); } $this->redirect('/member/' . $newProject->member_id . '/products/'); } private function saveGalleryPics($form_element) { $imageModel = new Default_Model_DbTable_Image(); return $imageModel->saveImages($form_element); } /** * @param $projectData * * @throws Zend_Exception * @throws Zend_Queue_Exception */ protected function createTaskWebsiteOwnerVerification($projectData) { if (empty($projectData->link_1)) { return; } $checkAuthCode = new Local_Verification_WebsiteProject(); $authCode = $checkAuthCode->generateAuthCode(stripslashes($projectData->link_1)); $queue = Local_Queue_Factory::getQueue(); $command = new Backend_Commands_CheckProjectWebsite($projectData->project_id, $projectData->link_1, $authCode); $queue->send(serialize($command)); } /** * @param $projectData */ protected function processPploadId($projectData) { if ($projectData->ppload_collection_id) { $pploadApi = new Ppload_Api(array( 'apiUri' => PPLOAD_API_URI, 'clientId' => PPLOAD_CLIENT_ID, 'secret' => PPLOAD_SECRET )); // Update collection information $collectionCategory = $projectData->project_category_id; if (Default_Model_Project::PROJECT_ACTIVE == $projectData->status) { $collectionCategory .= '-published'; } $collectionRequest = array( 'title' => $projectData->title, 'description' => $projectData->description, 'category' => $collectionCategory, 'content_id' => $projectData->project_id ); $collectionResponse = $pploadApi->putCollection($projectData->ppload_collection_id, $collectionRequest); // Store product image as collection thumbnail $this->_updatePploadMediaCollectionthumbnail($projectData); } } /** * ppload */ protected function _updatePploadMediaCollectionthumbnail($projectData) { if (empty($projectData->ppload_collection_id) || empty($projectData->image_small) ) { return false; } $pploadApi = new Ppload_Api(array( 'apiUri' => PPLOAD_API_URI, 'clientId' => PPLOAD_CLIENT_ID, 'secret' => PPLOAD_SECRET )); $filename = sys_get_temp_dir() . '/' . $projectData->image_small; if (false === file_exists(dirname($filename))) { mkdir(dirname($filename), 0777, true); } $viewHelperImage = new Default_View_Helper_Image(); $uri = $viewHelperImage->Image($projectData->image_small, array( 'width' => 600, 'height' => 600 )); file_put_contents($filename, file_get_contents($uri)); $mediaCollectionthumbnailResponse = $pploadApi->postMediaCollectionthumbnail($projectData->ppload_collection_id, array('file' => $filename)); unlink($filename); if (isset($mediaCollectionthumbnailResponse->status) && $mediaCollectionthumbnailResponse->status == 'success' ) { return true; } return false; } public function editAction() { if (empty($this->_projectId)) { $this->redirect($this->_helper->url('add')); return; } $this->_helper->viewRenderer('add'); // we use the same view as you can see at add a product $this->view->mode = 'edit'; $projectTable = new Default_Model_DbTable_Project(); $projectModel = new Default_Model_Project(); $modelTags = new Default_Model_Tags(); $tagTable = new Default_Model_DbTable_Tags(); //check if product with given id exists $projectData = $projectTable->find($this->_projectId)->current(); if (empty($projectData)) { $this->redirect($this->_helper->url('add')); return; } $member = null; if (isset($this->_authMember) AND (false === empty($this->_authMember->member_id))) { $member = $this->_authMember; } else { throw new Zend_Controller_Action_Exception('no authorization found'); } if (("admin" == $this->_authMember->roleName)) { $modelMember = new Default_Model_Member(); $member = $modelMember->fetchMember($projectData->member_id, false); } $helperUserRole = new Backend_View_Helper_UserRole(); $userRoleName = $helperUserRole->userRole(); $isAdmin = false; if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) { $isAdmin = true; } //set ppload-collection-id in view $this->view->ppload_collection_id = $projectData->ppload_collection_id; $this->view->project_id = $projectData->project_id; $this->view->product = $projectData; //create ppload download hash: secret + collection_id + expire-timestamp $salt = PPLOAD_DOWNLOAD_SECRET; $collectionID = $projectData->ppload_collection_id; $timestamp = time() + 3600; // one hour valid //20181009 ronald: change hash from MD5 to SHA512 //$hash = md5($salt . $collectionID . $timestamp); // order isn't important at all... just do the same when verifying $hash = hash('sha512',$salt . $collectionID . $timestamp); // order isn't important at all... just do the same when verifying $this->view->download_hash = $hash; $this->view->download_timestamp = $timestamp; $this->view->member_id = $member->member_id; $this->view->member = $member; //read the already existing gallery pics and add them to the form $sources = $projectModel->getGalleryPictureSources($this->_projectId); //get the gitlab projects for this user //setup form $form = new Default_Form_Product(array('pictures' => $sources, 'member_id' => $this->view->member_id)); if (false === empty($projectData->image_small)) { $form->getElement('image_small_upload')->setRequired(false); } $form->getElement('preview')->setLabel('Save'); $form->removeElement('project_id'); // we don't need this field in edit mode if ($this->_request->isGet()) { $form->populate($projectData->toArray()); // $form->populate(array('tags' => $modelTags->getTags($projectData->project_id, Default_Model_Tags::TAG_TYPE_PROJECT))); $form->populate(array('tagsuser' => $modelTags->getTagsUser($projectData->project_id, Default_Model_Tags::TAG_TYPE_PROJECT))); $form->getElement('image_small')->setValue($projectData->image_small); //Bilder voreinstellen $form->getElement(self::IMAGE_SMALL_UPLOAD)->setValue($projectData->image_small); $licenseTags = $tagTable->fetchLicenseTagsForProject($this->_projectId); $licenseTag = null; if($licenseTags) { $licenseTag = $licenseTags[0]['tag_id']; } $form->getElement('license_tag_id')->setValue($licenseTag); $is_original = $modelTags->isProductOriginal($projectData->project_id); $is_modification = $modelTags->isProductModification($projectData->project_id); if($is_original){ $form->getElement('is_original_or_modification')->setValue(1); } else if($is_modification){ $form->getElement('is_original_or_modification')->setValue(2); } $this->view->form = $form; return; } if (isset($_POST['cancel'])) { // user cancel function $this->redirect('/member/' . $member->member_id . '/news/'); } if (false === $form->isValid($_POST, $this->_projectId)) { // form not valid $this->view->form = $form; $this->view->error = 1; return; } $values = $form->getValues(); //set license, if needed $tagList = $modelTags->getTagsArray($this->_projectId, $modelTags::TAG_TYPE_PROJECT, $modelTags::TAG_LICENSE_GROUPID); $oldLicenseTagId = null; if($tagList && count($tagList) == 1) { $oldLicenseTagId = $tagList[0]['tag_id']; } $licenseTag = $form->getElement('license_tag_id')->getValue(); //only set/update license tags if something was changed if($licenseTag <> $oldLicenseTagId) { $modelTags->saveLicenseTagForProject($this->_projectId, $licenseTag); $activityLog = new Default_Model_ActivityLog(); $activityLog->logActivity($this->_projectId, $this->_projectId, $this->_authMember->member_id, Default_Model_ActivityLog::PROJECT_LICENSE_CHANGED, array('title' => 'License Tag', 'description' => 'Old TagId: '.$oldLicenseTagId.' - New TagId: '.$licenseTag)); } //gitlab project $isGitlabProject = $form->getElement('is_gitlab_project')->getValue(); $gitlabProjectId = $form->getElement('gitlab_project_id')->getValue(); if($isGitlabProject && $gitlabProjectId == 0) { $values['gitlab_project_id'] = null; } $imageModel = new Default_Model_DbTable_Image(); try { $uploadedSmallImage = $imageModel->saveImage($form->getElement(self::IMAGE_SMALL_UPLOAD)); $values['image_small'] = $uploadedSmallImage ? $uploadedSmallImage : $values['image_small']; } catch (Exception $e) { Zend_Registry::get('logger')->err(__METHOD__ . ' - ERROR upload productPicture - ' . print_r($e, true)); } // save changes $projectModel->updateProject($this->_projectId, $values); //update the gallery pics $pictureSources = array_merge($values['gallery']['online_picture'], $this->saveGalleryPics($form->gallery->upload->upload_picture)); $projectModel->updateGalleryPictures($this->_projectId, $pictureSources); //If there is no Logo, we take the 1. gallery pic if (!isset($projectData->image_small) || $projectData->image_small == '') { $projectData->image_small = $pictureSources[0]; } //20180219 ronald: we set the changed_at only by new files or new updates //$projectData->changed_at = new Zend_Db_Expr('NOW()'); $projectData->save(); $modelTags->processTagProductOriginalOrModification($this->_projectId,$values['is_original_or_modification'][0]); if($values['tagsuser']) { $modelTags->processTagsUser($this->_projectId,implode(',',$values['tagsuser']), Default_Model_Tags::TAG_TYPE_PROJECT); }else { $modelTags->processTagsUser($this->_projectId,null, Default_Model_Tags::TAG_TYPE_PROJECT); } $activityLog = new Default_Model_ActivityLog(); $activityLog->writeActivityLog($this->_projectId, $this->_authMember->member_id, Default_Model_ActivityLog::PROJECT_EDITED, $projectData->toArray()); // ppload $this->processPploadId($projectData); try { if (100 < $this->_authMember->roleId) { if (Default_Model_Spam::hasSpamMarkers($projectData->toArray())) { $tableReportComments = new Default_Model_DbTable_ReportProducts(); $tableReportComments->save(array('project_id' => $projectData->project_id, 'reported_by' => 24, 'text' => "System: automatic spam detection on product edit")); } Default_Model_DbTable_SuspicionLog::logProject($projectData, $this->_authMember, $this->getRequest()); } } catch (Zend_Exception $e) { Zend_Registry::get('logger')->err($e->getMessage()); } $helperBuildMemberUrl = new Default_View_Helper_BuildMemberUrl(); $this->redirect($helperBuildMemberUrl->buildMemberUrl($member->username, 'products')); } public function getupdatesajaxAction() { $this->view->authMember = $this->_authMember; $tableProject = new Default_Model_ProjectUpdates(); $updates = $tableProject->fetchProjectUpdates($this->_projectId); foreach ($updates as $key => $update) { $updates[$key]['title'] = Default_Model_HtmlPurify::purify($update['title']); $updates[$key]['text'] = Default_Model_BBCode::renderHtml(Default_Model_HtmlPurify::purify(htmlentities($update['text'], ENT_QUOTES | ENT_IGNORE))); $updates[$key]['raw_title'] = $update['title']; $updates[$key]['raw_text'] = $update['text']; } $result['status'] = 'success'; $result['ResultSize'] = count($updates); $result['updates'] = $updates; $this->_helper->json($result); } public function saveupdateajaxAction() { $filter = new Zend_Filter_Input( array( '*' => 'StringTrim' ), array( '*' => array(), 'title' => array( new Zend_Validate_StringLength(array('min' => 3, 'max' => 200)), 'presence' => 'required', 'allowEmpty' => false ), 'text' => array( new Zend_Validate_StringLength(array('min' => 3, 'max' => 16383)), 'presence' => 'required', 'allowEmpty' => false ), 'update_id' => array('digits', 'allowEmpty' => true) ), $this->getAllParams(), array('allowEmpty' => true)); if ($filter->hasInvalid() OR $filter->hasMissing() OR $filter->hasUnknown()) { $result['status'] = 'error'; $result['messages'] = $filter->getMessages(); $result['update_id'] = null; $this->_helper->json($result); } $update_id = $filter->getEscaped('update_id'); $tableProjectUpdates = new Default_Model_ProjectUpdates(); //Save update if (!empty($update_id)) { //Update old update $updateArray = array(); $updateArray['title'] = $filter->getUnescaped('title'); $updateArray['text'] = $filter->getUnescaped('text'); $updateArray['changed_at'] = new Zend_Db_Expr('Now()'); $countUpdated = $tableProjectUpdates->update($updateArray, 'project_update_id = ' . $update_id); } else { //Add new update $updateArray = array(); $updateArray['title'] = $filter->getUnescaped('title'); $updateArray['text'] = $filter->getUnescaped('text'); $updateArray['public'] = 1; $updateArray['project_id'] = $this->_projectId; $updateArray['member_id'] = $this->_authMember->member_id; $updateArray['created_at'] = new Zend_Db_Expr('Now()'); $updateArray['changed_at'] = new Zend_Db_Expr('Now()'); $rowset = $tableProjectUpdates->save($updateArray); $update_id = $rowset->project_update_id; //20180219 ronald: we set the changed_at only by new files or new updates $projectTable = new Default_Model_Project(); $projectUpdateRow = $projectTable->find($this->_projectId)->current(); if (count($projectUpdateRow) == 1) { $projectUpdateRow->changed_at = new Zend_Db_Expr('NOW()'); $projectUpdateRow->save(); } } $result['status'] = 'success'; $result['update_id'] = $update_id; $this->_helper->json($result); } public function deleteupdateajaxAction() { $this->view->authMember = $this->_authMember; $tableProject = new Default_Model_ProjectUpdates(); $params = $this->getAllParams(); $project_update_id = $params['update_id']; $updateArray = array(); $updateArray['public'] = 0; $updateArray['changed_at'] = new Zend_Db_Expr('Now()'); $tableProject->update($updateArray, 'project_update_id = ' . $project_update_id); $result['status'] = 'success'; $result['update_id'] = $project_update_id; $this->_helper->json($result); } public function updatesAction() { $this->view->authMember = $this->_authMember; $tableProject = new Default_Model_Project(); $this->view->product = $tableProject->fetchProductInfo($this->_projectId); if (false === isset($this->view->product)) { throw new Zend_Controller_Action_Exception('This page does not exist', 404); } $this->view->relatedProducts = $tableProject->fetchSimilarProjects($this->view->product, 6); $this->view->supporter = $tableProject->fetchProjectSupporter($this->_projectId); $this->view->product_views = $tableProject->fetchProjectViews($this->_projectId); $modelPlings = new Default_Model_DbTable_Plings(); $this->view->comments = $modelPlings->getCommentsForProject($this->_projectId, 10); $tableMember = new Default_Model_Member(); $this->view->member = $tableMember->fetchMemberData($this->view->product->member_id); $this->view->updates = $tableProject->fetchProjectUpdates($this->_projectId); $tablePageViews = new Default_Model_DbTable_StatPageViews(); $tablePageViews->savePageView($this->_projectId, $this->getRequest()->getClientIp(), $this->_authMember->member_id); } public function updateAction() { $this->_helper->layout()->setLayout('flat_ui'); $this->view->headScript()->setFile(''); $this->view->headLink()->setStylesheet(''); $this->_helper->viewRenderer('add'); $form = new Default_Form_ProjectUpdate(); $projectTable = new Default_Model_Project(); $projectData = null; $projectUpdateId = (int)$this->getParam('upid'); $this->view->member = $this->_authMember; $this->view->title = 'Add an update for your product'; $activityLogType = Default_Model_ActivityLog::PROJECT_ITEM_CREATED; if (false === empty($projectUpdateId)) { $this->view->title = 'Edit an product update'; $projectData = $projectTable->find($projectUpdateId)->current(); $form->populate($projectData->toArray()); $form->getElement('upid')->setValue($projectUpdateId); $activityLogType = Default_Model_ActivityLog::PROJECT_ITEM_EDITED; } $this->view->form = $form; if ($this->_request->isGet()) { return; } if (isset($_POST['cancel'])) { // user cancel function $this->_redirect('/member/' . $this->_authMember->member_id . '/news/'); } if (false === $form->isValid($_POST)) { // form not valid $this->view->form = $form; $this->view->error = 1; return; } $values = $form->getValues(); $projectUpdateRow = $projectTable->find($values['upid'])->current(); if (count($projectUpdateRow) == 0) { $projectUpdateRow = $projectTable->createRow($values); $projectUpdateRow->project_id = $values['upid']; $projectUpdateRow->created_at = new Zend_Db_Expr('NOW()'); $projectUpdateRow->start_date = new Zend_Db_Expr('NOW()'); $projectUpdateRow->member_id = $this->_authMember->member_id; $projectUpdateRow->creator_id = $this->_authMember->member_id; $projectUpdateRow->status = Default_Model_Project::PROJECT_ACTIVE; $projectUpdateRow->type_id = 2; $projectUpdateRow->pid = $this->_projectId; } else { $projectUpdateRow->setFromArray($values); //20180219 ronald: we set the changed_at only by new files or new updates //$projectUpdateRow->changed_at = new Zend_Db_Expr('NOW()'); } $lastId = $projectUpdateRow->save(); //New Project in Session, for AuthValidation (owner) $this->_auth->getIdentity()->projects[$lastId] = array('project_id' => $lastId); $tableProduct = new Default_Model_Project(); $product = $tableProduct->find($this->_projectId)->current(); $activityLogValues = $projectUpdateRow->toArray(); $activityLogValues['image_small'] = $product->image_small; $activityLog = new Default_Model_ActivityLog(); //$activityLog->writeActivityLog($lastId, $projectUpdateRow->member_id, $activityLogType, $activityLogValues); $activityLog->writeActivityLog($lastId, $this->_authMember->member_id, $activityLogType, $activityLogValues); $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); $urlProjectShow = $helperBuildProductUrl->buildProductUrl($this->_projectId); $this->redirect($urlProjectShow); } public function previewAction() { $this->view->authMember = $this->_authMember; $form = new Default_Form_ProjectConfirm(); if ($this->_request->isGet()) { $form->populate(get_object_vars($this->_authMember)); $this->view->form = $form; $this->fetchDataForIndexView(); $this->view->preview = $this->view->render('product/index.phtml'); return; } if (isset($_POST['save'])) { $projectTable = new Default_Model_Project(); $projectTable->setStatus(Default_Model_Project::PROJECT_INACTIVE, $this->_projectId); //todo: maybe we have to delete the project data from database otherwise we produce many zombies $this->redirect('/member/' . $this->_authMember->member_id . '/products/'); } if (isset($_POST['back'])) { $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); $this->redirect($helperBuildProductUrl->buildProductUrl($this->_projectId, 'edit')); } if (false === $form->isValid($_POST)) { // form not valid $this->view->form = $form; $this->fetchDataForIndexView(); $this->view->preview = $this->view->render('product/index.phtml'); $this->view->error = 1; return; } $projectTable = new Default_Model_Project(); $projectTable->setStatus(Default_Model_Project::PROJECT_ACTIVE, $this->_projectId); // add to search index $modelProject = new Default_Model_Project(); $productInfo = $modelProject->fetchProductInfo($this->_projectId); $modelSearch = new Default_Model_Search_Lucene(); $modelSearch->addDocument($productInfo->toArray()); $this->redirect('/member/' . $this->_authMember->member_id . '/products/'); } protected function fetchDataForIndexView() { $tableProject = new Default_Model_Project(); $this->view->product = $tableProject->fetchProductInfo($this->_projectId); if (false === isset($this->view->product)) { throw new Zend_Controller_Action_Exception('This page does not exist', 404); } $desc = $this->view->product->description; $newDesc = $this->bbcode2html($desc); $this->view->product->description = $newDesc; // switch off temporally 02.05.2017 //$this->view->supporting = $tableProject->fetchProjectSupporterWithPlings($this->_projectId); //$orgUpdates = $tableProjectUpdates->fetchLastProjectUpdate($this->_projectId); $tableProjectUpdates = new Default_Model_ProjectUpdates(); $orgUpdates = $tableProjectUpdates->fetchProjectUpdates($this->_projectId); $newUpdates = array(); foreach ($orgUpdates as $update) { $desc = $update['text']; $newDesc = $this->bbcode2html($desc); $update['text'] = $newDesc; $newUpdates[] = $update; } $this->view->updates = $newUpdates; // switch off temporally 02.05.2017 //$this->view->supporter = $tableProject->fetchProjectSupporter($this->_projectId); $this->view->galleryPictures = $tableProject->getGalleryPictureSources($this->_projectId); $this->view->product_views = $tableProject->fetchProjectViews($this->_projectId); $helperFetchCategory = new Default_View_Helper_CatTitle(); $helperFetchCatParent = new Default_View_Helper_CatParent(); $this->view->catId = $this->view->product->project_category_id; $this->view->catTitle = $helperFetchCategory->catTitle($this->view->product->project_category_id); $this->view->catParentId = $helperFetchCatParent->getCatParentId(array('project_category_id' => $this->view->product->project_category_id)); if ($this->view->catParentId) { $this->view->catParentTitle = $helperFetchCategory->catTitle($this->view->catParentId); } $AuthCodeExist = new Local_Verification_WebsiteProject(); $this->view->websiteAuthCode = $AuthCodeExist->generateAuthCode(stripslashes($this->view->product->link_1)); // switch off temporally 02.05.2017 //$modelPlings = new Default_Model_DbTable_Plings(); //$this->view->plings = $modelPlings->getDonationsForProject($this->_projectId, 10); $tableMember = new Default_Model_Member(); $this->view->member = $tableMember->fetchMemberData($this->view->product->member_id); $this->view->more_products = $tableProject->fetchMoreProjects($this->view->product, 8); $this->view->more_products_otheruser = $tableProject->fetchMoreProjectsOfOtherUsr($this->view->product, 8); $widgetDefaultModel = new Default_Model_DbTable_ProjectWidgetDefault(); $widgetDefault = $widgetDefaultModel->fetchConfig($this->_projectId); $widgetDefault->text->headline = $this->view->product->title; //$widgetDefault->amounts->current = $this->view->product->amount_received; $widgetDefault->amounts->goal = $this->view->product->amount; $widgetDefault->project = $this->_projectId; $this->view->widgetConfig = $widgetDefault; $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); $this->view->permaLink = $helperBuildProductUrl->buildProductUrl($this->_projectId, null, null, true); $this->view->urlPay = $helperBuildProductUrl->buildProductUrl($this->_projectId, 'pay'); $referrerUrl = $this->readExploreUrlFromReferrer(); if (false === empty($referrerUrl)) { $this->view->referrerUrl = $referrerUrl; } } /** * transforms a string with bbcode markup into html * * @param string $txt * @param bool $nl2br * * @return string */ private function bbcode2html($txt, $nl2br = true, $forcecolor = '') { if (!empty($forcecolor)) { $fc = ' style="color:' . $forcecolor . ';"'; } else { $fc = ''; } $newtxt = htmlspecialchars($txt); if ($nl2br) { $newtxt = nl2br($newtxt); } $patterns = array( '`\[b\](.+?)\[/b\]`is', '`\[i\](.+?)\[/i\]`is', '`\[u\](.+?)\[/u\]`is', '`\[li\](.+?)\[/li\]`is', '`\[strike\](.+?)\[/strike\]`is', '`\[url\]([a-z0-9]+?://){1}([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)\[/url\]`si', '`\[quote\](.+?)\[/quote\]`is', '`\[indent](.+?)\[/indent\]`is' ); $replaces = array( '\\1', '\\1', '\\1', '\\1', '\\1', '\1\2', 'Quote:
\1
', '\\1' ); $newtxt = preg_replace($patterns, $replaces, $newtxt); return ($newtxt); } protected function readExploreUrlFromReferrer() { $helperBuildExploreUrl = new Default_View_Helper_BuildExploreUrl(); $referrerExplore = $helperBuildExploreUrl->buildExploreUrl(null, null, null, null, true); /** @var Zend_Controller_Request_Http $request */ $request = $this->getRequest(); if (strpos($request->getHeader('referer'), $referrerExplore) !== false) { return $request->getHeader('referer'); } } public function plingAction() { if (empty($this->_projectId)) { $this->redirect('/explore'); } $this->view->authMember = $this->_authMember; $this->fetchDataForIndexView(); $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); $this->view->urlPay = $helperBuildProductUrl->buildProductUrl($this->_projectId, 'pay'); $this->view->amount = (float)$this->getParam('amount', 1); $this->view->comment = html_entity_decode(strip_tags($this->getParam('comment'), null), ENT_QUOTES, 'utf-8'); $this->view->provider = mb_strtolower(html_entity_decode(strip_tags($this->getParam('provider'), null), ENT_QUOTES, 'utf-8'), 'utf-8'); $this->view->headTitle($this->_browserTitlePrepend . $this->view->product->title, 'SET'); $helperUserIsOwner = new Default_View_Helper_UserIsOwner(); $helperIsProjectActive = new Default_View_Helper_IsProjectActive(); if ((false === $helperIsProjectActive->isProjectActive($this->view->product->project_status)) AND (false === $helperUserIsOwner->UserIsOwner($this->view->product->member_id)) ) { throw new Zend_Controller_Action_Exception('This page does not exist', 404); } $tableProject = new Default_Model_Project(); $this->view->supporting = $tableProject->fetchProjectSupporterWithPlings($this->_projectId); } public function payAction() { $this->_helper->layout()->disableLayout(); $tableProject = new Default_Model_Project(); $project = $tableProject->fetchProductInfo($this->_projectId); //get parameter $amount = (float)$this->getParam('amount', 1); $comment = Default_Model_HtmlPurify::purify($this->getParam('comment')); $paymentProvider = mb_strtolower(html_entity_decode(strip_tags($this->getParam('provider'), null), ENT_QUOTES, 'utf-8'), 'utf-8'); $hideIdentity = (int)$this->getParam('hideId', 0); $paymentGateway = $this->createPaymentGateway($paymentProvider); $paymentGateway->getUserDataStore()->generateFromArray($project->toArray()); $requestMessage = 'Thank you for supporting: ' . $paymentGateway->getUserDataStore()->getProductTitle(); $response = null; try { $response = $paymentGateway->requestPayment($amount, $requestMessage); $this->view->checkoutEndpoint = $paymentGateway->getCheckoutEndpoint(); $this->view->paymentKey = $response->getPaymentId(); $this->_helper->viewRenderer->setRender('pay_' . $paymentProvider); } catch (Exception $e) { throw new Zend_Controller_Action_Exception('payment error', 500, $e); } if (false === $response->isSuccessful()) { throw new Zend_Controller_Action_Exception('payment failure', 500); } if (empty($this->_authMember->member_id) or ($hideIdentity == 1)) { $memberId = 1; } else { $memberId = $this->_authMember->member_id; } //Add pling $modelPlings = new Default_Model_DbTable_Plings(); $plingId = $modelPlings->createNewPlingFromResponse($response, $memberId, $project->project_id, $amount); if (false == empty($comment)) { $modelComments = new Default_Model_ProjectComments(); $dataComment = array( 'comment_type' => Default_Model_DbTable_Comments::COMMENT_TYPE_PLING, 'comment_target_id' => $project->project_id, 'comment_member_id' => $memberId, 'comment_pling_id' => $plingId, 'comment_text' => $comment ); $modelComments->save($dataComment); } $activityLog = new Default_Model_ActivityLog(); $activityLog->writeActivityLog($this->_projectId, $memberId, Default_Model_ActivityLog::PROJECT_PLINGED, $project->toArray()); } /** * @param string $paymentProvider * * @return Local_Payment_GatewayInterface * @throws Exception * @throws Local_Payment_Exception * @throws Zend_Controller_Exception * @throws Zend_Exception */ protected function createPaymentGateway($paymentProvider) { $httpHost = $this->getRequest()->getHttpHost(); /** @var Zend_Config $config */ $config = Zend_Registry::get('config'); $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); switch ($paymentProvider) { case 'paypal': $paymentGateway = new Default_Model_PayPal_Gateway($config->third_party->paypal); $paymentGateway->setIpnNotificationUrl('http://' . $httpHost . '/gateway/paypal'); // $paymentGateway->setIpnNotificationUrl('http://' . $httpHost . '/gateway/paypal?XDEBUG_SESSION_START=1'); $paymentGateway->setCancelUrl($helperBuildProductUrl->buildProductUrl($this->_projectId, 'paymentcancel', null, true)); $paymentGateway->setReturnUrl($helperBuildProductUrl->buildProductUrl($this->_projectId, 'paymentok', null, true)); break; case 'dwolla': $paymentGateway = new Default_Model_Dwolla_Gateway($config->third_party->dwolla); $paymentGateway->setIpnNotificationUrl('http://' . $httpHost . '/gateway/dwolla'); // $paymentGateway->setIpnNotificationUrl('http://' . $_SERVER ['HTTP_HOST'] . '/gateway/dwolla?XDEBUG_SESSION_START=1'); $paymentGateway->setReturnUrl($helperBuildProductUrl->buildProductUrl($this->_projectId, 'dwolla', null, true)); break; case 'amazon': $paymentGateway = new Default_Model_Amazon_Gateway($config->third_party->amazon); $paymentGateway->setIpnNotificationUrl('http://' . $httpHost . '/gateway/amazon'); // $paymentGateway->setIpnNotificationUrl('http://' . $httpHost . '/gateway/amazon?XDEBUG_SESSION_START=1'); $paymentGateway->setCancelUrl($helperBuildProductUrl->buildProductUrl($this->_projectId, 'paymentcancel', null, true)); $paymentGateway->setReturnUrl($helperBuildProductUrl->buildProductUrl($this->_projectId, 'paymentok', null, true)); break; default: throw new Zend_Controller_Exception('No known payment provider found in parameters.'); break; } return $paymentGateway; } public function dwollaAction() { $modelPling = new Default_Model_DbTable_Plings(); $plingData = $modelPling->fetchRow(array('payment_reference_key = ?' => $this->getParam('checkoutId'))); $plingData->payment_transaction_id = (int)$this->getParam('transaction'); $plingData->save(); if ($this->_getParam('status') == 'Completed') { $this->_helper->viewRenderer('paymentok'); $this->paymentokAction(); } else { $this->_helper->viewRenderer('paymentcancel'); $this->paymentcancelAction(); } } public function paymentokAction() { $this->_helper->layout()->disableLayout(); $this->view->paymentStatus = 'success'; $this->view->paymentMessage = 'Payment successful.'; $this->fetchDataForIndexView(); } public function paymentcancelAction() { $this->_helper->layout()->disableLayout(); $this->view->paymentStatus = 'danger'; $this->view->paymentMessage = 'Payment cancelled.'; $this->fetchDataForIndexView(); } public function deleteAction() { $this->_helper->layout()->setLayout('flat_ui'); $memberId = (int)$this->getParam('m'); if ((empty($this->_authMember->member_id)) OR (empty($memberId)) OR ($this->_authMember->member_id != $memberId) ) { $this->forward('products', 'user', 'default'); return; } $tableProduct = new Default_Model_Project(); $tableProduct->setDeleted($this->_authMember->member_id,$this->_projectId); $product = $tableProduct->find($this->_projectId)->current(); // delete product from search index $modelSearch = new Default_Model_Search_Lucene(); $modelSearch->deleteDocument($product->toArray()); // $command = new Backend_Commands_DeleteProductExtended($product); // $command->doCommand(); // $queue = Local_Queue_Factory::getQueue('search'); // $command = new Backend_Commands_DeleteProductFromIndex($product->project_id, $product->project_category_id); // $msg = $queue->send(serialize($command)); // ppload // Delete collection if ($product->ppload_collection_id) { $pploadApi = new Ppload_Api(array( 'apiUri' => PPLOAD_API_URI, 'clientId' => PPLOAD_CLIENT_ID, 'secret' => PPLOAD_SECRET )); $collectionResponse = $pploadApi->deleteCollection($product->ppload_collection_id); } $activityLog = new Default_Model_ActivityLog(); $activityLog->writeActivityLog($this->_projectId, $this->_authMember->member_id, Default_Model_ActivityLog::PROJECT_DELETED, $product->toArray()); $this->forward('products', 'user', 'default'); } public function unpublishAction() { $this->_helper->layout()->setLayout('flat_ui'); $memberId = (int)$this->getParam('m'); if ( (empty($this->_authMember->member_id)) OR (empty($memberId)) OR ($this->_authMember->member_id != $memberId) ) { return; } $tableProduct = new Default_Model_Project(); $tableProduct->setInActive($this->_projectId, $memberId); $product = $tableProduct->find($this->_projectId)->current(); if (isset($product->type_id) && $product->type_id == Default_Model_Project::PROJECT_TYPE_UPDATE) { $parentProduct = $tableProduct->find($product->pid)->current(); $product->image_small = $parentProduct->image_small; } $activityLog = new Default_Model_ActivityLog(); $activityLog->writeActivityLog($this->_projectId, $this->_authMember->member_id, Default_Model_ActivityLog::PROJECT_UNPUBLISHED, $product->toArray()); // remove unpublished project from search index $modelSearch = new Default_Model_Search_Lucene(); $modelSearch->deleteDocument($product); // ppload if ($product->ppload_collection_id) { $pploadApi = new Ppload_Api(array( 'apiUri' => PPLOAD_API_URI, 'clientId' => PPLOAD_CLIENT_ID, 'secret' => PPLOAD_SECRET )); // Update collection information $collectionRequest = array( 'category' => $product->project_category_id ); $collectionResponse = $pploadApi->putCollection($product->ppload_collection_id, $collectionRequest); } $this->forward('products', 'user', 'default', array('member_id' => $memberId)); //$this->redirect('/member/'.$memberId.'/products'); } public function publishAction() { $memberId = (int)$this->getParam('m'); if ((empty($this->_authMember->member_id)) OR (empty($memberId)) OR ($this->_authMember->member_id != $memberId) ) { return; } $tableProduct = new Default_Model_Project(); $tableProduct->setActive($this->_authMember->member_id,$this->_projectId); $product = $tableProduct->find($this->_projectId)->current(); if (isset($product->type_id) && $product->type_id == Default_Model_Project::PROJECT_TYPE_UPDATE) { $parentProduct = $tableProduct->find($product->pid)->current(); $product->image_small = $parentProduct->image_small; } $activityLog = new Default_Model_ActivityLog(); $activityLog->writeActivityLog($this->_projectId, $this->_authMember->member_id, Default_Model_ActivityLog::PROJECT_PUBLISHED, $product->toArray()); // add published project to search index // $productInfo = $tableProduct->fetchProductInfo($this->_projectId); // $modelSearch = new Default_Model_Search_Lucene(); // $modelSearch->addDocument($productInfo); // ppload if ($product->ppload_collection_id) { $pploadApi = new Ppload_Api(array( 'apiUri' => PPLOAD_API_URI, 'clientId' => PPLOAD_CLIENT_ID, 'secret' => PPLOAD_SECRET )); // Update collection information $collectionRequest = array( 'category' => $product->project_category_id . '-published' ); $collectionResponse = $pploadApi->putCollection($product->ppload_collection_id, $collectionRequest); } $this->forward('products', 'user', 'default', array('member_id' => $memberId)); //$this->redirect('/member/'.$memberId.'/products'); } public function loadratingsAction() { $this->_helper->layout->disableLayout(); $tableProjectRatings = new Default_Model_DbTable_ProjectRating(); $ratings = $tableProjectRatings->fetchRating($this->_projectId); $this->_helper->json($ratings); } public function loadfilesjsonAction() { $this->_helper->layout->disableLayout(); // $project_id = $this->getParam('pid'); $modelProject = new Default_Model_Project(); $files = $modelProject->fetchFilesForProject($this->_projectId); $salt = PPLOAD_DOWNLOAD_SECRET; foreach ($files as &$file) { $timestamp = time() + 3600; // one hour valid $hash = hash('sha512',$salt . $file['collection_id'] . $timestamp); // order isn't important at all... just do the same when verifying $url = PPLOAD_API_URI . 'files/download/id/' . $file['id'] . '/s/' . $hash . '/t/' . $timestamp; if(null != $this->_authMember) { $url .= '/u/' . $this->_authMember->member_id; } $url .= '/lt/filepreview/' . $file['name']; $file['url'] = urlencode($url); } $this->_helper->json($files); } public function loadfirstfilejsonAction() { $this->_helper->layout->disableLayout(); // $project_id = $this->getParam('pid'); $modelProject = new Default_Model_Project(); $files = $modelProject->fetchFilesForProject($this->_projectId); $salt = PPLOAD_DOWNLOAD_SECRET; $file = $files[0]; $timestamp = time() + 3600; // one hour valid $hash = hash('sha512',$salt . $file['collection_id'] . $timestamp); // order isn't important at all... just do the same when verifying $url = PPLOAD_API_URI . 'files/download/id/' . $file['id'] . '/s/' . $hash . '/t/' . $timestamp; if(null != $this->_authMember) { $url .= '/u/' . $this->_authMember->member_id; } $url .= '/lt/filepreview/' . $file['name']; $file['url'] = urlencode($url); $this->_helper->json($file); } public function loadinstallinstructionAction() { $this->_helper->layout->disableLayout(); $infomodel = new Default_Model_Info(); $text = $infomodel->getOCSInstallInstruction(); $this->_helper->json(array( 'status' => 'ok', 'data' => $text )); } public function followAction() { $this->_helper->layout()->disableLayout(); // $this->_helper->viewRenderer->setNoRender(true); $this->view->project_id = $this->_projectId; $this->view->authMember = $this->_authMember; if (array_key_exists($this->_projectId, $this->_authMember->projects)) { return; } $projectFollowTable = new Default_Model_DbTable_ProjectFollower(); $newVals = array('project_id' => $this->_projectId, 'member_id' => $this->_authMember->member_id); $where = $projectFollowTable->select()->where('member_id = ?', $this->_authMember->member_id) ->where('project_id = ?', $this->_projectId, 'INTEGER') ; $result = $projectFollowTable->fetchRow($where); if (null === $result) { $projectFollowTable->createRow($newVals)->save(); $tableProduct = new Default_Model_Project(); $product = $tableProduct->find($this->_projectId)->current(); $activityLog = new Default_Model_ActivityLog(); $activityLog->writeActivityLog($this->_projectId, $this->_authMember->member_id, Default_Model_ActivityLog::PROJECT_FOLLOWED, $product->toArray()); } // ppload //Add collection to favorite // $projectTable = new Default_Model_DbTable_Project(); // $projectData = $projectTable->find($this->_projectId)->current(); // if ($projectData->ppload_collection_id) { // $pploadApi = new Ppload_Api(array( // 'apiUri' => PPLOAD_API_URI, // 'clientId' => PPLOAD_CLIENT_ID, // 'secret' => PPLOAD_SECRET // )); // // $favoriteRequest = array( // 'user_id' => $this->_authMember->member_id, // 'collection_id' => $projectData->ppload_collection_id // ); // // $favoriteResponse = $pploadApi->postFavorite($favoriteRequest); // } } public function unfollowAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer('follow'); $this->view->project_id = $this->_projectId; $this->view->authMember = $this->_authMember; $projectFollowTable = new Default_Model_DbTable_ProjectFollower(); $projectFollowTable->delete('member_id=' . $this->_authMember->member_id . ' AND project_id=' . $this->_projectId); $tableProduct = new Default_Model_Project(); $product = $tableProduct->find($this->_projectId)->current(); $activityLog = new Default_Model_ActivityLog(); $activityLog->writeActivityLog($this->_projectId, $this->_authMember->member_id, Default_Model_ActivityLog::PROJECT_UNFOLLOWED, $product->toArray()); // ppload // Delete collection from favorite // $projectTable = new Default_Model_DbTable_Project(); // $projectData = $projectTable->find($this->_projectId)->current(); // if ($projectData->ppload_collection_id) { // $pploadApi = new Ppload_Api(array( // 'apiUri' => PPLOAD_API_URI, // 'clientId' => PPLOAD_CLIENT_ID, // 'secret' => PPLOAD_SECRET // )); // // $favoriteRequest = array( // 'user_id' => $this->_authMember->member_id, // 'collection_id' => $projectData->ppload_collection_id // ); // // $favoriteResponse = // $pploadApi->postFavorite($favoriteRequest); // This post call will retrieve existing favorite info // if (!empty($favoriteResponse->favorite->id)) { // $favoriteResponse = $pploadApi->deleteFavorite($favoriteResponse->favorite->id); // } // } } public function followpAction() { $this->_helper->layout()->disableLayout(); // $this->_helper->viewRenderer->setNoRender(true); $this->view->project_id = $this->_projectId; $this->view->authMember = $this->_authMember; if (array_key_exists($this->_projectId, $this->_authMember->projects)) { return; } $projectFollowTable = new Default_Model_DbTable_ProjectFollower(); $newVals = array('project_id' => $this->_projectId, 'member_id' => $this->_authMember->member_id); $where = $projectFollowTable->select()->where('member_id = ?', $this->_authMember->member_id) ->where('project_id = ?', $this->_projectId, 'INTEGER') ; $result = $projectFollowTable->fetchRow($where); if (null === $result) { $projectFollowTable->createRow($newVals)->save(); $tableProduct = new Default_Model_Project(); $product = $tableProduct->find($this->_projectId)->current(); $activityLog = new Default_Model_ActivityLog(); $activityLog->writeActivityLog($this->_projectId, $this->_authMember->member_id, Default_Model_ActivityLog::PROJECT_FOLLOWED, $product->toArray()); } } public function unfollowpAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer('followp'); $this->view->project_id = $this->_projectId; $this->view->authMember = $this->_authMember; $projectFollowTable = new Default_Model_DbTable_ProjectFollower(); $projectFollowTable->delete('member_id=' . $this->_authMember->member_id . ' AND project_id=' . $this->_projectId); $tableProduct = new Default_Model_Project(); $product = $tableProduct->find($this->_projectId)->current(); $activityLog = new Default_Model_ActivityLog(); $activityLog->writeActivityLog($this->_projectId, $this->_authMember->member_id, Default_Model_ActivityLog::PROJECT_UNFOLLOWED, $product->toArray()); } protected function logActivity($logId) { $tableProduct = new Default_Model_Project(); $product = $tableProduct->find($this->_projectId)->current(); $activityLog = new Default_Model_ActivityLog(); $activityLog->writeActivityLog($this->_projectId, $this->_authMember->member_id, $logId, $product->toArray()); } public function followprojectAction() { $this->_helper->layout()->disableLayout(); $this->view->project_id = $this->_projectId; $this->view->authMember = $this->_authMember; // not allow to pling himself if (array_key_exists($this->_projectId, $this->_authMember->projects)) { $this->_helper->json(array( 'status' => 'error', 'msg' => 'not allowed' )); return; } $projectFollowTable = new Default_Model_DbTable_ProjectFollower(); $newVals = array('project_id' => $this->_projectId, 'member_id' => $this->_authMember->member_id); $where = $projectFollowTable->select()->where('member_id = ?', $this->_authMember->member_id) ->where('project_id = ?', $this->_projectId, 'INTEGER') ; $result = $projectFollowTable->fetchRow($where); if (null === $result) { $projectFollowTable->createRow($newVals)->save(); $this->logActivity(Default_Model_ActivityLog::PROJECT_FOLLOWED); $cnt = $projectFollowTable->countForProject($this->_projectId); $this->_helper->json(array( 'status' => 'ok', 'msg' => 'Success.', 'cnt' => $cnt, 'action' =>'insert' )); }else{ $projectFollowTable->delete('member_id=' . $this->_authMember->member_id . ' AND project_id=' . $this->_projectId); $this->logActivity(Default_Model_ActivityLog::PROJECT_UNFOLLOWED); $cnt = $projectFollowTable->countForProject($this->_projectId); $this->_helper->json(array( 'status' => 'ok', 'msg' => 'Success.', 'cnt' => $cnt, 'action' => 'delete' )); } } public function plingprojectAction() { $this->_helper->layout()->disableLayout(); $this->view->project_id = $this->_projectId; $this->view->authMember = $this->_authMember; // not allow to pling himself if (array_key_exists($this->_projectId, $this->_authMember->projects)) { $this->_helper->json(array( 'status' => 'error', 'msg' => 'not allowed' )); return; } // not allow to pling if not supporter $helperIsSupporter = new Default_View_Helper_IsSupporter(); if(!$helperIsSupporter->isSupporter($this->_authMember->member_id)) { $this->_helper->json(array( 'status' => 'error', 'msg' => 'become a supporter first please. ' )); return; } $projectplings = new Default_Model_ProjectPlings(); $newVals = array('project_id' => $this->_projectId, 'member_id' => $this->_authMember->member_id); $sql = $projectplings->select() ->where('member_id = ?', $this->_authMember->member_id) ->where('is_deleted = ?',0) ->where('project_id = ?', $this->_projectId, 'INTEGER') ; $result = $projectplings->fetchRow($sql); if (null === $result) { $projectplings->createRow($newVals)->save(); //$this->logActivity(Default_Model_ActivityLog::PROJECT_PLINGED_2); $cnt = $projectplings->getPlingsAmount($this->_projectId); $this->_helper->json(array( 'status' => 'ok', 'msg' => 'Success.', 'cnt' => $cnt, 'action' =>'insert' )); }else{ // delete pling $projectplings->setDelete($result->project_plings_id); //$this->logActivity(Default_Model_ActivityLog::PROJECT_DISPLINGED_2); $cnt = $projectplings->getPlingsAmount($this->_projectId); $this->_helper->json(array( 'status' => 'ok', 'msg' => 'Success.', 'cnt' => $cnt, 'action' => 'delete' )); } } /** public function unplingprojectAction() { $this->_helper->layout()->disableLayout(); $projectplings = new Default_Model_ProjectPlings(); $pling = $projectplings->getPling($this->_projectId,$this->_authMember->member_id); if($pling) { $projectplings->setDelete($pling->project_plings_id); $cnt = count($projectplings->getPlings($this->_projectId)); $this->_helper->json(array( 'status' => 'ok', 'deleted' => $pling->project_plings_id, 'msg' => 'Success. ', 'cnt' => $cnt )); $tableProduct = new Default_Model_Project(); $product = $tableProduct->find($this->_projectId)->current(); $activityLog = new Default_Model_ActivityLog(); $activityLog->writeActivityLog($this->_projectId, $this->_authMember->member_id, Default_Model_ActivityLog::PROJECT_DISPLINGED_2, $product->toArray()); }else{ $this->_helper->json(array( 'status' => 'error', 'msg' => 'not existing.' )); } } **/ public function followsAction() { $projectFollowTable = new Default_Model_Member(); $memberId = $this->_authMember->member_id; $this->view->productList = $projectFollowTable->fetchFollowedProjects($memberId); $projectArray = $this->generateFollowedProjectsViewData($this->view->productList); $this->view->productArray['followedProjects'] = $projectArray; } /** * @param $list * * @return array */ protected function generateFollowedProjectsViewData($list) { $viewArray = array(); if (count($list) == 0) { return $viewArray; } $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); foreach ($list as $element) { $arr = array(); $arr['id'] = $element->project_id; $arr['name'] = $element->title; $arr['image'] = $element->image_small; $arr['url'] = $helperBuildProductUrl->buildProductUrl($element->project_id); $arr['urlUnFollow'] = $helperBuildProductUrl->buildProductUrl($element->project_id, 'unfollow'); #$arr['showUrlUnFollow'] = $this->view->isMember; $viewArray[] = $arr; } return $viewArray; } public function verifycodeAction() { $this->_helper->layout()->disableLayout(); if ($this->_request->isXmlHttpRequest()) { $tabProject = new Default_Model_DbTable_Project(); $dataProject = $tabProject->find($this->_projectId)->current(); $this->createTaskWebsiteOwnerVerification($dataProject); $this->view->message = 'Your product page is stored for validation.'; return; } $this->view->message = 'This service is not available at the moment. Please try again later.'; } /** * @throws Zend_Controller_Action_Exception * @deprecated */ public function fetchAction() { $this->_helper->layout()->disableLayout(); if ($this->_request->isXmlHttpRequest()) { $this->view->authMember = $this->_authMember; $this->fetchDataForIndexView(); $tableProject = new Default_Model_Project(); $this->view->supporting = $tableProject->fetchProjectSupporterWithPlings($this->_projectId); if (false === isset($this->view->product)) { throw new Zend_Controller_Action_Exception('This page does not exist', 404); } $helperUserIsOwner = new Default_View_Helper_UserIsOwner(); $helperIsProjectActive = new Default_View_Helper_IsProjectActive(); if ((false === $helperIsProjectActive->isProjectActive($this->view->product->project_status)) AND (false === $helperUserIsOwner->UserIsOwner($this->view->product->member_id)) ) { throw new Zend_Controller_Action_Exception('This page does not exist', 404); } $tablePageViews = new Default_Model_DbTable_StatPageViews(); $tablePageViews->savePageView($this->_projectId, $this->getRequest()->getClientIp(), $this->_authMember->member_id); } $this->_helper->json(get_object_vars($this->view)); } public function claimAction() { $modelProduct = new Default_Model_Project(); $productInfo = $modelProduct->fetchProductInfo($this->_projectId); if ($productInfo->claimable != Default_Model_Project::PROJECT_CLAIMABLE) { throw new Zend_Controller_Action_Exception('Method not available', 404); } $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); if (empty($productInfo->claimed_by_member)) { $modelProduct->setClaimedByMember($this->_authMember->member_id, $this->_projectId); $claimMail = new Default_Plugin_SendMail('tpl_mail_claim_product'); $claimMail->setTemplateVar('sender', $this->_authMember->mail); $claimMail->setTemplateVar('productid', $productInfo->project_id); $claimMail->setTemplateVar('producttitle', $productInfo->title); $claimMail->setTemplateVar('userid', $this->_authMember->member_id); $claimMail->setTemplateVar('username', $this->_authMember->username); $claimMail->setTemplateVar('usermail', $this->_authMember->mail); $claimMail->setReceiverMail(array('contact@opendesktop.org')); $claimMail->send(); $claimMailConfirm = new Default_Plugin_SendMail('tpl_mail_claim_confirm'); $claimMailConfirm->setTemplateVar('sender', 'contact@opendesktop.org'); $claimMailConfirm->setTemplateVar('producttitle', $productInfo->title); $claimMailConfirm->setTemplateVar('productlink', 'http://' . $this->getRequest()->getHttpHost() . $helperBuildProductUrl->buildProductUrl($productInfo->project_id)); $claimMailConfirm->setTemplateVar('username', $this->_authMember->username); $claimMailConfirm->setReceiverMail($this->_authMember->mail); $claimMailConfirm->send(); } $this->_helper->viewRenderer('index'); $this->indexAction(); } public function makerconfigAction() { $this->_helper->layout()->disableLayout(); $widgetProjectId = (int)$this->getParam('project_id'); if (false == isset($widgetProjectId)) { throw new Zend_Controller_Action_Exception('This page does not exist', 404); } $widgetDefaultModel = new Default_Model_DbTable_ProjectWidgetDefault(); $widgetDefault = $widgetDefaultModel->fetchConfig($widgetProjectId); if (!isset($widgetDefault)) { throw new Zend_Controller_Action_Exception('This page does not exist', 404); } else { $this->view->widgetConfig = $widgetDefault; $productModel = new Default_Model_Project(); $this->view->product = $productModel->fetchProductDataFromMV($widgetProjectId); $this->view->supporting = $productModel->fetchProjectSupporterWithPlings($widgetProjectId); $plingModel = new Default_Model_DbTable_Plings(); $this->view->comments = $plingModel->getCommentsForProject($widgetProjectId, 10); $websiteOwner = new Local_Verification_WebsiteProject(); $this->view->authCode = ''; } } /** * ppload */ public function addpploadfileAction() { $this->_helper->layout()->disableLayout(); $log = Zend_Registry::get('logger'); $log->debug('**********' . __CLASS__ . '::' . __FUNCTION__ . '**********' . "\n"); $projectTable = new Default_Model_DbTable_Project(); $projectData = $projectTable->find($this->_projectId)->current(); $error_text = ''; // Add file to ppload collection if (!empty($_FILES['file_upload']['tmp_name']) && $_FILES['file_upload']['error'] == UPLOAD_ERR_OK ) { $tmpFilename = dirname($_FILES['file_upload']['tmp_name']) . '/' . basename($_FILES['file_upload']['name']); $log->debug(__CLASS__ . '::' . __FUNCTION__ . '::' . print_r($tmpFilename, true) . "\n"); move_uploaded_file($_FILES['file_upload']['tmp_name'], $tmpFilename); $pploadApi = new Ppload_Api(array( 'apiUri' => PPLOAD_API_URI, 'clientId' => PPLOAD_CLIENT_ID, 'secret' => PPLOAD_SECRET )); $fileRequest = array( 'file' => $tmpFilename, 'owner_id' => $this->_authMember->member_id ); //Admins can upload files for users $helperUserRole = new Backend_View_Helper_UserRole(); $userRoleName = $helperUserRole->userRole(); if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) { $member_id = $projectData->member_id; $fileRequest = array( 'file' => $tmpFilename, 'owner_id' => $member_id ); } if ($projectData->ppload_collection_id) { // Append to existing collection $fileRequest['collection_id'] = $projectData->ppload_collection_id; } //if (isset($_POST['file_description'])) { // $fileRequest['description'] = mb_substr($_POST['file_description'], 0, 140); //} $fileResponse = $pploadApi->postFile($fileRequest); $log->debug(__CLASS__ . '::' . __FUNCTION__ . '::' . print_r($fileResponse, true) . "\n"); unlink($tmpFilename); if (!empty($fileResponse->file->collection_id)) { if (!$projectData->ppload_collection_id) { // Save collection ID $projectData->ppload_collection_id = $fileResponse->file->collection_id; //20180219 ronald: we set the changed_at only by new files or new updates if((int)$this->_authMember->member_id==(int)$projectData->member_id) { $projectData->changed_at = new Zend_Db_Expr('NOW()'); } else { $log->info('********** ' . __CLASS__ . '::' . __FUNCTION__ . ' Project ChangedAt is not set: Auth-Member ('.$this->_authMember->member_id.') != Project-Owner ('.$projectData->member_id.'): **********' . "\n"); } $projectData->ghns_excluded = 0; $projectData->save(); $activityLog = new Default_Model_ActivityLog(); $activityLog->writeActivityLog($this->_projectId, $projectData->member_id, Default_Model_ActivityLog::PROJECT_EDITED, $projectData->toArray()); // Update profile information $memberTable = new Default_Model_DbTable_Member(); $memberSettings = $memberTable->find($this->_authMember->member_id)->current(); $mainproject = $projectTable->find($memberSettings->main_project_id)->current(); $profileName = ''; if ($memberSettings->firstname || $memberSettings->lastname ) { $profileName = trim($memberSettings->firstname . ' ' . $memberSettings->lastname); } else { if ($memberSettings->username) { $profileName = $memberSettings->username; } } $profileRequest = array( 'owner_id' => $this->_authMember->member_id, 'name' => $profileName, 'email' => $memberSettings->mail, 'homepage' => $memberSettings->link_website, 'description' => $mainproject->description ); $profileResponse = $pploadApi->postProfile($profileRequest); // Update collection information $collectionCategory = $projectData->project_category_id; if (Default_Model_Project::PROJECT_ACTIVE == $projectData->status) { $collectionCategory .= '-published'; } $collectionRequest = array( 'title' => $projectData->title, 'description' => $projectData->description, 'category' => $collectionCategory, 'content_id' => $projectData->project_id ); $collectionResponse = $pploadApi->putCollection($projectData->ppload_collection_id, $collectionRequest); // Store product image as collection thumbnail $this->_updatePploadMediaCollectionthumbnail($projectData); } else { //20180219 ronald: we set the changed_at only by new files or new updates if((int)$this->_authMember->member_id==(int)$projectData->member_id) { $projectData->changed_at = new Zend_Db_Expr('NOW()'); } else { $log->info('********** ' . __CLASS__ . '::' . __FUNCTION__ . ' Project ChangedAt is not set: Auth-Member ('.$this->_authMember->member_id.') != Project-Owner ('.$projectData->member_id.'): **********' . "\n"); } $projectData->ghns_excluded = 0; $projectData->save(); } //If this file is a video, we have to convert it for preview if(!empty($fileResponse->file->type) && in_array($fileResponse->file->type, Backend_Commands_ConvertVideo::$VIDEO_FILE_TYPES)) { $queue = Local_Queue_Factory::getQueue(); $command = new Backend_Commands_ConvertVideo($projectData->ppload_collection_id, $fileResponse->file->id, $fileResponse->file->type); $queue->send(serialize($command)); } $this->_helper->json(array( 'status' => 'ok', 'file' => $fileResponse->file )); return; } } $log->debug('********** END ' . __CLASS__ . '::' . __FUNCTION__ . '**********' . "\n"); $this->_helper->json(array('status' => 'error', 'error_text' => $error_text)); } /** * ppload */ public function updatepploadfileAction() { $this->_helper->layout()->disableLayout(); $log = Zend_Registry::get('logger'); $log->debug('**********' . __CLASS__ . '::' . __FUNCTION__ . '**********' . "\n"); $projectTable = new Default_Model_DbTable_Project(); $projectData = $projectTable->find($this->_projectId)->current(); $error_text = ''; // Update a file in ppload collection if (!empty($_POST['file_id'])) { $pploadApi = new Ppload_Api(array( 'apiUri' => PPLOAD_API_URI, 'clientId' => PPLOAD_CLIENT_ID, 'secret' => PPLOAD_SECRET )); $fileResponse = $pploadApi->getFile($_POST['file_id']); if (isset($fileResponse->file->collection_id) && $fileResponse->file->collection_id == $projectData->ppload_collection_id ) { $fileRequest = array(); $tmpFilename = ''; if (!empty($_FILES['file_upload']['tmp_name']) && $_FILES['file_upload']['error'] == UPLOAD_ERR_OK ) { $tmpFilename = dirname($_FILES['file_upload']['tmp_name']) . '/' . basename($_FILES['file_upload']['name']); $log->debug(__CLASS__ . '::' . __FUNCTION__ . '::' . print_r($tmpFilename, true) . "\n"); move_uploaded_file($_FILES['file_upload']['tmp_name'], $tmpFilename); $fileRequest['file'] = $tmpFilename; //20180219 ronald: we set the changed_at only by new files or new updates if((int)$this->_authMember->member_id==(int)$projectData->member_id) { $projectData->changed_at = new Zend_Db_Expr('NOW()'); } else { $log->info('********** ' . __CLASS__ . '::' . __FUNCTION__ . ' Project ChangedAt is not set: Auth-Member ('.$this->_authMember->member_id.') != Project-Owner ('.$projectData->member_id.'): **********' . "\n"); } $projectData->ghns_excluded = 0; $projectData->save(); } if (isset($_POST['file_description'])) { $fileRequest['description'] = mb_substr($_POST['file_description'], 0, 140); } if (isset($_POST['file_category'])) { $fileRequest['category'] = $_POST['file_category']; } if (isset($_POST['file_tags'])) { $fileRequest['tags'] = $_POST['file_tags']; } if (isset($_POST['ocs_compatible'])) { $fileRequest['ocs_compatible'] = $_POST['ocs_compatible']; } if (isset($_POST['file_version'])) { $fileRequest['version'] = $_POST['file_version']; } $fileResponse = $pploadApi->putFile($_POST['file_id'], $fileRequest); $log->debug(__CLASS__ . '::' . __FUNCTION__ . '::' . print_r($fileResponse, true) . "\n"); if ($tmpFilename) { unlink($tmpFilename); } if (isset($fileResponse->status) && $fileResponse->status == 'success' ) { $this->_helper->json(array( 'status' => 'ok', 'file' => $fileResponse->file )); return; } else { $error_text .= 'Response: $pploadApi->putFile(): ' . json_encode($fileResponse) . '; $fileResponse->status: ' . $fileResponse->status; } } else { $error_text .= 'PPload Response: ' . json_encode($fileResponse) . '; fileResponse->file->collection_id: ' . $fileResponse->file->collection_id . ' != $projectData->ppload_collection_id: ' . $projectData->ppload_collection_id; } } else { $error_text .= 'No CollectionId or no FileId. CollectionId: ' . $projectData->ppload_collection_id . ', FileId: ' . $_POST['file_id']; } $log->debug('********** END ' . __CLASS__ . '::' . __FUNCTION__ . '**********' . "\n"); $this->_helper->json(array('status' => 'error', 'error_text' => $error_text)); } public function updatefiletagAction() { $this->_helper->layout()->disableLayout(); $error_text = ''; // Update a file information in ppload collection if (!empty($_POST['file_id'])) { $tagId = null; if (isset($_POST['tag_id'])) { $tagId = $_POST['tag_id']; } $tagGroupId = null; if (isset($_POST['tag_group_id'])) { $tagGroupId = $_POST['tag_group_id']; } //set architecture $modelTags = new Default_Model_Tags(); $modelTags->saveFileTagForProjectAndTagGroup($this->_projectId, $_POST['file_id'], $tagId, $tagGroupId); $this->_helper->json(array('status' => 'ok')); return; } else { $error_text .= 'No FileId. , FileId: ' . $_POST['file_id']; } $this->_helper->json(array('status' => 'error', 'error_text' => $error_text)); } public function deletefiletagAction() { $this->_helper->layout()->disableLayout(); $error_text = ''; // Update a file information in ppload collection if (!empty($_POST['file_id'])) { $tagId = null; if (isset($_POST['tag_id'])) { $tagId = $_POST['tag_id']; } //set architecture $modelTags = new Default_Model_Tags(); $modelTags->deleteFileTagForProject($this->_projectId, $_POST['file_id'], $tagId); $this->_helper->json(array('status' => 'ok')); return; } else { $error_text .= 'No FileId. , FileId: ' . $_POST['file_id']; } $this->_helper->json(array('status' => 'error', 'error_text' => $error_text)); } public function updatecompatibleAction() { $this->_helper->layout()->disableLayout(); $error_text = ''; // Update a file information in ppload collection if (!empty($_POST['file_id'])) { $typeId = null; if (isset($_POST['is_compatible'])) { $is_compatible = $_POST['is_compatible']; } return; } else { $error_text .= 'No FileId. , FileId: ' . $_POST['file_id']; } $this->_helper->json(array('status' => 'error', 'error_text' => $error_text)); } public function startdownloadAction() { $this->_helper->layout()->disableLayout(); /** * Save Download-Data in Member_Download_History */ $file_id = $this->getParam('file_id'); $file_type = $this->getParam('file_type'); $file_name = $this->getParam('file_name'); $file_size = $this->getParam('file_size'); $projectId = $this->_projectId; $this->redirect('/dl?file_id='.$file_id.'&file_type='.$file_type.'&file_name='.$file_name.'&file_size='.$file_size.'&project_id='.$projectId); // if ($_SERVER['REQUEST_METHOD'] == 'POST') { /* if(isset($file_id) && isset($projectId) && isset($memberId)) { $memberDlHistory = new Default_Model_DbTable_MemberDownloadHistory(); $data = array('project_id' => $projectId, 'member_id' => $memberId, 'file_id' => $file_id, 'file_type' => $file_type, 'file_name' => $file_name, 'file_size' => $file_size); $memberDlHistory->createRow($data)->save(); } $url = urldecode($urltring); $this->redirect($url); * */ // } else { // $this->redirect('/ads?file_id='.$file_id); // } } /** * ppload */ public function deletepploadfileAction() { $this->_helper->layout()->disableLayout(); $projectTable = new Default_Model_DbTable_Project(); $projectData = $projectTable->find($this->_projectId)->current(); $error_text = ''; // Delete file from ppload collection if (!empty($_POST['file_id'])) { $pploadApi = new Ppload_Api(array( 'apiUri' => PPLOAD_API_URI, 'clientId' => PPLOAD_CLIENT_ID, 'secret' => PPLOAD_SECRET )); $fileResponse = $pploadApi->getFile($_POST['file_id']); if (isset($fileResponse->file->collection_id) && $fileResponse->file->collection_id == $projectData->ppload_collection_id ) { $fileResponse = $pploadApi->deleteFile($_POST['file_id']); if (isset($fileResponse->status) && $fileResponse->status == 'success' ) { $this->_helper->json(array('status' => 'ok')); return; } else { $error_text .= 'Response: $pploadApi->putFile(): ' . json_encode($fileResponse); } } } $this->_helper->json(array('status' => 'error', 'error_text' => $error_text)); } /** * ppload */ public function deletepploadfilesAction() { $this->_helper->layout()->disableLayout(); $projectTable = new Default_Model_DbTable_Project(); $projectData = $projectTable->find($this->_projectId)->current(); // Delete all files in ppload collection if ($projectData->ppload_collection_id) { $pploadApi = new Ppload_Api(array( 'apiUri' => PPLOAD_API_URI, 'clientId' => PPLOAD_CLIENT_ID, 'secret' => PPLOAD_SECRET )); $filesRequest = array( 'collection_id' => $projectData->ppload_collection_id, 'perpage' => 1000 ); $filesResponse = $pploadApi->getFiles($filesRequest); if (isset($filesResponse->status) && $filesResponse->status == 'success' ) { foreach ($filesResponse->files as $file) { $fileResponse = $pploadApi->deleteFile($file->id); if (!isset($fileResponse->status) || $fileResponse->status != 'success' ) { $this->_helper->json(array('status' => 'error')); return; } } } $this->_helper->json(array('status' => 'ok')); return; } $this->_helper->json(array('status' => 'error')); } /** * ppload */ /*public function deletepploadcollectionAction() { $this->_helper->layout()->disableLayout(); $projectTable = new Default_Model_DbTable_Project(); $projectData = $projectTable->find($this->_projectId)->current(); // Delete ppload collection if ($projectData->ppload_collection_id) { $pploadApi = new Ppload_Api(array( 'apiUri' => PPLOAD_API_URI, 'clientId' => PPLOAD_CLIENT_ID, 'secret' => PPLOAD_SECRET )); $collectionResponse = $pploadApi->deleteCollection($projectData->ppload_collection_id); if (isset($collectionResponse->status) && $collectionResponse->status == 'success' ) { $projectData->ppload_collection_id = null; $projectData->changed_at = new Zend_Db_Expr('NOW()'); $projectData->save(); $activityLog = new Default_Model_ActivityLog(); $activityLog->writeActivityLog( $this->_projectId, $projectData->member_id, Default_Model_ActivityLog::PROJECT_EDITED, $projectData->toArray() ); $this->_helper->json(array('status' => 'ok')); return; } } $this->_helper->json(array('status' => 'error')); }*/ public function saveproductAction() { $form = new Default_Form_Product(); // we don't need to test a file which doesn't exist in this case. The Framework stumbles if $_FILES is empty. if ($this->_request->isXmlHttpRequest() AND (count($_FILES) == 0)) { $form->removeElement('image_small_upload'); // $form->removeElement('image_big_upload'); $form->removeSubForm('gallery'); $form->removeElement('project_id'); //(workaround: Some Browsers send "0" in some cases.) } if (false === $form->isValid($_POST)) { $errors = $form->getMessages(); $messages = $this->getErrorMessages($errors); $this->_helper->json(array('status' => 'error', 'messages' => $messages)); } $formValues = $form->getValues(); $formValues['status'] = Default_Model_Project::PROJECT_INCOMPLETE; $modelProject = new Default_Model_Project(); $newProject = $modelProject->createProject($this->_authMember->member_id, $formValues, $this->_authMember->username); //$this->createSystemPlingForNewProject($newProject->project_id); //New Project in Session, for AuthValidation (owner) $this->_auth->getIdentity()->projects[$newProject->project_id] = array('project_id' => $newProject->project_id); $this->_helper->json(array('status' => 'ok', 'project_id' => $newProject->project_id)); } protected function createPling($member_id,$project_id) { $projectplings = new Default_Model_ProjectPlings(); $newVals = array('project_id' =>$project_id, 'member_id' => $member_id); $sql = $projectplings->select() ->where('member_id = ?', $this->_authMember->member_id) ->where('is_deleted = ?',0) ->where('project_id = ?', $this->_projectId, 'INTEGER'); $result = $projectplings->fetchRow($sql); if (null === $result) { $projectplings->createRow($newVals)->save(); } } /** * @param $errors * * @return array */ protected function getErrorMessages($errors) { $messages = array(); foreach ($errors as $element => $row) { if (!empty($row) && $element != 'submit') { foreach ($row as $validator => $message) { $messages[$element][] = $message; } } } return $messages; } public function searchAction() { // Filter-Parameter $params = $this->getAllParams(); $filterInput = new Zend_Filter_Input( array( '*' => 'StringTrim', 'projectSearchText' => array(new Zend_Filter_Callback('stripslashes'),'StripTags'), 'page' => 'digits', 'pci' => 'digits', 'ls' => 'digits', 't' => array(new Zend_Filter_Callback('stripslashes'),'StripTags'), 'pkg'=> array(new Zend_Filter_Callback('stripslashes'),'StripTags'), 'lic'=> array(new Zend_Filter_Callback('stripslashes'),'StripTags'), 'arch'=> array(new Zend_Filter_Callback('stripslashes'),'StripTags') ), array( 'projectSearchText' => array( new Zend_Validate_StringLength(array('min' => 3, 'max' => 100)), 'presence' => 'required' ), 'page' => array('digits', 'default' => '1'), 'f' => array( new Zend_Validate_StringLength(array('min' => 3, 'max' => 100)), //new Zend_Validate_InArray(array('f'=>'tags')), 'allowEmpty' => true ), 'pci' => array('digits', 'allowEmpty' => true ), 'ls' => array('digits', 'allowEmpty' => true ), 't' => array(new Zend_Validate_StringLength(array('min' => 3, 'max' => 100)), 'allowEmpty' => true ), 'pkg' => array(new Zend_Validate_StringLength(array('min' => 3, 'max' => 100)), 'allowEmpty' => true ), 'lic' => array(new Zend_Validate_StringLength(array('min' => 3, 'max' => 100)), 'allowEmpty' => true ), 'arch' => array(new Zend_Validate_StringLength(array('min' => 3, 'max' => 100)), 'allowEmpty' => true) ), $params); if ($filterInput->hasInvalid()) { $this->_helper->flashMessenger->addMessage('

There was an error. Please check your input and try again.

'); return; } $this->view->searchText = $filterInput->getEscaped('projectSearchText'); $this->view->page = $filterInput->getEscaped('page'); $this->view->searchField = $filterInput->getEscaped('f'); $this->view->pci = $filterInput->getEscaped('pci'); $this->view->ls = $filterInput->getEscaped('ls'); $this->view->t = $filterInput->getEscaped('t'); $this->view->pkg = $filterInput->getEscaped('pkg'); $this->view->arch = $filterInput->getEscaped('arch'); $this->view->lic = $filterInput->getEscaped('lic'); $this->view->store = $this->getParam('domain_store_id'); if(isset($params['isJson'])) { $this->_helper->layout()->disableLayout(); $filterScore = $this->view->ls ? 'laplace_score:['.$this->view->ls.' TO '.($this->view->ls+9).']':null; $filterCat = $this->view->pci ? 'project_category_id:('.$this->view->pci.')' : null; $filterTags = $this->view->t ? 'tags:('.$this->view->t.')' : null; $filterPkg = $this->view->pkg ? 'package_names:('.$this->view->pkg.')' : null; $filterArch = $this->view->arch ? 'arch_names:('.$this->view->arch.')' : null; $filterLic = $this->view->lic ? 'license_names:('.$this->view->lic.')' : null; // $param = array('q' => $this->view->searchText ,'store'=>$this->view->store,'page' => $this->view->page // , 'count' => 10, 'qf' => $this->view->searchField, 'fq' => array($filterCat, $filterScore, $filterTags,$filterPkg,$filterArch,$filterLic)); $param = array('q' => 'test','store'=>null,'page' => 1 , 'count' => 10); $viewHelperImage = new Default_View_Helper_Image(); $modelSearch = new Default_Model_Solr(); try { $result = $modelSearch->search($param); $products = $result['hits']; // var_dump($products); // die; $ps=array(); foreach ($products as $p) { $img = $viewHelperImage->Image($p->image_small, array( 'width' => 50, 'height' => 50 )); $ps[] =array('description'=>$p->description ,'title' =>$p->title ,'project_id' =>$p->project_id ,'member_id'=>$p->member_id ,'username' => $p->username ,'laplace_score' =>$p->laplace_score ,'score' =>$p->score ,'image_small' =>$img); } $this->_helper->json(array( 'status' => 'ok', 'products' => $ps, 'q' =>$param )); } catch (Exception $e) { $this->_helper->json(array( 'status' => 'err', 'msg' => 'Not Found! Try again.' )); } } } /** * @param $memberId * * @throws Zend_Db_Table_Exception */ protected function setViewDataForMyProducts($memberId) { $tableMember = new Default_Model_Member(); $this->view->member = $tableMember->find($memberId)->current(); $tableProduct = new Default_Model_Project(); $this->view->products = $tableProduct->fetchAllProjectsForMember($memberId); } protected function _initResponseHeader() { $duration = 1800; // in seconds $expires = gmdate("D, d M Y H:i:s", time() + $duration) . " GMT"; $this->getResponse()->setHeader('X-FRAME-OPTIONS', 'ALLOWALL', true)// ->setHeader('Last-Modified', $modifiedTime, true) ->setHeader('Expires', $expires, true)->setHeader('Pragma', 'no-cache', true) ->setHeader('Cache-Control', 'private, no-cache, must-revalidate', true) ; } /** * @param $hits * * @return array */ protected function generateProjectsArrayForView($hits) { $viewArray = array(); $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); /** @var $hit Zend_Search_Lucene_Search_QueryHit */ foreach ($hits as $hit) { $project = $hit->getDocument(); if (null != $project->username) { $isUpdate = ($project->type_id == 2); if ($isUpdate) { $showUrl = $helperBuildProductUrl->buildProductUrl($project->pid) . '#anker_' . $project->project_id; $plingUrl = $helperBuildProductUrl->buildProductUrl($project->pid, 'pling'); } else { $showUrl = $helperBuildProductUrl->buildProductUrl($project->project_id); $plingUrl = $helperBuildProductUrl->buildProductUrl($project->project_id, 'pling'); } $projectArr = array( 'score' => $hit->score, 'id' => $project->project_id, 'type_id' => $project->type_id, 'title' => $project->title, 'description' => $project->description, 'image' => $project->image_small, 'plings' => 0, 'urlGoal' => $showUrl, 'urlPling' => $plingUrl, 'showUrlPling' => ($project->paypal_mail != null), 'member' => array( 'name' => $project->username, 'url' => 'member/' . $project->member_id, 'image' => $project->profile_image_url, 'id' => $project->member_id ) ); $viewArray[] = $projectArr; } } return $viewArray; } protected function setLayout() { $layoutName = 'flat_ui_template'; $storeConfig = Zend_Registry::isRegistered('store_config') ? Zend_Registry::get('store_config') : null; if($storeConfig && $storeConfig->layout_pagedetail) { $this->_helper->layout()->setLayout($storeConfig->layout_pagedetail); }else{ $this->_helper->layout()->setLayout($layoutName); } } private function fetchGitlabProject($gitProjectId) { $gitlab = new Default_Model_Ocs_Gitlab(); try { $gitProject = $gitlab->getProject($gitProjectId); } catch (Exception $exc) { //Project is gone $modelProject = new Default_Model_Project(); $modelProject->updateProject($this->_projectId, array('is_gitlab_project' => 0, 'gitlab_project_id' => null, 'show_gitlab_project_issues' => 0, 'use_gitlab_project_readme' => 0)); $gitProject = null; } return $gitProject; } private function fetchGitlabProjectIssues($gitProjectId) { $gitlab = new Default_Model_Ocs_Gitlab(); try { $gitProjectIssues = $gitlab->getProjectIssues($gitProjectId); } catch (Exception $exc) { //Project is gone $modelProject = new Default_Model_Project(); $modelProject->updateProject($this->_projectId, array('is_gitlab_project' => 0, 'gitlab_project_id' => null, 'show_gitlab_project_issues' => 0, 'use_gitlab_project_readme' => 0)); $gitProjectIssues = null; } return $gitProjectIssues; } public function startmediaviewajaxAction() { return $this->startvideoajaxAction(); } public function startvideoajaxAction() { $this->_helper->layout()->disableLayout(); $collection_id = null; $file_id = null; $memberId = $this->_authMember->member_id; $media_view_type_id = $this->getParam('type_id'); if(!$media_view_type_id) { // default $media_view_type_id = Default_Model_DbTable_MediaViews::MEDIA_TYPE_VIDEO; } if($this->hasParam('collection_id') && $this->hasParam('file_id')) { $collection_id = $this->getParam('collection_id'); $file_id = $this->getParam('file_id'); $id = null; //Log media view try { $mediaviewsTable = new Default_Model_DbTable_MediaViews(); $id = $mediaviewsTable->getNewId(); $data = array('media_view_id' => $id, 'media_view_type_id' => $media_view_type_id, 'project_id' => $this->_projectId, 'collection_id' => $collection_id, 'file_id' => $file_id, 'start_timestamp' => new Zend_Db_Expr ('Now()'), 'ip' => $this->getRealIpAddr(), 'referer' => $this->getReferer()); if(!empty($memberId)) { $data['member_id'] = $memberId; } $data['source'] = 'OCS-Webserver'; $mediaviewsTable->createRow($data)->save(); } catch (Exception $exc) { //echo $exc->getTraceAsString(); $errorLog = Zend_Registry::get('logger'); $errorLog->err(__METHOD__ . ' - ' . $exc->getMessage() . ' ---------- ' . PHP_EOL); } $this->_helper->json(array('status' => 'success', 'MediaViewId' => $id)); return; } $this->_helper->json(array('status' => 'error')); } public function stopmediaviewajaxAction() { return $this->stopvideoajaxAction(); } public function stopvideoajaxAction() { $this->_helper->layout()->disableLayout(); $view_id = null; if($this->hasParam('media_view_id')) { $view_id = $this->getParam('media_view_id'); //Log media view stop try { $mediaviewsTable = new Default_Model_DbTable_MediaViews(); $data = array('stop_timestamp' => new Zend_Db_Expr ('Now()')); $mediaviewsTable->update($data, 'media_view_id = '. $view_id); } catch (Exception $exc) { //echo $exc->getTraceAsString(); $errorLog = Zend_Registry::get('logger'); $errorLog->err(__METHOD__ . ' - ' . $exc->getMessage() . ' ---------- ' . PHP_EOL); } $this->_helper->json(array('status' => 'success', 'MediaViewId' => $view_id)); return; } $this->_helper->json(array('status' => 'error')); } function getRealIpAddr() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet { $ip=$_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy { $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip=$_SERVER['REMOTE_ADDR']; } return $ip; } function getReferer() { $referer = null; if (!empty($_SERVER['HTTP_REFERER'])) { $referer = $_SERVER['HTTP_REFERER']; } return $referer; } } diff --git a/application/modules/default/controllers/SupportersController.php b/application/modules/default/controllers/SupportersController.php index c4c2f745a..4fa0a29a2 100755 --- a/application/modules/default/controllers/SupportersController.php +++ b/application/modules/default/controllers/SupportersController.php @@ -1,171 +1,171 @@ . **/ class SupportersController extends Local_Controller_Action_DomainSwitch { public function indexAction() { - $section_id = $this->getParam('id',null); + $section_id = $this->getParam('id',2); $products = self::fetchProducts($section_id); $creators = self::fetchCreators($section_id); $supporters = self::fetchSupporters($section_id); $model = new Default_Model_Section(); $section = null; if($section_id) { $section = $model->fetchSection($section_id); $this->view->section = $section; $this->view->section_id = $section_id; } $this->view->supporters = $supporters; $this->view->products = $products; $this->view->creators = $creators; $title = 'Section'; if($section){ $title = 'Section '.$section['name']; } $this->view->headTitle($title . ' - ' . $this->getHeadTitle(), 'SET'); } public function topAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $section_id = $this->getParam('id',null); $products = self::fetchProducts($section_id); $creators = self::fetchCreators($section_id); $this->_helper->json(array('status' => 'ok', 'products' => $products,'creators' => $creators)); } public function fetchCreators($section_id) { $model = new Default_Model_Section(); $helpPrintDate = new Default_View_Helper_PrintDate(); $helperImage = new Default_View_Helper_Image(); $creators = $model->fetchTopPlingedCreatorPerSection($section_id); foreach ($creators as &$p) { $p['profile_image_url'] = $helperImage->Image($p['profile_image_url'], array('width' => 100, 'height' => 100)); } return $creators; } public function fetchProducts($section_id) { $model = new Default_Model_Section(); $helpPrintDate = new Default_View_Helper_PrintDate(); $helperImage = new Default_View_Helper_Image(); $products=$model->fetchTopPlingedProductsPerSection($section_id); foreach ($products as &$p) { $p['image_small'] = $helperImage->Image($p['image_small'], array('width' => 200, 'height' => 200)); $p['updated_at'] = $helpPrintDate->printDate(($p['changed_at']==null?$p['created_at']:$p['changed_at'])); } return $products; } public function fetchSupporters($section_id) { $info = new Default_Model_Info(); $helperImage = new Default_View_Helper_Image(); if($section_id) { $supporters = $info->getNewActiveSupportersForSection($section_id,1000); }else{ $supporters = $info->getNewActiveSupportersForSectionAll(1000); } $s= array(); foreach ($supporters as &$p) { $s[] = array('profile_image_url' => $helperImage->Image($p['profile_image_url'], array('width' => 100, 'height' => 100)), 'member_id' => $p['member_id'], 'username' => $p['username'], 'section_support_tier' => $p['section_support_tier'] ); /*$p['profile_image_url'] = $helperImage->Image($p['profile_image_url'], array('width' => 100, 'height' => 100));*/ } return $s; } public function topcatAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $model = new Default_Model_Section(); $helpPrintDate = new Default_View_Helper_PrintDate(); $helperImage = new Default_View_Helper_Image(); $cat_id = $this->getParam('cat_id'); $products=$model->fetchTopPlingedProductsPerCategory($cat_id); foreach ($products as &$p) { $p['image_small'] = $helperImage->Image($p['image_small'], array('width' => 200, 'height' => 200)); $p['updated_at'] = $helpPrintDate->printDate(($p['changed_at']==null?$p['created_at']:$p['changed_at'])); } $creators = $model->fetchTopPlingedCreatorPerCategory($cat_id); foreach ($creators as &$p) { $p['profile_image_url'] = $helperImage->Image($p['profile_image_url'], array('width' => 100, 'height' => 100)); } $this->_helper->json(array('status' => 'ok', 'cat_id'=>$cat_id,'products' => $products,'creators' => $creators)); } public function recentplingsAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $section_id = $this->getParam('id',null); $model = new Default_Model_Section(); $helpPrintDate = new Default_View_Helper_PrintDate(); $helperImage = new Default_View_Helper_Image(); $products=$model->getNewActivePlingProduct($section_id); foreach ($products as &$p) { $p['image_small'] = $helperImage->Image($p['image_small'],array('width' => '115', 'height' => '75', 'crop' => 2)); $p['created_at'] = $helpPrintDate->printDate($p['created_at']); $p['profile_image_url'] = $helperImage->Image($p['profile_image_url'], array('width' => 100, 'height' => 100)); } $this->_helper->json(array('status' => 'ok', 'products' => $products)); } protected function setLayout() { $this->_helper->layout()->setLayout('layout_pling_home'); } } diff --git a/application/modules/default/models/ProjectClone.php b/application/modules/default/models/ProjectClone.php index 8e557078f..9193c5ec5 100755 --- a/application/modules/default/models/ProjectClone.php +++ b/application/modules/default/models/ProjectClone.php @@ -1,175 +1,233 @@ . **/ class Default_Model_ProjectClone extends Default_Model_DbTable_ProjectClone { public function fetchOrigins($project_id) { $sql = " SELECT c.project_id as project_id_clone ,c.project_id_parent as project_id ,c.external_link ,c.member_id ,c.text ,' ' as catTitle ,p.project_category_id ,p.title ,p.image_small ,p.changed_at FROM project_clone c JOIN project p ON p.project_id = c.project_id_parent WHERE c.is_deleted = 0 and c.is_valid = 1 and c.project_id = :project_id AND p.`status` = 100 order by c.created_at desc "; $resultSet = $this->_db->fetchAll($sql, array('project_id' => $project_id)); return $this->generateRowSet($resultSet); // return $resultSet; } public function fetchClones($project_id) { $sql = " SELECT c.project_id as project_id ,c.project_id_parent as project_id_origin ,c.external_link ,c.member_id ,c.text ,' ' as catTitle ,(select project_category_id from project p where p.project_id = c.project_id_parent) project_category_id ,p.title ,p.image_small ,p.changed_at FROM project_clone c JOIN project p ON p.project_id = c.project_id WHERE c.is_deleted = 0 and c.is_valid = 1 and c.project_id_parent = :project_id AND p.`status` = 100 order by c.created_at desc "; $resultSet = $this->_db->fetchAll($sql, array('project_id' => $project_id)); return $this->generateRowSet($resultSet); // return $resultSet; } public function fetchParent($project_id) { $sql = " SELECT * FROM project_clone c WHERE c.is_deleted = 0 and c.is_valid = 1 and c.project_id = :project_id "; $resultSet = $this->_db->fetchRow($sql, array('project_id' => $project_id)); return $this->generateRowSet($resultSet); } public function fetchRelatedProducts($project_id) { $sql = " select distinct * from ( SELECT c.project_id as project_id ,c.external_link ,c.member_id ,c.text ,' ' as catTitle ,(select project_category_id from project p where p.project_id = c.project_id_parent) project_category_id ,p.title ,p.image_small ,p.changed_at FROM project_clone c JOIN project p on p.project_id = c.project_id WHERE c.is_deleted = 0 and c.is_valid = 1 and c.project_id_parent = :project_id AND p.`status` = 100 union SELECT c.project_id as project_id ,c.external_link ,c.member_id ,c.text ,' ' as catTitle ,(select project_category_id from project p where p.project_id = c.project_id_parent) project_category_id ,p.title ,p.image_small ,p.changed_at FROM project_clone c JOIN project p on p.project_id = c.project_id WHERE c.project_id<> :project_id and c.is_deleted = 0 and c.is_valid = 1 AND p.`status` = 100 and c.project_id_parent in ( select project_id_parent from project_clone c where c.project_id = :project_id and c.is_valid = 1 and c.is_deleted = 0 ) ) a where a.catTitle is not null order by changed_at desc "; $resultSet = $this->_db->fetchAll($sql, array('project_id' => $project_id)); return $this->generateRowSet($resultSet); } public function fetchCredits() { $sql = " SELECT c.project_clone_id ,c.project_id ,c.project_id_parent ,c.external_link ,c.text ,c.member_id as reported_by ,m.username as reporter_username ,m.profile_image_url as reporter_profile_image_url ,p.cat_title catTitle ,p.title ,p.image_small ,p.changed_at ,p.laplace_score ,p.member_id ,p.username ,pp.cat_title parent_catTitle ,pp.title parent_title ,pp.image_small parent_image_small ,pp.changed_at parent_changed_at ,pp.laplace_score parent_laplace_score ,pp.member_id parent_member_id ,pp.username parent_username FROM project_clone c join stat_projects pp on pp.project_id =c.project_id_parent join member m on m.member_id = c.member_id left JOIN stat_projects p on p.project_id = c.project_id WHERE c.is_deleted = 0 and c.is_valid = 0 AND pp.status = 100 order by c.created_at desc "; $resultSet = $this->_db->fetchAll($sql); return $this->generateRowSet($resultSet); } + /** + * @return string comma seperated ids + */ + function fetchChildrensIds($project_id){ + $sql = " + select GROUP_CONCAT(project_id) as ids from project_clone c where c.project_id_parent = :project_id + "; + $resultSet = $this->_db->fetchRow($sql, array('project_id' => $project_id)); + return $resultSet['ids']; + } + + /** + * @return string comma seperated ids + */ + function fetchParentIds($project_id){ + $sql = " + select GROUP_CONCAT(project_id_parent) as ids from project_clone c where c.project_id = :project_id + "; + $resultSet = $this->_db->fetchRow($sql, array('project_id' => $project_id)); + return $resultSet['ids']; + } + + /** + * @return string siblings project ids without itself + */ + function fetchSiblings($project_id){ + $sql = " + select GROUP_CONCAT(distinct project_id) as ids from project_clone c where c.project_id_parent in ( + select project_id_parent from project_clone c where c.project_id = :project_id + ) and c.project_id <> :project_id + "; + $resultSet = $this->_db->fetchRow($sql, array('project_id' => $project_id)); + return $resultSet['ids']; + } + + /** + * @return string comma seperated ids + */ + function fetchAncestersIds($project_id,$level=3){ + + $parentIds = self::fetchParentIds($project_id); + $ids=''; + while ($level>0 && strlen($parentIds)>0) { + $sql = "select GROUP_CONCAT(distinct project_id_parent) as ids from project_clone c where c.project_id in(".$parentIds.")"; + $resultSet = $this->_db->fetchRow($sql); + if($resultSet['ids']) + { + $ids.=','.$resultSet['ids']; + } + else{ + break; + } + $parentIds = $resultSet['ids']; + $level--; + } + if(substr($ids, 0, 1)==','){ $ids=substr($ids,1);}; + return $ids; + } } \ No newline at end of file diff --git a/application/modules/default/views/helpers/Image.php b/application/modules/default/views/helpers/Image.php index 5c4b44966..752c3a67a 100644 --- a/application/modules/default/views/helpers/Image.php +++ b/application/modules/default/views/helpers/Image.php @@ -1,169 +1,190 @@ . **/ class Default_View_Helper_Image extends Zend_View_Helper_Abstract { protected $_operations = array( 'crop' => '%d', 'width' => '%d', 'height' => '%d', 'quality' => '%d', 'bgColor' => '%s', 'progressive' => '%d' ); protected $_options = array( 'temporal' => false ); protected $_separator = '-'; /** * @param $filename * @param array $options * @return string|null */ public function Image($filename, $options = array()) { if (false === $this->validUri($filename)) { return $this->createImageUri($filename, $options); } $uri = $filename; if (false === $this->isLocalhost($filename)) { $httpScheme = 'https'; $uri = $this->replaceScheme($filename, $httpScheme); } if (empty($options)) { return $uri; } return $this->updateImageUri($uri, $options); } /** * @param $filename * @return bool */ private function validUri($filename) { return Zend_Uri::check($filename); } /** * @param $filename * @param $options * @return string */ private function createImageUri($filename, $options) { $operations = ""; if (isset($options['width']) && isset($options['height'])) { $operations .= $options['width'] . 'x' . $options['height']; } else { //$operations .= '80x80'; $operations .= ''; } if (isset($options['crop'])) { $operations .= '-' . $options['crop']; } else { //$operations .= '-2'; $operations .= ''; } if ($filename == "") { $filename = 'default.png'; } if (isset($options['temporal'])) { $filename = '/img/default/tmp/' . $filename; $url = $filename; } else { if (strpos($filename, '.gif') > 0 || $operations == '') { $url = IMAGES_MEDIA_SERVER . '/img/' . $filename; } else { $url = IMAGES_MEDIA_SERVER . '/cache/' . $operations . '/img/' . $filename; } } return $url; } /** * @param $filename * @param $getScheme * @return string|string[]|null */ private function replaceScheme($filename, $getScheme) { $result = preg_replace("|^https?|", $getScheme, $filename); return $result; } /** * @param $filename * @param $options * @return string|string[]|null */ private function updateImageUri($filename, $options) { $dimension = ''; if (isset($options['width']) && isset($options['height'])) { $dimension = $options['width'] . 'x' . $options['height']; } else { if (isset($options['width']) && (false === isset($options['height']))) { $dimension = $options['width'] . 'x' . $options['width']; } else { if (isset($options['height']) && (false === isset($options['width']))) { $dimension = $options['height'] . 'x' . $options['height']; } } } $uri = preg_replace("/\d\d\dx\d\d\d/", $dimension, $filename); return $uri; } /** * @param string $filename * @return bool */ private function isLocalhost($filename) { $host = parse_url($filename, PHP_URL_HOST); $whitelist = array('127.0.0.1', '::1', 'localhost'); if (in_array($host, $whitelist)) { return true; } return false; } + public function getDataURI($image, $mime = '') { + return 'data: '.(function_exists('mime_content_type') ? mime_content_type($image) : $mime).';base64,'.base64_encode(file_get_contents($image)); + } + + public function getImageDataFromUrl($filename, $options) + { + $url = $this->Image($filename, $options); + $urlParts = pathinfo($url); + $extension = $urlParts['extension']; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_HEADER, 0); + $response = curl_exec($ch); + curl_close($ch); + $base64 = 'data:image/' . $extension . ';base64,' . base64_encode($response); + + return $base64; + } + } \ No newline at end of file diff --git a/application/modules/default/views/scripts/explore/index-react8.phtml b/application/modules/default/views/scripts/explore/index-react8.phtml new file mode 100755 index 000000000..bf858ded5 --- /dev/null +++ b/application/modules/default/views/scripts/explore/index-react8.phtml @@ -0,0 +1,253 @@ +. + **/ +$modelCategory = new Default_Model_DbTable_ProjectCategory(); +$this->dataCategory = $modelCategory->findSingleRow($this->cat_id); +$store_config = Zend_Registry::get('store_config'); +$host = $store_config->host; +$og_server = $this->serverUrl(true); +$catTitle = ''; +if($this->dataCategory['project_category_id']) +{ + $catTitle = $this->dataCategory['title']; +} +if($this->filters['order'] == 'latest'){ + $og_title = 'Browse '.$catTitle.' Latest | '.$host; +}else if($this->filters['order'] == 'top'){ + $og_title = 'Browse '.$catTitle.' Top | '.$host; +}else{ + $og_title='Browse '.$catTitle.' | '.$host; +} +$og_description = $og_title .'| A community for free and open source software and libre content'; +$this->templateConfigData = Zend_Registry::get('store_template'); +$og_image = 'https://' . $_SERVER['HTTP_HOST'] .$this->templateConfigData['logo']; +$this->doctype(Zend_View_Helper_Doctype::XHTML1_RDFA); +$this->headMeta()->appendProperty('og:type', 'website'); +$this->headMeta()->appendProperty('og:url', $og_server); +$this->headMeta()->appendProperty('og:title', $og_title); +$this->headMeta()->appendProperty('og:site_name',$host); +$this->headMeta()->appendProperty('og:description',$og_description); +$this->headMeta()->appendProperty('og:image',$og_image); + + +$helperBuildExploreUrl = new Default_View_Helper_BuildExploreUrl(); +$modelInfo = new Default_Model_Info(); + +$this->countSupporters = $modelInfo->getCountAllSupporters(); +$this->supporters = $modelInfo->getNewActiveSupporters(7); +$this->headLink()->appendStylesheet('/theme/flatui/css/explore_index.css'); + + +if($this->inputFilterOriginal ==1) +{ + $checkedOriginal = ' checked'; +}else +{ + $checkedOriginal = ''; +} + +?> + + + + +
+
+ +
+ +
+
+
+ comments = $modelInfo->getLatestComments(5, $this->cat_id, $this->tags); + //$donations = $modelInfo->getLatestPlings(5, $this->cat_id); + $topprods = $modelInfo->getMostDownloaded(100, $this->cat_id, $this->tags); + $asidehide = ''; + if(!$this->catabout && count($this->comments)==0 && count($topprods)==0 ) + { + $asidehide = 'hide'; + } + $this->show_git = false; + ?> + +
+
+ + +
+ + +inlineScript()->appendScript( + ' $(document).ready(function(){ + TooltipUser.setup("tooltipuserleft","left"); + TooltipUser.setup("tooltipuser","right"); + FilterBrowseOriginalFn.setup(); + FilterBrowseTagGroupFn.setup(); + }); + '); diff --git a/application/modules/default/views/scripts/explore/index-react9.phtml b/application/modules/default/views/scripts/explore/index-react9.phtml new file mode 100755 index 000000000..bf858ded5 --- /dev/null +++ b/application/modules/default/views/scripts/explore/index-react9.phtml @@ -0,0 +1,253 @@ +. + **/ +$modelCategory = new Default_Model_DbTable_ProjectCategory(); +$this->dataCategory = $modelCategory->findSingleRow($this->cat_id); +$store_config = Zend_Registry::get('store_config'); +$host = $store_config->host; +$og_server = $this->serverUrl(true); +$catTitle = ''; +if($this->dataCategory['project_category_id']) +{ + $catTitle = $this->dataCategory['title']; +} +if($this->filters['order'] == 'latest'){ + $og_title = 'Browse '.$catTitle.' Latest | '.$host; +}else if($this->filters['order'] == 'top'){ + $og_title = 'Browse '.$catTitle.' Top | '.$host; +}else{ + $og_title='Browse '.$catTitle.' | '.$host; +} +$og_description = $og_title .'| A community for free and open source software and libre content'; +$this->templateConfigData = Zend_Registry::get('store_template'); +$og_image = 'https://' . $_SERVER['HTTP_HOST'] .$this->templateConfigData['logo']; +$this->doctype(Zend_View_Helper_Doctype::XHTML1_RDFA); +$this->headMeta()->appendProperty('og:type', 'website'); +$this->headMeta()->appendProperty('og:url', $og_server); +$this->headMeta()->appendProperty('og:title', $og_title); +$this->headMeta()->appendProperty('og:site_name',$host); +$this->headMeta()->appendProperty('og:description',$og_description); +$this->headMeta()->appendProperty('og:image',$og_image); + + +$helperBuildExploreUrl = new Default_View_Helper_BuildExploreUrl(); +$modelInfo = new Default_Model_Info(); + +$this->countSupporters = $modelInfo->getCountAllSupporters(); +$this->supporters = $modelInfo->getNewActiveSupporters(7); +$this->headLink()->appendStylesheet('/theme/flatui/css/explore_index.css'); + + +if($this->inputFilterOriginal ==1) +{ + $checkedOriginal = ' checked'; +}else +{ + $checkedOriginal = ''; +} + +?> + + + + +
+
+ +
+ +
+
+
+ comments = $modelInfo->getLatestComments(5, $this->cat_id, $this->tags); + //$donations = $modelInfo->getLatestPlings(5, $this->cat_id); + $topprods = $modelInfo->getMostDownloaded(100, $this->cat_id, $this->tags); + $asidehide = ''; + if(!$this->catabout && count($this->comments)==0 && count($topprods)==0 ) + { + $asidehide = 'hide'; + } + $this->show_git = false; + ?> + +
+
+ + +
+ + +inlineScript()->appendScript( + ' $(document).ready(function(){ + TooltipUser.setup("tooltipuserleft","left"); + TooltipUser.setup("tooltipuser","right"); + FilterBrowseOriginalFn.setup(); + FilterBrowseTagGroupFn.setup(); + }); + '); diff --git a/application/modules/default/views/scripts/product/index.phtml b/application/modules/default/views/scripts/product/index.phtml index 49ab3b29d..e3cd63e41 100644 --- a/application/modules/default/views/scripts/product/index.phtml +++ b/application/modules/default/views/scripts/product/index.phtml @@ -1,1221 +1,1225 @@ . **/ $helpAddDefaultScheme = new Default_View_Helper_AddDefaultScheme(); $helpMemberUrl = new Default_View_Helper_BuildMemberUrl(); $helpEncryptUrl = new Default_View_Helper_EncryptUrl(); $helpImage = new Default_View_Helper_Image(); $helpTruncate = new Default_View_Helper_Truncate(); $helpProductUrl = new Default_View_Helper_BuildProductUrl(); $helpBBCode = new Default_View_Helper_Bbcode2html(); $helperUserRole = new Backend_View_Helper_UserRole(); $userRoleName = $helperUserRole->userRole(); $isAdmin = false; if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) { $isAdmin = true; } $identity = Zend_Auth::getInstance()->getStorage()->read(); $loginUrl = '/login?redirect=' . $helpEncryptUrl->encryptUrl(Zend_Controller_Front::getInstance()->getRequest() ->getRequestUri(), true); $viewSidebar = 'product/partials/productAboutSidebar.phtml'; $viewClaimBox = false; if ($this->product->claimable == 1) { $viewClaimBox = 'product/partials/productClaimTopHeader.phtml'; } $helpProjectFiles = new Default_View_Helper_ProjectFiles(); $productFileInfos = $helpProjectFiles->projectFiles($this->product->ppload_collection_id); $this->product->title = Default_Model_HtmlPurify::purify($this->product->title); $this->product->description = Default_Model_BBCode::renderHtml(Default_Model_HtmlPurify::purify($this->product->description)); $this->product->version = Default_Model_HtmlPurify::purify($this->product->version); //$this->product->embed_code =Default_Model_HtmlPurify::purify($this->product->embed_code,Default_Model_HtmlPurify::ALLOW_EMBED); $this->product->link_1 = Default_Model_HtmlPurify::purify($helpAddDefaultScheme->addDefaultScheme($this->product->link_1),Default_Model_HtmlPurify::ALLOW_URL); $this->product->source_url = Default_Model_HtmlPurify::purify($this->product->source_url,Default_Model_HtmlPurify::ALLOW_URL); $this->product->facebook_code = Default_Model_HtmlPurify::purify($this->product->facebook_code,Default_Model_HtmlPurify::ALLOW_URL); $this->product->twitter_code = Default_Model_HtmlPurify::purify($this->product->twitter_code,Default_Model_HtmlPurify::ALLOW_URL); $this->product->google_code = Default_Model_HtmlPurify::purify($this->product->google_code,Default_Model_HtmlPurify::ALLOW_URL); $this->doctype(Zend_View_Helper_Doctype::XHTML1_RDFA); $this->headMeta()->setName('description', $helpTruncate->truncate($this->product->description, 200, '...', false, true)); $this->headMeta()->setName('title', $helpTruncate->truncate($this->product->title, 200, '...', false, true)); $this->headMeta()->appendProperty('og:url', $helpProductUrl->buildProductUrl($this->product->project_id, '', null, true)); $this->headMeta()->appendProperty('og:type', 'website'); $this->headMeta()->appendProperty('og:title', $this->product->title); $this->headMeta()->appendProperty('og:description', $helpTruncate->truncate($this->product->description, 200, '...', false, true)); $this->headMeta()->appendProperty('og:image', $helpImage->Image($this->product->image_small, array('width' => 400, 'height' => 400))); $tableProject = new Default_Model_Project(); $tableCollection = new Default_Model_Collection(); $tableProjectUpdates = new Default_Model_ProjectUpdates(); $this->updates = $tableProjectUpdates->fetchProjectUpdates($this->product->project_id); $tableProjectRatings = new Default_Model_DbTable_ProjectRating(); $this->ratings = $tableProjectRatings->fetchRating($this->product->project_id); //$cntRatingsActive = 0; // foreach ($this->ratings as $p) { // if($p['rating_active']==1) $cntRatingsActive =$cntRatingsActive+1; // } if (Zend_Auth::getInstance()->hasIdentity()){ $this->ratingOfUser = $tableProjectRatings->getProjectRateForUser($this->product->project_id,$identity->member_id); } $tableProjectFollower = new Default_Model_DbTable_ProjectFollower(); $this->likes = $tableProjectFollower->fetchLikesForProject($this->product->project_id); $projectplings = new Default_Model_ProjectPlings(); $this->projectplings = $projectplings->fetchPlingsForProject($this->product->project_id); $projectsupport = new Default_Model_SectionSupport(); $this->projectaffiliates = $projectsupport->fetchAffiliatesForProject($this->product->project_id); $tagmodel = new Default_Model_Tags(); $helperUserRole = new Backend_View_Helper_UserRole(); $userRoleName = $helperUserRole->userRole(); $this->userRoleName = $userRoleName; $productJson = Zend_Json::encode(Default_Model_Collection::cleanProductInfoForJson($this->product->toArray())); $filesJson = $this->filesJson; $helperCatXdgType = new Default_View_Helper_CatXdgType(); $xdgTypeJson = Zend_Json::encode($helperCatXdgType->catXdgType($this->product->project_category_id)); $isowner = false; if(Zend_Auth::getInstance()->hasIdentity() && $identity->member_id==$this->product->member_id){ $isowner = true; } $this->isowner = $isowner; $filesTable = new Default_Model_DbTable_PploadFiles(); $countFiles = $filesTable->fetchFilesCntForProject($this->product->ppload_collection_id); $pics= $tableProject->getGalleryPictureSources($this->product->project_id); if(sizeof($pics)==0) { array_push($pics,$this->product->image_small); } $this->galleryPictures=array(); foreach ($pics as $p) { $this->galleryPictures[] = $this->Image($p, array('height' => '600')); } $galleryPicturesJson = Zend_Json::encode($this->galleryPictures); ?>
hasIdentity()) { ?> hasIdentity()) { ?> hasIdentity()) { ?>
product->link_1)): ?> product->title; ?> product->title; ?> translate('Edit Product') ?> product->featured=='1'){ ?> Featured isProjectOriginal($this->product->project_id)){?> Original

product->project_category_id . '/order/latest">' . $this->product->cat_title . ' '; ?> '; $tagsuser = $tagmodel->getTagsUser($this->product->project_id, Default_Model_Tags::TAG_TYPE_PROJECT); echo ''; if(false === empty($tagsuser)) { foreach (explode(',',$tagsuser) as $tag) { ?> '; if($isowner){ $this->headLink()->appendStylesheet('/theme/flatui/css/select2.min.css'); $this->headLink()->appendStylesheet('/theme/flatui/css/select2.custmized.css'); $this->inlineScript()->appendFile('/theme/flatui/js/lib/select2.min.js'); ?> Saved inlineScript()->appendScript( ' $(document).ready(function(){ TagingProductDetail.setup(); }); '); } echo ''; ?>

Source (link to git-repo or to original if based on someone elses unmodified work): product->gitlab_project_id)) { $url = $this->gitlab_project['web_url']; $url = str_replace("http://", "https://", $url); echo ' ' . $url . ' '; } else if (false === empty($this->product->source_url)) { $target='_blank'; if (strpos($this->product->source_url, 'opencode.net') !== false) { $target='_self'; } echo '' . $this->product->source_url . ' '; if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) { $cntSameSource = $tableProject->getCountSourceurl($this->product->source_url); if($cntSameSource>1){ $link = '/p/'.$this->product->project_id.'/listsamesourceurl'; echo ' ['.$cntSameSource.']'; } } } else { echo ' Add the source-code for this project on opencode.net'; } ?>

partial( '/product/partials/projectlike.phtml', array( "authMember" => $identity, "project_id" => $this->product->project_id ) ); ?>
render('partials/sidebarRating.phtml'); ?>
render('partials/sidebarScore.phtml'); ?>
product->is_gitlab_project && $this->product->use_gitlab_project_readme && null != $this->gitlab_project['readme_url']) { ?>
Description:

readme ?>

Description:

product->description ?>
updates) > 0) { $this->productUpdate = $this->updates[0]; ?>
Last changelog: render('product/partials/productUpdatesV1.phtml'); ?>
paramPageId; $testComments = $modelComments->getCommentTreeForProject($this->product->project_id); $testComments->setItemCountPerPage(25); $testComments->setCurrentPageNumber($offset); $this->comments = $testComments; echo $this->render('product/partials/productCommentsUX1.phtml'); ?>
partial( $viewClaimBox, array( "member" => $this->member, "product" => $this->product ) ); } ?>
updates) > 0) { ?>
updates as $this->productUpdate) { echo $this->render('product/partials/productUpdatesV1.phtml'); } ?>
product->show_gitlab_project_issues) { ?>
gitlab_project_issues; $i = 0; foreach ($issues as $issue){ $date = date('Y-m-d H:i:s', strtotime($issue['created_at'])); echo '
' . $issue['title'] . '
'.$this->printDate($date).'
'; $i ++; if($i>5) { break; } } ?> Show all gitlab_project['open_issues_count'] ?> Issues
render('product/partials/productRating.phtml'); ?>
render('product/partials/productRating2.phtml'); ?>
+ + + + likes) > 0) { ?>
render('product/partials/productLikes.phtml'); ?>
projectplings) > 0) { ?>
render('product/partials/productPlings.phtml'); ?>
render('product/partials/productAffiliates.phtml'); ?>
render('product/partials/ppload.phtml'); ?>
- *Needs ocs-url or ocs-store to install things + + *Needs pling-store or ocs-url to install things
product->claimable)) { ?>
partial( '/product/partials/projectplings.phtml', array( "authMember" => $identity, "project_id" => $this->product->project_id, "ppload_collection_id" => $this->product->ppload_collection_id, "project_category_id" => $this->product->project_category_id ) ); ?>
projectaffiliates) ?> Affiliateprojectaffiliates) == 0?'s':'' ?>projectaffiliates) > 1?'s':'' ?>
product->paypal_mail) { echo $this->partial( '/product/partials/support_box.phtml', array( "authMember" => $identity, "project_id" => $this->product->project_id, "project_title" => $this->product->title, "ppload_collection_id" => $this->product->ppload_collection_id, "project_category_id" => $this->product->project_category_id, "project_category_title" => $this->product->cat_title, "isAdmin" => $isAdmin ) ); } ?> render('partials/sidebarRating.phtml'); */ ?>
*/ ?> countAllCollectionsForProject($this->product->project_id); if($cntCollections>0) { ?>
moreProducts = $tableCollection->fetchAllCollectionsForProject($this->product->project_id, 6); $this->moreProductsTitle = 'Is part of these Collections'; if (count($this->moreProducts) > 0) { echo $this->render('product/partials/productMoreProductsWidgetV1.phtml'); } ?>
fetchOrigins($this->product->project_id); $this->moreProducts = $origins; $this->moreProductsTitle = 'Based on'; if (count($this->moreProducts) > 0) { echo $this->render('product/partials/productCloneFrom.phtml'); } ?> fetchRelatedProducts($this->product->project_id); $bflag = false; foreach ($related as $r){ $rid = $r->project_id; $bflag = false; foreach ($origins as $o){ $oid = $o->project_id; if($rid == $oid){ $bflag = true; break; } } if(!$bflag) { $relatednew[] = $r; } } $this->moreProducts = $relatednew; $this->moreProductsTitle = 'Variants'; if (count($this->moreProducts) > 0) { echo $this->render('product/partials/productCloneFrom.phtml'); } ?>
moreProducts = $tableProject->fetchMoreProjects($this->product, 6); $this->moreProductsTitle = 'More ' . $this->product->cat_title . ' from ' . $this->product->username; if (count($this->moreProducts) > 0) { echo $this->render('product/partials/productMoreProductsWidgetV1.phtml'); } ?>
moreProducts = $tableProject->fetchMoreProjectsOfOtherUsr($this->product, 6); $this->moreProductsTitle = 'Other ' . $this->product->cat_title; if (count($this->moreProducts) > 0) { echo $this->render('product/partials/productMoreProductsWidgetV1.phtml'); } ?>
render('partials/sidebarCcLicense.phtml'); ?> isProjectEbook($this->product->project_id)) { echo $this->render('product/partials/ebook_details.phtml'); } ?> render('product/partials/details.phtml'); ?> render('product/partials/tags.phtml'); ?>
inlineScript()->appendScript( ' $(document).ready(function(){ InitActiveHashTab.setup(); PartialJson.setup(); PartialJsonFraud.setup(); PartialJsonClone.setup(); ProductDetailCarousel.setup(); PartialCommentReviewForm.setup(); PartialCommentReviewFormNew.setup(); PartialsButtonHeartDetail.setup(); PartialsButtonPlingProject.setup(); TooltipUser.setup("tooltipuserleft","left"); AppimagequestionOnClick.setup(); Opendownloadfile.setup(); CreateScoreRatingPopup.setup(); $(\'.tooltipheart\').tooltipster({theme: [\'tooltipster-light\', \'tooltipster-light-customized\'], contentCloning: true, contentAsHTML: true, interactive: true}); }); '); diff --git a/application/modules/default/views/scripts/product/partials/productRelated.phtml b/application/modules/default/views/scripts/product/partials/productRelated.phtml new file mode 100644 index 000000000..15f316dfe --- /dev/null +++ b/application/modules/default/views/scripts/product/partials/productRelated.phtml @@ -0,0 +1,50 @@ + + +related_ancesters){ +?> +
Ancesters
+
+userProducts=$this->related_ancesters; +echo $this->render('product/partials/productRelatedProducts.phtml'); ?> +
+ + +related_parents){ +?> +
Parents
+
+userProducts=$this->related_parents; +echo $this->render('product/partials/productRelatedProducts.phtml'); ?> +
+ + +related_siblings){ +?> +
Siblings
+
+userProducts=$this->related_siblings; +echo $this->render('product/partials/productRelatedProducts.phtml'); ?> +
+ + + +related_children){ +?> +
Children
+
+userProducts=$this->related_children; +echo $this->render('product/partials/productRelatedProducts.phtml'); ?> +
+ diff --git a/application/modules/default/views/scripts/product/partials/productRelatedProducts.phtml b/application/modules/default/views/scripts/product/partials/productRelatedProducts.phtml new file mode 100644 index 000000000..e1b90df78 --- /dev/null +++ b/application/modules/default/views/scripts/product/partials/productRelatedProducts.phtml @@ -0,0 +1,68 @@ + + +userProducts == null || count($this->userProducts)==0) return; + + foreach ($this->userProducts as $product): + + ?> +
+
+ +
+ +
+
+

+ + + + + + + + printDate($product['project_changed_at']) ?> + + + +
+
+ + + + widgetRating = new stdClass(); + $this->widgetRating->project_id = $product['project_id']; + $this->widgetRating->laplace_score = $product['laplace_score']; + $this->widgetRating->count_likes = $product['count_likes']; + $this->widgetRating->count_dislikes = $product['count_dislikes']; + echo $this->render('partials/widgetRating.phtml'); ?> + +
+
+ + + + + \ No newline at end of file diff --git a/application/modules/default/views/scripts/subscription/support2.phtml b/application/modules/default/views/scripts/subscription/support2.phtml index d6da9d3e8..be93f0364 100644 --- a/application/modules/default/views/scripts/subscription/support2.phtml +++ b/application/modules/default/views/scripts/subscription/support2.phtml @@ -1,464 +1,464 @@ . * * Created: 31.05.2017 */ $modelInfo= new Default_Model_Info(); $filter = new Local_Filter_Url_Encrypt(); $thisurl = "/"; if(isset($_GET['url'])) { $thisurl = $_GET['url']; }else { $thisurl= Zend_Controller_Front::getInstance()->getRequest()->getScheme() . '://' . Zend_Controller_Front::getInstance()->getRequest()->getHttpHost().$_SERVER["REQUEST_URI"]; } $url_login = "/login/redirect/".$filter->filter($thisurl); $sections = $this->sections; $creator_id = $this->creator_id; $baseurlStore = Zend_Registry::get('config')->settings->client->default->baseurl_store; ?>

Become a Supporter

-

Help sustain any of these sub-sections and creators providing content for it (see Pling FAQ).

+

Support any of these sections and their creators via a donation:

Section
Pick Amount
Enter Amount
payment_options['Option5']['checked']?> id="sam-15-" type="radio" value="payment_options['Option5']['name']?>" name="amount_predefined-"/> $ 0.99 monthly
checked?> id="custom_amount_item_" type="radio" value="Option7" name="amount_predefined-"> $
  • getCountSectionSupporters($section['section_id']);?> */?>
\ No newline at end of file diff --git a/httpdocs/theme/react/all.js b/httpdocs/theme/react/all.js index 5aa96a6c1..4ad19565d 100644 --- a/httpdocs/theme/react/all.js +++ b/httpdocs/theme/react/all.js @@ -1,5054 +1,751 @@ -'use strict'; - window.appHelpers = function () { - function getEnv(domain) { - var env = void 0; + let env; + if (this.splitByLastDot(domain) === 'com' || this.splitByLastDot(domain) === 'org') { env = 'live'; } else { env = 'test'; } + return env; } function getDeviceWidth(width) { - var device = void 0; + let device; + if (width > 1720) { device = "very-huge"; } else if (width < 1720 && width > 1500) { device = "huge"; } else if (width < 1500 && width > 1250) { device = "full"; } else if (width < 1250 && width >= 1000) { device = "large"; } else if (width < 1000 && width >= 661) { device = "mid"; } else if (width < 661 && width >= 400) { device = "tablet"; } else if (width < 400) { device = "phone"; } + return device; } function splitByLastDot(text) { var index = text.lastIndexOf('.'); return text.slice(index + 1); } function getTimeAgo(datetime) { - var a = timeago().format(datetime); + const a = timeago().format(datetime); return a; } function getFileSize(size) { if (isNaN(size)) size = 0; - if (size < 1024) return size + ' Bytes'; - size /= 1024; - if (size < 1024) return size.toFixed(2) + ' Kb'; - size /= 1024; - if (size < 1024) return size.toFixed(2) + ' Mb'; - size /= 1024; - if (size < 1024) return size.toFixed(2) + ' Gb'; - size /= 1024; - return size.toFixed(2) + ' Tb'; } function generateFilterUrl(location, currentCat) { - var link = {}; + let link = {}; + if (currentCat && currentCat !== 0) { link.base = "/browse/cat/" + currentCat + "/ord/"; } else { link.base = "/browse/ord/"; } + if (location.search) link.search = location.search; return link; } function generateFileDownloadHash(file, env) { - var salt = void 0; + let salt; + if (env === "test") { salt = "vBHnf7bbdhz120bhNsd530LsA2mkMvh6sDsCm4jKlm23D186Fj"; } else { salt = "Kcn6cv7&dmvkS40Hna§4ffcvl=021nfMs2sdlPs123MChf4s0K"; } - var timestamp = Math.floor(new Date().getTime() / 1000 + 3600); - var hash = md5(salt + file.collection_id + timestamp); + + const timestamp = Math.floor(new Date().getTime() / 1000 + 3600); + const hash = md5(salt + file.collection_id + timestamp); return hash; } return { - getEnv: getEnv, - getDeviceWidth: getDeviceWidth, - splitByLastDot: splitByLastDot, - getTimeAgo: getTimeAgo, - getFileSize: getFileSize, - generateFilterUrl: generateFilterUrl, - generateFileDownloadHash: generateFileDownloadHash + getEnv, + getDeviceWidth, + splitByLastDot, + getTimeAgo, + getFileSize, + generateFilterUrl, + generateFileDownloadHash }; }(); -"use strict"; - window.categoryHelpers = function () { - function findCurrentCategories(categories, catId) { - var currentCategories = {}; + let currentCategories = {}; categories.forEach(function (mc, index) { if (parseInt(mc.id) === catId) { currentCategories.category = mc; } else { - var cArray = categoryHelpers.convertCatChildrenObjectToArray(mc.children); + const cArray = categoryHelpers.convertCatChildrenObjectToArray(mc.children); cArray.forEach(function (sc, index) { if (parseInt(sc.id) === catId) { currentCategories.category = mc; currentCategories.subcategory = sc; } else { - var scArray = categoryHelpers.convertCatChildrenObjectToArray(sc.children); + const scArray = categoryHelpers.convertCatChildrenObjectToArray(sc.children); scArray.forEach(function (ssc, index) { if (parseInt(ssc.id) === catId) { currentCategories.category = mc; currentCategories.subcategory = sc; currentCategories.secondSubCategory = ssc; } }); } }); } }); return currentCategories; } function convertCatChildrenObjectToArray(children) { - var cArray = []; + let cArray = []; + for (var i in children) { cArray.push(children[i]); } + return cArray; } return { - findCurrentCategories: findCurrentCategories, - convertCatChildrenObjectToArray: convertCatChildrenObjectToArray + findCurrentCategories, + convertCatChildrenObjectToArray }; }(); -"use strict"; - window.productHelpers = function () { - function getNumberOfProducts(device, numRows) { - var num = void 0; + let num; + if (device === "very-huge") { num = 7; } else if (device === "huge") { num = 6; } else if (device === "full") { num = 5; } else if (device === "large") { num = 4; } else if (device === "mid") { num = 3; } else if (device === "tablet") { num = 2; } else if (device === "phone") { num = 1; } + if (numRows) num = num * numRows; return num; } function generatePaginationObject(numPages, pathname, currentCategoy, order, page) { - var pagination = []; + let pagination = []; + let baseHref = "/browse"; - var baseHref = "/browse"; if (pathname.indexOf('cat') > -1) { baseHref += "/cat/" + currentCategoy; } if (page > 1) { - var prev = { + const prev = { number: 'previous', link: baseHref + "/page/" + parseInt(page - 1) + "/ord/" + order }; pagination.push(prev); } for (var i = 0; i < numPages; i++) { - var p = { + const p = { number: parseInt(i + 1), link: baseHref + "/page/" + parseInt(i + 1) + "/ord/" + order }; pagination.push(p); } if (page < numPages) { - var next = { + const next = { number: 'next', link: baseHref + "/page/" + parseInt(page + 1) + "/ord/" + order }; pagination.push(next); } return pagination; } function calculateProductRatings(ratings) { - var pRating = void 0; - var totalUp = 0, + let pRating; + let totalUp = 0, totalDown = 0; ratings.forEach(function (r, index) { if (r.rating_active === "1") { if (r.user_like === "1") { totalUp += 1; } else if (r.user_dislike === "1") { totalDown += 1; } } }); pRating = 100 / ratings.length * (totalUp - totalDown); return pRating; } function getActiveRatingsNumber(ratings) { - var activeRatingsNumber = 0; + let activeRatingsNumber = 0; ratings.forEach(function (r, index) { if (r.rating_active === "1") { activeRatingsNumber += 1; } }); return activeRatingsNumber; } function getFilesSummary(files) { - var summery = { + let summery = { downloads: 0, archived: 0, fileSize: 0, total: 0 }; files.forEach(function (file, index) { summery.total += 1; summery.fileSize += parseInt(file.size); summery.downloads += parseInt(file.downloaded_count); }); - return summery; } function checkIfLikedByUser(user, likes) { - var likedByUser = false; + let likedByUser = false; likes.forEach(function (like, index) { if (user.member_id === like.member_id) { likedByUser = true; } }); return likedByUser; } function getLoggedUserRatingOnProduct(user, ratings) { - var userRating = -1; + let userRating = -1; ratings.forEach(function (r, index) { if (r.member_id === user.member_id) { if (r.user_like === "1") { userRating = 1; } else { userRating = 0; } } }); return userRating; } function calculateProductLaplaceScore(ratings) { - var laplace_score = 0; - var upvotes = 0; - var downvotes = 0; + let laplace_score = 0; + let upvotes = 0; + let downvotes = 0; ratings.forEach(function (rating, index) { if (rating.rating_active === "1") { if (rating.user_like === "1") { upvotes += 1; } else if (rating.user_like === "0") { downvotes += 1; } } }); laplace_score = Math.round((upvotes + 6) / (upvotes + downvotes + 12), 2) * 100; return laplace_score; } return { - getNumberOfProducts: getNumberOfProducts, - generatePaginationObject: generatePaginationObject, - calculateProductRatings: calculateProductRatings, - getActiveRatingsNumber: getActiveRatingsNumber, - getFilesSummary: getFilesSummary, - checkIfLikedByUser: checkIfLikedByUser, - getLoggedUserRatingOnProduct: getLoggedUserRatingOnProduct, - calculateProductLaplaceScore: calculateProductLaplaceScore + getNumberOfProducts, + generatePaginationObject, + calculateProductRatings, + getActiveRatingsNumber, + getFilesSummary, + checkIfLikedByUser, + getLoggedUserRatingOnProduct, + calculateProductLaplaceScore }; }(); -"use strict"; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var ProductGroupScrollWrapper = function (_React$Component) { - _inherits(ProductGroupScrollWrapper, _React$Component); - - function ProductGroupScrollWrapper(props) { - _classCallCheck(this, ProductGroupScrollWrapper); - - var _this = _possibleConstructorReturn(this, (ProductGroupScrollWrapper.__proto__ || Object.getPrototypeOf(ProductGroupScrollWrapper)).call(this, props)); - - _this.state = { - products: [], - offset: 0 - }; - _this.onProductGroupScroll = _this.onProductGroupScroll.bind(_this); - _this.loadMoreProducts = _this.loadMoreProducts.bind(_this); - return _this; - } - - _createClass(ProductGroupScrollWrapper, [{ - key: "componentWillMount", - value: function componentWillMount() { - window.addEventListener("scroll", this.onProductGroupScroll); - } - }, { - key: "componentDidMount", - value: function componentDidMount() { - this.loadMoreProducts(); - } - }, { - key: "onProductGroupScroll", - value: function onProductGroupScroll() { - var end = $("footer").offset().top; - var viewEnd = $(window).scrollTop() + $(window).height(); - var distance = end - viewEnd; - if (distance < 0 && this.state.loadingMoreProducts !== true) { - this.setState({ loadingMoreProducts: true }, function () { - this.loadMoreProducts(); - }); - } - } - }, { - key: "loadMoreProducts", - value: function loadMoreProducts() { - var itemsPerScroll = 50; - var moreProducts = store.getState().products.slice(this.state.offset, this.state.offset + itemsPerScroll); - var products = this.state.products.concat(moreProducts); - var offset = this.state.offset + itemsPerScroll; - this.setState({ - products: products, - offset: offset, - loadingMoreProducts: false - }); - } - }, { - key: "render", - value: function render() { - var loadingMoreProductsDisplay = void 0; - if (this.state.loadingMoreProducts) { - loadingMoreProductsDisplay = React.createElement( - "div", - { className: "product-group-scroll-loading-container" }, - React.createElement( - "div", - { className: "icon-wrapper" }, - React.createElement("span", { className: "glyphicon glyphicon-refresh spinning" }) - ) - ); - } - return React.createElement( - "div", - { className: "product-group-scroll-wrapper" }, - React.createElement(ProductGroup, { - products: this.state.products, - device: this.props.device - }), - loadingMoreProductsDisplay - ); - } - }]); - - return ProductGroupScrollWrapper; -}(React.Component); - -var ProductGroup = function (_React$Component2) { - _inherits(ProductGroup, _React$Component2); - - function ProductGroup() { - _classCallCheck(this, ProductGroup); - - return _possibleConstructorReturn(this, (ProductGroup.__proto__ || Object.getPrototypeOf(ProductGroup)).apply(this, arguments)); - } - - _createClass(ProductGroup, [{ - key: "render", - value: function render() { - var products = void 0; - if (this.props.products) { - var productsArray = this.props.products; - if (this.props.numRows) { - var limit = productHelpers.getNumberOfProducts(this.props.device, this.props.numRows); - productsArray = productsArray.slice(0, limit); - } - products = productsArray.map(function (product, index) { - return React.createElement(ProductGroupItem, { - key: index, - product: product - }); - }); - } - - var sectionHeader = void 0; - if (this.props.title) { - sectionHeader = React.createElement( - "div", - { className: "section-header" }, - React.createElement( - "h3", - { className: "mdl-color-text--primary" }, - this.props.title - ), - React.createElement( - "div", - { className: "actions" }, - React.createElement( - "a", - { href: this.props.link, className: "mdl-button mdl-js-button mdl-button--colored mdl-button--raised mdl-js-ripple-effect mdl-color--primary" }, - "see more" - ) - ) - ); - } - return React.createElement( - "div", - { className: "products-showcase" }, - sectionHeader, - React.createElement( - "div", - { className: "products-container row" }, - products - ) - ); - } - }]); - - return ProductGroup; -}(React.Component); - -var ProductGroupItem = function (_React$Component3) { - _inherits(ProductGroupItem, _React$Component3); - - function ProductGroupItem() { - _classCallCheck(this, ProductGroupItem); - - return _possibleConstructorReturn(this, (ProductGroupItem.__proto__ || Object.getPrototypeOf(ProductGroupItem)).apply(this, arguments)); - } - - _createClass(ProductGroupItem, [{ - key: "render", - value: function render() { - var imageBaseUrl = void 0; - if (store.getState().env === 'live') { - imageBaseUrl = 'cn.opendesktop.org'; - } else { - imageBaseUrl = 'cn.pling.it'; - } - return React.createElement( - "div", - { className: "product square" }, - React.createElement( - "div", - { className: "content" }, - React.createElement( - "div", - { className: "product-wrapper mdl-shadow--2dp" }, - React.createElement( - "a", - { href: "/p/" + this.props.product.project_id }, - React.createElement( - "div", - { className: "product-image-container" }, - React.createElement( - "figure", - null, - React.createElement("img", { className: "very-rounded-corners", src: 'https://' + imageBaseUrl + '/cache/200x171/img/' + this.props.product.image_small }), - React.createElement( - "span", - { className: "product-info-title" }, - this.props.product.title - ) - ) - ), - React.createElement( - "div", - { className: "product-info" }, - React.createElement( - "span", - { className: "product-info-description" }, - this.props.product.description - ) - ) - ) - ) - ) - ); - } - }]); - - return ProductGroupItem; -}(React.Component); -'use strict'; - -var reducer = Redux.combineReducers({ +const reducer = Redux.combineReducers({ products: productsReducer, product: productReducer, lightboxGallery: lightboxGalleryReducer, pagination: paginationReducer, topProducts: topProductsReducer, categories: categoriesReducer, comments: commentsReducer, users: usersReducer, user: userReducer, supporters: supportersReducer, domain: domainReducer, env: envReducer, device: deviceReducer, view: viewReducer, filters: filtersReducer }); - /* reducers */ -function productsReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function productsReducer(state = {}, action) { if (action.type === 'SET_PRODUCTS') { return action.products; } else { return state; } } -function productReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function productReducer(state = {}, action) { if (action.type === 'SET_PRODUCT') { return action.product; } else if (action.type === 'SET_PRODUCT_FILES') { - var s = Object.assign({}, state, { + const s = Object.assign({}, state, { r_files: action.files }); return s; } else if (action.type === 'SET_PRODUCT_UPDATES') { - var _s = Object.assign({}, state, { + const s = Object.assign({}, state, { r_updates: action.updates }); - return _s; + return s; } else if (action.type === 'SET_PRODUCT_RATINGS') { - var _s2 = Object.assign({}, state, { + const s = Object.assign({}, state, { r_ratings: action.ratings }); - return _s2; + return s; } else if (action.type === 'SET_PRODUCT_LIKES') { - var _s3 = Object.assign({}, state, { + const s = Object.assign({}, state, { r_likes: action.likes }); - return _s3; + return s; } else if (action.type === 'SET_PRODUCT_PLINGS') { - var _s4 = Object.assign({}, state, { + const s = Object.assign({}, state, { r_plings: action.plings }); - return _s4; + return s; } else if (action.type === 'SET_PRODUCT_USER_RATINGS') { - var _s5 = Object.assign({}, state, { + const s = Object.assign({}, state, { r_userRatings: action.userRatings }); - return _s5; + return s; } else if (action.type === 'SET_PRODUCT_GALLERY') { - var _s6 = Object.assign({}, state, { + const s = Object.assign({}, state, { r_gallery: action.gallery }); - return _s6; + return s; } else if (action.type === 'SET_PRODUCT_COMMENTS') { - var _s7 = Object.assign({}, state, { + const s = Object.assign({}, state, { r_comments: action.comments }); - return _s7; + return s; } else if (action.type === 'SET_PRODUCT_ORIGINS') { - var _s8 = Object.assign({}, state, { + const s = Object.assign({}, state, { r_origins: action.origins }); - return _s8; + return s; } else if (action.type === 'SET_PRODUCT_RELATED') { - var _s9 = Object.assign({}, state, { + const s = Object.assign({}, state, { r_related: action.related }); - return _s9; + return s; } else if (action.type === 'SET_PRODUCT_MORE_PRODUCTS') { - var _s10 = Object.assign({}, state, { + const s = Object.assign({}, state, { r_more_products: action.products }); - return _s10; + return s; } else if (action.type === 'SET_PRODUCT_MORE_PRODUCTS_OTHER_USERS') { - var _s11 = Object.assign({}, state, { + const s = Object.assign({}, state, { r_more_products_other_users: action.products }); - return _s11; + return s; } else if (action.type === 'SET_PRODUCT_TAGS') { - var _s12 = Object.assign({}, state, { + const s = Object.assign({}, state, { r_tags_user: action.userTags, r_tags_system: action.systemTags }); - return _s12; + return s; } else { return state; } } -function lightboxGalleryReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function lightboxGalleryReducer(state = {}, action) { if (action.type === 'SHOW_LIGHTBOX') { - var s = Object.assign({}, state, { + const s = Object.assign({}, state, { show: true, currentItem: action.item }); return s; } else if (action.type === 'HIDE_LIGHTBOX') { - var _s13 = Object.assign({}, state, { + const s = Object.assign({}, state, { show: false }); - return _s13; + return s; } else { return state; } } -function paginationReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function paginationReducer(state = {}, action) { if (action.type === 'SET_PAGINATION') { return action.pagination; } else { return state; } } -function topProductsReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function topProductsReducer(state = {}, action) { if (action.type === 'SET_TOP_PRODUCTS') { return action.products; } else { return state; } } -function categoriesReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function categoriesReducer(state = {}, action) { if (action.type === 'SET_CATEGORIES') { - var s = Object.assign({}, state, { + const s = Object.assign({}, state, { items: categories }); return s; } else if (action.type === 'SET_CURRENT_CAT') { - var _s14 = Object.assign({}, state, { + const s = Object.assign({}, state, { current: action.cat }); - return _s14; + return s; } else if (action.type === 'SET_CURRENT_SUBCAT') { - var _s15 = Object.assign({}, state, { + const s = Object.assign({}, state, { currentSub: action.cat }); - return _s15; + return s; } else if (action.type === 'SET_CURRENT_SECONDSUBCAT') { - var _s16 = Object.assign({}, state, { + const s = Object.assign({}, state, { currentSecondSub: action.cat }); - return _s16; + return s; } else { return state; } } -function commentsReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function commentsReducer(state = {}, action) { if (action.type === 'SET_COMMENTS') { return action.comments; } else { return state; } } -function usersReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function usersReducer(state = {}, action) { if (action.type === 'SET_USERS') { return action.users; } else { return state; } } -function userReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function userReducer(state = {}, action) { if (action.type === 'SET_USER') { return action.user; } else { return state; } } -function supportersReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function supportersReducer(state = {}, action) { if (action.type === 'SET_SUPPORTERS') { return action.supporters; } else { return state; } } -function domainReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function domainReducer(state = {}, action) { if (action.type === 'SET_DOMAIN') { return action.domain; } else { return state; } } -function envReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function envReducer(state = {}, action) { if (action.type === 'SET_ENV') { return action.env; } else { return state; } } -function deviceReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function deviceReducer(state = {}, action) { if (action.type === 'SET_DEVICE') { return action.device; } else { return state; } } -function viewReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function viewReducer(state = {}, action) { if (action.type === 'SET_VIEW') { return action.view; } else { return state; } } -function filtersReducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - +function filtersReducer(state = {}, action) { if (action.type === 'SET_FILTERS') { return action.filters; } else { return state; } } - /* /reducers */ /* dispatch */ + function setProducts(products) { return { type: 'SET_PRODUCTS', products: products }; } function setProduct(product) { return { type: 'SET_PRODUCT', product: product }; } function setProductFiles(files) { return { type: 'SET_PRODUCT_FILES', files: files }; } function setProductUpdates(updates) { return { type: 'SET_PRODUCT_UPDATES', updates: updates }; } function setProductRatings(ratings) { return { type: 'SET_PRODUCT_RATINGS', ratings: ratings }; } function setProductLikes(likes) { return { type: 'SET_PRODUCT_LIKES', likes: likes }; } function setProductPlings(plings) { return { type: 'SET_PRODUCT_PLINGS', plings: plings }; } function setProductUserRatings(userRatings) { return { type: 'SET_PRODUCT_USER_RATINGS', userRatings: userRatings }; } function setProductGallery(gallery) { return { type: 'SET_PRODUCT_GALLERY', gallery: gallery }; } function setProductComments(comments) { return { type: 'SET_PRODUCT_COMMENTS', comments: comments }; } function setProductOrigins(origins) { return { type: 'SET_PRODUCT_ORIGINS', origins: origins }; } function setProductRelated(related) { return { type: 'SET_PRODUCT_RELATED', related: related }; } function setProductMoreProducts(products) { return { type: 'SET_PRODUCT_MORE_PRODUCTS', products: products }; } function setProductMoreProductsOtherUsers(products) { return { type: 'SET_PRODUCT_MORE_PRODUCTS_OTHER_USERS', products: products }; } function setProductTags(userTags, systemTags) { return { type: 'SET_PRODUCT_TAGS', userTags: userTags, systemTags: systemTags }; } function showLightboxGallery(num) { return { type: 'SHOW_LIGHTBOX', item: num }; } function hideLightboxGallery() { return { type: 'HIDE_LIGHTBOX' }; } function setPagination(pagination) { return { type: 'SET_PAGINATION', pagination: pagination }; } function setTopProducts(topProducts) { return { type: 'SET_TOP_PRODUCTS', products: topProducts }; } function setCategories(categories) { return { type: 'SET_CATEGORIES', categories: categories }; } function setCurrentCategory(cat) { return { type: 'SET_CURRENT_CAT', cat: cat }; } function setCurrentSubCategory(cat) { return { type: 'SET_CURRENT_SUBCAT', cat: cat }; } function setCurrentSecondSubCategory(cat) { return { type: 'SET_CURRENT_SECONDSUBCAT', cat: cat }; } function setComments(comments) { return { type: 'SET_COMMENTS', comments: comments }; } function setUsers(users) { return { type: 'SET_USERS', users: users }; } function setUser(user) { return { type: 'SET_USER', user: user }; } function setSupporters(supporters) { return { type: 'SET_SUPPORTERS', supporters: supporters }; } function setDomain(domain) { return { type: 'SET_DOMAIN', domain: domain }; } function setEnv(env) { return { type: 'SET_ENV', env: env }; } function setDevice(device) { return { type: 'SET_DEVICE', device: device }; } function setView(view) { return { type: 'SET_VIEW', view: view }; } function setFilters(filters) { return { type: 'SET_FILTERS', filters: filters }; } - /* /dispatch */ -"use strict"; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var ExplorePage = function (_React$Component) { - _inherits(ExplorePage, _React$Component); - - function ExplorePage(props) { - _classCallCheck(this, ExplorePage); - - var _this = _possibleConstructorReturn(this, (ExplorePage.__proto__ || Object.getPrototypeOf(ExplorePage)).call(this, props)); - - _this.state = { - device: store.getState().device, - minHeight: 'auto' - }; - - _this.updateContainerHeight = _this.updateContainerHeight.bind(_this); - return _this; - } - - _createClass(ExplorePage, [{ - key: "componentWillReceiveProps", - value: function componentWillReceiveProps(nextProps) { - if (nextProps.device) { - this.setState({ device: nextProps.device }); - } - if (nextProps.products) { - this.setState({ products: nextProps.products }); - } - if (nextProps.filters) { - this.setState({ filters: filters }); - } - } - }, { - key: "updateContainerHeight", - value: function updateContainerHeight(sideBarHeight) { - this.setState({ minHeight: sideBarHeight + 100 }); - } - }, { - key: "render", - value: function render() { - - var titleDisplay = void 0; - if (this.props.categories) { - var title = ""; - if (this.props.categories.currentSecondSub) { - title = this.props.categories.currentSecondSub.title; - } else { - if (this.props.categories.currentSub) { - title = this.props.categories.currentSub.title; - } else { - if (this.props.categories.current) { - title = this.props.categories.current.title; - } - } - } - - if (title.length > 0) { - titleDisplay = React.createElement( - "div", - { className: "explore-page-category-title" }, - React.createElement( - "h2", - null, - title - ), - React.createElement( - "small", - null, - store.getState().pagination.totalcount, - " results" - ) - ); - } - } - - return React.createElement( - "div", - { id: "explore-page" }, - React.createElement( - "div", - { className: "wrapper" }, - React.createElement( - "div", - { className: "main-content-container", style: { "minHeight": this.state.minHeight } }, - React.createElement( - "div", - { className: "left-sidebar-container" }, - React.createElement(ExploreLeftSideBarWrapper, { - updateContainerHeight: this.updateContainerHeight - }) - ), - React.createElement( - "div", - { className: "main-content" }, - titleDisplay, - React.createElement( - "div", - { className: "top-bar" }, - React.createElement(ExploreTopBarWrapper, null) - ), - React.createElement( - "div", - { className: "explore-products-container" }, - React.createElement(ProductGroupScrollWrapper, { - device: this.state.device - }), - React.createElement(PaginationWrapper, null) - ) - ) - ), - React.createElement( - "div", - { className: "right-sidebar-container" }, - React.createElement(ExploreRightSideBarWrapper, null) - ) - ) - ); - } - }]); - - return ExplorePage; -}(React.Component); - -var mapStateToExploreProps = function mapStateToExploreProps(state) { - var device = state.device; - var products = state.products; - var categories = state.categories; - return { - device: device, - products: products, - categories: categories - }; -}; - -var mapDispatchToExploreProps = function mapDispatchToExploreProps(dispatch) { - return { - dispatch: dispatch - }; -}; - -var ExplorePageWrapper = ReactRedux.connect(mapStateToExploreProps, mapDispatchToExploreProps)(ExplorePage); - -var ExploreTopBar = function (_React$Component2) { - _inherits(ExploreTopBar, _React$Component2); - - function ExploreTopBar(props) { - _classCallCheck(this, ExploreTopBar); - - var _this2 = _possibleConstructorReturn(this, (ExploreTopBar.__proto__ || Object.getPrototypeOf(ExploreTopBar)).call(this, props)); - - _this2.state = {}; - return _this2; - } - - _createClass(ExploreTopBar, [{ - key: "render", - value: function render() { - var categories = this.props.categories; - var currentId = void 0; - if (categories.current) { - currentId = categories.current.id; - } - if (categories.currentSub) { - currentId = categories.currentSub.id; - } - if (categories.currentSecondSub) { - currentId = categories.currentSecondSub.id; - } - - var link = appHelpers.generateFilterUrl(window.location, currentId); - var linkSearch = ""; - if (link.search) { - linkSearch = link.search; - } - - return React.createElement( - "div", - { className: "explore-top-bar" }, - React.createElement( - "a", - { href: link.base + "latest" + linkSearch, className: this.props.filters.order === "latest" ? "item active" : "item" }, - "Latest" - ), - React.createElement( - "a", - { href: link.base + "top" + linkSearch, className: this.props.filters.order === "top" ? "item active" : "item" }, - "Top" - ) - ); - } - }]); - - return ExploreTopBar; -}(React.Component); - -var mapStateToExploreTopBarProps = function mapStateToExploreTopBarProps(state) { - var filters = state.filters; - var categories = state.categories; - return { - filters: filters, - categories: categories - }; -}; - -var mapDispatchToExploreTopBarProps = function mapDispatchToExploreTopBarProps(dispatch) { - return { - dispatch: dispatch - }; -}; - -var ExploreTopBarWrapper = ReactRedux.connect(mapStateToExploreTopBarProps, mapDispatchToExploreTopBarProps)(ExploreTopBar); - -var ExploreLeftSideBar = function (_React$Component3) { - _inherits(ExploreLeftSideBar, _React$Component3); - - function ExploreLeftSideBar(props) { - _classCallCheck(this, ExploreLeftSideBar); - - var _this3 = _possibleConstructorReturn(this, (ExploreLeftSideBar.__proto__ || Object.getPrototypeOf(ExploreLeftSideBar)).call(this, props)); - - _this3.state = {}; - return _this3; - } - - _createClass(ExploreLeftSideBar, [{ - key: "componentDidMount", - value: function componentDidMount() { - var sideBarHeight = $('#left-sidebar').height(); - this.props.updateContainerHeight(sideBarHeight); - } - }, { - key: "render", - value: function render() { - var categoryTree = void 0; - if (this.props.categories) { - categoryTree = this.props.categories.items.map(function (cat, index) { - return React.createElement(ExploreSideBarItem, { - key: index, - category: cat - }); - }); - } - - return React.createElement( - "aside", - { className: "explore-left-sidebar", id: "left-sidebar" }, - React.createElement( - "ul", - null, - React.createElement( - "li", - { className: "category-item" }, - React.createElement( - "a", - { className: this.props.categories.current === 0 ? "active" : "", href: "/browse/ord/" + filters.order }, - React.createElement( - "span", - { className: "title" }, - "All" - ) - ) - ), - categoryTree - ) - ); - } - }]); - - return ExploreLeftSideBar; -}(React.Component); - -var mapStateToExploreLeftSideBarProps = function mapStateToExploreLeftSideBarProps(state) { - var categories = state.categories; - var filters = state.filters; - return { - categories: categories - }; -}; - -var mapDispatchToExploreLeftSideBarProps = function mapDispatchToExploreLeftSideBarProps(dispatch) { - return { - dispatch: dispatch - }; -}; - -var ExploreLeftSideBarWrapper = ReactRedux.connect(mapStateToExploreLeftSideBarProps, mapDispatchToExploreLeftSideBarProps)(ExploreLeftSideBar); - -var ExploreSideBarItem = function (_React$Component4) { - _inherits(ExploreSideBarItem, _React$Component4); - - function ExploreSideBarItem() { - _classCallCheck(this, ExploreSideBarItem); - - return _possibleConstructorReturn(this, (ExploreSideBarItem.__proto__ || Object.getPrototypeOf(ExploreSideBarItem)).apply(this, arguments)); - } - - _createClass(ExploreSideBarItem, [{ - key: "render", - value: function render() { - var order = store.getState().filters.order; - var categories = store.getState().categories; - - var currentId = void 0, - currentSubId = void 0, - currentSecondSubId = void 0; - if (categories.current) { - currentId = categories.current.id; - } - if (categories.currentSub) { - currentSubId = categories.currentSub.id; - } - if (categories.currentSecondSub) { - currentSecondSubId = categories.currentSecondSub.id; - } - - var active = void 0; - if (currentId === this.props.category.id || currentSubId === this.props.category.id || currentSecondSubId === this.props.category.id) { - active = true; - } - - var subcatMenu = void 0; - if (this.props.category.has_children === true && active) { - var cArray = categoryHelpers.convertCatChildrenObjectToArray(this.props.category.children); - var subcategories = cArray.map(function (cat, index) { - return React.createElement(ExploreSideBarItem, { - key: index, - category: cat - }); - }); - subcatMenu = React.createElement( - "ul", - null, - subcategories - ); - } - - return React.createElement( - "li", - { className: "category-item" }, - React.createElement( - "a", - { className: active === true ? "active" : "", href: "/browse/cat/" + this.props.category.id + "/ord/" + order + window.location.search }, - React.createElement( - "span", - { className: "title" }, - this.props.category.title - ), - React.createElement( - "span", - { className: "product-counter" }, - this.props.category.product_count - ) - ), - subcatMenu - ); - } - }]); - - return ExploreSideBarItem; -}(React.Component); - -var Pagination = function (_React$Component5) { - _inherits(Pagination, _React$Component5); - - function Pagination(props) { - _classCallCheck(this, Pagination); - - var _this5 = _possibleConstructorReturn(this, (Pagination.__proto__ || Object.getPrototypeOf(Pagination)).call(this, props)); - - _this5.state = {}; - return _this5; - } - - _createClass(Pagination, [{ - key: "componentDidMount", - value: function componentDidMount() { - var itemsPerPage = 50; - var numPages = Math.ceil(this.props.pagination.totalcount / itemsPerPage); - var pagination = productHelpers.generatePaginationObject(numPages, window.location.pathname, this.props.currentCategoy, this.props.filters.order, this.props.pagination.page); - this.setState({ pagination: pagination }, function () {}); - } - }, { - key: "render", - value: function render() { - var _this6 = this; - - var paginationDisplay = void 0; - if (this.state.pagination && this.props.pagination.totalcount > 50) { - var pagination = this.state.pagination.map(function (pi, index) { - - var numberDisplay = void 0; - if (pi.number === 'previous') { - numberDisplay = React.createElement( - "span", - { className: "num-wrap" }, - React.createElement( - "i", - { className: "material-icons" }, - "arrow_back_ios" - ), - React.createElement( - "span", - null, - pi.number - ) - ); - } else if (pi.number === 'next') { - numberDisplay = React.createElement( - "span", - { className: "num-wrap" }, - React.createElement( - "span", - null, - pi.number - ), - React.createElement( - "i", - { className: "material-icons" }, - "arrow_forward_ios" - ) - ); - } else { - numberDisplay = pi.number; - } - - var cssClass = void 0; - if (pi.number === _this6.props.pagination.page) { - cssClass = "active"; - } - - return React.createElement( - "li", - { key: index }, - React.createElement( - "a", - { href: pi.link, className: cssClass }, - numberDisplay - ) - ); - }); - paginationDisplay = React.createElement( - "ul", - null, - pagination - ); - } - return React.createElement( - "div", - { id: "pagination-container" }, - React.createElement( - "div", - { className: "wrapper" }, - paginationDisplay - ) - ); - } - }]); - - return Pagination; -}(React.Component); - -var mapStateToPaginationProps = function mapStateToPaginationProps(state) { - var pagination = state.pagination; - var filters = state.filters; - var currentCategoy = state.categories.current; - return { - pagination: pagination, - filters: filters, - currentCategoy: currentCategoy - }; -}; - -var mapDispatchToPaginationProps = function mapDispatchToPaginationProps(dispatch) { - return { - dispatch: dispatch - }; -}; - -var PaginationWrapper = ReactRedux.connect(mapStateToPaginationProps, mapDispatchToPaginationProps)(Pagination); - -var ExploreRightSideBar = function (_React$Component6) { - _inherits(ExploreRightSideBar, _React$Component6); - - function ExploreRightSideBar(props) { - _classCallCheck(this, ExploreRightSideBar); - - var _this7 = _possibleConstructorReturn(this, (ExploreRightSideBar.__proto__ || Object.getPrototypeOf(ExploreRightSideBar)).call(this, props)); - - _this7.state = {}; - return _this7; - } - - _createClass(ExploreRightSideBar, [{ - key: "render", - value: function render() { - return React.createElement( - "aside", - { className: "explore-right-sidebar" }, - React.createElement( - "div", - { className: "ers-section" }, - React.createElement( - "a", - { href: "https://www.opendesktop.org/p/1175480/", target: "_blank" }, - React.createElement("img", { id: "download-app", src: "/images/system/download-app.png" }) - ) - ), - React.createElement( - "div", - { className: "ers-section" }, - React.createElement( - "a", - { href: "/support", id: "become-a-supporter", className: "mdl-button mdl-js-button mdl-button--colored mdl-button--raised mdl-js-ripple-effect mdl-color--primary" }, - "Become a supporter" - ) - ), - React.createElement( - "div", - { className: "ers-section" }, - React.createElement(ExploreSupportersContainerWrapper, null) - ), - React.createElement( - "div", - { className: "ers-section" }, - React.createElement(RssNewsContainer, null) - ), - React.createElement( - "div", - { className: "ers-section" }, - React.createElement(BlogFeedContainer, null) - ), - React.createElement( - "div", - { className: "ers-section" }, - React.createElement(ExploreCommentsContainerWrapper, null) - ), - React.createElement( - "div", - { className: "ers-section" }, - React.createElement(ExploreTopProductsWrapper, null) - ) - ); - } - }]); - - return ExploreRightSideBar; -}(React.Component); - -var mapStateToExploreRightSideBarProps = function mapStateToExploreRightSideBarProps(state) { - var categories = state.categories; - var filters = state.filters; - return { - categories: categories - }; -}; - -var mapDispatchToExploreRightSideBarProps = function mapDispatchToExploreRightSideBarProps(dispatch) { - return { - dispatch: dispatch - }; -}; - -var ExploreRightSideBarWrapper = ReactRedux.connect(mapStateToExploreRightSideBarProps, mapDispatchToExploreRightSideBarProps)(ExploreRightSideBar); - -var ExploreSupportersContainer = function (_React$Component7) { - _inherits(ExploreSupportersContainer, _React$Component7); - - function ExploreSupportersContainer(props) { - _classCallCheck(this, ExploreSupportersContainer); - - var _this8 = _possibleConstructorReturn(this, (ExploreSupportersContainer.__proto__ || Object.getPrototypeOf(ExploreSupportersContainer)).call(this, props)); - - _this8.state = {}; - return _this8; - } - - _createClass(ExploreSupportersContainer, [{ - key: "render", - value: function render() { - var supportersContainer = void 0; - if (this.props.supporters) { - var cArray = categoryHelpers.convertCatChildrenObjectToArray(this.props.supporters); - var supporters = cArray.map(function (sp, index) { - return React.createElement( - "div", - { className: "supporter-item", key: index }, - React.createElement( - "a", - { href: "/member/" + sp.member_id, className: "item" }, - React.createElement("img", { src: sp.profile_image_url }) - ) - ); - }); - supportersContainer = React.createElement( - "div", - { className: "supporter-list-wrapper" }, - supporters - ); - } - - return React.createElement( - "div", - { id: "supporters-container", className: "sidebar-feed-container" }, - React.createElement( - "h3", - null, - this.props.supporters.length, - " people support those who create freedom" - ), - supportersContainer - ); - } - }]); - - return ExploreSupportersContainer; -}(React.Component); - -var mapStateToExploreSupportersContainerProps = function mapStateToExploreSupportersContainerProps(state) { - var supporters = state.supporters; - return { - supporters: supporters - }; -}; - -var mapDispatchToExploreSupportersContainerProps = function mapDispatchToExploreSupportersContainerProps(dispatch) { - return { - dispatch: dispatch - }; -}; - -var ExploreSupportersContainerWrapper = ReactRedux.connect(mapStateToExploreSupportersContainerProps, mapDispatchToExploreSupportersContainerProps)(ExploreSupportersContainer); - -var RssNewsContainer = function (_React$Component8) { - _inherits(RssNewsContainer, _React$Component8); - - function RssNewsContainer(props) { - _classCallCheck(this, RssNewsContainer); - - var _this9 = _possibleConstructorReturn(this, (RssNewsContainer.__proto__ || Object.getPrototypeOf(RssNewsContainer)).call(this, props)); - - _this9.state = {}; - return _this9; - } - - _createClass(RssNewsContainer, [{ - key: "componentDidMount", - value: function componentDidMount() { - var self = this; - $.getJSON("https://blog.opendesktop.org/?json=1&callback=?", function (res) { - self.setState({ items: res.posts }); - }); - } - }, { - key: "render", - value: function render() { - var feedItemsContainer = void 0; - if (this.state.items) { - - var feedItems = this.state.items.slice(0, 3).map(function (fi, index) { - return React.createElement( - "li", - { key: index }, - React.createElement( - "a", - { className: "title", href: fi.url }, - React.createElement( - "span", - null, - fi.title - ) - ), - React.createElement( - "span", - { className: "info-row" }, - React.createElement( - "span", - { className: "date" }, - appHelpers.getTimeAgo(fi.date) - ), - React.createElement( - "span", - { className: "comment-counter" }, - fi.comment_count, - " comments" - ) - ) - ); - }); - - feedItemsContainer = React.createElement( - "ul", - null, - feedItems - ); - } - return React.createElement( - "div", - { id: "rss-new-container", className: "sidebar-feed-container" }, - React.createElement( - "h3", - null, - "News" - ), - feedItemsContainer - ); - } - }]); - - return RssNewsContainer; -}(React.Component); - -var BlogFeedContainer = function (_React$Component9) { - _inherits(BlogFeedContainer, _React$Component9); - - function BlogFeedContainer(props) { - _classCallCheck(this, BlogFeedContainer); - - var _this10 = _possibleConstructorReturn(this, (BlogFeedContainer.__proto__ || Object.getPrototypeOf(BlogFeedContainer)).call(this, props)); - - _this10.state = {}; - return _this10; - } - - _createClass(BlogFeedContainer, [{ - key: "componentDidMount", - value: function componentDidMount() { - var self = this; - $.ajax("https://forum.opendesktop.org/latest.json").then(function (result) { - var topics = result.topic_list.topics; - topics.sort(function (a, b) { - return new Date(b.last_posted_at) - new Date(a.last_posted_at); - }); - topics = topics.slice(0, 3); - self.setState({ items: topics }); - }); - } - }, { - key: "render", - value: function render() { - var feedItemsContainer = void 0; - if (this.state.items) { - - var feedItems = this.state.items.map(function (fi, index) { - return React.createElement( - "li", - { key: index }, - React.createElement( - "a", - { className: "title", href: "https://forum.opendesktop.org//t/" + fi.id }, - React.createElement( - "span", - null, - fi.title - ) - ), - React.createElement( - "span", - { className: "info-row" }, - React.createElement( - "span", - { className: "date" }, - appHelpers.getTimeAgo(fi.created_at) - ), - React.createElement( - "span", - { className: "comment-counter" }, - fi.reply_count, - " replies" - ) - ) - ); - }); - - feedItemsContainer = React.createElement( - "ul", - null, - feedItems - ); - } - return React.createElement( - "div", - { id: "blog-feed-container", className: "sidebar-feed-container" }, - React.createElement( - "h3", - null, - "Forum" - ), - feedItemsContainer - ); - } - }]); - - return BlogFeedContainer; -}(React.Component); - -var ExploreCommentsContainer = function (_React$Component10) { - _inherits(ExploreCommentsContainer, _React$Component10); - - function ExploreCommentsContainer(props) { - _classCallCheck(this, ExploreCommentsContainer); - - var _this11 = _possibleConstructorReturn(this, (ExploreCommentsContainer.__proto__ || Object.getPrototypeOf(ExploreCommentsContainer)).call(this, props)); - - _this11.state = {}; - return _this11; - } - - _createClass(ExploreCommentsContainer, [{ - key: "render", - value: function render() { - var commentsContainer = void 0; - if (this.props.comments) { - var comments = this.props.comments.map(function (cm, index) { - return React.createElement( - "li", - { key: index }, - React.createElement( - "div", - { className: "cm-content" }, - React.createElement( - "span", - { className: "cm-userinfo" }, - React.createElement("img", { src: cm.profile_image_url }), - React.createElement( - "span", - { className: "username" }, - React.createElement( - "a", - { href: "/p/" + cm.comment_target_id }, - cm.username - ) - ) - ), - React.createElement( - "a", - { className: "title", href: "/member/" + cm.member_id }, - React.createElement( - "span", - null, - cm.title - ) - ), - React.createElement( - "span", - { className: "content" }, - cm.comment_text - ), - React.createElement( - "span", - { className: "info-row" }, - React.createElement( - "span", - { className: "date" }, - appHelpers.getTimeAgo(cm.comment_created_at) - ) - ) - ) - ); - }); - commentsContainer = React.createElement( - "ul", - null, - comments - ); - } - return React.createElement( - "div", - { id: "blog-feed-container", className: "sidebar-feed-container" }, - React.createElement( - "h3", - null, - "Forum" - ), - commentsContainer - ); - } - }]); - - return ExploreCommentsContainer; -}(React.Component); - -var mapStateToExploreCommentsContainerProps = function mapStateToExploreCommentsContainerProps(state) { - var comments = state.comments; - return { - comments: comments - }; -}; - -var mapDispatchToExploreCommentsContainerProps = function mapDispatchToExploreCommentsContainerProps(dispatch) { - return { - dispatch: dispatch - }; -}; - -var ExploreCommentsContainerWrapper = ReactRedux.connect(mapStateToExploreCommentsContainerProps, mapDispatchToExploreCommentsContainerProps)(ExploreCommentsContainer); - -var ExploreTopProducts = function (_React$Component11) { - _inherits(ExploreTopProducts, _React$Component11); - - function ExploreTopProducts(props) { - _classCallCheck(this, ExploreTopProducts); - - var _this12 = _possibleConstructorReturn(this, (ExploreTopProducts.__proto__ || Object.getPrototypeOf(ExploreTopProducts)).call(this, props)); - - _this12.state = {}; - return _this12; - } - - _createClass(ExploreTopProducts, [{ - key: "render", - value: function render() { - var topProductsContainer = void 0; - if (this.props.topProducts) { - - var imageBaseUrl = void 0; - if (store.getState().env === 'live') { - imageBaseUrl = 'cn.opendesktop.org'; - } else { - imageBaseUrl = 'cn.pling.it'; - } - - var topProducts = this.props.topProducts.map(function (tp, index) { - return React.createElement( - "li", - { key: index }, - React.createElement("img", { src: "https://" + imageBaseUrl + "/cache/40x40/img/" + tp.image_small }), - React.createElement( - "a", - { href: "/p/" + tp.project_id }, - tp.title - ), - React.createElement( - "span", - { className: "cat-name" }, - tp.cat_title - ) - ); - }); - - topProductsContainer = React.createElement( - "ol", - null, - topProducts - ); - } - return React.createElement( - "div", - { id: "top-products-container", className: "sidebar-feed-container" }, - React.createElement( - "h3", - null, - "3 Months Ranking" - ), - React.createElement( - "small", - null, - "(based on downloads)" - ), - topProductsContainer - ); - } - }]); - - return ExploreTopProducts; -}(React.Component); - -var mapStateToExploreTopProductsProps = function mapStateToExploreTopProductsProps(state) { - var topProducts = state.topProducts; - return { - topProducts: topProducts - }; -}; - -var mapDispatchToExploreTopProductsProps = function mapDispatchToExploreTopProductsProps(dispatch) { - return { - dispatch: dispatch - }; -}; - -var ExploreTopProductsWrapper = ReactRedux.connect(mapStateToExploreTopProductsProps, mapDispatchToExploreTopProductsProps)(ExploreTopProducts); -"use strict"; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var HomePage = function (_React$Component) { - _inherits(HomePage, _React$Component); - - function HomePage(props) { - _classCallCheck(this, HomePage); - - var _this = _possibleConstructorReturn(this, (HomePage.__proto__ || Object.getPrototypeOf(HomePage)).call(this, props)); - - _this.state = { - device: store.getState().device, - products: store.getState().products - }; - return _this; - } - - _createClass(HomePage, [{ - key: "componentWillReceiveProps", - value: function componentWillReceiveProps(nextProps) { - if (nextProps.device) { - this.setState({ device: nextProps.device }); - } - if (nextProps.products) { - this.setState({ products: nextProps.products }); - } - } - }, { - key: "render", - value: function render() { - return React.createElement( - "div", - { id: "homepage" }, - React.createElement( - "div", - { className: "hp-wrapper" }, - React.createElement(Introduction, { - device: this.state.device, - count: window.totalProjects - }) - ) - ); - } - }]); - - return HomePage; -}(React.Component); - -var mapStateToHomePageProps = function mapStateToHomePageProps(state) { - var device = state.device; - var products = state.products; - return { - device: device, - products: products - }; -}; - -var mapDispatchToHomePageProps = function mapDispatchToHomePageProps(dispatch) { - return { - dispatch: dispatch - }; -}; - -var HomePageWrapper = ReactRedux.connect(mapStateToHomePageProps, mapDispatchToHomePageProps)(HomePage); - -var Introduction = function (_React$Component2) { - _inherits(Introduction, _React$Component2); - - function Introduction() { - _classCallCheck(this, Introduction); - - return _possibleConstructorReturn(this, (Introduction.__proto__ || Object.getPrototypeOf(Introduction)).apply(this, arguments)); - } - - _createClass(Introduction, [{ - key: "render", - value: function render() { - - var introductionText = void 0, - siteTitle = void 0, - buttonsContainer = void 0; - if (window.page === "appimages") { - siteTitle = "AppImageHub"; - introductionText = React.createElement( - "p", - null, - "This catalog has ", - this.props.count, - " AppImages and counting.", - React.createElement("br", null), - "AppImages are self-contained apps which can simply be downloaded & run on any Linux distribution. For easy integration, download AppImageLauncher:" - ); - buttonsContainer = React.createElement( - "div", - { className: "actions" }, - React.createElement( - "a", - { href: "/p/1228228", className: "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored mdl-color--primary" }, - React.createElement("img", { src: "/theme/react/assets/img/icon-download_white.png" }), - " AppImageLauncher" - ), - React.createElement( - "a", - { href: "/browse", className: "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored mdl-color--primary" }, - "Browse all apps" - ), - React.createElement( - "a", - { href: "https://chat.opendesktop.org/#/room/#appimagehub:chat.opendesktop.org", className: "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored mdl-color--primary", style: { "margin-left": "50px" } }, - "Join our chat #AppImageHub" - ) - ); - } else if (window.page === "libreoffice") { - siteTitle = "LibreOffice"; - introductionText = React.createElement( - "p", - null, - "Extensions add new features to your LibreOffice or make the use of already existing ones easier. Currently there are ", - this.props.count, - " project(s) available." - ); - buttonsContainer = React.createElement( - "div", - { className: "actions green" }, - React.createElement( - "a", - { href: window.baseUrl + "product/add", className: "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored mdl-color--primary" }, - "Add Extension" - ), - React.createElement( - "a", - { href: window.baseUrl + "browse/", className: "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored mdl-color--primary" }, - "Browse all Extensions" - ) - ); - } - - return React.createElement( - "div", - { id: "introduction", className: "section" }, - React.createElement( - "div", - { className: "container" }, - React.createElement( - "article", - null, - React.createElement( - "h2", - { className: "mdl-color-text--primary" }, - "Welcome to ", - siteTitle - ), - introductionText, - buttonsContainer - ) - ) - ); - } - }]); - - return Introduction; -}(React.Component); - -var HpIntroSection = function (_React$Component3) { - _inherits(HpIntroSection, _React$Component3); - - function HpIntroSection(props) { - _classCallCheck(this, HpIntroSection); - - var _this3 = _possibleConstructorReturn(this, (HpIntroSection.__proto__ || Object.getPrototypeOf(HpIntroSection)).call(this, props)); - - _this3.state = {}; - return _this3; - } - - _createClass(HpIntroSection, [{ - key: "render", - value: function render() { - return React.createElement( - "div", - { id: "homepage-search-container", className: "section intro" }, - React.createElement( - "div", - { className: "container" }, - React.createElement( - "article", - null, - React.createElement( - "p", - null, - "Search thousands of snaps used by millions of people across 50 Linux distributions" - ) - ), - React.createElement( - "div", - { id: "hp-search-form-container" }, - React.createElement( - "select", - { className: "mdl-selectfield__select" }, - React.createElement( - "option", - null, - "categories" - ) - ), - React.createElement("input", { type: "text" }), - React.createElement( - "button", - null, - "search" - ) - ) - ) - ); - } - }]); - - return HpIntroSection; -}(React.Component); - -var mapStateToHpIntroSectionProps = function mapStateToHpIntroSectionProps(state) { - var categories = state.categories; - return { - categories: categories - }; -}; - -var mapDispatchToHpIntroSectionProps = function mapDispatchToHpIntroSectionProps(dispatch) { - return { - dispatch: dispatch - }; -}; - -var HpIntroSectionWrapper = ReactRedux.connect(mapStateToHpIntroSectionProps, mapDispatchToHpIntroSectionProps)(HpIntroSection); - -var ProductCarousel = function (_React$Component4) { - _inherits(ProductCarousel, _React$Component4); - - function ProductCarousel(props) { - _classCallCheck(this, ProductCarousel); - - var _this4 = _possibleConstructorReturn(this, (ProductCarousel.__proto__ || Object.getPrototypeOf(ProductCarousel)).call(this, props)); - - _this4.state = { - showRightArrow: true, - showLeftArrow: false - }; - _this4.updateDimensions = _this4.updateDimensions.bind(_this4); - _this4.animateProductCarousel = _this4.animateProductCarousel.bind(_this4); - return _this4; - } - - _createClass(ProductCarousel, [{ - key: "componentWillMount", - value: function componentWillMount() { - window.addEventListener("resize", this.updateDimensions); - } - }, { - key: "componentDidMount", - value: function componentDidMount() { - this.updateDimensions(); - } - }, { - key: "updateDimensions", - value: function updateDimensions() { - var containerWidth = $('#introduction').find('.container').width(); - var sliderWidth = containerWidth * 3; - var itemWidth = containerWidth / 5; - this.setState({ - sliderPosition: 0, - containerWidth: containerWidth, - sliderWidth: sliderWidth, - itemWidth: itemWidth - }); - } - }, { - key: "animateProductCarousel", - value: function animateProductCarousel(dir) { - - var newSliderPosition = this.state.sliderPosition; - if (dir === 'left') { - newSliderPosition = this.state.sliderPosition - this.state.containerWidth; - } else { - newSliderPosition = this.state.sliderPosition + this.state.containerWidth; - } - - this.setState({ sliderPosition: newSliderPosition }, function () { - - var showLeftArrow = true, - showRightArrow = true; - var endPoint = this.state.sliderWidth - this.state.containerWidth; - if (this.state.sliderPosition <= 0) { - showLeftArrow = false; - } - if (this.state.sliderPosition >= endPoint) { - showRightArrow = false; - } - - this.setState({ - showLeftArrow: showLeftArrow, - showRightArrow: showRightArrow - }); - }); - } - }, { - key: "render", - value: function render() { - var _this5 = this; - - var carouselItemsDisplay = void 0; - if (this.props.products && this.props.products.length > 0) { - carouselItemsDisplay = this.props.products.map(function (product, index) { - return React.createElement(ProductCarouselItem, { - key: index, - product: product, - itemWidth: _this5.state.itemWidth - }); - }); - } - - var rightArrowDisplay = void 0, - leftArrowDisplay = void 0; - if (this.state.showLeftArrow) { - leftArrowDisplay = React.createElement( - "div", - { className: "product-carousel-left" }, - React.createElement( - "a", - { onClick: function onClick() { - return _this5.animateProductCarousel('left'); - }, className: "carousel-arrow arrow-left" }, - React.createElement( - "i", - { className: "material-icons" }, - "chevron_left" - ) - ) - ); - } - if (this.state.showRightArrow) { - rightArrowDisplay = React.createElement( - "div", - { className: "product-carousel-right" }, - React.createElement( - "a", - { onClick: function onClick() { - return _this5.animateProductCarousel('right'); - }, className: "carousel-arrow arrow-right" }, - React.createElement( - "i", - { className: "material-icons" }, - "chevron_right" - ) - ) - ); - } - - return React.createElement( - "div", - { className: "product-carousel" }, - React.createElement( - "div", - { className: "product-carousel-header" }, - React.createElement( - "h2", - null, - React.createElement( - "a", - { href: this.props.link }, - this.props.title, - React.createElement( - "i", - { className: "material-icons" }, - "chevron_right" - ) - ) - ) - ), - React.createElement( - "div", - { className: "product-carousel-wrapper" }, - leftArrowDisplay, - React.createElement( - "div", - { className: "product-carousel-container" }, - React.createElement( - "div", - { className: "product-carousel-slider", style: { "width": this.state.sliderWidth, "left": "-" + this.state.sliderPosition + "px" } }, - carouselItemsDisplay - ) - ), - rightArrowDisplay - ) - ); - } - }]); - - return ProductCarousel; -}(React.Component); - -var ProductCarouselItem = function (_React$Component5) { - _inherits(ProductCarouselItem, _React$Component5); - - function ProductCarouselItem(props) { - _classCallCheck(this, ProductCarouselItem); - - var _this6 = _possibleConstructorReturn(this, (ProductCarouselItem.__proto__ || Object.getPrototypeOf(ProductCarouselItem)).call(this, props)); - - _this6.state = {}; - return _this6; - } - - _createClass(ProductCarouselItem, [{ - key: "render", - value: function render() { - var imageBaseUrl = void 0; - if (store.getState().env === 'live') { - imageBaseUrl = 'cn.opendesktop.org'; - } else { - imageBaseUrl = 'cn.pling.it'; - } - return React.createElement( - "div", - { className: "product-carousel-item", style: { "width": this.props.itemWidth } }, - React.createElement( - "a", - { href: "/p/" + this.props.product.project_id }, - React.createElement( - "figure", - null, - React.createElement("img", { className: "very-rounded-corners", src: 'https://' + imageBaseUrl + '/cache/200x171/img/' + this.props.product.image_small }) - ), - React.createElement( - "div", - { className: "product-info" }, - React.createElement( - "span", - { className: "product-info-title" }, - this.props.product.title - ), - React.createElement( - "span", - { className: "product-info-user" }, - this.props.product.username - ) - ) - ) - ); - } - }]); - - return ProductCarouselItem; -}(React.Component); -'use strict'; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var ProductView = function (_React$Component) { - _inherits(ProductView, _React$Component); - - function ProductView(props) { - _classCallCheck(this, ProductView); - - var _this = _possibleConstructorReturn(this, (ProductView.__proto__ || Object.getPrototypeOf(ProductView)).call(this, props)); - - _this.state = { - tab: 'comments', - showDownloadSection: false - }; - _this.toggleTab = _this.toggleTab.bind(_this); - _this.toggleDownloadSection = _this.toggleDownloadSection.bind(_this); - return _this; - } - - _createClass(ProductView, [{ - key: 'componentDidMount', - value: function componentDidMount() { - var downloadTableHeight = $('#product-download-section').find('#files-tab').height(); - downloadTableHeight += 80; - this.setState({ downloadTableHeight: downloadTableHeight }); - } - }, { - key: 'componentWillReceiveProps', - value: function componentWillReceiveProps(nextProps) { - if (nextProps.product !== this.props.product) { - this.forceUpdate(); - } - if (nextProps.lightboxGallery !== this.props.lightboxGallery) { - this.forceUpdate(); - } - } - }, { - key: 'toggleTab', - value: function toggleTab(tab) { - this.setState({ tab: tab }); - } - }, { - key: 'toggleDownloadSection', - value: function toggleDownloadSection() { - var showDownloadSection = this.state.showDownloadSection === true ? false : true; - this.setState({ showDownloadSection: showDownloadSection }); - } - }, { - key: 'render', - value: function render() { - - var productGalleryDisplay = void 0; - if (this.props.product.r_gallery.length > 0) { - productGalleryDisplay = React.createElement(ProductViewGallery, { - product: this.props.product - }); - } - - var productGalleryLightboxDisplay = void 0; - if (this.props.lightboxGallery.show === true) { - productGalleryLightboxDisplay = React.createElement(ProductGalleryLightbox, { - product: this.props.product - }); - } - - var downloadSectionDisplayHeight = void 0; - if (this.state.showDownloadSection === true) { - downloadSectionDisplayHeight = this.state.downloadTableHeight; - } - - return React.createElement( - 'div', - { id: 'product-page' }, - React.createElement( - 'div', - { id: 'product-download-section', style: { "height": downloadSectionDisplayHeight } }, - React.createElement(ProductViewFilesTab, { - product: this.props.product, - files: this.props.product.r_files - }) - ), - React.createElement(ProductViewHeader, { - product: this.props.product, - user: this.props.user, - onDownloadBtnClick: this.toggleDownloadSection - }), - productGalleryDisplay, - React.createElement(ProductDescription, { - product: this.props.product - }), - React.createElement(ProductNavBar, { - onTabToggle: this.toggleTab, - tab: this.state.tab, - product: this.props.product - }), - React.createElement(ProductViewContent, { - product: this.props.product, - user: this.props.user, - tab: this.state.tab - }), - productGalleryLightboxDisplay - ); - } - }]); - - return ProductView; -}(React.Component); - -var mapStateToProductPageProps = function mapStateToProductPageProps(state) { - var product = state.product; - var user = state.user; - var lightboxGallery = state.lightboxGallery; - return { - product: product, - user: user, - lightboxGallery: lightboxGallery - }; -}; - -var mapDispatchToProductPageProps = function mapDispatchToProductPageProps(dispatch) { - return { - dispatch: dispatch - }; -}; - -var ProductViewWrapper = ReactRedux.connect(mapStateToProductPageProps, mapDispatchToProductPageProps)(ProductView); - -var ProductViewHeader = function (_React$Component2) { - _inherits(ProductViewHeader, _React$Component2); - - function ProductViewHeader(props) { - _classCallCheck(this, ProductViewHeader); - - var _this2 = _possibleConstructorReturn(this, (ProductViewHeader.__proto__ || Object.getPrototypeOf(ProductViewHeader)).call(this, props)); - - _this2.state = {}; - return _this2; - } - - _createClass(ProductViewHeader, [{ - key: 'render', - value: function render() { - - var imageBaseUrl = void 0; - if (store.getState().env === 'live') { - imageBaseUrl = 'cn.opendesktop.org'; - } else { - imageBaseUrl = 'cn.pling.it'; - } - - var productTagsDisplay = void 0; - if (this.props.product.r_tags_user) { - var tagsArray = this.props.product.r_tags_user.split(','); - var tags = tagsArray.map(function (tag, index) { - return React.createElement( - 'span', - { className: 'mdl-chip', key: index }, - React.createElement( - 'span', - { className: 'mdl-chip__text' }, - React.createElement('span', { className: 'glyphicon glyphicon-tag' }), - React.createElement( - 'a', - { href: "search/projectSearchText/" + tag + "/f/tags" }, - tag - ) - ) - ); - }); - productTagsDisplay = React.createElement( - 'div', - { className: 'product-tags' }, - tags - ); - } - - return React.createElement( - 'div', - { className: 'wrapper', id: 'product-view-header' }, - React.createElement( - 'div', - { className: 'container' }, - React.createElement( - 'div', - { className: 'section mdl-grid' }, - React.createElement( - 'div', - { className: 'product-view-header-left' }, - React.createElement( - 'figure', - { className: 'image-container' }, - React.createElement('img', { src: 'https://' + imageBaseUrl + '/cache/140x140/img/' + this.props.product.image_small }) - ), - React.createElement( - 'div', - { className: 'product-info' }, - React.createElement( - 'h1', - null, - this.props.product.title - ), - React.createElement( - 'div', - { className: 'info-row' }, - React.createElement( - 'a', - { className: 'user', href: "/member/" + this.props.product.member_id }, - React.createElement( - 'span', - { className: 'avatar' }, - React.createElement('img', { src: this.props.product.profile_image_url }) - ), - React.createElement( - 'span', - { className: 'username' }, - this.props.product.username - ) - ), - React.createElement( - 'a', - { href: "/browse/cat/" + this.props.product.project_category_id + "/order/latest?new=1" }, - React.createElement( - 'span', - null, - this.props.product.cat_title - ) - ), - productTagsDisplay - ) - ) - ), - React.createElement( - 'div', - { className: 'product-view-header-right' }, - React.createElement( - 'div', - { className: 'details-container' }, - React.createElement( - 'a', - { onClick: this.props.onDownloadBtnClick, href: '#', className: 'mdl-button mdl-js-button mdl-button--colored mdl-button--raised mdl-js-ripple-effect mdl-color--primary' }, - 'Download' - ), - React.createElement(ProductViewHeaderLikes, { - product: this.props.product, - user: this.props.user - }), - React.createElement( - 'div', - { id: 'product-view-header-right-side' }, - React.createElement(ProductViewHeaderRatings, { - product: this.props.product, - user: this.props.user - }) - ) - ) - ) - ) - ) - ); - } - }]); - - return ProductViewHeader; -}(React.Component); - -var ProductViewHeaderLikes = function (_React$Component3) { - _inherits(ProductViewHeaderLikes, _React$Component3); - - function ProductViewHeaderLikes(props) { - _classCallCheck(this, ProductViewHeaderLikes); - - var _this3 = _possibleConstructorReturn(this, (ProductViewHeaderLikes.__proto__ || Object.getPrototypeOf(ProductViewHeaderLikes)).call(this, props)); - - _this3.state = {}; - _this3.onUserLike = _this3.onUserLike.bind(_this3); - return _this3; - } - - _createClass(ProductViewHeaderLikes, [{ - key: 'componentDidMount', - value: function componentDidMount() { - var user = store.getState().user; - var likedByUser = productHelpers.checkIfLikedByUser(user, this.props.product.r_likes); - this.setState({ likesTotal: this.props.product.r_likes.length, likedByUser: likedByUser }); - } - }, { - key: 'onUserLike', - value: function onUserLike() { - if (this.props.user.username) { - var url = "/p/" + this.props.product.project_id + "/followproject/"; - var self = this; - $.ajax({ url: url, cache: false }).done(function (response) { - // error - if (response.status === "error") { - self.setState({ msg: response.msg }); - } else { - // delete - if (response.action === "delete") { - var likesTotal = self.state.likesTotal - 1; - self.setState({ likesTotal: likesTotal, likedByUser: false }); - } - // insert - else { - var _likesTotal = self.state.likesTotal + 1; - self.setState({ likesTotal: _likesTotal, likedByUser: true }); - } - } - }); - } else { - this.setState({ msg: 'please login to like' }); - } - } - }, { - key: 'render', - value: function render() { - var cssContainerClass = void 0, - cssHeartClass = void 0; - if (this.state.likedByUser === true) { - cssContainerClass = "liked-by-user"; - cssHeartClass = "plingheart fa heartproject fa-heart"; - } else { - cssHeartClass = "plingheart fa fa-heart-o heartgrey"; - } - - return React.createElement( - 'div', - { className: cssContainerClass, id: 'likes-container' }, - React.createElement( - 'div', - { className: 'likes' }, - React.createElement('i', { className: cssHeartClass }), - React.createElement( - 'span', - { onClick: this.onUserLike }, - this.state.likesTotal - ) - ), - React.createElement( - 'div', - { className: 'likes-label-container' }, - this.state.msg - ) - ); - } - }]); - - return ProductViewHeaderLikes; -}(React.Component); - -var ProductViewHeaderRatings = function (_React$Component4) { - _inherits(ProductViewHeaderRatings, _React$Component4); - - function ProductViewHeaderRatings(props) { - _classCallCheck(this, ProductViewHeaderRatings); - - var _this4 = _possibleConstructorReturn(this, (ProductViewHeaderRatings.__proto__ || Object.getPrototypeOf(ProductViewHeaderRatings)).call(this, props)); - - _this4.state = { - userIsOwner: '', - action: '', - laplace_score: _this4.props.product.laplace_score - }; - _this4.onRatingFormResponse = _this4.onRatingFormResponse.bind(_this4); - return _this4; - } - - _createClass(ProductViewHeaderRatings, [{ - key: 'componentDidMount', - value: function componentDidMount() { - - var userIsOwner = false; - if (this.props.user && this.props.user.member_id === this.props.product.member_id) { - userIsOwner = true; - } - var userRating = -1; - if (userIsOwner === false) { - userRating = productHelpers.getLoggedUserRatingOnProduct(this.props.user, this.props.product.r_ratings); - } - this.setState({ userIsOwner: userIsOwner, userRating: userRating }); - } - }, { - key: 'onRatingBtnClick', - value: function onRatingBtnClick(action) { - this.setState({ showModal: false }, function () { - this.setState({ action: action, showModal: true }, function () { - $('#ratings-form-modal').modal('show'); - }); - }); - } - }, { - key: 'onRatingFormResponse', - value: function onRatingFormResponse(modalResponse, val) { - var self = this; - this.setState({ errorMsg: '' }, function () { - jQuery.ajax({ - data: {}, - url: '/p/' + this.props.product.project_id + '/loadratings/', - method: 'get', - error: function error(jqXHR, textStatus, errorThrown) { - self.setState({ errorMsg: textStatus + " " + errorThrown }); - $('#ratings-form-modal').modal('hide'); - }, - success: function success(response) { - // const laplace_score = productHelpers.calculateProductLaplaceScore(response); - store.dispatch(setProductRatings(response)); - if (modalResponse.status !== "ok") self.setState({ errorMsg: modalResponse.status + " - " + modalResponse.message }); - self.setState({ laplace_score: modalResponse.laplace_score }, function () {}); - $('#ratings-form-modal').modal('hide'); - } - }); - }); - } - }, { - key: 'render', - value: function render() { - var _this5 = this; - - var ratingsFormModalDisplay = void 0; - if (this.state.showModal === true) { - if (this.props.user.username) { - ratingsFormModalDisplay = React.createElement(RatingsFormModal, { - user: this.props.user, - userIsOwner: this.state.userIsOwner, - userRating: this.state.userRating, - action: this.state.action, - product: this.props.product, - onRatingFormResponse: this.onRatingFormResponse - }); - } else { - ratingsFormModalDisplay = React.createElement( - 'div', - { className: 'modal please-login', id: 'ratings-form-modal', tabIndex: '-1', role: 'dialog' }, - React.createElement( - 'div', - { className: 'modal-dialog', role: 'document' }, - React.createElement( - 'div', - { className: 'modal-content' }, - React.createElement( - 'div', - { className: 'modal-header' }, - React.createElement( - 'h4', - { className: 'modal-title' }, - 'Please Login' - ), - React.createElement( - 'button', - { type: 'button', id: 'review-modal-close', className: 'close', 'data-dismiss': 'modal', 'aria-label': 'Close' }, - React.createElement( - 'span', - { 'aria-hidden': 'true' }, - '\xD7' - ) - ) - ), - React.createElement( - 'div', - { className: 'modal-body' }, - React.createElement( - 'a', - { href: '/login/' }, - 'Login' - ) - ) - ) - ) - ); - } - } - - return React.createElement( - 'div', - { className: 'ratings-bar-container' }, - React.createElement( - 'div', - { className: 'ratings-bar-left', onClick: function onClick() { - return _this5.onRatingBtnClick('minus'); - } }, - React.createElement( - 'i', - { className: 'material-icons' }, - 'remove' - ) - ), - React.createElement( - 'div', - { className: 'ratings-bar-holder' }, - React.createElement('div', { className: 'green ratings-bar', style: { "width": this.state.laplace_score + "%" } }), - React.createElement('div', { className: 'ratings-bar-empty', style: { "width": 100 - this.state.laplace_score + "%" } }) - ), - React.createElement( - 'div', - { className: 'ratings-bar-right', onClick: function onClick() { - return _this5.onRatingBtnClick('plus'); - } }, - React.createElement( - 'i', - { className: 'material-icons' }, - 'add' - ) - ), - ratingsFormModalDisplay, - React.createElement( - 'p', - { className: 'ratings-bar-error-msg-container' }, - this.state.errorMsg - ) - ); - } - }]); - - return ProductViewHeaderRatings; -}(React.Component); - -var RatingsFormModal = function (_React$Component5) { - _inherits(RatingsFormModal, _React$Component5); - - function RatingsFormModal(props) { - _classCallCheck(this, RatingsFormModal); - - var _this6 = _possibleConstructorReturn(this, (RatingsFormModal.__proto__ || Object.getPrototypeOf(RatingsFormModal)).call(this, props)); - - _this6.state = { - action: _this6.props.action - }; - _this6.submitRatingForm = _this6.submitRatingForm.bind(_this6); - _this6.onTextAreaInputChange = _this6.onTextAreaInputChange.bind(_this6); - return _this6; - } - - _createClass(RatingsFormModal, [{ - key: 'componentDidMount', - value: function componentDidMount() { - var actionIcon = void 0; - if (this.props.action === 'plus') { - actionIcon = '+'; - } else if (this.props.action === 'minus') { - actionIcon = '-'; - } - this.setState({ action: this.props.action, actionIcon: actionIcon, text: actionIcon }, function () { - this.forceUpdate(); - }); - } - }, { - key: 'onTextAreaInputChange', - value: function onTextAreaInputChange(e) { - this.setState({ text: e.target.value }); - } - }, { - key: 'submitRatingForm', - value: function submitRatingForm() { - this.setState({ loading: true }, function () { - var self = this; - var v = void 0; - if (this.state.action === 'plus') { - v = '1'; - } else { - v = '2'; - } - - jQuery.ajax({ - data: { - p: this.props.product.project_id, - m: this.props.user.member_id, - v: v, - pm: this.props.product.member_id, - otxt: this.state.text, - userrate: this.props.userRating, - msg: this.state.text - }, - url: '/productcomment/addreplyreview/', - method: 'post', - error: function error() { - var msg = "Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error."; - self.setState({ msg: msg }); - }, - success: function success(response) { - self.props.onRatingFormResponse(response, v); - } - }); - }); - } - }, { - key: 'render', - value: function render() { - var textAreaDisplay = void 0, - modalBtnDisplay = void 0; - if (!this.props.user) { - textAreaDisplay = React.createElement( - 'p', - null, - 'Please login to comment' - ); - modalBtnDisplay = React.createElement( - 'button', - { type: 'button', className: 'btn btn-secondary', 'data-dismiss': 'modal' }, - 'Close' - ); - } else { - if (this.props.userIsOwner) { - textAreaDisplay = React.createElement( - 'p', - null, - 'Project owner not allowed' - ); - modalBtnDisplay = React.createElement( - 'button', - { type: 'button', className: 'btn btn-secondary', 'data-dismiss': 'modal' }, - 'Close' - ); - } else if (this.state.text) { - textAreaDisplay = React.createElement('textarea', { onChange: this.onTextAreaInputChange, defaultValue: this.state.text, className: 'form-control' }); - if (this.state.loading !== true) { - - if (this.state.msg) { - modalBtnDisplay = React.createElement( - 'p', - null, - this.state.msg - ); - } else { - modalBtnDisplay = React.createElement( - 'button', - { onClick: this.submitRatingForm, type: 'button', className: 'btn btn-primary' }, - 'Rate Now' - ); - } - } else { - modalBtnDisplay = React.createElement('span', { className: 'glyphicon glyphicon-refresh spinning' }); - } - } - } - - return React.createElement( - 'div', - { className: 'modal', id: 'ratings-form-modal', tabIndex: '-1', role: 'dialog' }, - React.createElement( - 'div', - { className: 'modal-dialog', role: 'document' }, - React.createElement( - 'div', - { className: 'modal-content' }, - React.createElement( - 'div', - { className: 'modal-header' }, - React.createElement( - 'div', - { className: this.props.action + " action-icon-container" }, - this.state.actionIcon - ), - React.createElement( - 'h5', - { className: 'modal-title' }, - 'Add Comment (min. 1 char):' - ), - React.createElement( - 'button', - { type: 'button', id: 'review-modal-close', className: 'close', 'data-dismiss': 'modal', 'aria-label': 'Close' }, - React.createElement( - 'span', - { 'aria-hidden': 'true' }, - '\xD7' - ) - ) - ), - React.createElement( - 'div', - { className: 'modal-body' }, - textAreaDisplay - ), - React.createElement( - 'div', - { className: 'modal-footer' }, - modalBtnDisplay - ) - ) - ) - ); - } - }]); - - return RatingsFormModal; -}(React.Component); - -var ProductViewGallery = function (_React$Component6) { - _inherits(ProductViewGallery, _React$Component6); - - function ProductViewGallery(props) { - _classCallCheck(this, ProductViewGallery); - - var _this7 = _possibleConstructorReturn(this, (ProductViewGallery.__proto__ || Object.getPrototypeOf(ProductViewGallery)).call(this, props)); - - _this7.state = { - loading: true, - currentItem: 1, - galleryWrapperMarginLeft: 0 - }; - _this7.updateDimensions = _this7.updateDimensions.bind(_this7); - _this7.onLeftArrowClick = _this7.onLeftArrowClick.bind(_this7); - _this7.onRightArrowClick = _this7.onRightArrowClick.bind(_this7); - _this7.animateGallerySlider = _this7.animateGallerySlider.bind(_this7); - return _this7; - } - - _createClass(ProductViewGallery, [{ - key: 'componentDidMount', - value: function componentDidMount() { - window.addEventListener("resize", this.updateDimensions); - this.updateDimensions(); - } - }, { - key: 'componentWillUnmount', - value: function componentWillUnmount() { - window.removeEventListener("resize", this.updateDimensions); - } - }, { - key: 'updateDimensions', - value: function updateDimensions() { - var productGallery = document.getElementById('product-gallery'); - var itemsWidth = 300; - var itemsTotal = this.props.product.r_gallery.length + 1; - this.setState({ - itemsWidth: itemsWidth, - itemsTotal: itemsTotal, - loading: false - }); - } - }, { - key: 'onLeftArrowClick', - value: function onLeftArrowClick() { - var nextItem = void 0; - if (this.state.currentItem <= 1) { - nextItem = this.state.itemsTotal; - } else { - nextItem = this.state.currentItem - 1; - } - var marginLeft = this.state.itemsWidth * (nextItem - 1); - this.animateGallerySlider(nextItem, marginLeft); - } - }, { - key: 'onRightArrowClick', - value: function onRightArrowClick() { - var nextItem = void 0; - if (this.state.currentItem === this.state.itemsTotal) { - nextItem = 1; - } else { - nextItem = this.state.currentItem + 1; - } - var marginLeft = this.state.itemsWidth * (nextItem - 1); - this.animateGallerySlider(nextItem, marginLeft); - } - }, { - key: 'animateGallerySlider', - value: function animateGallerySlider(nextItem, marginLeft) { - this.setState({ currentItem: nextItem, galleryWrapperMarginLeft: "-" + marginLeft + "px" }); - } - }, { - key: 'onGalleryItemClick', - value: function onGalleryItemClick(num) { - store.dispatch(showLightboxGallery(num)); - } - }, { - key: 'render', - value: function render() { - var _this8 = this; - - var galleryDisplay = void 0; - - if (this.props.product.embed_code && this.props.product.embed_code.length > 0) { - - var imageBaseUrl = void 0; - if (store.getState().env === 'live') { - imageBaseUrl = 'http://cn.opendesktop.org'; - } else { - imageBaseUrl = 'http://cn.pling.it'; - } - - if (this.props.product.r_gallery.length > 0) { - - var itemsWidth = this.state.itemsWidth; - var currentItem = this.state.currentItem; - var self = this; - var moreItems = this.props.product.r_gallery.map(function (gi, index) { - return React.createElement( - 'div', - { key: index, onClick: function onClick() { - return _this8.onGalleryItemClick(index + 2); - }, className: currentItem === index + 2 ? "active-gallery-item gallery-item" : "gallery-item" }, - React.createElement('img', { className: 'media-item', src: imageBaseUrl + "/img/" + gi }) - ); - }); - - galleryDisplay = React.createElement( - 'div', - { id: 'product-gallery' }, - React.createElement( - 'a', - { className: 'gallery-arrow arrow-left', onClick: this.onLeftArrowClick }, - React.createElement( - 'i', - { className: 'material-icons' }, - 'chevron_left' - ) - ), - React.createElement( - 'div', - { className: 'section' }, - React.createElement( - 'div', - { style: { "width": this.state.itemsWidth * this.state.itemsTotal + "px", "marginLeft": this.state.galleryWrapperMarginLeft }, className: 'gallery-items-wrapper' }, - React.createElement('div', { onClick: function onClick() { - return _this8.onGalleryItemClick(1); - }, dangerouslySetInnerHTML: { __html: this.props.product.embed_code }, className: this.state.currentItem === 1 ? "active-gallery-item gallery-item" : "gallery-item" }), - moreItems - ) - ), - React.createElement( - 'a', - { className: 'gallery-arrow arrow-right', onClick: this.onRightArrowClick }, - React.createElement( - 'i', - { className: 'material-icons' }, - 'chevron_right' - ) - ) - ); - } - } - - return React.createElement( - 'div', - { className: 'section', id: 'product-view-gallery-container' }, - React.createElement( - 'div', - { className: 'container' }, - React.createElement( - 'div', - { className: 'section' }, - galleryDisplay - ) - ) - ); - } - }]); - - return ProductViewGallery; -}(React.Component); - -var ProductGalleryLightbox = function (_React$Component7) { - _inherits(ProductGalleryLightbox, _React$Component7); - - function ProductGalleryLightbox(props) { - _classCallCheck(this, ProductGalleryLightbox); - - var _this9 = _possibleConstructorReturn(this, (ProductGalleryLightbox.__proto__ || Object.getPrototypeOf(ProductGalleryLightbox)).call(this, props)); - - var currentItem = void 0; - if (store.getState().lightboxGallery) { - currentItem = store.getState().lightboxGallery.currentItem; - } else { - currentItem = 1; - } - _this9.state = { - currentItem: currentItem, - loading: true - }; - _this9.updateDimensions = _this9.updateDimensions.bind(_this9); - _this9.toggleNextGalleryItem = _this9.toggleNextGalleryItem.bind(_this9); - _this9.togglePrevGalleryItem = _this9.togglePrevGalleryItem.bind(_this9); - _this9.animateGallerySlider = _this9.animateGallerySlider.bind(_this9); - _this9.onThumbnailClick = _this9.onThumbnailClick.bind(_this9); - return _this9; - } - - _createClass(ProductGalleryLightbox, [{ - key: 'componentDidMount', - value: function componentDidMount() { - window.addEventListener("resize", this.updateDimensions); - this.updateDimensions(); - } - }, { - key: 'componentWillUnmount', - value: function componentWillUnmount() { - window.removeEventListener("resize", this.updateDimensions); - } - }, { - key: 'updateDimensions', - value: function updateDimensions() { - var thumbnailsSectionWidth = document.getElementById('thumbnails-section').offsetWidth; - var itemsWidth = 300; - var itemsTotal = this.props.product.r_gallery.length + 1; - var thumbnailsMarginLeft = 0; - if (this.state.currentItem * itemsWidth > thumbnailsSectionWidth) { - thumbnailsMarginLeft = thumbnailsSectionWidth - this.state.currentItem * itemsWidth; - } - this.setState({ - itemsWidth: itemsWidth, - itemsTotal: itemsTotal, - thumbnailsSectionWidth: thumbnailsSectionWidth, - thumbnailsMarginLeft: thumbnailsMarginLeft, - loading: false - }); - } - }, { - key: 'togglePrevGalleryItem', - value: function togglePrevGalleryItem() { - var nextItem = void 0; - if (this.state.currentItem <= 1) { - nextItem = this.state.itemsTotal; - } else { - nextItem = this.state.currentItem - 1; - } - - this.animateGallerySlider(nextItem); - } - }, { - key: 'toggleNextGalleryItem', - value: function toggleNextGalleryItem() { - var nextItem = void 0; - if (this.state.currentItem === this.state.itemsTotal) { - nextItem = 1; - } else { - nextItem = this.state.currentItem + 1; - } - this.animateGallerySlider(nextItem); - } - }, { - key: 'animateGallerySlider', - value: function animateGallerySlider(currentItem) { - this.setState({ currentItem: currentItem }, function () { - this.updateDimensions(); - }); - } - }, { - key: 'onThumbnailClick', - value: function onThumbnailClick(num) { - this.animateGallerySlider(num); - } - }, { - key: 'hideLightbox', - value: function hideLightbox() { - store.dispatch(hideLightboxGallery()); - } - }, { - key: 'render', - value: function render() { - var _this10 = this; - - var imageBaseUrl = void 0; - if (store.getState().env === 'live') { - imageBaseUrl = 'http://cn.opendesktop.org'; - } else { - imageBaseUrl = 'http://cn.pling.it'; - } - - var currentItem = this.state.currentItem; - var self = this; - var thumbnails = this.props.product.r_gallery.map(function (gi, index) { - return React.createElement( - 'div', - { key: index, onClick: function onClick() { - return self.onThumbnailClick(index + 2); - }, className: self.state.currentItem === index + 2 ? "active thumbnail-item" : "thumbnail-item" }, - React.createElement('img', { className: 'media-item', src: imageBaseUrl + "/img/" + gi }) - ); - }); - - var mainItemDisplay = void 0; - if (currentItem === 1) { - mainItemDisplay = React.createElement('div', { dangerouslySetInnerHTML: { __html: this.props.product.embed_code } }); - } else { - var mainItem = this.props.product.r_gallery[currentItem - 2]; - mainItemDisplay = React.createElement('img', { className: 'media-item', src: imageBaseUrl + "/img/" + mainItem }); - } - - return React.createElement( - 'div', - { id: 'product-gallery-lightbox' }, - React.createElement( - 'a', - { id: 'close-lightbox', onClick: this.hideLightbox }, - React.createElement( - 'i', - { className: 'material-icons' }, - 'cancel' - ) - ), - React.createElement( - 'div', - { id: 'lightbox-gallery-main-view' }, - React.createElement( - 'a', - { className: 'gallery-arrow', onClick: this.togglePrevGalleryItem, id: 'arrow-left' }, - React.createElement( - 'i', - { className: 'material-icons' }, - 'chevron_left' - ) - ), - React.createElement( - 'div', - { className: 'current-gallery-item' }, - mainItemDisplay - ), - React.createElement( - 'a', - { className: 'gallery-arrow', onClick: this.toggleNextGalleryItem, id: 'arrow-right' }, - React.createElement( - 'i', - { className: 'material-icons' }, - 'chevron_right' - ) - ) - ), - React.createElement( - 'div', - { id: 'lightbox-gallery-thumbnails' }, - React.createElement( - 'div', - { className: 'section', id: 'thumbnails-section' }, - React.createElement( - 'div', - { id: 'gallery-items-wrapper', style: { "width": this.state.itemsTotal * this.state.itemsWidth + "px", "marginLeft": this.state.thumbnailsMarginLeft + "px" } }, - React.createElement('div', { onClick: function onClick() { - return _this10.onThumbnailClick(1); - }, dangerouslySetInnerHTML: { __html: this.props.product.embed_code }, className: this.state.currentItem === 1 ? "active thumbnail-item" : "thumbnail-item" }), - thumbnails - ) - ) - ) - ); - } - }]); - - return ProductGalleryLightbox; -}(React.Component); - -var ProductDescription = function (_React$Component8) { - _inherits(ProductDescription, _React$Component8); - - function ProductDescription(props) { - _classCallCheck(this, ProductDescription); - - var _this11 = _possibleConstructorReturn(this, (ProductDescription.__proto__ || Object.getPrototypeOf(ProductDescription)).call(this, props)); - - _this11.state = {}; - return _this11; - } - - _createClass(ProductDescription, [{ - key: 'render', - value: function render() { - return React.createElement( - 'div', - { id: 'product-description', className: 'section' }, - React.createElement( - 'div', - { className: 'container' }, - React.createElement( - 'div', - { className: 'main-content' }, - React.createElement( - 'article', - null, - React.createElement('p', { dangerouslySetInnerHTML: { __html: this.props.product.description } }) - ), - React.createElement( - 'aside', - null, - React.createElement( - 'ul', - null, - React.createElement( - 'li', - null, - React.createElement( - 'span', - { className: 'key' }, - 'License' - ), - React.createElement( - 'span', - { className: 'val' }, - this.props.product.project_license_title - ) - ), - React.createElement( - 'li', - null, - React.createElement( - 'span', - { className: 'key' }, - 'Last Update' - ), - React.createElement( - 'span', - { className: 'val' }, - this.props.product.changed_at.split(' ')[0] - ) - ) - ) - ) - ) - ) - ); - } - }]); - - return ProductDescription; -}(React.Component); - -var ProductNavBar = function (_React$Component9) { - _inherits(ProductNavBar, _React$Component9); - - function ProductNavBar() { - _classCallCheck(this, ProductNavBar); - - return _possibleConstructorReturn(this, (ProductNavBar.__proto__ || Object.getPrototypeOf(ProductNavBar)).apply(this, arguments)); - } - - _createClass(ProductNavBar, [{ - key: 'render', - value: function render() { - var _this13 = this; - - var productNavBarDisplay = void 0; - var filesMenuItem = void 0, - ratingsMenuItem = void 0, - favsMenuItem = void 0, - plingsMenuItem = void 0; - if (this.props.product.r_files.length > 0) { - filesMenuItem = React.createElement( - 'a', - { className: this.props.tab === "files" ? "item active" : "item", onClick: function onClick() { - return _this13.props.onTabToggle('files'); - } }, - 'Files (', - this.props.product.r_files.length, - ')' - ); - } - if (this.props.product.r_ratings.length > 0) { - var activeRatingsNumber = productHelpers.getActiveRatingsNumber(this.props.product.r_ratings); - ratingsMenuItem = React.createElement( - 'a', - { className: this.props.tab === "ratings" ? "item active" : "item", onClick: function onClick() { - return _this13.props.onTabToggle('ratings'); - } }, - 'Ratings & Reviews (', - activeRatingsNumber, - ')' - ); - } - if (this.props.product.r_likes.length > 0) { - favsMenuItem = React.createElement( - 'a', - { className: this.props.tab === "favs" ? "item active" : "item", onClick: function onClick() { - return _this13.props.onTabToggle('favs'); - } }, - 'Favs (', - this.props.product.r_likes.length, - ')' - ); - } - if (this.props.product.r_plings.length > 0) { - plingsMenuItem = React.createElement( - 'a', - { className: this.props.tab === "plings" ? "item active" : "item", onClick: function onClick() { - return _this13.props.onTabToggle('plings'); - } }, - 'Plings (', - this.props.product.r_plings.length, - ')' - ); - } - return React.createElement( - 'div', - { className: 'wrapper' }, - React.createElement( - 'div', - { className: 'container' }, - React.createElement( - 'div', - { className: 'explore-top-bar' }, - React.createElement( - 'a', - { className: this.props.tab === "comments" ? "item active" : "item", onClick: function onClick() { - return _this13.props.onTabToggle('comments'); - } }, - 'Comments (', - this.props.product.r_comments.length, - ')' - ), - filesMenuItem, - ratingsMenuItem, - favsMenuItem, - plingsMenuItem - ) - ) - ); - } - }]); - - return ProductNavBar; -}(React.Component); - -var ProductViewContent = function (_React$Component10) { - _inherits(ProductViewContent, _React$Component10); - - function ProductViewContent() { - _classCallCheck(this, ProductViewContent); - - return _possibleConstructorReturn(this, (ProductViewContent.__proto__ || Object.getPrototypeOf(ProductViewContent)).apply(this, arguments)); - } - - _createClass(ProductViewContent, [{ - key: 'render', - value: function render() { - - var currentTabDisplay = void 0; - if (this.props.tab === 'comments') { - currentTabDisplay = React.createElement( - 'div', - { className: 'product-tab', id: 'comments-tab' }, - React.createElement(ProductCommentsContainer, { - product: this.props.product, - user: this.props.user - }) - ); - } else if (this.props.tab === 'files') { - currentTabDisplay = React.createElement(ProductViewFilesTab, { - product: this.props.product, - files: this.props.product.r_files - }); - } else if (this.props.tab === 'ratings') { - currentTabDisplay = React.createElement(ProductViewRatingsTabWrapper, { - ratings: this.props.product.r_ratings - }); - } else if (this.props.tab === 'favs') { - currentTabDisplay = React.createElement(ProductViewFavTab, { - likes: this.props.product.r_likes - }); - } else if (this.props.tab === 'plings') { - currentTabDisplay = React.createElement(ProductViewPlingsTab, { - plings: this.props.product.r_plings - }); - } - return React.createElement( - 'div', - { className: 'wrapper' }, - React.createElement( - 'div', - { className: 'container' }, - React.createElement( - 'div', - { className: 'section', id: 'product-view-content-container' }, - currentTabDisplay - ) - ) - ); - } - }]); - - return ProductViewContent; -}(React.Component); - -var ProductCommentsContainer = function (_React$Component11) { - _inherits(ProductCommentsContainer, _React$Component11); - - function ProductCommentsContainer(props) { - _classCallCheck(this, ProductCommentsContainer); - - var _this15 = _possibleConstructorReturn(this, (ProductCommentsContainer.__proto__ || Object.getPrototypeOf(ProductCommentsContainer)).call(this, props)); - - _this15.state = {}; - return _this15; - } - - _createClass(ProductCommentsContainer, [{ - key: 'render', - value: function render() { - var _this16 = this; - - var commentsDisplay = void 0; - var cArray = categoryHelpers.convertCatChildrenObjectToArray(this.props.product.r_comments); - if (cArray.length > 0) { - var product = this.props.product; - var comments = cArray.map(function (c, index) { - if (c.level === 1) { - return React.createElement(CommentItem, { user: _this16.props.user, product: product, comment: c.comment, key: index, level: 1 }); - } - }); - commentsDisplay = React.createElement( - 'div', - { className: 'comment-list' }, - comments - ); - } - - return React.createElement( - 'div', - { className: 'product-view-section', id: 'product-comments-container' }, - React.createElement(CommentForm, { - user: this.props.user, - product: this.props.product - }), - commentsDisplay - ); - } - }]); - - return ProductCommentsContainer; -}(React.Component); - -var CommentForm = function (_React$Component12) { - _inherits(CommentForm, _React$Component12); - - function CommentForm(props) { - _classCallCheck(this, CommentForm); - - var _this17 = _possibleConstructorReturn(this, (CommentForm.__proto__ || Object.getPrototypeOf(CommentForm)).call(this, props)); - - _this17.state = { - text: '', - errorMsg: '', - errorTitle: '', - loading: false - }; - _this17.updateCommentText = _this17.updateCommentText.bind(_this17); - _this17.submitComment = _this17.submitComment.bind(_this17); - _this17.updateComments = _this17.updateComments.bind(_this17); - return _this17; - } - - _createClass(CommentForm, [{ - key: 'updateCommentText', - value: function updateCommentText(e) { - this.setState({ text: e.target.value }); - } - }, { - key: 'submitComment', - value: function submitComment() { - this.setState({ loading: true }, function () { - var msg = this.state.text; - var self = this; - var data = { - p: this.props.product.project_id, - m: this.props.user.member_id, - msg: this.state.text - }; - if (this.props.comment) { - data.i = this.props.comment.comment_id; - } - jQuery.ajax({ - data: data, - url: '/productcomment/addreply/', - type: 'post', - dataType: 'json', - error: function error(jqXHR, textStatus, errorThrown) { - var results = JSON && JSON.parse(jqXHR.responseText) || $.parseJSON(jqXHR.responseText); - self.setState({ - errorMsg: results.message, - errorTitle: results.title, - login_url: results.login_url, - status: 'error' }); - }, - success: function success(results) { - var baseUrl = void 0; - if (store.getState().env === 'live') { - baseUrl = 'cn.opendesktop.org'; - } else { - baseUrl = 'cn.pling.it'; - } - $.ajax({ url: '/productcomment?p=' + self.props.product.project_id, cache: false }).done(function (response) { - self.updateComments(response); - }); - } - }); - }); - } - }, { - key: 'updateComments', - value: function updateComments(response) { - store.dispatch(setProductComments(response)); - this.setState({ text: '', loading: false }, function () { - if (this.props.hideReplyForm) { - this.props.hideReplyForm(); - } - }); - } - }, { - key: 'render', - value: function render() { - - var commentFormDisplay = void 0; - if (this.props.user.username) { - if (this.state.loading) { - commentFormDisplay = React.createElement( - 'div', - { className: 'comment-form-container' }, - React.createElement( - 'p', - null, - React.createElement('span', { className: 'glyphicon glyphicon-refresh spinning' }), - ' posting comment' - ) - ); - } else { - var submitBtnDisplay = void 0; - if (this.state.text.length === 0) { - submitBtnDisplay = React.createElement( - 'button', - { disabled: 'disabled', type: 'button', className: 'mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored mdl-color--primary' }, - 'send' - ); - } else { - submitBtnDisplay = React.createElement( - 'button', - { onClick: this.submitComment, type: 'button', className: 'mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored mdl-color--primary' }, - React.createElement('span', { className: 'glyphicon glyphicon-send' }), - 'send' - ); - } - - var errorDisplay = void 0; - if (this.state.status === 'error') { - errorDisplay = React.createElement( - 'div', - { className: 'comment-form-error-display-container' }, - React.createElement('div', { dangerouslySetInnerHTML: { __html: this.state.errorTitle } }), - React.createElement('div', { dangerouslySetInnerHTML: { __html: this.state.errorMsg } }) - ); - } - - commentFormDisplay = React.createElement( - 'div', - { className: 'comment-form-container' }, - React.createElement( - 'span', - null, - 'Add Comment' - ), - React.createElement('textarea', { className: 'form-control', onChange: this.updateCommentText, value: this.state.text }), - errorDisplay, - submitBtnDisplay - ); - } - } else { - commentFormDisplay = React.createElement( - 'p', - null, - 'Please ', - React.createElement( - 'a', - { href: '/login?redirect=ohWn43n4SbmJZWlKUZNl2i1_s5gggiCE' }, - 'login' - ), - ' or ', - React.createElement( - 'a', - { href: '/register' }, - 'register' - ), - ' to add a comment' - ); - } - - return React.createElement( - 'div', - { id: 'product-page-comment-form-container' }, - commentFormDisplay - ); - } - }]); - - return CommentForm; -}(React.Component); - -var CommentItem = function (_React$Component13) { - _inherits(CommentItem, _React$Component13); - - function CommentItem(props) { - _classCallCheck(this, CommentItem); - - var _this18 = _possibleConstructorReturn(this, (CommentItem.__proto__ || Object.getPrototypeOf(CommentItem)).call(this, props)); - - _this18.state = { - showCommentReplyForm: false - }; - _this18.filterByCommentLevel = _this18.filterByCommentLevel.bind(_this18); - _this18.onToggleReplyForm = _this18.onToggleReplyForm.bind(_this18); - _this18.onReportComment = _this18.onReportComment.bind(_this18); - _this18.onConfirmReportClick = _this18.onConfirmReportClick.bind(_this18); - return _this18; - } - - _createClass(CommentItem, [{ - key: 'filterByCommentLevel', - value: function filterByCommentLevel(val) { - if (val.level > this.props.level && this.props.comment.comment_id === val.comment.comment_parent_id) { - return val; - } - } - }, { - key: 'onToggleReplyForm', - value: function onToggleReplyForm() { - var showCommentReplyForm = this.state.showCommentReplyForm === true ? false : true; - this.setState({ showCommentReplyForm: showCommentReplyForm }); - } - }, { - key: 'onReportComment', - value: function onReportComment() { - $('#report-' + this.props.comment.comment_id).modal('show'); - } - }, { - key: 'onConfirmReportClick', - value: function onConfirmReportClick(commentId, productId) { - jQuery.ajax({ - data: { - i: commentId, - p: productId - }, - url: "/report/comment/", - type: "POST", - dataType: "json", - error: function error(jqXHR, textStatus, errorThrown) { - var results = JSON && JSON.parse(jqXHR.responseText) || $.parseJSON(jqXHR.responseText); - $("#report-" + commentId).find('.modal-header-text').empty().append(results.title); - $("#report-" + commentId).find('.modal-body').empty().append(results.message); - setTimeout(function () { - $("#report-" + commentId).modal('hide'); - }, 2000); - }, - success: function success(results) { - if (results.status == 'ok') { - $("#report-" + commentId).find(".comment-report-p").empty().html(results.message.split('

')[0].split('

')[1]); - } - if (results.status == 'error') { - if (results.message != '') { - $("#report-" + commentId).find(".comment-report-p").empty().html(results.message); - } else { - $("#report-" + commentId).find(".comment-report-p").empty().html('Service is temporarily unavailable.'); - } - } - setTimeout(function () { - $("#report-" + commentId).modal('hide'); - }, 2000); - } - }); - } - }, { - key: 'render', - value: function render() { - var commentRepliesContainer = void 0; - var filteredComments = categoryHelpers.convertCatChildrenObjectToArray(this.props.product.r_comments).filter(this.filterByCommentLevel); - if (filteredComments.length > 0) { - var product = this.props.product; - var user = this.props.user; - var comments = filteredComments.map(function (c, index) { - return React.createElement(CommentItem, { user: user, product: product, comment: c.comment, key: index, level: c.level }); - }); - commentRepliesContainer = React.createElement( - 'div', - { className: 'comment-item-replies-container' }, - comments - ); - } - - var displayIsSupporter = void 0; - if (this.props.comment.issupporter === "1") { - displayIsSupporter = React.createElement( - 'li', - null, - React.createElement( - 'span', - { className: 'is-supporter-display uc-icon' }, - 'S' - ) - ); - } - - var displayIsCreater = void 0; - if (this.props.comment.member_id === this.props.product.member_id) { - displayIsCreater = React.createElement( - 'li', - null, - React.createElement( - 'span', - { className: 'is-creater-display uc-icon' }, - 'C' - ) - ); - } - - var commentReplyFormDisplay = void 0; - if (this.state.showCommentReplyForm) { - commentReplyFormDisplay = React.createElement(CommentForm, { - comment: this.props.comment, - user: this.props.user, - product: this.props.product, - hideReplyForm: this.onToggleReplyForm - }); - } - - return React.createElement( - 'div', - { className: 'comment-item' }, - React.createElement( - 'div', - { className: 'comment-user-avatar' }, - React.createElement('img', { src: this.props.comment.profile_image_url }) - ), - React.createElement( - 'div', - { className: 'comment-item-content' }, - React.createElement( - 'div', - { className: 'comment-item-header' }, - React.createElement( - 'ul', - null, - React.createElement( - 'li', - null, - React.createElement( - 'a', - { className: 'comment-username', href: "/member/" + this.props.comment.member_id }, - this.props.comment.username - ) - ), - displayIsSupporter, - displayIsCreater, - React.createElement( - 'li', - null, - React.createElement( - 'span', - { className: 'comment-created-at' }, - appHelpers.getTimeAgo(this.props.comment.comment_created_at) - ) - ) - ) - ), - React.createElement( - 'div', - { className: 'comment-item-text' }, - this.props.comment.comment_text - ), - React.createElement( - 'div', - { className: 'comment-item-actions' }, - React.createElement( - 'a', - { onClick: this.onToggleReplyForm }, - React.createElement( - 'i', - { className: 'material-icons reverse' }, - 'reply' - ), - React.createElement( - 'span', - null, - 'Reply' - ) - ), - React.createElement( - 'a', - { onClick: this.onReportComment }, - React.createElement( - 'i', - { className: 'material-icons' }, - 'warning' - ), - React.createElement( - 'span', - null, - 'Report' - ) - ), - React.createElement(ReportCommentModal, { - comment: this.props.comment, - product: this.props.product, - user: this.props.user, - onConfirmReportClick: this.onConfirmReportClick - }) - ) - ), - commentReplyFormDisplay, - commentRepliesContainer - ); - } - }]); - - return CommentItem; -}(React.Component); - -var ReportCommentModal = function (_React$Component14) { - _inherits(ReportCommentModal, _React$Component14); - - function ReportCommentModal(props) { - _classCallCheck(this, ReportCommentModal); - - var _this19 = _possibleConstructorReturn(this, (ReportCommentModal.__proto__ || Object.getPrototypeOf(ReportCommentModal)).call(this, props)); - - _this19.state = { - status: "ready" - }; - return _this19; - } - - _createClass(ReportCommentModal, [{ - key: 'onConfirmReportClick', - value: function onConfirmReportClick(commmentId, productId) { - this.setState({ status: "loading" }, function () { - this.props.onConfirmReportClick(commmentId, productId); - }); - } - }, { - key: 'render', - value: function render() { - var _this20 = this; - - var confirmActionButtonIconDisplay = void 0; - if (this.state.status === "ready") { - confirmActionButtonIconDisplay = React.createElement( - 'i', - { className: 'material-icons reverse' }, - 'reply' - ); - } else if (this.state.status === "loading") { - confirmActionButtonIconDisplay = React.createElement('span', { className: 'glyphicon glyphicon-refresh spinning' }); - } - - return React.createElement( - 'div', - { className: 'modal report-comment-modal', id: "report-" + this.props.comment.comment_id, tabIndex: '-1', role: 'dialog' }, - React.createElement( - 'div', - { className: 'modal-dialog', role: 'document' }, - React.createElement( - 'div', - { className: 'modal-content' }, - React.createElement( - 'div', - { className: 'modal-header' }, - React.createElement( - 'h4', - { className: 'modal-title' }, - 'Report Comment' - ), - React.createElement( - 'button', - { type: 'button', id: 'review-modal-close', className: 'close', 'data-dismiss': 'modal', 'aria-label': 'Close' }, - React.createElement( - 'span', - { 'aria-hidden': 'true' }, - '\xD7' - ) - ) - ), - React.createElement( - 'div', - { className: 'modal-body' }, - React.createElement( - 'p', - { className: 'comment-report-p' }, - 'Do you really want to report this comment?' - ) - ), - React.createElement( - 'div', - { className: 'modal-footer' }, - React.createElement( - 'a', - { onClick: function onClick() { - return _this20.onConfirmReportClick(_this20.props.comment.comment_id, _this20.props.product.project_id); - } }, - confirmActionButtonIconDisplay, - ' yes' - ) - ) - ) - ) - ); - } - }]); - - return ReportCommentModal; -}(React.Component); - -var ProductViewFilesTab = function (_React$Component15) { - _inherits(ProductViewFilesTab, _React$Component15); - - function ProductViewFilesTab() { - _classCallCheck(this, ProductViewFilesTab); - - return _possibleConstructorReturn(this, (ProductViewFilesTab.__proto__ || Object.getPrototypeOf(ProductViewFilesTab)).apply(this, arguments)); - } - - _createClass(ProductViewFilesTab, [{ - key: 'render', - value: function render() { - var _this22 = this; - - var filesDisplay = void 0; - var files = this.props.files.map(function (f, index) { - return React.createElement(ProductViewFilesTabItem, { - product: _this22.props.product, - key: index, - file: f - }); - }); - var summeryRow = productHelpers.getFilesSummary(this.props.files); - filesDisplay = React.createElement( - 'tbody', - null, - files, - React.createElement( - 'tr', - null, - React.createElement( - 'td', - null, - summeryRow.total, - ' files (0 archived)' - ), - React.createElement('td', null), - React.createElement('td', null), - React.createElement('td', null), - React.createElement('td', null), - React.createElement( - 'td', - null, - summeryRow.downloads - ), - React.createElement('td', null), - React.createElement( - 'td', - null, - appHelpers.getFileSize(summeryRow.fileSize) - ), - React.createElement('td', null), - React.createElement('td', null) - ) - ); - return React.createElement( - 'div', - { id: 'files-tab', className: 'product-tab' }, - React.createElement( - 'table', - { className: 'mdl-data-table mdl-js-data-table mdl-shadow--2dp' }, - React.createElement( - 'thead', - null, - React.createElement( - 'tr', - null, - React.createElement( - 'th', - { className: 'mdl-data-table__cell--non-numericm' }, - 'File' - ), - React.createElement( - 'th', - { className: 'mdl-data-table__cell--non-numericm' }, - 'Version' - ), - React.createElement( - 'th', - { className: 'mdl-data-table__cell--non-numericm' }, - 'Description' - ), - React.createElement( - 'th', - { className: 'mdl-data-table__cell--non-numericm' }, - 'Packagetype' - ), - React.createElement( - 'th', - { className: 'mdl-data-table__cell--non-numericm' }, - 'Architecture' - ), - React.createElement( - 'th', - { className: 'mdl-data-table__cell--non-numericm' }, - 'Downloads' - ), - React.createElement( - 'th', - { className: 'mdl-data-table__cell--non-numericm' }, - 'Date' - ), - React.createElement( - 'th', - { className: 'mdl-data-table__cell--non-numericm' }, - 'Filesize' - ), - React.createElement( - 'th', - { className: 'mdl-data-table__cell--non-numericm' }, - 'DL' - ), - React.createElement( - 'th', - { className: 'mdl-data-table__cell--non-numericm' }, - 'OCS-Install' - ) - ) - ), - filesDisplay - ) - ); - } - }]); - - return ProductViewFilesTab; -}(React.Component); - -var ProductViewFilesTabItem = function (_React$Component16) { - _inherits(ProductViewFilesTabItem, _React$Component16); - - function ProductViewFilesTabItem(props) { - _classCallCheck(this, ProductViewFilesTabItem); - - var _this23 = _possibleConstructorReturn(this, (ProductViewFilesTabItem.__proto__ || Object.getPrototypeOf(ProductViewFilesTabItem)).call(this, props)); - - _this23.state = { downloadLink: "" }; - return _this23; - } - - _createClass(ProductViewFilesTabItem, [{ - key: 'componentDidMount', - value: function componentDidMount() { - var baseUrl = void 0, - downloadLinkUrlAttr = void 0; - if (store.getState().env === 'live') { - baseUrl = 'opendesktop.org'; - downloadLinkUrlAttr = "https%3A%2F%dl.opendesktop.org%2Fapi%2F"; - } else { - baseUrl = 'pling.cc'; - downloadLinkUrlAttr = "https%3A%2F%2Fcc.ppload.com%2Fapi%2F"; - } - - var f = this.props.file; - var timestamp = Math.floor(new Date().getTime() / 1000 + 3600); - var fileDownloadHash = appHelpers.generateFileDownloadHash(f, store.getState().env); - var downloadLink = "https://" + baseUrl + "/p/" + this.props.product.project_id + "/startdownload?file_id=" + f.id + "&file_name=" + f.title + "&file_type=" + f.type + "&file_size=" + f.size + "&url=" + downloadLinkUrlAttr + "files%2Fdownload%2Fid%2F" + f.id + "%2Fs%2F" + fileDownloadHash + "%2Ft%2F" + timestamp + "%2Fu%2F" + this.props.product.member_id + "%2F" + f.title; - - this.setState({ downloadLink: downloadLink }); - } - }, { - key: 'render', - value: function render() { - var f = this.props.file; - return React.createElement( - 'tr', - null, - React.createElement( - 'td', - { className: 'mdl-data-table__cell--non-numericm' }, - React.createElement( - 'a', - { href: this.state.downloadLink }, - f.title - ) - ), - React.createElement( - 'td', - null, - f.version - ), - React.createElement( - 'td', - { className: 'mdl-data-table__cell--non-numericm' }, - f.description - ), - React.createElement( - 'td', - { className: 'mdl-data-table__cell--non-numericm' }, - f.packagename - ), - React.createElement( - 'td', - { className: 'mdl-data-table__cell--non-numericm' }, - f.archname - ), - React.createElement( - 'td', - null, - f.downloaded_count - ), - React.createElement( - 'td', - { className: 'mdl-data-table__cell--non-numericm' }, - appHelpers.getTimeAgo(f.created_timestamp) - ), - React.createElement( - 'td', - { className: 'mdl-data-table__cell--non-numericm' }, - appHelpers.getFileSize(f.size) - ), - React.createElement( - 'td', - null, - React.createElement( - 'a', - { href: this.state.downloadLink }, - React.createElement( - 'i', - { className: 'material-icons' }, - 'cloud_download' - ) - ) - ), - React.createElement( - 'td', - null, - f.ocs_compatible - ) - ); - } - }]); - - return ProductViewFilesTabItem; -}(React.Component); - -var ProductViewRatingsTab = function (_React$Component17) { - _inherits(ProductViewRatingsTab, _React$Component17); - - function ProductViewRatingsTab(props) { - _classCallCheck(this, ProductViewRatingsTab); - - var _this24 = _possibleConstructorReturn(this, (ProductViewRatingsTab.__proto__ || Object.getPrototypeOf(ProductViewRatingsTab)).call(this, props)); - - _this24.state = { - filter: 'active' - }; - _this24.filterLikes = _this24.filterLikes.bind(_this24); - _this24.filterDislikes = _this24.filterDislikes.bind(_this24); - _this24.filterActive = _this24.filterActive.bind(_this24); - _this24.setFilter = _this24.setFilter.bind(_this24); - return _this24; - } - - _createClass(ProductViewRatingsTab, [{ - key: 'filterLikes', - value: function filterLikes(rating) { - if (rating.user_like === "1") { - return rating; - } - } - }, { - key: 'filterDislikes', - value: function filterDislikes(rating) { - if (rating.user_dislike === "1") { - return rating; - } - } - }, { - key: 'filterActive', - value: function filterActive(rating) { - if (rating.rating_active === "1") { - return rating; - } - } - }, { - key: 'setFilter', - value: function setFilter(filter) { - this.setState({ filter: filter }); - } - }, { - key: 'render', - value: function render() { - var _this25 = this; - - var ratingsLikes = this.props.ratings.filter(this.filterLikes); - var ratingsDislikes = this.props.ratings.filter(this.filterDislikes); - var ratingsActive = this.props.ratings.filter(this.filterActive); - - var ratingsDisplay = void 0; - if (this.props.ratings.length > 0) { - - var ratings = void 0; - if (this.state.filter === "all") { - ratings = this.props.ratings; - } else if (this.state.filter === "active") { - ratings = ratingsActive; - } else if (this.state.filter === "dislikes") { - ratings = ratingsDislikes; - } else if (this.state.filter === "likes") { - ratings = ratingsLikes; - } - - var ratingsItems = ratings.map(function (r, index) { - return React.createElement(RatingItem, { - key: index, - rating: r - }); - }); - - ratingsDisplay = React.createElement( - 'div', - { className: 'product-ratings-list comment-list' }, - ratingsItems - ); - } - var subMenuItemClassName = " mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect"; - var subMenuActiveItemClassName = "active mdl-button--colored mdl-color--primary item"; - return React.createElement( - 'div', - { id: 'ratings-tab', className: 'product-tab' }, - React.createElement( - 'div', - { className: 'ratings-filters-menu' }, - React.createElement( - 'span', - { className: 'btn-container', onClick: function onClick() { - return _this25.setFilter("dislikes"); - } }, - React.createElement( - 'a', - { className: this.state.filter === "dislikes" ? subMenuActiveItemClassName + subMenuItemClassName : subMenuItemClassName, onClick: this.showDislikes }, - 'show dislikes (', - ratingsDislikes.length, - ')' - ) - ), - React.createElement( - 'span', - { className: 'btn-container', onClick: function onClick() { - return _this25.setFilter("likes"); - } }, - React.createElement( - 'a', - _defineProperty({ onClick: this.setDislikesFilter, className: this.state.filter === "likes" ? subMenuActiveItemClassName + subMenuItemClassName : subMenuItemClassName }, 'onClick', this.showLikes), - 'show likes (', - ratingsLikes.length, - ')' - ) - ), - React.createElement( - 'span', - { className: 'btn-container', onClick: function onClick() { - return _this25.setFilter("active"); - } }, - React.createElement( - 'a', - _defineProperty({ onClick: this.setDislikesFilter, className: this.state.filter === "active" ? subMenuActiveItemClassName + subMenuItemClassName : subMenuItemClassName }, 'onClick', this.showActive), - 'show active reviews (', - ratingsActive.length, - ')' - ) - ), - React.createElement( - 'span', - { className: 'btn-container', onClick: function onClick() { - return _this25.setFilter("all"); - } }, - React.createElement( - 'a', - _defineProperty({ onClick: this.setDislikesFilter, className: this.state.filter === "all" ? subMenuActiveItemClassName + subMenuItemClassName : subMenuItemClassName }, 'onClick', this.showAll), - 'show all (', - this.props.ratings.length, - ')' - ) - ) - ), - ratingsDisplay - ); - } - }]); - - return ProductViewRatingsTab; -}(React.Component); - -var mapStateToProductViewRatingsTabProps = function mapStateToProductViewRatingsTabProps(state) { - var ratings = state.product.r_ratings; - return { - ratings: ratings - }; -}; - -var mapDispatchToProductViewRatingsTabProps = function mapDispatchToProductViewRatingsTabProps(dispatch) { - return { - dispatch: dispatch - }; -}; - -var ProductViewRatingsTabWrapper = ReactRedux.connect(mapStateToProductViewRatingsTabProps, mapDispatchToProductViewRatingsTabProps)(ProductViewRatingsTab); - -var RatingItem = function (_React$Component18) { - _inherits(RatingItem, _React$Component18); - - function RatingItem(props) { - _classCallCheck(this, RatingItem); - - var _this26 = _possibleConstructorReturn(this, (RatingItem.__proto__ || Object.getPrototypeOf(RatingItem)).call(this, props)); - - _this26.state = {}; - return _this26; - } - - _createClass(RatingItem, [{ - key: 'render', - value: function render() { - return React.createElement( - 'div', - { className: 'product-rating-item comment-item' }, - React.createElement( - 'div', - { className: 'rating-user-avatar comment-user-avatar' }, - React.createElement('img', { src: this.props.rating.profile_image_url }) - ), - React.createElement( - 'div', - { className: 'rating-item-content comment-item-content' }, - React.createElement( - 'div', - { className: 'rating-item-header comment-item-header' }, - React.createElement( - 'a', - { href: "/member/" + this.props.rating.member_id }, - this.props.rating.username - ), - React.createElement( - 'span', - { className: 'comment-created-at' }, - appHelpers.getTimeAgo(this.props.rating.created_at) - ) - ), - React.createElement( - 'div', - { className: 'rating-item-text comment-item-text' }, - this.props.rating.comment_text - ) - ) - ); - } - }]); - - return RatingItem; -}(React.Component); - -var ProductViewFavTab = function (_React$Component19) { - _inherits(ProductViewFavTab, _React$Component19); - - function ProductViewFavTab(props) { - _classCallCheck(this, ProductViewFavTab); - - var _this27 = _possibleConstructorReturn(this, (ProductViewFavTab.__proto__ || Object.getPrototypeOf(ProductViewFavTab)).call(this, props)); - - _this27.state = {}; - return _this27; - } - - _createClass(ProductViewFavTab, [{ - key: 'render', - value: function render() { - var favsDisplay = void 0; - if (this.props.likes) { - var favs = this.props.likes.map(function (like, index) { - return React.createElement(UserCardItem, { - key: index, - like: like - }); - }); - favsDisplay = React.createElement( - 'div', - { className: 'favs-list supporter-list' }, - favs - ); - } - return React.createElement( - 'div', - { className: 'product-tab', id: 'fav-tab' }, - favsDisplay - ); - } - }]); - - return ProductViewFavTab; -}(React.Component); - -var ProductViewPlingsTab = function (_React$Component20) { - _inherits(ProductViewPlingsTab, _React$Component20); - - function ProductViewPlingsTab(props) { - _classCallCheck(this, ProductViewPlingsTab); - - var _this28 = _possibleConstructorReturn(this, (ProductViewPlingsTab.__proto__ || Object.getPrototypeOf(ProductViewPlingsTab)).call(this, props)); - - _this28.state = {}; - return _this28; - } - - _createClass(ProductViewPlingsTab, [{ - key: 'render', - value: function render() { - var plingsDisplay = void 0; - if (this.props.plings) { - var plings = this.props.plings.map(function (pling, index) { - return React.createElement(UserCardItem, { - key: index, - pling: pling - }); - }); - plingsDisplay = React.createElement( - 'div', - { className: 'plings-list supporter-list' }, - plings - ); - } - return React.createElement( - 'div', - { className: 'product-tab', id: 'plings-tab' }, - plingsDisplay - ); - } - }]); - - return ProductViewPlingsTab; -}(React.Component); - -var UserCardItem = function (_React$Component21) { - _inherits(UserCardItem, _React$Component21); - - function UserCardItem(props) { - _classCallCheck(this, UserCardItem); - - var _this29 = _possibleConstructorReturn(this, (UserCardItem.__proto__ || Object.getPrototypeOf(UserCardItem)).call(this, props)); - - _this29.state = {}; - return _this29; - } - - _createClass(UserCardItem, [{ - key: 'render', - value: function render() { - var item = void 0; - if (this.props.like) { - item = this.props.like; - } else if (this.props.pling) { - item = this.props.pling; - } - - var cardTypeDisplay = void 0; - if (this.props.like) { - cardTypeDisplay = React.createElement('i', { className: 'fa fa-heart myfav', 'aria-hidden': 'true' }); - } else if (this.props.pling) { - cardTypeDisplay = React.createElement('img', { src: '/images/system/pling-btn-active.png' }); - } - - return React.createElement( - 'div', - { className: 'supporter-list-item' }, - React.createElement( - 'div', - { className: 'item-content' }, - React.createElement( - 'div', - { className: 'user-avatar' }, - React.createElement('img', { src: item.profile_image_url }) - ), - React.createElement( - 'span', - { className: 'username' }, - React.createElement( - 'a', - { href: "/member/" + item.member_id }, - item.username - ) - ), - React.createElement( - 'span', - { className: 'card-type-holder' }, - cardTypeDisplay - ), - React.createElement( - 'span', - { className: 'created-at' }, - appHelpers.getTimeAgo(item.created_at) - ) - ) - ); - } - }]); - - return UserCardItem; -}(React.Component); -"use strict"; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _ReactRedux = ReactRedux, - Provider = _ReactRedux.Provider, - connect = _ReactRedux.connect; - -var store = Redux.createStore(reducer); - -var App = function (_React$Component) { - _inherits(App, _React$Component); - - function App(props) { - _classCallCheck(this, App); - - var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, props)); - - _this.state = { - loading: true, - version: 1 - }; - _this.updateDimensions = _this.updateDimensions.bind(_this); - return _this; - } - - _createClass(App, [{ - key: "componentWillMount", - value: function componentWillMount() { - // device - this.updateDimensions(); - } - }, { - key: "componentDidMount", - value: function componentDidMount() { - - // domain - store.dispatch(setDomain(window.location.hostname)); - - // env - var env = appHelpers.getEnv(window.location.hostname); - store.dispatch(setEnv(env)); - - // device - window.addEventListener("resize", this.updateDimensions); - - // view - if (window.view) store.dispatch(setView(view)); - - // products - if (window.products) { - store.dispatch(setProducts(products)); - } - - // product (single) - if (window.product) { - store.dispatch(setProduct(product)); - store.dispatch(setProductFiles(filesJson)); - store.dispatch(setProductUpdates(updatesJson)); - store.dispatch(setProductRatings(ratingsJson)); - store.dispatch(setProductLikes(likeJson)); - store.dispatch(setProductPlings(projectplingsJson)); - store.dispatch(setProductUserRatings(ratingOfUserJson)); - store.dispatch(setProductGallery(galleryPicturesJson)); - store.dispatch(setProductComments(commentsJson)); - store.dispatch(setProductOrigins(originsJson)); - store.dispatch(setProductRelated(relatedJson)); - store.dispatch(setProductMoreProducts(moreProductsJson)); - store.dispatch(setProductMoreProductsOtherUsers(moreProductsOfOtherUsrJson)); - store.dispatch(setProductTags(tagsuserJson, tagssystemJson)); - } - - // pagination - if (window.pagination) { - store.dispatch(setPagination(pagination)); - } - - // filters - if (window.filters) { - store.dispatch(setFilters(filters)); - } - - // top products - if (window.topProducts) { - store.dispatch(setTopProducts(topProducts)); - } - - // categories - if (window.categories) { - // set categories - store.dispatch(setCategories(categories)); - if (window.catId) { - // current categories - var currentCategories = categoryHelpers.findCurrentCategories(categories, catId); - store.dispatch(setCurrentCategory(currentCategories.category)); - store.dispatch(setCurrentSubCategory(currentCategories.subcategory)); - store.dispatch(setCurrentSecondSubCategory(currentCategories.secondSubCategory)); - } - } - - // supporters - if (window.supporters) { - store.dispatch(setSupporters(supporters)); - } - - // comments - if (window.comments) { - store.dispatch(setComments(comments)); - } - - // user - if (window.user) { - store.dispatch(setUser(user)); - } - - // finish loading - this.setState({ loading: false }); - } - }, { - key: "componentWillUnmount", - value: function componentWillUnmount() { - // device - window.removeEventListener("resize", this.updateDimensions); - } - }, { - key: "updateDimensions", - value: function updateDimensions() { - var device = appHelpers.getDeviceWidth(window.innerWidth); - store.dispatch(setDevice(device)); - } - }, { - key: "render", - value: function render() { - var displayView = React.createElement(HomePageWrapper, null); - if (store.getState().view === 'explore') { - displayView = React.createElement(ExplorePageWrapper, null); - } else if (store.getState().view === 'product') { - displayView = React.createElement(ProductViewWrapper, null); - } - return React.createElement( - "div", - { id: "app-root" }, - displayView - ); - } - }]); - - return App; -}(React.Component); - -var AppWrapper = function (_React$Component2) { - _inherits(AppWrapper, _React$Component2); - - function AppWrapper() { - _classCallCheck(this, AppWrapper); - - return _possibleConstructorReturn(this, (AppWrapper.__proto__ || Object.getPrototypeOf(AppWrapper)).apply(this, arguments)); - } - - _createClass(AppWrapper, [{ - key: "render", - value: function render() { - return React.createElement( - Provider, - { store: store }, - React.createElement(App, null) - ); - } - }]); - - return AppWrapper; -}(React.Component); - -ReactDOM.render(React.createElement(AppWrapper, null), document.getElementById('explore-content')); diff --git a/httpdocs/theme/react/assets/css/carousel.css b/httpdocs/theme/react/assets/css/carousel.css index 2f4e3b0bb..0bae20327 100644 --- a/httpdocs/theme/react/assets/css/carousel.css +++ b/httpdocs/theme/react/assets/css/carousel.css @@ -1 +1 @@ -.score-info{text-align:center}.score-info .score-number{width:100%;text-align:center;margin-bottom:5px}.score-info .score-bar-container{width:100%;height:10px;background:#ccc;margin-bottom:5px}.score-info .score-bar-container .score-bar{height:9px;background-color:#30c830;border-bottom:1px solid #2bb32b}#carousel-module-container{width:100%;float:left;position:relative}#carousel-module-container #carousels-module{width:100%;float:left;position:relative}#carousel-module-container .container{width:100% !important;max-width:100% !important;padding:0}#carousel-module-container .product-carousel{padding-bottom:10px;border-bottom:0 solid #ccc}#carousel-module-container .product-carousel .product-carousel-header{height:auto;overflow:auto;width:100%}#carousel-module-container .product-carousel .product-carousel-header h2{font-size:25px !important;float:left;display:block;width:auto;padding-right:20px;position:relative;width:auto !important;margin-bottom:20px;line-height:30px}#carousel-module-container .product-carousel .product-carousel-header h2 a{color:#007aa6}#carousel-module-container .product-carousel .product-carousel-header h2 i,#carousel-module-container .product-carousel .product-carousel-header h2 span.glyphicon{display:inline-block;position:absolute;right:0;top:8px;font-size:16px}#carousel-module-container .product-carousel .product-carousel-wrapper{width:100%;height:120px;position:relative}#carousel-module-container .product-carousel .product-carousel-wrapper .product-carousel-left{position:absolute;top:0;left:0;height:100%}#carousel-module-container .product-carousel .product-carousel-wrapper .product-carousel-right{right:0;position:absolute;top:0;width:10px;height:100%}#carousel-module-container .product-carousel .product-carousel-wrapper .carousel-arrow{position:absolute;top:50%;width:50px;height:50px;margin-top:-35px;border-radius:100%;border:1px solid #ccc;background-color:white;z-index:10;margin-left:-25px;cursor:pointer;opacity:1 !important;-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;-o-transition:all .2s ease-out;transition:all .2s ease-out}#carousel-module-container .product-carousel .product-carousel-wrapper .carousel-arrow i,#carousel-module-container .product-carousel .product-carousel-wrapper .carousel-arrow span.glyphicon{position:absolute;top:50%;left:50%;margin-left:-7px;margin-top:-7px;color:#2673b0}#carousel-module-container .product-carousel .product-carousel-wrapper .carousel-arrow:active{background-color:#e6e6e6}#carousel-module-container .product-carousel .product-carousel-wrapper .carousel-arrow.disabled{color:darkgray}#carousel-module-container .product-carousel .product-carousel-wrapper:hover .carousel-arrow{opacity:1}#carousel-module-container .product-carousel .product-carousel-container{width:100%;overflow:hidden;position:relative;height:120px}#carousel-module-container .product-carousel .product-carousel-container .product-carousel-slider{position:absolute;top:0;left:0;height:120px;-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;-o-transition:all .2s ease-out;transition:all .2s ease-out}#carousel-module-container .product-carousel .product-carousel-container .product-carousel-item{float:left;height:120px}#carousel-module-container .product-carousel .product-carousel-container .product-carousel-item figure{margin:0;width:100%;float:left;margin-bottom:10px}#carousel-module-container .product-carousel .product-carousel-container .product-carousel-item figure img{height:48px;width:48px;float:left}#carousel-module-container .product-carousel .product-carousel-container .product-carousel-item .product-info span{display:block;float:left;width:100%;line-height:14px;height:auto}#carousel-module-container .product-carousel .product-carousel-container .product-carousel-item .product-info span.product-info-title{color:#007aa6;display:block}#carousel-module-container .product-carousel .product-carousel-container .product-carousel-item .product-info span.product-info-user{color:#666}#carousel-module-container .product-carousel.one .product-carousel-container .product-carousel-item .product-info span{height:22px;line-height:22px}#carousel-module-container .product-carousel.one .product-carousel-container .product-carousel-item .product-info span.product-info-title{text-overflow:ellipsis;word-break:break-word;overflow:hidden;white-space:nowrap;padding-right:20px;font-size:16px}#carousel-module-container .product-carousel.one .product-carousel-container .product-carousel-item .product-info span.product-info-user{font-size:15px}#carousel-module-container .product-carousel.two .product-carousel-wrapper{height:220px}#carousel-module-container .product-carousel.two .product-carousel-container{height:inherit !important}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider{height:inherit !important}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item{padding:10px;height:inherit !important}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-carousel-item-wrapper{width:100%;height:100%;border:1px solid #ccc;border-radius:5px;position:relative}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item a{display:block;width:100%;height:inherit !important}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item figure{border-bottom:1px solid #ccc;margin-bottom:0;height:50%;overflow:hidden;position:absolute;top:0;left:0;width:100%}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item figure img{height:100%;width:100%}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-info{height:100%;padding:5px;font-size:14px;position:relative}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-info span{color:#888;font-size:12px}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-info span.product-info-title{max-height:37px;overflow:hidden;margin-bottom:5px;color:#007aa6}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-info .score-info{position:absolute;bottom:5px;width:40%;right:5px}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-info .score-info .score-number{margin-bottom:2px;font-size:11px;line-height:12px;color:#2673b0}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-info .plings{position:absolute;bottom:5px;left:5px}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-info .plings img{width:20px;height:20px}#carousel-module-container.app-images-hub{float:none;margin:0 auto;padding:0 10px} \ No newline at end of file +.score-info{text-align:center}.score-info .score-number{width:100%;text-align:center;margin-bottom:5px}.score-info .score-bar-container{width:100%;height:10px;background:#ccc;margin-bottom:5px}.score-info .score-bar-container .score-bar{height:9px;background-color:#30c830;border-bottom:1px solid #2bb32b}#carousel-module-container{width:100%;float:left;position:relative}#carousel-module-container #carousels-module{width:100%;float:left;position:relative}#carousel-module-container .container{width:100% !important;max-width:100% !important;padding:0}#carousel-module-container .product-carousel{padding-bottom:10px;border-bottom:0 solid #ccc}#carousel-module-container .product-carousel .product-carousel-header{height:auto;overflow:auto;width:100%}#carousel-module-container .product-carousel .product-carousel-header h2{font-size:25px !important;float:left;display:block;width:auto;padding-right:20px;position:relative;width:auto !important;margin-bottom:20px;line-height:30px}#carousel-module-container .product-carousel .product-carousel-header h2 a{color:#007aa6}#carousel-module-container .product-carousel .product-carousel-header h2 i,#carousel-module-container .product-carousel .product-carousel-header h2 span.glyphicon{display:inline-block;position:absolute;right:0;top:8px;font-size:16px}#carousel-module-container .product-carousel .product-carousel-wrapper{width:100%;height:120px;position:relative}#carousel-module-container .product-carousel .product-carousel-wrapper .product-carousel-left{position:absolute;top:0;left:0;height:100%}#carousel-module-container .product-carousel .product-carousel-wrapper .product-carousel-right{right:0;position:absolute;top:0;width:10px;height:100%}#carousel-module-container .product-carousel .product-carousel-wrapper .carousel-arrow{position:absolute;top:50%;width:50px;height:50px;margin-top:-35px;border-radius:100%;border:1px solid #ccc;background-color:white;z-index:10;margin-left:-25px;cursor:pointer;opacity:1 !important;-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;-o-transition:all .2s ease-out;transition:all .2s ease-out}#carousel-module-container .product-carousel .product-carousel-wrapper .carousel-arrow i,#carousel-module-container .product-carousel .product-carousel-wrapper .carousel-arrow span.glyphicon{position:absolute;top:50%;left:50%;margin-left:-7px;margin-top:-7px;color:#2673b0}#carousel-module-container .product-carousel .product-carousel-wrapper .carousel-arrow:active{background-color:#e6e6e6}#carousel-module-container .product-carousel .product-carousel-wrapper .carousel-arrow.disabled{color:darkgray}#carousel-module-container .product-carousel .product-carousel-wrapper:hover .carousel-arrow{opacity:1}#carousel-module-container .product-carousel .product-carousel-container{width:100%;overflow:hidden;position:relative;height:120px}#carousel-module-container .product-carousel .product-carousel-container .product-carousel-slider{position:absolute;top:0;left:0;height:120px;-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;-o-transition:all .2s ease-out;transition:all .2s ease-out}#carousel-module-container .product-carousel .product-carousel-container .product-carousel-item{float:left;height:120px}#carousel-module-container .product-carousel .product-carousel-container .product-carousel-item figure{margin:0;width:100%;float:left;margin-bottom:10px}#carousel-module-container .product-carousel .product-carousel-container .product-carousel-item figure img{height:48px;width:48px;float:left}#carousel-module-container .product-carousel .product-carousel-container .product-carousel-item .product-info span{display:block;float:left;width:100%;line-height:14px;height:auto}#carousel-module-container .product-carousel .product-carousel-container .product-carousel-item .product-info span.product-info-title{color:#007aa6;display:block}#carousel-module-container .product-carousel .product-carousel-container .product-carousel-item .product-info span.product-info-user{color:#666}#carousel-module-container .product-carousel.one .product-carousel-container .product-carousel-item .product-info span{height:22px;line-height:22px}#carousel-module-container .product-carousel.one .product-carousel-container .product-carousel-item .product-info span.product-info-title{text-overflow:ellipsis;word-break:break-word;overflow:hidden;white-space:nowrap;padding-right:20px;font-size:16px}#carousel-module-container .product-carousel.one .product-carousel-container .product-carousel-item .product-info span.product-info-user{font-size:15px}#carousel-module-container .product-carousel.two .product-carousel-wrapper{height:220px}#carousel-module-container .product-carousel.two .product-carousel-container{height:inherit !important}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider{height:inherit !important}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item{padding:10px;height:inherit !important}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-carousel-item-wrapper{width:100%;height:100%;border:1px solid #ccc;border-radius:5px;position:relative}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item a{display:block;width:100%;height:inherit !important}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item figure{border-bottom:1px solid #ccc;margin-bottom:0;height:50%;overflow:hidden;position:absolute;top:0;left:0;width:100%}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item figure img{height:100%;width:100%}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-info{height:100%;padding:5px;font-size:14px;position:relative}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-info span{color:#888;font-size:12px}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-info span.product-info-title{max-height:37px;overflow:hidden;margin-bottom:5px;color:#007aa6}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-info .score-info{position:absolute;bottom:5px;width:40%;right:5px}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-info .score-info .score-number{margin-bottom:2px;font-size:11px;line-height:12px;color:#2673b0}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-info .plings{position:absolute;bottom:5px;left:5px}#carousel-module-container .product-carousel.two .product-carousel-container .product-carousel-slider .product-carousel-item .product-info .plings img{width:20px;height:20px}#carousel-module-container.app-images-hub{float:none;margin:0 auto;padding:0 10px;display:none !important} \ No newline at end of file diff --git a/httpdocs/theme/react/assets/css/pling-section.css b/httpdocs/theme/react/assets/css/pling-section.css index 54df16b9e..6dabfa544 100644 --- a/httpdocs/theme/react/assets/css/pling-section.css +++ b/httpdocs/theme/react/assets/css/pling-section.css @@ -1 +1 @@ -#pling-section-content{width:100%;height:100%;display:flex;flex-flow:column nowrap}#pling-section-content a{cursor:pointer}#pling-section-content h1{text-align:center}#pling-section-content h2.focused{text-decoration:underline}#pling-section-content .pling-section-header{width:100%;height:300px;background-color:#f1f1f1;display:flex;justify-content:center;flex-flow:column nowrap;font-size:32px}#pling-section-content .pling-section-header>div{text-align:center}#pling-section-content .pling-section-header .score-container>span{font-size:small;font-weight:bold;padding:5px}#pling-section-content .pling-section-header .score-container .score-bar-container{width:300px;height:20px;background:#ccc;margin-bottom:5px;display:inline-block;font-size:small}#pling-section-content .pling-section-header .score-container .score-bar-container .score-bar{height:20px;background-color:#286090;border-bottom:0 solid #22537c;color:#fff}#pling-section-content .supporters-container>ul{list-style:none;padding:0}#pling-section-content .supporters-container>ul>li{margin:3px;display:inline-block;float:left}#pling-section-content .supporters-container>ul>li img{width:100px;height:100px}#pling-section-content .supporters-container>ul>li .username{background-color:#282C34;color:#fff;text-align:center;font-size:small;padding:3px;max-width:100px}#pling-section-content .pling-section-tabs{display:block;margin:0 auto}#pling-section-content .pling-section-detail{display:flex;width:1200px;margin:0 auto;flex-flow:row wrap}#pling-section-content .pling-section-detail .pling-section-detail-left{width:200px;text-align:right}#pling-section-content .pling-section-detail .pling-section-detail-left ul.pling-section-detail-ul{list-style-type:none;padding:0px}#pling-section-content .pling-section-detail .pling-section-detail-left ul.pling-section-detail-ul li{margin:5px}#pling-section-content .pling-section-detail .pling-section-detail-right{width:200px;margin:5px}#pling-section-content .pling-section-detail .pling-section-detail-right .btnSupporter{-moz-box-align:center;align-items:center;backface-visibility:hidden;background-color:#286090;border-radius:9999px;border:medium none;box-sizing:border-box;color:#fff !important;display:inline-flex;font-size:1.4rem !important;font-weight:800;height:unset;-moz-box-pack:center;justify-content:center;padding:.875rem 1.5rem;position:relative;pointer-events:unset;text-align:center;text-decoration:none;text-transform:none;transition:all 300ms cubic-bezier(.19, 1, .22, 1) 0s;-moz-user-select:none;white-space:unset;width:100%}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container{border-color:#e5e3dd;border-style:solid;border-width:1px;border-radius:4px;box-shadow:none;background-color:#fff;overflow:hidden;font-size:small;margin-top:10px}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tiers{display:block;padding:1rem;margin:0rem;border-bottom:1px solid #e5e3dd;-moz-box-align:center;align-items:center;place-content:flex-start space-between;box-sizing:border-box;display:flex;flex-flow:row nowrap;-moz-box-pack:justify;transition:all 300ms cubic-bezier(.19, 1, .22, 1) 0s}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tiers h5{color:#241e12;font-family:aktiv-grotesk,sans-serif;font-weight:700 !important;margin:0px;position:relative;text-transform:uppercase;transition:all 300ms cubic-bezier(.19, 1, .22, 1) 0s;font-size:.875rem !important;line-height:1.5 !important}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tier-container{box-sizing:border-box;transition:all 300ms cubic-bezier(.19, 1, .22, 1) 0s;padding:1rem;margin:0rem;border-bottom:1px solid #e5e3dd;text-align:center}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tier-container span{display:inline-block}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tier-container ul{list-style-type:none;padding:0px;display:inline-block}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tier-container ul li{float:left;margin:2px}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tier-container ul li img{width:25px;height:25px}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tier-container .join{display:flex;justify-content:center;flex-flow:column}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tier-container .join input.free-amount{opacity:.95;margin-top:-8px;color:#000;font-size:18px;width:40px;margin:0;margin-top:0px;margin-top:0;border:0;border-bottom-color:currentcolor;border-bottom-style:none;border-bottom-width:0px;border-bottom:1px solid #d0d0d0;padding:0;box-shadow:none;background:none}#pling-section-content .pling-section-detail .pling-section-detail-middle{flex:2 0px;padding:10px 20px;display:flex;justify-content:center}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer{border:1px solid #ccc;border-radius:5px;background-image:url(../img/home/back3.jpg);padding:8px;margin:0px 5px 5px 0;width:320px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer div.title{font-size:11pt;font-weight:bold;border-bottom:1px solid #ccc;height:20px;padding-left:5px;margin-bottom:10px;color:#888888;font-size:9pt}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol{list-style:none;padding-left:5px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li{padding:5px 0px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .creatorrow,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .creatorrow{font-size:small}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .creatorrow figure img,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .creatorrow figure img{width:100px;height:100px;border:1px solid #dbdbdb;-webkit-border-radius:999px;-moz-border-radius:999px;border-radius:999px;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .creatorrow .userinfo .userinfo-title,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .creatorrow .userinfo .userinfo-title{font-weight:bold}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .creatorrow .userinfo ul.userinfo-detail li,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .creatorrow .userinfo ul.userinfo-detail li{padding:1px 2px;border:0px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow{padding-bottom:5px;padding-top:5px;font-size:small}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .rating,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .rating{width:60px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .time,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .time{font-size:smaller}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .cntComments,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .cntComments{font-size:smaller;display:block;padding-top:5px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .defaultProjectAvatar,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .defaultProjectAvatar{width:50px;height:50px;color:#3B658A;line-height:50px;text-align:center;background-color:#e8eaf6}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .productimg,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .productimg{width:50px;height:50px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .product-user,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .product-user{width:42px;height:42px;border-radius:100%}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .commenttext,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .commenttext{padding-left:20px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .product-info span,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .product-info span{display:block;float:left;width:100%;line-height:14px;height:auto}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .product-info span.product-info-title,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .product-info span.product-info-title{color:#444444;font-size:10pt;font-weight:bold;display:block}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .product-info span.product-info-date,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .product-info span.product-info-date{padding-top:10px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .product-info span.product-info-user,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .product-info span.product-info-user{color:#666}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .score-info,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .score-info{text-align:center;width:80%}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .score-info .score-number,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .score-info .score-number{width:100%;text-align:center;margin-bottom:0px;font-size:8pt}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .score-info .score-bar-container,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .score-info .score-bar-container{width:100%;height:10px;background:#ccc;margin-bottom:5px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .score-info .score-bar-container .score-bar,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .score-info .score-bar-container .score-bar{height:9px;background-color:#30c830;border-bottom:1px solid #2bb32b}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .title,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .title,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .info-row,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .info-row{display:block;width:100%;color:#777777}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .title,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .title{color:#444444;font-size:10pt;font-weight:bold}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .content,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .content{font-size:13px;line-height:1}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .info-row span.comment-counter,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .info-row span.comment-counter{float:right}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li+li,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li+li{border-top:1px solid #ccc}#pling-section-content .pling-section-detail .pling-section-detail-middle #recentplinged-list .product-wrap{float:left;width:100%;padding:.3em;border:.35em solid #dee0e0;border-radius:5px;height:14em;margin-bottom:1em;background:white;width:115px;height:200px;margin-right:10px;-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;-ms-transition:all .2s ease-out;-o-transition:all .2s ease-out;text-align:center;position:relative;padding-top:50px}#pling-section-content .pling-section-detail .pling-section-detail-middle #recentplinged-list .product-wrap figure{padding:.25em;border:1px solid #dbdbdb;background:#f6f6f6;border-radius:999px;width:50px}#pling-section-content .pling-section-detail .pling-section-detail-middle #recentplinged-list .product-wrap figure img{width:40px;height:40px;border:1px solid #dbdbdb;-webkit-border-radius:999px;-moz-border-radius:999px;border-radius:999px;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}#pling-section-content .pling-section-detail .pling-section-detail-middle #recentplinged-list .product-wrap h3{font-size:13px;font-weight:normal;word-wrap:break-word;line-height:15px;padding:0;margin:0}#pling-section-content .pling-section-detail .pling-section-detail-middle #recentplinged-list .product-wrap span.small{font-size:13px;color:#444;position:absolute;bottom:5px;right:5px}#pling-section-content .pling-section-detail .pling-section-detail-middle #recentplinged-list .product-wrap div.projecttitle{font-size:11px}#pling-section-content .pling-section-detail .pling-section-detail-middle #recentplinged-list .product-wrap span.rank{font-size:14px;position:absolute;bottom:5px;left:5px;color:#444;font-weight:bold} \ No newline at end of file +#pling-section-content{width:100%;height:100%;display:flex;flex-flow:column nowrap}#pling-section-content a{cursor:pointer}#pling-section-content h1{text-align:center}#pling-section-content h2.focused{text-decoration:underline}#pling-section-content .pling-section-header{width:100%;height:300px;background-color:#f1f1f1;display:flex;justify-content:center;flex-flow:column nowrap;font-size:32px}#pling-section-content .pling-section-header>div{text-align:center}#pling-section-content .pling-section-header .score-container>span{font-size:small;font-weight:bold;padding:5px}#pling-section-content .pling-section-header .score-container .score-bar-container{width:300px;height:20px;background:#ccc;margin-bottom:5px;display:inline-block;font-size:small}#pling-section-content .pling-section-header .score-container .score-bar-container .score-bar{height:20px;background-color:#286090;border-bottom:0 solid #22537c;color:#fff}#pling-section-content .supporters-container>ul{list-style:none;padding:0}#pling-section-content .supporters-container>ul>li{margin:3px;display:inline-block;float:left}#pling-section-content .supporters-container>ul>li img{width:100px;height:100px}#pling-section-content .supporters-container>ul>li .username{background-color:#282C34;color:#fff;text-align:center;font-size:small;padding:3px;max-width:100px}#pling-section-content .pling-section-tabs{display:block;margin:0 auto}#pling-section-content .pling-section-detail{display:flex;width:1200px;margin:0 auto;flex-flow:row wrap}#pling-section-content .pling-section-detail .pling-section-detail-left{width:200px;text-align:right}#pling-section-content .pling-section-detail .pling-section-detail-left ul.pling-section-detail-ul{list-style-type:none;padding:0px}#pling-section-content .pling-section-detail .pling-section-detail-left ul.pling-section-detail-ul li{margin:5px}#pling-section-content .pling-section-detail .pling-section-detail-right{width:200px;margin:5px}#pling-section-content .pling-section-detail .pling-section-detail-right .btnSupporter{-moz-box-align:center;align-items:center;backface-visibility:hidden;background-color:#286090;border-radius:9999px;border:medium none;box-sizing:border-box;color:#fff !important;display:inline-flex;font-size:1.4rem !important;font-weight:800;height:unset;-moz-box-pack:center;justify-content:center;padding:.875rem 1.5rem;position:relative;pointer-events:unset;text-align:center;text-decoration:none;text-transform:none;transition:all 300ms cubic-bezier(.19, 1, .22, 1) 0s;-moz-user-select:none;white-space:unset;width:100%}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container{border-color:#e5e3dd;border-style:solid;border-width:1px;border-radius:4px;box-shadow:none;background-color:#fff;overflow:hidden;font-size:small;margin-top:10px}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tiers{display:block;padding:1rem;margin:0rem;border-bottom:1px solid #e5e3dd;-moz-box-align:center;align-items:center;place-content:flex-start space-between;box-sizing:border-box;display:flex;flex-flow:row nowrap;-moz-box-pack:justify;transition:all 300ms cubic-bezier(.19, 1, .22, 1) 0s}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tiers h5{color:#241e12;font-family:aktiv-grotesk,sans-serif;font-weight:700 !important;margin:0px;position:relative;text-transform:uppercase;transition:all 300ms cubic-bezier(.19, 1, .22, 1) 0s;font-size:.875rem !important;line-height:1.5 !important}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tier-container{box-sizing:border-box;transition:all 300ms cubic-bezier(.19, 1, .22, 1) 0s;padding:1rem;margin:0rem;border-bottom:1px solid #e5e3dd;text-align:center}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tier-container span{display:inline-block}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tier-container ul{list-style-type:none;padding:0px;display:inline-block}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tier-container ul li{float:left;margin:2px}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tier-container ul li img{width:25px;height:25px}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tier-container .join{display:flex;justify-content:center;flex-flow:column}#pling-section-content .pling-section-detail .pling-section-detail-right .support-container .tier-container .join input.free-amount{opacity:.95;margin-top:-8px;color:#000;font-size:18px;width:40px;margin:0;margin-top:0px;margin-top:0;border:0;border-bottom-color:currentcolor;border-bottom-style:none;border-bottom-width:0px;border-bottom:1px solid #d0d0d0;padding:0;box-shadow:none;background:none}#pling-section-content .pling-section-detail .pling-section-detail-middle{flex:2 0px;padding:10px 20px;display:flex;justify-content:center}#pling-section-content .pling-section-detail .pling-section-detail-middle span.colorGrey{color:#ccc}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer{border:1px solid #ccc;border-radius:5px;background-image:url(../img/home/back3.jpg);padding:8px;margin:0px 5px 5px 0;width:320px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer div.title{font-size:11pt;font-weight:bold;border-bottom:1px solid #ccc;height:20px;padding-left:5px;margin-bottom:10px;color:#888888;font-size:9pt}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol{list-style:none;padding-left:5px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li{padding:5px 0px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .creatorrow,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .creatorrow{padding-bottom:5px;padding-top:5px;font-size:small}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .creatorrow figure img,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .creatorrow figure img{width:50px;height:50px;border:1px solid #dbdbdb;-webkit-border-radius:999px;-moz-border-radius:999px;border-radius:999px;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .creatorrow .userinfo .userinfo-title,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .creatorrow .userinfo .userinfo-title{font-weight:bold}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .creatorrow .userinfo ul.userinfo-detail li,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .creatorrow .userinfo ul.userinfo-detail li{padding:1px 2px;border:0px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow{padding-bottom:5px;padding-top:5px;font-size:small}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .rating,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .rating{width:60px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .time,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .time{font-size:smaller}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .cntComments,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .cntComments{font-size:smaller;display:block;padding-top:5px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .defaultProjectAvatar,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .defaultProjectAvatar{width:50px;height:50px;color:#3B658A;line-height:50px;text-align:center;background-color:#e8eaf6}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .productimg,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .productimg{width:50px;height:50px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .product-user,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .product-user{width:42px;height:42px;border-radius:100%}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .commenttext,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .commenttext{padding-left:20px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .product-info span,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .product-info span{display:block;float:left;width:100%;line-height:14px;height:auto}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .product-info span.product-info-title,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .product-info span.product-info-title{color:#444444;font-size:10pt;font-weight:bold;display:block}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .product-info span.product-info-date,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .product-info span.product-info-date{padding-top:10px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .product-info span.product-info-user,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .product-info span.product-info-user{color:#666}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .score-info,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .score-info{text-align:center;width:80%}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .score-info .score-number,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .score-info .score-number{width:100%;text-align:center;margin-bottom:0px;font-size:8pt}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .score-info .score-bar-container,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .score-info .score-bar-container{width:100%;height:10px;background:#ccc;margin-bottom:5px}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .productrow .score-info .score-bar-container .score-bar,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .productrow .score-info .score-bar-container .score-bar{height:9px;background-color:#30c830;border-bottom:1px solid #2bb32b}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .title,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .title,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .info-row,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .info-row{display:block;width:100%;color:#777777}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .title,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .title{color:#444444;font-size:10pt;font-weight:bold}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .content,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .content{font-size:13px;line-height:1}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li .info-row span.comment-counter,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li .info-row span.comment-counter{float:right}#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ul li+li,#pling-section-content .pling-section-detail .pling-section-detail-middle .panelContainer ol li+li{border-top:1px solid #ccc}#pling-section-content .pling-section-detail .pling-section-detail-middle #recentplinged-list .product-wrap{float:left;width:100%;padding:.3em;border:.35em solid #dee0e0;border-radius:5px;height:14em;margin-bottom:1em;background:white;width:115px;height:200px;margin-right:10px;-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;-ms-transition:all .2s ease-out;-o-transition:all .2s ease-out;text-align:center;position:relative;padding-top:80px}#pling-section-content .pling-section-detail .pling-section-detail-middle #recentplinged-list .product-wrap figure{padding:.25em;border:1px solid #dbdbdb;background:#f6f6f6;border-radius:999px;width:50px}#pling-section-content .pling-section-detail .pling-section-detail-middle #recentplinged-list .product-wrap figure img{width:40px;height:40px;border:1px solid #dbdbdb;-webkit-border-radius:999px;-moz-border-radius:999px;border-radius:999px;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}#pling-section-content .pling-section-detail .pling-section-detail-middle #recentplinged-list .product-wrap h3{font-size:13px;font-weight:normal;word-wrap:break-word;line-height:15px;padding:0;margin:0}#pling-section-content .pling-section-detail .pling-section-detail-middle #recentplinged-list .product-wrap span.small{font-size:13px;color:#444;position:absolute;bottom:5px;right:5px}#pling-section-content .pling-section-detail .pling-section-detail-middle #recentplinged-list .product-wrap div.projecttitle{font-size:11px}#pling-section-content .pling-section-detail .pling-section-detail-middle #recentplinged-list .product-wrap span.rank{font-size:14px;position:absolute;bottom:5px;left:5px;color:#444;font-weight:bold} \ No newline at end of file diff --git a/httpdocs/theme/react/assets/less/carousel.less b/httpdocs/theme/react/assets/less/carousel.less index b9548d907..85600cca4 100644 --- a/httpdocs/theme/react/assets/less/carousel.less +++ b/httpdocs/theme/react/assets/less/carousel.less @@ -1,312 +1,313 @@ -out: ../css/carousel.css, sourcemap: true, compress: true +// out: ../css/carousel.css, sourcemap: true, compress: true @import "elements.less"; .score-info { text-align: center; .score-number { width: 100%; text-align: center; margin-bottom: 5px; } .score-bar-container { width: 100%; height: 10px; background: #ccc; margin-bottom: 5px; .score-bar { height: 9px; background-color: #30c830; border-bottom: 1px solid darken( #30c830,5%); } } } #carousel-module-container { width: 100%; float: left; position: relative; #carousels-module { width: 100%; float: left; position: relative; } .container { width: 100% !important; max-width: 100% !important; padding: 0; } .product-carousel { padding-bottom: 10px; border-bottom: 0px solid #ccc; .product-carousel-header { height: auto; overflow: auto; width: 100%; h2 { font-size: 25px !important; float: left; display: block; width: auto; padding-right: 20px; position: relative; width: auto !important; margin-bottom: 20px; line-height: 30px; a { color: #007aa6; } i, span.glyphicon{ display: inline-block; position: absolute; right: 0; top: 8px; font-size: 16px; } } } .product-carousel-wrapper { width: 100%; height: 120px; position: relative; .product-carousel-left { position: absolute; top: 0; left: 0; height: 100%; } .product-carousel-right { right:0; position: absolute; top: 0; width: 10px; height: 100%; } .carousel-arrow { position: absolute; top: 50%; width: 50px; height: 50px; margin-top: -35px; border-radius: 100%; border:1px solid #ccc; background-color: white; z-index: 10; margin-left: -25px; cursor: pointer; opacity: 1 !important; .transition(); i , span.glyphicon { position: absolute; top: 50%; left: 50%; margin-left: -7px; margin-top: -7px; color: #2673b0; } &:active { background-color: darken(white,10%); } &.disabled { color: darkgray; } } &:hover { .carousel-arrow { opacity: 1; } } } .product-carousel-container { width: 100%; overflow: hidden; position: relative; height: 120px; .product-carousel-slider { position: absolute; top: 0; left: 0; height: 120px; .transition(); } .product-carousel-item { float: left; height: 120px; figure { margin: 0; width: 100%; float: left; margin-bottom: 10px; img { height: 48px; width: 48px; float: left; } } .product-info { span { display: block; float: left; width: 100%; line-height: 14px; height: auto; &.product-info-title { color: #007aa6; display: block; } &.product-info-user { color: #666; } } } } } &.one { .product-carousel-container .product-carousel-item .product-info span { height: 22px; line-height: 22px; } .product-carousel-container .product-carousel-item .product-info span.product-info-title { text-overflow: ellipsis; word-break: break-word; overflow: hidden; white-space: nowrap; padding-right: 20px; font-size: 16px; } .product-carousel-container .product-carousel-item .product-info span.product-info-user { font-size: 15px; } } &.two { .product-carousel-wrapper { height: 220px; } .product-carousel-container { height: inherit !important; .product-carousel-slider { height: inherit !important; .product-carousel-item { padding: 10px; height: inherit !important; .product-carousel-item-wrapper { width: 100%; height: 100%; border: 1px solid #ccc; border-radius: 5px; position: relative; } a { display: block; width: 100%; height: inherit !important; } figure { border-bottom: 1px solid #ccc; margin-bottom: 0; height: 50%; overflow: hidden; position: absolute; top: 0; left: 0; width: 100%; img { height: 100%; width: 100%; } } .product-info { height: 100%; padding: 5px; font-size: 14px; position: relative; span { color: #888; font-size: 12px; &.product-info-title { max-height: 37px; overflow: hidden; margin-bottom: 5px; color: #007aa6; } } .score-info { position: absolute; bottom: 5px; width: 40%; right: 5px; .score-number { margin-bottom: 2px; font-size: 11px; line-height: 12px; color: #2673b0; } } .plings { position: absolute; bottom: 5px; left: 5px; img{ width: 20px; height: 20px; } } } } } } } } &.app-images-hub { float: none; margin: 0 auto; padding: 0 10px; + display: none !important; } } diff --git a/httpdocs/theme/react/assets/less/pling-section.less b/httpdocs/theme/react/assets/less/pling-section.less index 287f4ca64..8434ad655 100644 --- a/httpdocs/theme/react/assets/less/pling-section.less +++ b/httpdocs/theme/react/assets/less/pling-section.less @@ -1,506 +1,513 @@ // out: ../css/pling-section.css, sourcemap: true, compress: true #pling-section-content { width: 100%; height: 100%; display: flex; flex-flow: column nowrap; a{ cursor: pointer; } h1{ text-align: center; } h2{ &.focused { text-decoration: underline; } } .pling-section-header{ width: 100%; height: 300px; background-color: #f1f1f1; display: flex; justify-content: center; flex-flow: column nowrap; font-size: 32px; & > div{ text-align: center; } .score-container { &>span{ font-size: small; font-weight: bold; padding:5px; } .score-bar-container { width: 300px; height: 20px; background: #ccc; margin-bottom: 5px; display: inline-block; font-size: small; .score-bar { height: 20px; background-color: #286090; border-bottom: 0px solid darken( #286090,5%); color:#fff; } } } } .supporters-container{ & > ul{ list-style: none; padding: 0; &>li{ margin: 3px; display: inline-block; float: left; img{ width: 100px; height: 100px; } .username{ background-color: #282C34; color: #fff; text-align: center; font-size: small; padding:3px; max-width: 100px; } } } } .pling-section-tabs{ display: block; margin: 0 auto; } .pling-section-detail { display: flex; width: 1200px; margin: 0 auto; flex-flow: row wrap; .pling-section-detail-left { width: 200px; text-align: right; ul.pling-section-detail-ul{ list-style-type: none; padding: 0px; li{ margin: 5px; } } } .pling-section-detail-right { width: 200px; margin: 5px; .btnSupporter{ -moz-box-align: center; align-items: center; backface-visibility: hidden; background-color: #286090; border-radius: 9999px; border: medium none; box-sizing: border-box; color: rgb(255, 255, 255) !important; display: inline-flex; font-size: 1.4rem !important; font-weight: 800; height: unset; -moz-box-pack: center; justify-content: center; padding: 0.875rem 1.5rem; position: relative; pointer-events: unset; text-align: center; text-decoration: none; text-transform: none; transition: all 300ms cubic-bezier(0.19, 1, 0.22, 1) 0s; -moz-user-select: none; white-space: unset; width: 100%; } .support-container{ border-color: rgb(229, 227, 221); border-style: solid; border-width: 1px; border-radius: 4px; box-shadow: none; background-color: rgb(255, 255, 255); overflow: hidden; font-size: small; margin-top: 10px; .tiers{ box-sizing: border-box; display: block; transition: all 300ms cubic-bezier(0.19, 1, 0.22, 1) 0s; padding: 1rem; margin: 0rem; border-bottom: 1px solid rgb(229, 227, 221); -moz-box-align: center; align-items: center; place-content: flex-start space-between; box-sizing: border-box; display: flex; flex-flow: row nowrap; -moz-box-pack: justify; transition: all 300ms cubic-bezier(0.19, 1, 0.22, 1) 0s; h5{ color: rgb(36, 30, 18); font-family: aktiv-grotesk, sans-serif; font-weight: 700 !important; margin: 0px; position: relative; text-transform: uppercase; transition: all 300ms cubic-bezier(0.19, 1, 0.22, 1) 0s; font-size: 0.875rem !important; line-height: 1.5 !important; } } .tier-container{ box-sizing: border-box; transition: all 300ms cubic-bezier(0.19, 1, 0.22, 1) 0s; padding: 1rem; margin: 0rem; border-bottom: 1px solid rgb(229, 227, 221); text-align: center; span{ display: inline-block; } ul{ list-style-type: none; padding:0px; display: inline-block; li{ float: left; margin:2px; img{ width: 25px; height:25px; } } } .join{ display: flex; justify-content: center; flex-flow: column; input.free-amount{ opacity: .95; margin-top: -8px; color: #000; font-size: 18px; width: 40px; margin: 0; margin-top: 0px; margin-top: 0px; margin-top: 0; border: 0; border-bottom-color: currentcolor; border-bottom-style: none; border-bottom-width: 0px; border-bottom-color: currentcolor; border-bottom-style: none; border-bottom-width: 0px; border-bottom: 1px solid #d0d0d0; padding: 0; box-shadow: none; background: none; } } } } } .pling-section-detail-middle { + flex: 2 0px; padding: 10px 20px; display: flex; justify-content: center; + span.colorGrey{ + color: #ccc; + + } .panelContainer{ border: 1px solid #ccc; border-radius: 5px; background-image: url(../img/home/back3.jpg); padding: 8px; margin: 0px 5px 5px 0; width:320px; div.title{ color: #888888; font-size:11pt; font-weight: bold; border-bottom: 1px solid #ccc; height: 20px; padding-left: 5px; margin-bottom: 10px; color: #888888; font-size: 9pt; } ul, ol { list-style: none; padding-left: 5px; li { padding: 5px 0px; - .creatorrow{ + .creatorrow{ + padding-bottom: 5px; + padding-top: 5px; font-size: small; figure img { - width: 100px; - height: 100px; + width: 50px; + height: 50px; border: 1px solid #dbdbdb; -webkit-border-radius: 999px; -moz-border-radius: 999px; border-radius: 999px; -webkit-background-clip: padding-box; -moz-background-clip: padding; background-clip: padding-box; } .userinfo{ .userinfo-title{ font-weight: bold; } ul.userinfo-detail{ li{ padding:1px 2px; border: 0px; } } } } .productrow { padding-bottom: 5px; padding-top: 5px; font-size: small; - + .rating { width: 60px; } .time { font-size: smaller; } .cntComments { font-size: smaller; display: block; padding-top: 5px; } .defaultProjectAvatar{ width: 50px; height: 50px; color: #3B658A; line-height: 50px; text-align: center; background-color: #e8eaf6; } .productimg { width:50px; height:50px; } .product-user{ width: 42px; height: 42px; border-radius: 100%; } .commenttext{ padding-left: 20px; } .product-info { span { display: block; float: left; width: 100%; line-height: 14px; height: auto; &.product-info-title { color: #444444; font-size: 10pt; font-weight: bold; display: block; } &.product-info-date{ padding-top: 10px; } &.product-info-user { color: #666; } } } .score-info { text-align: center; width: 80%; .score-number { width: 100%; text-align: center; margin-bottom: 0px; font-size: 8pt; } .score-bar-container { width: 100%; height: 10px; background: #ccc; margin-bottom: 5px; .score-bar { height: 9px; background-color: #30c830; border-bottom: 1px solid darken( #30c830,5%); } } } } .title, .info-row { display: block; width: 100%; color: #777777; } .title { color: #444444; font-size: 10pt; font-weight: bold; } .content { font-size: 13px; line-height: 1; } .info-row { /*overflow: auto; */ span { /* float: left; display: inline-block; font-size: 12px; */ &.comment-counter { float: right; } } } } li + li { border-top:1px solid #ccc; } } } #recentplinged-list{ .product-wrap{ float: left; width: 100%; padding: 0.3em; border: 0.35em solid #dee0e0; border-radius: 5px; height: 14em; margin-bottom: 1em; background: white; width: 115px; height: 200px; margin-right: 10px; -webkit-transition: all 0.2s ease-out; -moz-transition: all 0.2s ease-out; -ms-transition: all 0.2s ease-out; -o-transition: all 0.2s ease-out; position: relative; text-align: center; position: relative; - padding-top:50px; + padding-top:80px; figure { padding: .25em; border: 1px solid #dbdbdb; background: #f6f6f6; border-radius:999px; width:50px; img{ width:40px; height: 40px; border: 1px solid #dbdbdb; -webkit-border-radius: 999px; -moz-border-radius: 999px; border-radius: 999px; -webkit-background-clip: padding-box; -moz-background-clip: padding; background-clip: padding-box; } } h3{ font-size: 13px; font-weight: normal; word-wrap: break-word; line-height: 15px; padding: 0; margin: 0; } span.small { font-size: 13px; color: #444; position: absolute; bottom: 5px; right: 5px; } div.projecttitle{ font-size: 11px; } span.rank { font-size: 14px; position: absolute; bottom: 5px; left: 5px; color: #444; font-weight: bold; } } } } } } diff --git a/httpdocs/theme/react/bundle/app-supporters-bundle.js b/httpdocs/theme/react/bundle/app-supporters-bundle.js index a4d63e245..82a8a4b0d 100644 --- a/httpdocs/theme/react/bundle/app-supporters-bundle.js +++ b/httpdocs/theme/react/bundle/app-supporters-bundle.js @@ -1,30 +1,365 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var l=t[r]={i:r,l:!1,exports:{}};return e[r].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(r,l,function(t){return e[t]}.bind(null,l));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=381)}({0:function(e,t,n){"use strict";e.exports=n(101)},101:function(e,t,n){"use strict"; -/** @license React v16.10.2 - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var r=n(70),l="function"==typeof Symbol&&Symbol.for,a=l?Symbol.for("react.element"):60103,i=l?Symbol.for("react.portal"):60106,o=l?Symbol.for("react.fragment"):60107,u=l?Symbol.for("react.strict_mode"):60108,c=l?Symbol.for("react.profiler"):60114,s=l?Symbol.for("react.provider"):60109,f=l?Symbol.for("react.context"):60110,d=l?Symbol.for("react.forward_ref"):60112,p=l?Symbol.for("react.suspense"):60113,m=l?Symbol.for("react.suspense_list"):60120,h=l?Symbol.for("react.memo"):60115,v=l?Symbol.for("react.lazy"):60116;l&&Symbol.for("react.fundamental"),l&&Symbol.for("react.responder"),l&&Symbol.for("react.scope");var g="function"==typeof Symbol&&Symbol.iterator;function y(e){for(var t=e.message,n="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;rM.length&&M.push(e)}function F(e,t,n){return null==e?0:function e(t,n,r,l){var o=typeof t;"undefined"!==o&&"boolean"!==o||(t=null);var u=!1;if(null===t)u=!0;else switch(o){case"string":case"number":u=!0;break;case"object":switch(t.$$typeof){case a:case i:u=!0}}if(u)return r(l,t,""===n?"."+D(t,0):n),1;if(u=0,n=""===n?".":n+":",Array.isArray(t))for(var c=0;c