diff --git a/application/modules/default/views/scripts/home/index-libreoffice.phtml b/application/modules/default/views/scripts/home/index-libreoffice.phtml
index 7cd13b57b..3fd338a48 100644
--- a/application/modules/default/views/scripts/home/index-libreoffice.phtml
+++ b/application/modules/default/views/scripts/home/index-libreoffice.phtml
@@ -1,116 +1,120 @@
.
**/
$this->headTitle($_SERVER['HTTP_HOST'], 'SET');
$this->doctype(Zend_View_Helper_Doctype::XHTML1_RDFA);
$this->headMeta()->appendProperty('og:url', 'www.opendesktop.org/s/LibreOffice');
$this->headMeta()->appendProperty('og:type', 'website');
$this->headMeta()->appendProperty('og:title', 'www.opendesktop.org/s/LibreOffice');
$this->headMeta()->appendProperty('og:site_name','www.opendesktop.org/s/LibreOffice');
$this->headMeta()->appendProperty('og:description','A community where developers and artists share applications, themes and other content');
$this->headMeta()->appendProperty('og:image','https://www.opendesktop.org/images_sys/superstore/lo-logo.png');
$modelInfo = new Default_Model_Info();
$helperBuildMemberUrl = new Default_View_Helper_BuildMemberUrl();
+$helperBuildBaseUrl = new Default_View_Helper_BuildBaseUrl();
$helperImage = new Default_View_Helper_Image();
$helpPrintDate = new Default_View_Helper_PrintDate();
$host = $_SERVER['SERVER_NAME'];
$modelProject = new Default_Model_Project();
$totalProjects = $modelProject->fetchTotalProjectsCount(true);
+$basrUrl = $helperBuildBaseUrl->buildBaserUrl();
+
if(strpos ( $host , ".cc" ) > 0 || strpos ( $host , ".local" ) > 0) {
$products1 = $modelInfo->getJsonLastProductsForHostStores(15,"104");
$products2 = $modelInfo->getJsonLastProductsForHostStores(15,"105");
$products3 = $modelInfo->getJsonLastProductsForHostStores(15,"98");
$products4= $modelInfo->getJsonLastProductsForHostStores(15,"57");
$products5= $modelInfo->getJsonLastProductsForHostStores(15,"53");
$products6 = $modelInfo->getJsonLastProductsForHostStores(15,"52");
$products7 = $modelInfo->getJsonLastProductsForHostStores(15,"52");
$response = array(
'products3' => array('title' =>'Documentation','catIds' =>'52','products' => $products3),
'products4' => array('title' =>'Extensions','catIds' =>'98','products' => $products4),
'products7' => array('title' =>'Templates','catIds' =>'52','products' => $products7),
'products2' => array('title' =>'Dictionaries','catIds' =>'105','products' => $products2),
'products1' => array('title' =>'Clipart Galleries','catIds' =>'104','products' => $products1),
'products6' => array('title' =>'Splash Screens','catIds' =>'53','products' => $products6),
'products5' => array('title' =>'Fonts','catIds' =>'57','products' => $products5),
);
} else {
$products1 = $modelInfo->getJsonLastProductsForHostStores(15,"559");
$products2 = $modelInfo->getJsonLastProductsForHostStores(15,"547");
$products3 = $modelInfo->getJsonLastProductsForHostStores(15,"554");
$products4= $modelInfo->getJsonLastProductsForHostStores(15,"556");
$products5= $modelInfo->getJsonLastProductsForHostStores(15,"555");
$products6 = $modelInfo->getJsonLastProductsForHostStores(15,"271");
$products7 = $modelInfo->getJsonLastProductsForHostStores(15,"103");
$response = array(
'products1' => array('title' =>'Documentation','catIds' =>'559','products' => $products1),
'products2' => array('title' =>'Extensions','catIds' =>'547','products' => $products2),
'products3' => array('title' =>'Templates','catIds' =>'554','products' => $products3),
'products4' => array('title' =>'Dictionaries','catIds' =>'556','products' => $products4),
'products5' => array('title' =>'Clipart Galleries','catIds' =>'555','products' => $products5),
'products6' => array('title' =>'Splash Screens','catIds' =>'271','products' => $products6),
'products7' => array('title' =>'Fonts','catIds' =>'103','products' => $products7),
);
}
?>
diff --git a/application/modules/default/views/scripts/product/add.phtml b/application/modules/default/views/scripts/product/add.phtml
index 00245f119..e7f7b466a 100644
--- a/application/modules/default/views/scripts/product/add.phtml
+++ b/application/modules/default/views/scripts/product/add.phtml
@@ -1,2150 +1,2150 @@
.
**/
//$this->os = Zend_Registry::get('application_os');
$this->tab = 'add';
$helperImage = new Default_View_Helper_Image();
$helpMemberUrl = new Default_View_Helper_BuildMemberUrl();
$helpProductUrl = new Default_View_Helper_BuildProductUrl();
$helpBaseUrl = new Default_View_Helper_BaseUrl();
$modelCategory = new Default_Model_DbTable_ProjectCategory();
$valueCatId = $this->form->project_category_id->getValue();
//$valueCatId = 55;
$storeCatIds = Zend_Registry::isRegistered('store_category_list') ? Zend_Registry::get('store_category_list') : null;
$categories = $modelCategory->fetchCategoriesForForm($valueCatId);
$categoryAncestors = $modelCategory->fetchAncestorsAsId($valueCatId);
if (count($categoryAncestors) > 0) {
$categoryPath = explode(',',$categoryAncestors['ancestors']);
}
$categoryPath[] = $valueCatId;
$this->headLink()->appendStylesheet('/theme/flatui/css/chosen.css');
$this->inlineScript()->appendFile('/theme/flatui/js/lib/chosen.jquery.min.js');
$this->inlineScript()->appendScript('
$(document).ready(function(){
$("select.chosen").chosen({
width: "100%",
max_selected_options: "5",
disable_search: "false",
disable_search_threshold: "5"
});
});
');
?>
render('user/partials/userHeader.phtml'); ?>
inlineScript()->appendScript(
' $(document).ready(function(){
ImagePreview.setup();
ProductForm.setup();
ProductGallery.setup();
Opendownloadfile.setup();
$(\'#demo\').multiselect({
includeSelectAllOption: true
});
});
');
diff --git a/httpdocs/theme/react/app-carousel/app.js b/httpdocs/theme/react/app-carousel/app.js
index b0e2ebcfa..f6a72f66d 100644
--- a/httpdocs/theme/react/app-carousel/app.js
+++ b/httpdocs/theme/react/app-carousel/app.js
@@ -1,482 +1,482 @@
window.hpHelpers = (function(){
function dechex(number) {
// discuss at: http://locutus.io/php/dechex/
// original by: Philippe Baumann
// bugfixed by: Onno Marsman (https://twitter.com/onnomarsman)
// improved by: http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript
// input by: pilus
// example 1: dechex(10)
// returns 1: 'a'
// example 2: dechex(47)
// returns 2: '2f'
// example 3: dechex(-1415723993)
// returns 3: 'ab9dc427'
if (number < 0) {
number = 0xFFFFFFFF + number + 1
}
return parseInt(number, 10).toString(16)
}
function calculateScoreColor(score){
let blue, red, green, defaultColor = 200;
if (score > 50){
red = defaultColor - ((score-50)*4);
green = defaultColor;
blue = defaultColor - ((score-50)*4);
} else if (score < 51){
red = defaultColor;
green = defaultColor - ((score-50)*4);
blue = defaultColor - ((score-50)*4);
}
return "rgb("+red+","+green+","+blue+")";
}
return {
dechex,
calculateScoreColor
}
}());
class CarouselsModule extends React.Component {
constructor(props){
super(props);
this.state = {
};
this.initCarouselModule = this.initCarouselModule.bind(this);
this.updateDimensions = this.updateDimensions.bind(this);
this.convertDataObject = this.convertDataObject.bind(this);
}
componentWillMount() {
this.updateDimensions();
}
componentWillUnmount(){
window.removeEventListener("resize", this.updateDimensions);
window.removeEventListener("orientationchange",this.updateDimensions);
}
componentDidMount() {
this.initCarouselModule();
}
initCarouselModule(){
window.addEventListener("resize", this.updateDimensions);
window.addEventListener("orientationchange",this.updateDimensions);
let env = "live";
if (location.hostname.endsWith('cc')) {
env = "test";
} else if (location.hostname.endsWith('localhost')) {
env = "test";
}
this.setState({env:env},function(){
this.convertDataObject();
});
}
updateDimensions(){
const width = window.innerWidth;
let device;
if (width >= 910){
device = "large";
} else if (width < 910 && width >= 610){
device = "mid";
} else if (width < 610){
device = "tablet";
}
this.setState({device:device});
}
convertDataObject() {
let productGroupsArray = [];
for (var i in window.data) {
if (i !== "comments" && i !== "featureProducts"){
const productGroup = {
title:window.data[i].title,
catIds:window.data[i].catIds,
products:JSON.parse(window.data[i].products)
}
productGroupsArray.push(productGroup);
}
}
this.setState({productGroupsArray:productGroupsArray,loading:false});
}
render(){
let productCarouselsContainer;
if (this.state.loading === false){
productCarouselsContainer = this.state.productGroupsArray.map((pgc,index) => {
if (pgc.catIds){
return (
);
}
});
}
return (
{productCarouselsContainer}
)
}
}
class Carousel extends React.Component {
constructor(props){
super(props);
this.state = {
products:this.props.products,
disableleftArrow:true
};
this.updateDimensions = this.updateDimensions.bind(this);
this.animateProductCarousel = this.animateProductCarousel.bind(this);
this.getNextProductsBatch = this.getNextProductsBatch.bind(this);
}
componentWillMount() {
window.addEventListener("resize", this.updateDimensions);
}
componentDidMount() {
this.updateDimensions();
}
updateDimensions(animateCarousel){
let itemsPerRow = 5;
if (window.hpVersion === 2){
if (this.props.device === 'large'){
itemsPerRow = 6;
} else if (this.props.device === 'mid'){
itemsPerRow = 6;
} else if (this.props.device === 'tablet'){
itemsPerRow = 2;
}
}
let containerWidth;
if (window.page === "opendesktop"){
containerWidth = $('#main-content').width();
} else if (window.page === "appimages" || window.page === "libreoffice"){
containerWidth = $('#introduction').find('.container').width();
}
const containerNumber = Math.ceil(this.state.products.length / (itemsPerRow - 1));
const itemWidth = containerWidth / itemsPerRow;
const sliderWidth = (containerWidth - itemWidth) * containerNumber;
let sliderPosition = 0;
if (this.state.sliderPosition){
sliderPosition = this.state.sliderPosition;
}
if (window.page === "appimages" || window.page === "libreoffice"){
$('#carousel-module-container').width(containerWidth);
}
this.setState({
sliderPosition:sliderPosition,
containerWidth:containerWidth,
containerNumber:containerNumber,
sliderWidth:sliderWidth,
itemWidth:itemWidth,
itemsPerRow:itemsPerRow - 1
},function(){
if (animateCarousel){
this.animateProductCarousel('right',animateCarousel);
} else if (this.state.finishedProducts){
this.setState({disableRightArrow:true});
}
});
}
animateProductCarousel(dir,animateCarousel){
let newSliderPosition = this.state.sliderPosition;
const endPoint = this.state.sliderWidth - (this.state.containerWidth - this.state.itemWidth);
if (dir === 'left'){
if (this.state.sliderPosition > 0){
newSliderPosition = this.state.sliderPosition - (this.state.containerWidth - this.state.itemWidth);
}
} else {
if (Math.trunc(this.state.sliderPosition) < Math.trunc(endPoint)){
newSliderPosition = this.state.sliderPosition + (this.state.containerWidth - this.state.itemWidth);
} else {
newSliderPosition = 0
/*if (!animateCarousel){
if (this.state.products.length >= 15 || this.state.finishedProducts){
newSliderPosition = 0;
} else {
this.getNextProductsBatch();
}
}*/
}
}
this.setState({sliderPosition:newSliderPosition},function(){
let disableleftArrow = false;
if (this.state.sliderPosition <= 0){
disableleftArrow = true;
}
let disableRightArrow = false;
/*if (this.state.sliderPosition >= endPoint && this.state.finishedProducts === true){
disableRightArrow = true;
}*/
this.setState({disableRightArrow:disableRightArrow,disableleftArrow:disableleftArrow});
});
}
getNextProductsBatch(){
this.setState({disableRightArrow:true},function(){
let limit = (this.state.itemsPerRow * (this.state.containerNumber + 1)) - this.state.products.length;
if (limit <= 0){
limit = this.state.itemsPerRow;
}
let url;
if (!this.props.catIds){
url = "/home/getnewactiveplingedproductjson/?limit="+limit+"&offset="+this.state.offset;
} else {
url = "/home/showlastproductsjson/?page=1&limit="+limit+"&offset="+this.state.offset+"&catIDs="+this.props.catIds+"&isoriginal=0";
}
const self = this;
$.ajax({url: url,cache: false}).done(function(response){
let products = self.state.products,
finishedProducts = false,
animateCarousel = true;
if (response.length > 0){
products = products.concat(response);
} else {
finishedProducts = true;
animateCarousel = false;
}
if (response.length < limit){
finishedProducts = true;
}
self.setState({
products:products,
offset:self.state.offset + response.length,
finishedProducts:finishedProducts},function(){
self.updateDimensions(animateCarousel);
});
});
});
}
render(){
let carouselItemsDisplay;
if (this.state.products && this.state.products.length > 0){
let plingedProduct = false;
if (!this.props.catIds) plingedProduct = true;
carouselItemsDisplay = this.state.products.map((product,index) => (
));
}
let carouselArrowLeftDisplay;
if (this.state.disableleftArrow){
carouselArrowLeftDisplay = (
)
} else {
carouselArrowLeftDisplay = (
this.animateProductCarousel('left')} className="carousel-arrow arrow-left">
);
}
let carouselArrowRightDisplay;
if (this.state.disableRightArrow){
carouselArrowRightDisplay = (
)
} else {
carouselArrowRightDisplay = (
this.animateProductCarousel('right')} className="carousel-arrow arrow-right">
);
}
let hpVersionClass = "one";
let carouselWrapperStyling = {};
let carouselArrowsMargin;
if (window.hpVersion === 2 && this.state.itemWidth){
hpVersionClass = "two";
let itemHeightMultiplier;
// if (this.state.itemWidth > 150){
itemHeightMultiplier = 1.35;
/*} else {
itemHeightMultiplier = 1.85;
}*/
carouselWrapperStyling = {
"paddingLeft":this.state.itemWidth / 2,
"paddingRight":this.state.itemWidth / 2,
"height":this.state.itemWidth * itemHeightMultiplier
}
carouselArrowsMargin = this.state.itemWidth / 4;
}
let urlSuffix;
if (window.page === "libreoffice"){
urlSuffix = "/s/LibreOffice";
}
let titleLink = urlSuffix + "/browse/cat/" + this.props.catIds + "/";
if (!this.props.catIds){
titleLink = "/community#plingedproductsPanel";
}
return (
{carouselArrowLeftDisplay}
{carouselArrowRightDisplay}
)
}
}
class CarouselItem extends React.Component {
constructor(props){
super(props);
this.state = {};
}
render(){
let paddingTop;
let productInfoDisplay = (
{this.props.product.title}
{this.props.product.username}
);
if (window.hpVersion === 2){
if (this.props.itemWidth){
paddingTop = ((this.props.itemWidth * 1.35) / 2) - 10;
}
let lastDate;
if (this.props.product.changed_at){
lastDate = this.props.product.changed_at;
} else {
lastDate = this.props.product.created_at;
}
let cDate = new Date(lastDate);
// cDate = cDate.toString();
// const createdDate = cDate.split(' ')[1] + " " + cDate.split(' ')[2] + " " + cDate.split(' ')[3];
const createdDate = jQuery.timeago(cDate)
// const productScoreColor = window.hpHelpers.calculateScoreColor(this.props.product.laplace_score);
let scoreDisplay;
if (this.props.plingedProduct){
scoreDisplay = (
{this.props.product.sum_plings}
);
} else {
scoreDisplay = (
score {this.props.product.laplace_score + "%"}
);
}
productInfoDisplay = (
{this.props.product.title}
{this.props.product.cat_title}
{createdDate}
{scoreDisplay}
);
}
return (
)
}
}
ReactDOM.render(
,
document.getElementById('carousel-module-container')
);