linpha-cvs Mailing List for LinPHA PHP Photo Gallery (Page 3)
Status: Inactive
Brought to you by:
bzrudi
You can subscribe to this list here.
2006 |
Jan
|
Feb
(143) |
Mar
(104) |
Apr
(127) |
May
(20) |
Jun
(10) |
Jul
(28) |
Aug
(48) |
Sep
(55) |
Oct
(85) |
Nov
(57) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(16) |
Feb
(41) |
Mar
(56) |
Apr
(8) |
May
(1) |
Jun
(9) |
Jul
(54) |
Aug
(24) |
Sep
(2) |
Oct
(14) |
Nov
(30) |
Dec
(7) |
2008 |
Jan
(48) |
Feb
(52) |
Mar
(18) |
Apr
(30) |
May
(4) |
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: <fan...@us...> - 2008-03-16 08:51:50
|
Revision: 4904 http://linpha.svn.sourceforge.net/linpha/?rev=4904&view=rev Author: fangehrn Date: 2008-03-16 01:51:49 -0700 (Sun, 16 Mar 2008) Log Message: ----------- 2008-03-15 flo * fixed some IE bugs everything should now work fine on firefox/opera/IE 2008-03-13 flo * finished fullscreen/slideshow/navigation 2008-03-09 flo * re-design thumb and image view Modified Paths: -------------- trunk/linpha2/lib/js/LinYUIAlbumNavigation.js Added Paths: ----------- trunk/linpha2/lib/js/LinYUIAlbum.js trunk/linpha2/lib/js/LinYUIGlobal.js trunk/linpha2/lib/js/LinYUIPage.js Added: trunk/linpha2/lib/js/LinYUIAlbum.js =================================================================== --- trunk/linpha2/lib/js/LinYUIAlbum.js (rev 0) +++ trunk/linpha2/lib/js/LinYUIAlbum.js 2008-03-16 08:51:49 UTC (rev 4904) @@ -0,0 +1,549 @@ +YAHOO.namespace("linpha"); + +// linpha.Album +YAHOO.linpha.Album = function() { + YAHOO.log('linpha.Album()'); + + this.currentIndex = null; + this.currentFileType = null; + + this.mode = 'init'; + //this.initHistoryManager(); + this.album = null; + + this.fullscreenActive = false; + this.fullscreenInitialised = false; + this.fullscreenOldMaxWidth, this.fullscreenOldMaxHeight, this.previousBodyOverflow; + this.slideshowActive = false; + this.ssCurrentTimerID; + this.ssCurrentDelay = 5000; + this.ssRandom = false; + this.ssLoop = false; + + this.preloadImageSrc = new Array(); // image array, will contain a lot of preloaded images + this.finishedPreloadedImages = new Array(); // set to true after preload completed + + this.TabView = null; + this.Tabs = new Array(); + this.activeTabLabel = null; +}; + +// initHistoryManager() +YAHOO.linpha.Album.prototype.initHistoryManager = function() { + + try { + var myModuleBookmarkedState = YAHOO.util.History.getBookmarkedState("linphaViewer"); + var myModuleInitialState = myModuleBookmarkedState || "album"; + YAHOO.util.History.register("linphaViewer", myModuleInitialState, this.historyChangeHandler); //, this, true + YAHOO.util.History.onReady(function () { + myLinAlbum.historyChangeHandler( YAHOO.util.History.getCurrentState("linphaViewer") ); + }); + YAHOO.util.History.initialize("yui-history-field", "yui-history-iframe"); + YAHOO.log("Successfully initialized history manager"); + } + catch(e) + { + YAHOO.log("Error initializing history manager"); + myLinAlbum.showAlbum(); // opera fallback + } +}; + +// historyChangeHandler() +YAHOO.linpha.Album.prototype.historyChangeHandler = function(state) { + YAHOO.log("historyChangeHandler() " + state); + + if (state=="album") { + myLinAlbum.showAlbum(); + } else { + var parts = state.split('_'); + if (parts[0] == "image") { + YAHOO.log("navigate to image: " + parts[1]); + myLinAlbum.changeImage( parseInt(parts[1]) ); + } else { + YAHOO.log("Error: Unknown bookmark state"); + } + } +}; + +// loadAlbum() +YAHOO.linpha.Album.prototype.loadAlbum = function() { + YAHOO.log('linpha.Album.loadAlbum()'); + + //YAHOO.util.Dom.setStyle('linDivNav', "display", "block"); + YAHOO.util.Dom.setStyle('linDivImage', "display", "none"); + YAHOO.util.Dom.setStyle('linDivThumbs', "display", "none"); + YAHOO.util.Dom.setStyle('linDivTabs', "display", "none"); + + myLinGlobal.asyncRequest('GET', 'album.txt' /*linUrlBase + '&loadAlbum'*/, this.storeAlbum, this, null); + +}; + +// storeAlbum() +YAHOO.linpha.Album.prototype.storeAlbum = function(t) { + try { + this.album = YAHOO.lang.JSON.parse(t.responseText); + + /** + * translate linId to index + * i have no better idea at the moment (its already late...) + * whats the best solution to store the array + * we need access with the index (for prev/next/first/last/image x of y) + * and we need access with the id (for history manager/open image directly with id) + * + * benchmark is not bad: 0ms for 100000 iterations + */ + this.ThumbIds = []; + for(index in this.album.Thumbs) + { + this.ThumbIds[ this.album.Thumbs[index].id ] = parseInt(index); + this.preloadImageSrc[ this.album.Thumbs[index].id ] = new Array(); // init two dimensional array for easy access + this.finishedPreloadedImages[ this.album.Thumbs[index].id ] = new Array(); // init two dimensional array for easy access + } + + this.initHistoryManager(); // this will call showAlbum() or showImage() + //this.showAlbum(); + } + catch (e) { + alert("Error loading album (" + e + ")"); + } +} + +// openAlbum() +YAHOO.linpha.Album.prototype.openAlbum = function() { + try { + YAHOO.util.History.navigate("linphaViewer", "album"); + } catch (e) { + this.showAlbum(); // opera fallback + } +}; + +// showAlbum() +YAHOO.linpha.Album.prototype.showAlbum = function(t) { + + YAHOO.log("showAlbum()"); + + YAHOO.util.Dom.setStyle('linDivThumbs', "display", "none"); + myLinPage.setTitle(this.album.TitleUrl); + + + htmlstr = []; + idx = 0; + for (imgIndex in this.album.Thumbs) + { + htmlstr[idx++] = '<div id="linDivThumb'+imgIndex+'" class="linDivThumb"><a href="javascript:myLinAlbum.openImage('; + htmlstr[idx++] = this.album.Thumbs[imgIndex].id + ')"><img src="' + linThumbSrc + this.album.Thumbs[imgIndex].id; + htmlstr[idx++] = '" alt="' + this.album.Thumbs[imgIndex].title; + htmlstr[idx++] = '" title="' + this.album.Thumbs[imgIndex].title + '" class="linImgThumb" /></a></div>'; + } + htmlstr[idx++] = '<div style="clear: both;"></div>'; // needed by IE + document.getElementById('linDivThumbs').innerHTML = htmlstr.join(""); + + YAHOO.util.Dom.setStyle('linDivTabs', "display", "none"); + YAHOO.util.Dom.setStyle('linDivImage', "display", "none"); + //YAHOO.util.Dom.setStyle('linDivNav', "display", "block"); + + + myLinPage.setResizeMode('thumb'); + + if (this.mode == 'image') { + (new YAHOO.util.Element('linDivThumbs')).removeClass("linDivThumbsSmall"); // would give an warning if the class does not exist + } + this.mode = 'thumb'; + + YAHOO.util.Dom.setStyle('linDivThumbs', "display", "block"); +}; + +// openImage() +YAHOO.linpha.Album.prototype.openImage = function(imgId) { + try { + YAHOO.util.History.navigate("linphaViewer", "image_"+imgId); + } catch (e) { + this.changeImage(imgId); // opera fallback + } +}; + +// changeImage() +YAHOO.linpha.Album.prototype.changeImage = function(imgId) { + + YAHOO.log("showImage(): " + imgId); + + linIdCurrent = imgId; + this.currentIndex = this.ThumbIds[imgId]; + this.currentFileType = this.album.Thumbs[this.currentIndex].type; + + + // handle direct entry + if (this.mode == 'init') { + this.showAlbum(); // load thumbnails (will set this.mode = 'thumb') + } + + + /** + * set title and thumbnail border + */ + // set thumbnail border + if (this.prevSelection != 'undefined') { + (new YAHOO.util.Element('linDivThumb'+this.prevSelection)).removeClass("linImgThumbActive"); + this.prevSelection = this.currentIndex; + } + (new YAHOO.util.Element('linDivThumb'+this.currentIndex)).addClass("linImgThumbActive"); + + myLinPage.setTitle(this.album.TitleUrl + ' > <a href="javascript:myLinAlbum.openImage('+imgId+')">' + + this.album.Thumbs[this.currentIndex].title + '</a>' ); + + /** + * hide elements + */ + //YAHOO.util.Dom.setStyle('linDivImgInfo', "display", "none"); + YAHOO.util.Dom.setStyle('linHrefPanoLink', "display", "none"); + YAHOO.util.Dom.setStyle('linDivVideoInfo', "display", "none"); + YAHOO.util.Dom.setStyle('linDivOtherInfo', "display", "none"); + + // handle coming from thumb (or init) + if (this.mode != 'image') { + + YAHOO.util.Dom.setStyle('linDivDescription', "display", "none"); + YAHOO.util.Dom.setStyle('linImgMainImage', "display", "none"); + + YAHOO.util.Dom.setStyle('linDivThumbs', "display", "none"); + this.mode = 'image'; + + //YAHOO.util.Dom.setStyle('linDivThumbs', "display", "none"); + (new YAHOO.util.Element('linDivThumbs')).addClass("linDivThumbsSmall"); + //YAHOO.util.Dom.setStyle('linDivNav', "display", "none"); + + YAHOO.util.Dom.setStyle('linDivImage', "display", "block"); + YAHOO.util.Dom.setStyle('linDivThumbs', "display", "block"); // its good to hide thumbnails during calculation to prevent flicker when coming from thumbnails + YAHOO.util.Dom.setStyle('linDivTabs', "display", "block"); + + myLinPage.setResizeMode('image'); // if possible this should be at the end to know if have scrollbars or not (if necessary we could also add enough padding) + } + else + { + /*if(! this.fullscreenActive) + {*/ + YAHOO.util.Dom.setStyle('linDivMainImage', "height", + (document.getElementById('linImgMainImage').offsetHeight + document.getElementById('linDivDescription').offsetHeight)+'px' + ); + /*}*/ + + //document.getElementById('linDivDescription').innerHTML = ' '; + YAHOO.util.Dom.setStyle('linDivDescription', "display", "none"); // do not hide whole block to keep the right height + //YAHOO.util.Dom.setStyle('linDivDescription', "height", document.getElementById('linDivDescription').offsetHeight + 'px'); + //YAHOO.util.Dom.setStyle('linDivDescription', "visibility", "hidden"); + + YAHOO.util.Dom.setStyle('linImgMainImage', "display", "none"); + } + + + /** + * prepare image + */ + switch( this.currentFileType ) + { + case 1: // image + + /** + * calc image width and height + */ + imgDim = myLinPage.scaleToFit( this.album.Thumbs[this.currentIndex].w, this.album.Thumbs[this.currentIndex].h, + myLinPage.maxImgWidth, myLinPage.maxImgHeight, true); + + if (!this.finishedPreloadedImages[linIdCurrent][imgDim[0]]) + { + YAHOO.util.Dom.setStyle('linDivLoading', "display", "block"); + } + + + /** + * preload image + */ + var currentImgSrc = linImageSrc + this.album.Thumbs[this.currentIndex].id + '&width=' + imgDim[0] + '&height=' + imgDim[1]; + imgPreloader = new Image(); + + /** + * once image is preloaded, resize image container + * + * pay attention with the other image preloader! + * if imgWidth and imgWidth was not set with trailing 'var' it got overlapping with the other variables + * and this caused the image not resized correctly in resizeImageContainer() !!! + */ + imgPreloader.onload=function(){ + myLinAlbum.finishedPreloadedImages[linIdCurrent][imgDim[0]] = true; + document.getElementById('linImgMainImage').src = currentImgSrc; + myLinAlbum.showImage(imgDim[0], imgDim[1]); + } + imgPreloader.src = currentImgSrc; + break; + + case 2: // video + + document.getElementById('linImgMainImage').src = linThumbSrc + this.album.Thumbs[this.currentIndex].id; + this.showImage(0, 0); + break; + + case 0: // others + + document.getElementById('linImgMainImage').src = linThumbSrc + this.album.Thumbs[this.currentIndex].id; + this.showImage(0, 0); + break; + } +}; + +// resizeImageContainer() +YAHOO.linpha.Album.prototype.resizeImageContainer = function(imgWidth, imgHeight, comingFromEvent) { + + if (this.currentFileType != 1) + { + imgWidth = linTnSizeOther; + imgHeight = linTnSizeOther; + } + + YAHOO.util.Dom.setStyle('linDivMainImage', "width", imgWidth + 'px'); + + if (comingFromEvent) { + YAHOO.util.Dom.setStyle('linDivMainImage', "height", 'auto'); + } else { + YAHOO.util.Dom.setStyle('linDivMainImage', "height", imgHeight + 'px'); // it will be reset to 'auto' after showing the image + } + YAHOO.util.Dom.setStyle('linDivLoading', "display", "none"); + YAHOO.util.Dom.setStyle('linImgMainImage', "width", imgWidth + 'px'); + YAHOO.util.Dom.setStyle('linImgMainImage', "height", imgHeight + 'px'); +} + +// showImage() +YAHOO.linpha.Album.prototype.showImage = function(imgWidth, imgHeight) { + + var imgIndex = this.currentIndex; + + this.resizeImageContainer( imgWidth, imgHeight, false ); + + switch( this.currentFileType ) + { + case 1: // image + //YAHOO.util.Dom.setStyle('linDivImgInfo', "display", "block"); + break; + case 2: // video + YAHOO.util.Dom.setStyle('linDivVideoInfo', "display", "block"); + break; + default: // other + YAHOO.util.Dom.setStyle('linDivOtherInfo', "display", "block"); + break; + } + + YAHOO.util.Dom.setStyle('linImgMainImage', "display", "block"); + /*if (!this.fullscreenActive) + {*/ + //$('linDivMainimage').style.height = $('linImgMainimage').style.height; + YAHOO.util.Dom.setStyle('linDivMainImage', "height", 'auto'); // reset to correct height to prevent trouble if image is bigger or smaller + /*}*/ + + document.getElementById('linDivDescription').innerHTML = this.album.Thumbs[imgIndex].descr; + //YAHOO.util.Dom.setStyle('linDivDescription', "height", "auto"); + //YAHOO.util.Dom.setStyle('linDivDescription', "visibility", "visible"); + YAHOO.util.Dom.setStyle('linDivDescription', "display", "block"); + + + // disable buttons when end/start reached + if (this.fullscreenActive) { + if (this.album.Thumbs[imgIndex+1]) { + //YAHOO.util.Dom.setStyle('linSsImgNext', "opacity", 1); does not work correctly because apear effect just overwrites it again + YAHOO.util.Dom.setStyle('linSsImgLast', "opacity", 1); + } else { + //YAHOO.util.Dom.setStyle('linSsImgNext', "opacity", 0.7); + YAHOO.util.Dom.setStyle('linSsImgLast', "opacity", 0.7); + } + + if (this.album.Thumbs[imgIndex-1]) { + //YAHOO.util.Dom.setStyle('linSsImgPrev', "opacity", 1); + YAHOO.util.Dom.setStyle('linSsImgFirst', "opacity", 1); + } else { + //YAHOO.util.Dom.setStyle('linSsImgPrev', "opacity", 0.7); + YAHOO.util.Dom.setStyle('linSsImgFirst', "opacity", 0.7); + } + + } + + /** + * remove old tabs + */ + if (this.TabView != null) + { + this.activeTabLabel = this.TabView.get('activeTab').get('label'); + + document.getElementById('linUlTabNav').innerHTML = ''; + document.getElementById('linDivTabContent').innerHTML = ''; + this.Tabs = []; + /* when using removeTab and the active tab gets removed, another the next one gets active and will load data from the server + for (tabIndex in this.Tabs) { + this.TabView.removeTab( this.Tabs[tabIndex] ); + } + this.TabView = null;*/ + } + + // add new tabs + idx = 0; + + for (tabIndex in linTabs) { + linTabs[tabIndex].dataSrc = LINPHA_LINK+'linCat=image&linTab='+tabIndex+'&linId='+linIdCurrent; + + // restore previous selection + if (this.activeTabLabel != null) + { + if (linTabs[tabIndex].label == this.activeTabLabel) { + linTabs[tabIndex].active = true; + } else { + linTabs[tabIndex].active = false; + } + } + } + + this.indexCommentTab = idx; // used by saveComment() + this.Tabs[idx++] = new YAHOO.widget.Tab(linTabs['comments']); + + switch( this.currentFileType ) + { + case 1: // image + this.Tabs[idx++] = new YAHOO.widget.Tab(linTabs['imageInfo']); + + if (this.album.Thumbs[imgIndex].opt != null && this.album.Thumbs[imgIndex].opt.gps) { + this.Tabs[idx++] = new YAHOO.widget.Tab(linTabs['gps']); + } + + if (linEXIFEnabled) { + this.Tabs[idx++] = new YAHOO.widget.Tab(linTabs['exif']); + } + + if (linITPCXMPEnabled) { + this.Tabs[idx++] = new YAHOO.widget.Tab(linTabs['iptcXmp']); + } + + if (linPermMetaEdit) { + this.Tabs[idx++] = new YAHOO.widget.Tab(linTabs['editMeta']); + + if (linITPCXMPEnabled) { + this.Tabs[idx++] = new YAHOO.widget.Tab(linTabs['editIptcXmp']); + } + } + break; + case 2: // video + this.Tabs[idx++] = new YAHOO.widget.Tab(linTabs['videoInfo']); + if (linPermMetaEdit) { + this.Tabs[idx++] = new YAHOO.widget.Tab(linTabs['editMeta']); + } + break; + default: // other + if (linPermMetaEdit) { + this.Tabs[idx++] = new YAHOO.widget.Tab(linTabs['editMeta']); + } + break; + } + + this.TabView = new YAHOO.widget.TabView("linDivTabs"); + for (tabIndex in this.Tabs) { + this.TabView.addTab( this.Tabs[tabIndex] ); + } + + for(i = 1; i <= linPreloadImages; i++) + { + if ( this.album.Thumbs[imgIndex+i] ) + this.preloadImage(this.album.Thumbs[imgIndex+i].id); + } + + this.enableKeyboardNav(); +}; + +// preloadImage() +YAHOO.linpha.Album.prototype.preloadImage = function(imgId) { + + YAHOO.log('preloadImage(): ' + imgId); + + var imgIndex = this.ThumbIds[imgId]; + + if (this.album.Thumbs[imgIndex].type == 1) + { + /** + * set image width and height + */ + var sizeArray = myLinPage.scaleToFit(this.album.Thumbs[imgIndex].w, this.album.Thumbs[imgIndex].h, myLinPage.maxImgWidth, myLinPage.maxImgHeight, true); + var imgWidth = sizeArray[0]; + var imgHeight = sizeArray[1]; + + if (!this.finishedPreloadedImages[imgId][imgWidth] ) + { + /** + * preload image + */ + this.preloadImageSrc[imgId][imgWidth] = new Image(); + + this.preloadImageSrc[imgId][imgWidth].onload=function(){ + myLinAlbum.preloadImageFinished(imgId, imgWidth); + } + this.preloadImageSrc[imgId][imgWidth].src = linImageSrc + imgId + '&width=' + imgWidth + '&height=' + imgHeight; + } + } +}; + +// preloadImageFinished() +YAHOO.linpha.Album.prototype.preloadImageFinished = function(imgId, imgWidth) { + + YAHOO.log('preloadImageFinished(): ' + imgId); + + this.finishedPreloadedImages[imgId][imgWidth] = true; + + //if( $('thumb'+imgId) ) // maybe its not here anymore + //{ + // new Effect.Appear('thumb'+imgId, { duration: 0.5, from: 0.5, to: 1.0 }); + //} + + //YAHOO.util.Dom.setStyle('linDivThumb' + this.ThumbIds[imgId], "opacity", 0.75); + if (linUseEffects) { + (new YAHOO.util.Anim('linDivThumb' + this.ThumbIds[imgId], {opacity: {from: 0.1, to: 1}}, 1)).animate(); + } +}; + +// saveComment(formElem) +YAHOO.linpha.Album.prototype.saveComment = function(formElem) { + + YAHOO.util.Connect.setForm(formElem); + myLinGlobal.asyncRequest("POST", LINPHA_LINK+'linCat=image&linTab=comments&linId='+linIdCurrent, this.saveCommentFinish, this, null); + + /*this.Tabs[this.indexCommentTab].set('cacheData', false); + this.Tabs[this.indexCommentTab].set('loadMethod', "POST"); + this.Tabs[this.indexCommentTab].set('activeIndex', this.indexCommentTab); + this.Tabs[this.indexCommentTab].set('cacheData', true); + this.Tabs[this.indexCommentTab].set('loadMethod', "GET");*/ +}; + +// saveCommentFinish() +YAHOO.linpha.Album.prototype.saveCommentFinish = function(t) { + + this.Tabs[this.indexCommentTab].set('content', t.responseText); +}; + +// openTextarea() +YAHOO.linpha.Album.prototype.openTextarea = function() { + //Element.show('linDivAddCommentTextarea'); + //Element.hide('linDivAddCommentText'); + YAHOO.util.Dom.setStyle('linDivAddCommentText', 'display', 'none'); + YAHOO.util.Dom.setStyle('linDivAddCommentTextarea', 'display', 'block'); + + document.getElementById('linInputAddCommentTextarea').value = document.getElementById('linInputAddCommentText').value; +}; + +// closeTextarea() +YAHOO.linpha.Album.prototype.closeTextarea = function() { + //Element.show('linDivAddCommentTextarea'); + //Element.hide('linDivAddCommentText'); + YAHOO.util.Dom.setStyle('linDivAddCommentText', 'display', 'block'); + YAHOO.util.Dom.setStyle('linDivAddCommentTextarea', 'display', 'none'); + + document.getElementById('linInputAddCommentText').value = document.getElementById('linInputAddCommentTextarea').value; +}; + + +myLinPage.enableOnResize('thumb'); + +var myLinAlbum = new YAHOO.linpha.Album(); +myLinAlbum.loadAlbum(); + Modified: trunk/linpha2/lib/js/LinYUIAlbumNavigation.js =================================================================== --- trunk/linpha2/lib/js/LinYUIAlbumNavigation.js 2008-03-16 08:51:31 UTC (rev 4903) +++ trunk/linpha2/lib/js/LinYUIAlbumNavigation.js 2008-03-16 08:51:49 UTC (rev 4904) @@ -1,1186 +1,511 @@ -/** - * class and global definitions - */ -var LinImage = Class.create(); -var myLinImage; - -LinImage.prototype = { +// movePrev() +YAHOO.linpha.Album.prototype.movePrev = function() { - /** - * initialize() - * - * Constructor runs on completion of the DOM loading. - */ - initialize: function() + if (this.slideshowActive) { - /*this.imgInfoColorNotActive = $('linDivInfoLink').style.color; - this.imgInfoColorActive = $('linHrefInfoLink').style.color;*/ - this.imgInfoShowHide = 'hide'; - - - this.fullscreenActive = false; - this.fullscreenOldMaxWidth, this.fullscreenOldMaxHeight, this.previousBodyOverflow; - this.slideshowActive = false; - this.ssCurrentTimerID; - this.ssCurrentDelay = 5000; - this.ssRandom = false; - this.ssLoop = false; - - this.xmlDoc = new Array(); - this.nextThumbs = new Array(); - this.prevThumbs = new Array(); - this.preloadImageSrc = new Array(); // image array, will contain a lot of preloaded images - this.finishedPreloadedImages = new Array(); // set to true after preload completed - this.preloadXmlFinished = new Array(); - - this.currentFileType; // 1 = image, 2 = video, 3 = others - - this.curLocationHash; - //this.timerResize; - }, - - - // ----------------------------------------------------------------------------------- - // functions to load xml data of images - // ----------------------------------------------------------------------------------- - - loadImage: function(imgId) { - if(IdCurrent != imgId) - { - IdCurrent = imgId; - //myLinGlobal.menuNeedsUpdating = true; // IdCurrent changed, update menu on next hover of the menu - location.hash = 'idCurrent='+IdCurrent; - } - - this.curLocationHash = location.hash; // update current Hash, this value is periodically checked to reload the image if neccessary - - // do not load the data again if it is already cached - if(this.preloadXmlFinished[imgId] && typeof this.xmlDoc[imgId] != "undefined" ) // use typeof to work in IE - { - this.changeImage(); - } - else - { - this.loadImageXml(imgId); - } - }, + clearTimeout(this.ssCurrentTimerID); + } - loadImageXml: function(imgId) { - myLinGlobal.AjaxPost(linUrlBase + '&linId=' + imgId + '&xml', '', myLinImage.loadImageContinue); - }, - - loadImageContinue: function(t) { - var loadedimgid = t.responseXML.documentElement.getElementsByTagName('imgid').item(0).firstChild.data; - - // save xml data - myLinImage.xmlDoc[loadedimgid] = t.responseXML.documentElement; - myLinImage.preloadXmlFinished[loadedimgid] = true; - - if( loadedimgid == IdCurrent ) // coming from loadImage() - { - myLinImage.changeImage(); + if (this.album.Thumbs[this.currentIndex-1]) + { + if (this.fullscreenActive && linUseEffects) { + (new YAHOO.util.Anim('linSsImgPrev', {opacity: {from: 0.7, to: 1}}, 0.5)).animate(); + //Element.setOpacity('linSsImgPrev',0.7); + //new Effect.Appear('linSsImgPrev', { duration: 0.5, from: 0.7, to: 1.0 }); } - else // coming from preloadImage() + myLinAlbum.openImage( this.album.Thumbs[this.currentIndex-1].id ); + + if (this.slideshowActive) { - myLinImage.preloadImage(loadedimgid); - } - }, - - - // ----------------------------------------------------------------------------------- - // Navigation functions - // ----------------------------------------------------------------------------------- - - movePrev: function() { - if( this.slideshowActive ) - { clearTimeout(this.ssCurrentTimerID); + this.ssCurrentTimerID = setTimeout("myLinAlbum.slideshowPlay()", this.ssCurrentDelay); } + } + else // end reached, do nothing but enable keyboard navigation again + { + myLinAlbum.enableKeyboardNav(); + } + + if (this.slideshowActive) + { + this.ssCurrentTimerID = setTimeout("myLinAlbum.slideshowPlay()", this.ssCurrentDelay); + } +}; - if(this.prevThumbs[ this.prevThumbs.length - 1 ]) - { - Element.setOpacity('linSsImgPrev',0.7); - new Effect.Appear('linSsImgPrev', { duration: 0.5, from: 0.7, to: 1.0 }); - myLinImage.loadImage(this.prevThumbs[ this.prevThumbs.length - 1 ]); - - if( this.slideshowActive ) - { - clearTimeout(this.ssCurrentTimerID); - this.ssCurrentTimerID = setTimeout("myLinImage.slideshowPlay()", this.ssCurrentDelay); - } - } - else // end reached, do nothing but enable keyboard navigation again - { - myLinImage.enableKeyboardNav(); - } +// moveNext() +YAHOO.linpha.Album.prototype.moveNext = function() { - if( this.slideshowActive ) - { - this.ssCurrentTimerID = setTimeout("myLinImage.slideshowPlay()", this.ssCurrentDelay); - } - }, - moveNext: function() { - if( this.slideshowActive ) - { - clearTimeout(this.ssCurrentTimerID); - } + if (this.slideshowActive) + { + clearTimeout(this.ssCurrentTimerID); + } + + if (this.ssRandom) + { + if (this.fullscreenActive && linUseEffects) { + (new YAHOO.util.Anim('linSsImgNext', {opacity: {from: 0.7, to: 1}}, 0.5)).animate(); + //Element.setOpacity('linSsImgNext',0.7); + //new Effect.Appear('linSsImgNext', { duration: 0.5, from: 0.7, to: 1.0 }); + } + + var nextIndex = Math.round( Math.random()*myLinAlbum.album.Thumbs.length ); + myLinAlbum.openImage( this.album.Thumbs[nextIndex].id ); + } + else if (this.album.Thumbs[this.currentIndex+1]) + { + if (this.fullscreenActive && linUseEffects) { + (new YAHOO.util.Anim('linSsImgNext', {opacity: {from: 0.7, to: 1}}, 0.5)).animate(); + //Element.setOpacity('linSsImgNext',0.7); + //new Effect.Appear('linSsImgNext', { duration: 0.5, from: 0.7, to: 1.0 }); + } + myLinAlbum.openImage( this.album.Thumbs[this.currentIndex+1].id ); + } + else if (this.ssLoop) + { + if (this.fullscreenActive && linUseEffects) { + (new YAHOO.util.Anim('linSsImgNext', {opacity: {from: 0.7, to: 1}}, 0.5)).animate(); + //Element.setOpacity('linSsImgNext',0.7); + //new Effect.Appear('linSsImgNext', { duration: 0.5, from: 0.7, to: 1.0 }); + } + this.moveFirst(); + } + else // end reached, do nothing but enable keyboard navigation again + { + myLinAlbum.enableKeyboardNav(); + } - if(this.nextThumbs[0]) - { - Element.setOpacity('linSsImgNext',0.7); - new Effect.Appear('linSsImgNext', { duration: 0.5, from: 0.7, to: 1.0 }); - myLinImage.loadImage(this.nextThumbs[0]); - } - else if( this.ssLoop ) - { - Element.setOpacity('linSsImgNext',0.7); - new Effect.Appear('linSsImgNext', { duration: 0.5, from: 0.7, to: 1.0 }); - this.moveFirst(); - } - else // end reached, do nothing but enable keyboard navigation again - { - myLinImage.enableKeyboardNav(); - } + if (this.slideshowActive) + { + this.ssCurrentTimerID = setTimeout("myLinAlbum.slideshowPlay()", this.ssCurrentDelay); + } +}; - if( this.slideshowActive ) - { - this.ssCurrentTimerID = setTimeout("myLinImage.slideshowPlay()", this.ssCurrentDelay); - } - }, - moveFirst: function() { - if( this.slideshowActive ) - { - clearTimeout(this.ssCurrentTimerID); - } +// moveFirst() +YAHOO.linpha.Album.prototype.moveFirst = function() { - Element.setOpacity('linSsImgFirst',0.7); - new Effect.Appear('linSsImgFirst', { duration: 0.5, from: 0.7, to: 1.0 }); - myLinImage.loadImage( firstImgId ); + if (this.slideshowActive) + { + clearTimeout(this.ssCurrentTimerID); + } - if( this.slideshowActive ) - { - this.ssCurrentTimerID = setTimeout("myLinImage.slideshowPlay()", this.ssCurrentDelay); - } - }, - moveLast: function() { - if( this.slideshowActive ) - { - clearTimeout(this.ssCurrentTimerID); - } + /*if (this.fullscreenActive && linUseEffects) { + (new YAHOO.util.Anim('linSsImgFirst', {opacity: {from: 0.7, to: 1}}, 0.5)).animate(); + //Element.setOpacity('linSsImgFirst',0.7); + //new Effect.Appear('linSsImgFirst', { duration: 0.5, from: 0.7, to: 1.0 }); + }*/ - Element.setOpacity('linSsImgLast',0.7); - new Effect.Appear('linSsImgLast', { duration: 0.5, from: 0.7, to: 1.0 }); - myLinImage.loadImage( lastImgId ); + myLinAlbum.openImage( this.album.Thumbs[0].id ); - if( this.slideshowActive ) - { - this.ssCurrentTimerID = setTimeout("myLinImage.slideshowPlay()", this.ssCurrentDelay); - } - }, + if (this.slideshowActive) + { + this.ssCurrentTimerID = setTimeout("myLinAlbum.slideshowPlay()", this.ssCurrentDelay); + } +}; - // ----------------------------------------------------------------------------------- - // Change image functions - // ----------------------------------------------------------------------------------- +// moveLast() +YAHOO.linpha.Album.prototype.moveLast = function() { - /** - * changeImage() - */ - changeImage: function() { - - /** - * set height of outer div to prevent the whole page getting smaller, and if the image is loaded getting bigger again - * but in fullscreen, we want no activities in background - */ - if(! this.fullscreenActive) { - $('linDivMainimage').style.height = $('linImgMainimage').style.height; - //$('linDivMain').style.height = $('linDivMain').offsetHeight; - //alert($('linDivMain').offsetHeight); - } - - /** - * hide elements during transition - */ - this.hideImgInfoNow(); // hide text info link immediately - Element.hide('linImgMainimage'); // hide mainimage while changing image to prevent flicker - Element.hide('linDivInfoLink'); - - this.currentFileType = this.xmlDoc[IdCurrent].getElementsByTagName('filetype').item(0).firstChild.data; - - switch( this.currentFileType ) - { - case '1': // image - - if(! this.finishedPreloadedImages[IdCurrent] ) - { - Element.show('linDivloading'); - } - - //$('linImgMainimage').style.marginLeft = 0; // restore left margin, set when viewing videos - - /** - * calc image width and height - */ - var orgWidth = this.xmlDoc[IdCurrent].getElementsByTagName('imgwidth').item(0).firstChild.data; - var orgHeight = this.xmlDoc[IdCurrent].getElementsByTagName('imgheight').item(0).firstChild.data; - var sizeArray = this.scaleToFit(orgWidth,orgHeight,maxImageWidth,maxImageHeight,1); - var imgWidth = sizeArray[0]; - var imgHeight = sizeArray[1]; + if (this.slideshowActive) + { + clearTimeout(this.ssCurrentTimerID); + } - /** - * preload image - */ - var currentImgSrc = imageSrc + IdCurrent + '&width=' + imgWidth + '&height=' + imgHeight; - imgPreloader = new Image(); - - /** - * once image is preloaded, resize image container - * - * pay attention with the other image preloader! - * if imgWidth and imgWidth was not set with trailing 'var' it got overlapping with the other variables - * and this caused the image not resized correctly in resizeImageContainer() !!! - */ - imgPreloader.onload=function(){ - myLinImage.finishedPreloadedImages[IdCurrent] = true; - $('linImgMainimage').src = currentImgSrc; - myLinImage.resizeImageContainer(imgWidth, imgHeight); - } - imgPreloader.src = currentImgSrc; + /*if (this.fullscreenActive && linUseEffects) { + (new YAHOO.util.Anim('linSsImgLast', {opacity: {from: 0.7, to: 1}}, 0.5)).animate(); + //Element.setOpacity('linSsImgLast',0.7); + //new Effect.Appear('linSsImgLast', { duration: 0.5, from: 0.7, to: 1.0 }); + }*/ - break; - case '2': // video + myLinAlbum.openImage( this.album.Thumbs [this.album.Thumbs.length-1].id ); - //$('linImgMainimage').style.marginLeft = 200; - - /** - * show video thumbnail - */ - $('linImgMainimage').src = thumbSrc + IdCurrent ; - $('linImgMainimage').style.width = 'auto'; - $('linImgMainimage').style.height = 'auto'; + if (this.slideshowActive) + { + this.ssCurrentTimerID = setTimeout("myLinAlbum.slideshowPlay()", this.ssCurrentDelay); + } +}; - /** - * show image and set div height - */ - this.showImage(); - break; - case '0': // others - break; - } - }, - /** - * resizeImageContainer() - */ - resizeImageContainer: function( imgWidth, imgHeight) { +// ----------------------------------------------------------------------------------- +// Slideshow functions +// ----------------------------------------------------------------------------------- - // get current height and width - /*this.wCur = $('linImgMainimage').offsetWidth; - this.hCur = $('linImgMainimage').offsetHeight; +// initFullscreen() +YAHOO.linpha.Album.prototype.initFullscreen = function() { - // scalars based on change from old to new - this.xScale = ((imgWidth + (borderSize * 2)) / this.wCur) * 100; - this.yScale = ((imgHeight + (borderSize * 2)) / this.hCur) * 100; + /** + * append the slideshow divs to the body + * we need to append to body to be sure to get the real fullscreen + * even if we are locked in another div + */ + var myDiv = document.createElement("div"); + var attrId = document.createAttribute("id"); + attrId.nodeValue = "linDivSlideshowBody"; + myDiv.setAttributeNode( attrId ); + document.getElementsByTagName("body").item(0).appendChild(myDiv); + + // copy html from slideshow.js.php + document.getElementById('linDivSlideshowBody').innerHTML = linSlideshowHtml; - // calculate size difference between new and old image, and resize if necessary - wDiff = (this.wCur - borderSize * 2) - imgWidth; - hDiff = (this.hCur - borderSize * 2) - imgHeight; + + /*var objBody = document.getElementsByTagName("body").item(0); + objBody.appendChild( Builder.node('div', {id: "linDivSlideshowOverlay", style: "display: none;"}) ); + objBody.appendChild( Builder.node('div', {id: "linDivSlideshowImage", style: "display: none;"}) ); + objBody.appendChild( Builder.node('div', {id: "linDivSlideshowControlsOuter", style: "display: none;"}) );*/ + + //$('linDivSlideshowControlsOuter').innerHTML = linSlideshowHtml; + + YAHOO.util.Event.addListener('linDivSlideshowBody', "dblclick", this.fullscreenStop, this, true); + //YAHOO.util.Event.addListener('linDivSlideshowBody', "dblclick", myLinAlbum.fullscreenStop()); + + this.fullscreenInitialised = true; +} - if(!( hDiff == 0)){ new Effect.Scale('linImgMainimage', this.yScale, {scaleX: false, duration: resizeDuration, queue: 'front'}); } - if(!( wDiff == 0)){ new Effect.Scale('linImgMainimage', this.xScale, {scaleY: false, delay: resizeDuration, duration: resizeDuration}); } +// fullscreenStart() +YAHOO.linpha.Album.prototype.fullscreenStart = function() { - // if new and old image are same size and no scaling transition is necessary, - // do a quick pause to prevent image flicker. - if((hDiff == 0) && (wDiff == 0)){ - if (navigator.appVersion.indexOf("MSIE")!=-1){ pause(250); } else { pause(100);} - }*/ - - $('linImgMainimage').style.width = imgWidth + 'px'; - $('linImgMainimage').style.height = imgHeight + 'px'; - + if (!this.fullscreenInitialised) + { + this.initFullscreen(); + } - /*Element.setHeight('prevLink', imgHeight); - Element.setHeight('nextLink', imgHeight); - Element.setWidth( 'imageDataContainer', imgWidth + (borderSize * 2));*/ - - /** - * show panorama link - * the only reason why do this at this point is, because this is only done on images - * and we just know the width and height - */ - if( imgWidth/imgHeight >= 2 || imgHeight/imgWidth >= 2 ) - { - Element.show('linHrefPanoLink'); - } - this.showImage(); - }, - /** - * showImage() - * - * Display image and begin preloading next images. + * save old values to restore if slideshow ends */ - showImage: function(){ - Element.hide('linDivloading'); - - if( useEffects ) - { - new Effect.Appear('linImgMainimage', { duration: 0.2, afterFinish: function(){ myLinImage.setImageData(); } }); - } - else - { - Element.show('linImgMainimage'); - this.setImageData() - } + //this.fullscreenOldMaxWidth = maxImageWidth; + //this.fullscreenOldMaxHeight = maxImageHeight; - if(! this.fullscreenActive) - { - $('linDivMainimage').style.height = $('linImgMainimage').style.height; // reset to correct height to prevent trouble if image is bigger or smaller - //$('linDivMain').style.height = 'auto'; - } - }, - /** - * setImageData() + * disable scrollbars + * IE requires html tag, firefox and opera dont care */ - setImageData: function() - { - this.enableKeyboardNav(); - - /** - * set title - */ - if( typeof $('linDivTitle') != 'undefined' ) - { - $('linDivTitle').innerHTML = this.xmlDoc[IdCurrent].getElementsByTagName('title').item(0).firstChild.data; - } - - /** - * update the menu - * - * replace the image ids in the menu - * replace( /linId=[0-9]* /g , "linId=" + IdCurrent ); - * its just an search/replace of 'linId=x' in the menu - * its very fast (about 0 - 15ms) and its executed every time the image changes - * - * but only in menuMore and menuAdmin, because we have in menuLogin - * linId='+IdCurrent, and ooh this will create very unexpected results..!! - */ - /*if( typeof $('linMenuAdmin') != 'undefined' ) - {*/ - //$('linMenuAdmin').innerHTML = $('linMenuAdmin').innerHTML.replace( /linId=[0-9]*/g , "linId=" + IdCurrent ); - /*}*/ - - /** - * menuMore - */ - /*if( typeof $('linMenuMore') != 'undefined' ) - {*/ - //$('linMenuMore').innerHTML = $('linMenuMore').innerHTML.replace( /linId=[0-9]*/g , "linId=" + IdCurrent ); - - // replace the width and height dimensions of the view at fullscreen link - //var orgWidth = this.xmlDoc[IdCurrent].getElementsByTagName('imgwidth').item(0).firstChild.data; - //var orgHeight = this.xmlDoc[IdCurrent].getElementsByTagName('imgheight').item(0).firstChild.data; - //$('linLiViewAtFullscreen').innerHTML = $('linLiViewAtFullscreen').innerHTML.replace( /width=[0-9]*/ , "width=" + orgWidth ); - //$('linLiViewAtFullscreen').innerHTML = $('linLiViewAtFullscreen').innerHTML.replace( /height=[0-9]*/ , "height=" + orgHeight ); - //$('linLiViewAtFullscreen').innerHTML = $('linLiViewAtFullscreen').innerHTML.replace( /[0-9]*x[0-9]*/ , orgWidth + "x" + orgHeight ); - /*}*/ - - /** - * set current thumb - */ - $('linDivThumbnavi_Current').innerHTML = '<a href="javascript:myLinImage.loadImage(' + IdCurrent + ')"><img class="linImgThumbnavi_Current" src="' + thumbSrc + IdCurrent + '" /></a>'; + //this.previousBodyOverflow = document.getElementsByTagName("html")[0].style.overflow; + this.previousHtmlCSS = document.getElementsByTagName("html")[0].style.cssText; + document.getElementsByTagName("html")[0].style.overflow='hidden'; - /** - * set prev thumbs - */ - $('linDivThumbnavi_Prev').innerHTML = ''; - this.prevThumbs = new Array(); - if(this.xmlDoc[IdCurrent].getElementsByTagName('prevthumb').length > 0) - { - for(var i = 0; i < this.xmlDoc[IdCurrent].getElementsByTagName('prevthumb').length; i++) - { - var thumbId = this.xmlDoc[IdCurrent].getElementsByTagName('prevthumb').item(i).firstChild.data; - this.prevThumbs[i] = thumbId; - this.setPrevNextThumb(thumbId, 'linDivThumbnavi_Prev'); - } - } - - /** - * set next thumbs - */ - $('linDivThumbnavi_Next').innerHTML = ''; - this.nextThumbs = new Array(); - if(this.xmlDoc[IdCurrent].getElementsByTagName('nextthumb').length > 0) - { - for(var i = 0; i < this.xmlDoc[IdCurrent].getElementsByTagName('nextthumb').length; i++) - { - var thumbId = this.xmlDoc[IdCurrent].getElementsByTagName('nextthumb').item(i).firstChild.data; - this.nextThumbs[i] = thumbId; - this.setPrevNextThumb(thumbId, 'linDivThumbnavi_Next'); - } - } - - /** - * set meta data - */ - $('linDivMeta').innerHTML = ''; - if(this.xmlDoc[IdCurrent].getElementsByTagName('meta').length > 0) - { - var table = Builder.node('table', {id: 'linTableMeta'} ); - var tbody = Builder.node('tbody'); + if (YAHOO.env.ua.ie) { // required for width=100% + this.previousBodyCSS = document.getElementsByTagName("body")[0].style.cssText; + document.getElementsByTagName("body")[0].style.margin = 0; + } - for(var i = 0; i < this.xmlDoc[IdCurrent].getElementsByTagName('meta').length; i++) - { - var meta = this.xmlDoc[IdCurrent].getElementsByTagName('meta').item(i); - var metaname = meta.getElementsByTagName('name').item(0).firstChild.data; - if(meta.getElementsByTagName('value').item(0).hasChildNodes()) { // prevent error in IE - var metavalue = meta.getElementsByTagName('value').item(0).firstChild.data; - } else { - var metavalue = ''; - } + /** + * steal the mainimage + */ + YAHOO.util.Dom.setStyle('linDivThumbs', "visibility", "hidden"); + YAHOO.util.Dom.setStyle('linDivMainImage', "visibility", "hidden"); - var tr = Builder.node('tr'); - var tdleft = Builder.node('td', {className: 'linTdMetaLeftColumn'}, metaname ); - var tdright = Builder.node('td', metavalue ); + document.getElementById('linDivMainImage').id = 'linDivMainImageNormal'; + document.getElementById('linDivLoading').id = 'linDivLoadingNormal'; + document.getElementById('linImgMainImage').id = 'linImgMainImageNormal'; + document.getElementById('linDivDescription').id = 'linDivDescriptionNormal'; + + document.getElementById('linDivMainImageSlideshow').id = 'linDivMainImage'; + document.getElementById('linDivLoadingSlideshow').id = 'linDivLoading'; + document.getElementById('linImgMainImageSlideshow').id = 'linImgMainImage'; + document.getElementById('linDivDescriptionSlideshow').id = 'linDivDescription'; - tr.appendChild(tdleft); - tr.appendChild(tdright); - tbody.appendChild(tr); - } + //$('linDivMainimage').innerHTML = ''; + //$('linDivSlideshowImage').innerHTML = '<img id="linImgMainimage" style="display: none;" class="linImgSlideshow">'; - table.appendChild(tbody); - - $('linDivMeta').appendChild(table); - } - - /** - * file type specific meta data stuff - */ - switch( this.currentFileType ) - { - case '1': // image - this.setImageInfoLink(); // show the "info" link, must be called after Appear('linImgMainimage') - - //Element.hide('linDivVideoLink'); - //Element.show('linDivExifLink'); - //$('linAMetaExif').href = '#' + $('linAMetaExif').href; - //myLinGlobal.enableTab( 'linDivTab', 3, 'linAMetaExif' ); - - break; - case '2': // video - - //Element.show('linDivVideoLink'); - //Element.hide('linDivExifLink'); - //$('linAMetaExif').href = $('linAMetaExif').href.substring(1); - //$('linAMetaExif').href = '#' + $('linAMetaExif').href; - - //myLinGlobal.disableTab( 'linDivTab', 3, 'linAMetaExif' ); - - /*$('linDivMetaOuter').style.top = $('linImgMainimage').offsetTop + 'px'; - $('linDivMetaOuter').style.height = $('linImgMainimage').offsetHeight + 'px'; // 'auto' - Element.show('linDivMetaOuter');*/ - - break; - } - - this.initTextareaAddComment(); - this.setComments(); - - /** - * set image nr - * currently only in slideshow used - */ - $('linDivSlideshowImgNr').innerHTML = this.xmlDoc[IdCurrent].getElementsByTagName('imgnr').item(0).firstChild.data; - - - /** - * and at last, start preloading next and previous images - */ - this.preloadXml(); - + /** + * start slideshow with some superduper effects + */ + //Effect.Appear('linDivSlideshowOverlay', { queue: 'end', duration: 1.0, from: 0.0, to: 0.9 }); + //Effect.BlindDown('linDivSlideshowControlsOuter', { queue: 'end'} ); + //Element.show('linDivSlideshowImage'); + + if (linUseEffects) { + YAHOO.util.Dom.setStyle('linDivSlideshowBody', "opacity", 0); + YAHOO.util.Dom.setStyle('linDivSlideshowBody', "display", "block"); + (new YAHOO.util.Anim('linDivSlideshowBody', {opacity: {from: 0, to: 1}}, 1)).animate(); + } else { + YAHOO.util.Dom.setStyle('linDivSlideshowBody', "display", "block"); + } + if (linUseEffects) { + YAHOO.util.Dom.setStyle('linDivSlideshowControlsOuter', "top", '-100px'); + YAHOO.util.Dom.setStyle('linDivSlideshowControlsOuter', "display", "block"); + (new YAHOO.util.Anim('linDivSlideshowControlsOuter', {top: {from: -100, to: 0}}, 1)).animate(); + } else { + YAHOO.util.Dom.setStyle('linDivSlideshowControlsOuter', "display", "block"); + } + + YAHOO.util.Dom.setStyle('linDivImageSlideshow', "display", "block"); - }, + this.fullscreenActive = true; + /** - * setPrevNextThumb() - * - * code to generate a thumbnail with a <div><a><img> tag + * reload image with new position and size */ - setPrevNextThumb: function(thumbId, divId) - { - var ElemImg = Builder.node('img', {id: 'thumb'+thumbId, className: 'linImgThumbnavi_PrevNext', src: thumbSrc + thumbId}); - var ElemA = Builder.node('a', {href: 'javascript:myLinImage.loadImage(' + thumbId + ')'}); - var ElemDiv = Builder.node('div', {className: 'linDivThumbnavi_PrevNext'}); - - ElemA.appendChild( ElemImg ); - ElemDiv.appendChild( ElemA ); - $(divId).appendChild(ElemDiv); - - if(! this.finishedPreloadedImages[thumbId]) { - Element.setOpacity('thumb'+thumbId,0.5); - } - - }, + //linOnResizeWrapper(); + myLinPage.setResizeMode('image'); + this.changeImage( linIdCurrent ); +} - // ----------------------------------------------------------------------------------- - // Keyboard actions - // ----------------------------------------------------------------------------------- +// fullscreenStop() +YAHOO.linpha.Album.prototype.fullscreenStop = function() { - /** - * enableKeyboardNav() - */ - enableKeyboardNav: function() { - document.onkeydown = this.keyboardAction; - }, + if (!this.fullscreenActive) + { + return; + } + this.fullscreenActive = false; /** - * disableKeyboardNav() + * end slideshow with some superduper effects */ - disableKeyboardNav: function() { - document.onkeydown = ''; - }, + //Effect.Fold('linDivSlideshowControlsOuter', { queue: 'end'} ); + //Effect.Fade('linDivSlideshowOverlay', { queue: 'end', duration: 0.5, from: 0.9, to: 0.0 } ); + //Element.hide('linDivSlideshowImage'); + + if (linUseEffects) { + var myAnimObj = new YAHOO.util.Anim('linDivSlideshowBody', {opacity: {from: 1, to: 0}}, 1); + myAnimObj.onComplete.subscribe( function() { YAHOO.util.Dom.setStyle('linDivSlideshowBody', "display", "none"); } ); + myAnimObj.animate(); + } else { + YAHOO.util.Dom.setStyle('linDivSlideshowBody', "display", "none"); + } + if (linUseEffects) { + var myAnimObj = new YAHOO.util.Anim('linDivSlideshowControlsOuter', {top: {from: 0, to: -100}}, 1); + myAnimObj.onComplete.subscribe( function() { + YAHOO.util.Dom.setStyle('linDivSlideshowControlsOuter', "display", "none"); + document.getElementsByTagName("body")[0].style.overflow = myLinAlbum.previousBodyOverflow; /* to prevent jump of control div */ + } ); + myAnimObj.animate(); + } else { + YAHOO.util.Dom.setStyle('linDivSlideshowControlsOuter', "display", "none"); + } /** - * keyboardAction() - * - * very nice - * http://www.mediaevent.de/javascript/needful_tables.html + * re-enable scrollbars + * IE requires html tag, firefox and opera dont care */ - keyboardAction: function(e) { - - if (e == null) { // ie - keycode = event.keyCode; - ctrlKey = event.ctrlKey; - } else { // mozilla - keycode = e.which; - ctrlKey = e.ctrlKey; - } - - /*if( ctrlKey ) - { - alert('ctrl pressed'); - return; - }*/ - - //alert(keycode); - - key = String.fromCharCode(keycode).toLowerCase(); + document.getElementsByTagName("html")[0].style.cssText = this.previousHtmlCSS; + if (YAHOO.env.ua.ie) { + this.previousBodyCSS = document.getElementsByTagName("body")[0].style.cssText; + document.getElementsByTagName("body")[0].style.cssText = this.previousBodyCSS; + } + - //if ((keycode == 39) && (ctrlKey == true)) // ctrl + arrow right - if (keycode == 34) // page down - { - myLinImage.disableKeyboardNav(); - myLinImage.moveNext(); - return false; - } - //else if ((keycode == 37) && (ctrlKey == true)) // ctrl + arrow left - else if (keycode == 33) // page up - { - myLinImage.disableKeyboardNav(); - myLinImage.movePrev(); - return false; - } - else if ((keycode == 32) && (ctrlKey == true)) // ctrl + space - { - myLinImage.slideshowStartStop(); - } - else if ((keycode == 122)) // F11 - { - if( myLinImage.fullscreenActive ) { - $('linDivSlideshowExit').show(); // hide exit button to force exit again with F11 - myLinImage.fullscreenStop(); - } else { - $('linDivSlideshowExit').hide(); - myLinImage.fullscreenStart(); - } - } - else if ((keycode == 36) && (ctrlKey == true)) // ctrl + home - //else if (keycode == 36) // home - { - myLinImage.moveFirst(); - return false; - } - else if ((keycode == 35) && (ctrlKey == true)) // ctrl + end - //else if (keycode == 35) // end - { - myLinImage.moveLast(); - return false; - } - else if( myLinImage.fullscreenActive && ((key == 'f') || (key == 'x') || (key == 'o') || (key == 'c') ) ) // close fullscreen - { - myLinImage.fullscreenStop(); - } - else if(myLinImage.fullscreenActive && key == 's') // start/stop slideshow - { - myLinImage.slideshowStartStop(); - } - else if(myLinImage.fullscreenActive && key == 'p') // display previous image - { - myLinImage.disableKeyboardNav(); - myLinImage.movePrev(); - } - else if(myLinImage.fullscreenActive && key == 'n') // display next image - { - myLinImage.disableKeyboardNav(); - myLinImage.moveNext(); - } - }, - - // ----------------------------------------------------------------------------------- - // Preload functions - // ----------------------------------------------------------------------------------- - + + YAHOO.util.Dom.setStyle('linDivImageSlideshow', "display", "none"); + /** - * preloadXml() - * Preload previous and next images. - * - * normally, loadImageXml() will call also preloadImage() - * but we also need to call preloadImage() if the Xml data is preloaded, - * but not yet the image (this may occur if we change to fullscreen, - * then, the images need to be re preloaded all + * give back the mainimage */ - preloadXml: function() { + //$('linDivSlideshowImage').innerHTML = ''; + //$('linDivMainimage').innerHTML = '<img id="linImgMainimage" style="display: none;">'; + + document.getElementById('linDivMainImage').id = 'linDivMainImageSlideshow'; + document.getElementById('linDivLoading').id = 'linDivLoadingSlideshow'; + document.getElementById('linImgMainImage').id = 'linImgMainImageSlideshow'; + document.getElementById('linDivDescription').id = 'linDivDescriptionSlideshow'; - // preload nextthumb from left to right - if(this.xmlDoc[IdCurrent].getElementsByTagName('nextthumb').length > 0) - { - for(var i = 0; i < this.xmlDoc[IdCurrent].getElementsByTagName('nextthumb').length; i++) - { - var imgId = this.xmlDoc[IdCurrent].getElementsByTagName('nextthumb').item(i).firstChild.data; + document.getElementById('linDivMainImageNormal').id = 'linDivMainImage'; + document.getElementById('linDivLoadingNormal').id = 'linDivLoading'; + document.getElementById('linImgMainImageNormal').id = 'linImgMainImage'; + document.getElementById('linDivDescriptionNormal').id = 'linDivDescription'; + + YAHOO.util.Dom.setStyle('linDivMainImage', "visibility", "visible"); + YAHOO.util.Dom.setStyle('linDivThumbs', "visibility", "visible"); - if(! this.preloadXmlFinished[imgId]) - { - this.loadImageXml(imgId); - } - else if(! this.finishedPreloadedImages[imgId] ) - { - this.preloadImage(imgId); - } - } - } - // preload prevthumb from right to left - if(this.xmlDoc[IdCurrent].getElementsByTagName('prevthumb').length > 0) - { - for(var i = this.xmlDoc[IdCurrent].getElementsByTagName('prevthumb').length-1; i >= 0; i--) - { - var imgId = this.xmlDoc[IdCurrent].getElementsByTagName('prevthumb').item(i).firstChild.data; - - if(! this.preloadXmlFinished[imgId]) - { - this.loadImageXml(imgId); - } - else if(! this.finishedPreloadedImages[imgId] ) - { - this.preloadImage(imgId); - } - } - } - }, - /** - * preloadImage() - * - * will be called after getting the xml data + * reload image with old position and size */ - preloadImage: function(imgId) - { - if(! this.finishedPreloadedImages[imgId] ) - { - switch(this.xmlDoc[imgId].getElementsByTagName('filetype').item(0).firstChild.data) - { - case '1': // image - /** - * set image width and height - */ - var orgWidth = this.xmlDoc[imgId].getElementsByTagName('imgwidth').item(0).firstChild.data; - var orgHeight = this.xmlDoc[imgId].getElementsByTagName('imgheight').item(0).firstChild.data; - var sizeArray = this.scaleToFit(orgWidth,orgHeight,maxImageWidth,maxImageHeight,1); - var imgWidth = sizeArray[0]; - var imgHeight = sizeArray[1]; - - /** - * preload image - */ - this.preloadImageSrc[imgId] = new Image(); - - this.preloadImageSrc[imgId].onload=function(){ - myLinImage.preloadImageFinished(imgId); - } - this.preloadImageSrc[imgId].src = imageSrc + imgId + '&width=' + imgWidth + '&height=' + imgHeight; - - break; - case '2': // video - this.preloadImageFinished(imgId); - break; - case '0': // other - break; - } - } - }, - - preloadImageFinished: function(imgId) { + myLinPage.setResizeMode('image'); + this.changeImage( linIdCurrent ); +}; - this.finishedPreloadedImages[imgId] = true; +// slideshowStartStop() +YAHOO.linpha.Album.prototype.slideshowStartStop = function() { - if( $('thumb'+imgId) ) // maybe its not here anymore - { - new Effect.Appear('thumb'+imgId, { duration: 0.5, from: 0.5, to: 1.0 }); - } - - }, - - - // ----------------------------------------------------------------------------------- - // Slideshow functions - // ----------------------------------------------------------------------------------- - - fullscreenStart: function() + // start Slideshow + if (!this.slideshowActive) { - this.fullscreenActive = true; - - /** - * save old values to restore if slideshow ends - */ - this.fullscreenOldMaxWidth = maxImageWidth; - this.fullscreenOldMaxHeight = maxImageHeight; - - /** - * disable scrollbars - */ - this.previousBodyOverflow = document.getElementsByTagName("body")[0].style.overflow; - document.getElementsByTagName("body")[0].style.overflow='hidden'; - - /** - * start slideshow with some superduper effects - */ - Effect.Appear('linDivSlideshowOverlay', { queue: 'end', duration: 1.0, from: 0.0, to: 0.9 }); - Effect.BlindDown('linDivSlideshowControlsOuter', { queue: 'end'} ); - Element.show('linDivSlideshowImage'); - - /** - * steal the mainimage - */ - $('linDivMainimage').innerHTML = ''; - $('linDivSlideshowImage').innerHTML = '<img id="linImgMainimage" style="display: none;" class="linImgSlideshow">'; - - /** - * reload image with new position and size - */ - //this.resizeWindow(); - //linOnResizeCreateTrigger(); - linOnResizeWrapper(); - }, - fullscreenStop: function() + this.slideshowActive = true; + //Element.setOpacity('linSsImgStart',0.7); + YAHOO.util.Dom.setStyle('linSsImgStart', "opacity", 0.7); + this.ssCurrentTimerID = setTimeout("myLinAlbum.slideshowPlay()", this.ssCurrentDelay); + } + else // stop Slideshow { - this.fullscreenActive = false; + this.slideshowActive = false; + YAHOO.util.Dom.setStyle('linSsImgStart', "opacity", 1); + //Element.setOpacity('linSsImgStart',1); + clearTimeout(this.ssCurrentTimerID); + } +}; - /** - * restore max image size - */ - maxImageWidth = this.fullscreenOldMaxWidth; - maxImageHeight = this.fullscreenOldMaxHeight; +// slideshowPlay() +YAHOO.linpha.Album.prototype.slideshowPlay = function() { - /** - * re-enable scrollbars - */ - document.getElementsByTagName("body")[0].style.overflow = this.previousBodyOverflow; - - /** - * delete preloaded images after stopping fullscreen - */ - this.finishedPreloadedImages = new Array(); - - /** - * end slideshow with some superduper effects - */ - Effect.Fold('linDivSlideshowControlsOuter', { queue: 'end'} ); - Effect.Fade('linDivSlideshowOverlay', { queue: 'end', duration: 0.5, from: 0.9, to: 0.0 } ); - Element.hide('linDivSlideshowImage'); - - /** - * give back the mainimage - */ - $('linDivSlideshowImage').innerHTML = ''; - $('linDivMainimage').innerHTML = '<img id="linImgMainimage" style="display: none;">'; - - /** - * reload image with old position and size - */ - this.loadImage( IdCurrent ); - }, - - slideshowStartStop: function() + if (this.album.Thumbs[this.currentIndex+1] || this.ssLoop || this.ssRandom) { - // start Slideshow - if(! this.slideshowActive) - { - this.slideshowActive = true; - Element.setOpacity('linSsImgStart',0.7); - this.ssCurrentTimerID = setTimeout("myLinImage.slideshowPlay()", this.ssCurrentDelay); - } - else // stop Slideshow - { - this.slideshowActive = false; - Element.setOpacity('linSsImgStart',1); - clearTimeout(this.ssCurrentTimerID); - } - }, - slideshowPlay: function() + this.moveNext(); + //this.ssCurrentTimerID = setTimeout("myLinAlbum.slideshowPlay()", this.ssCurrentDelay); + } + else { - if(this.nextThumbs[0] || this.ssLoop) - { - this.moveNext(); - //this.ssCurrentTimerID = setTimeout("myLinImage.slideshowPlay()", this.ssCurrentDelay); - } - else - { - // force stop slideshow - this.slideshowActive = true; - this.slideshowStartStop(); - } - }, + // force stop slideshow + this.slideshowActive = true; + this.slideshowStartStop(); + } +}; - slideshowChangeDelay: function() - { - this.ssCurrentDelay = $('linSsDelay').options[ $('linSsDelay').selectedIndex ].value * 1000; - //document.optionsForm.delay.options[document.optionsForm.delay.selectedIndex].value * 1000; - }, - slideshowChangeLoop: function() - { - if(! this.ssLoop) { - this.ssLoop = true; - Element.setOpacity('linSsImgLoop',0.7); - } else { - this.ssLoop = false; - Element.setOpacity('linSsImgLoop',1); - } - }, - slideshowChangeRandom: function() - { - if(! this.ssRandom) { - this.ssRandom = true; - Element.setOpacity('linSsImgRandom',0.7); - } else { - this.ssRandom = false; - Element.setOpacity('linSsImgRandom',1); - } - alert('This feature is currently not implemented, do we really need that?'); - }, +// slideshowChangeDelay() +YAHOO.linpha.Album.prototype.slideshowChangeDelay = function() { + this.ssCurrentDelay = document.getElementById('linSsDelay').options[ document.getElementById('linSsDelay').selectedIndex ].value * 1000; + //document.optionsForm.delay.options[document.optionsForm.delay.selectedIndex].value * 1000; +}; - // ----------------------------------------------------------------------------------- - // Image info functions - // ----------------------------------------------------------------------------------- +// slideshowChangeLoop() +YAHOO.linpha.Album.prototype.sl... [truncated message content] |
From: <fan...@us...> - 2008-03-16 08:51:33
|
Revision: 4903 http://linpha.svn.sourceforge.net/linpha/?rev=4903&view=rev Author: fangehrn Date: 2008-03-16 01:51:31 -0700 (Sun, 16 Mar 2008) Log Message: ----------- 2008-03-15 flo * fixed some IE bugs everything should now work fine on firefox/opera/IE 2008-03-13 flo * finished fullscreen/slideshow/navigation 2008-03-09 flo * re-design thumb and image view Modified Paths: -------------- trunk/linpha2/lib/classes/linpha.view.image.class.php Modified: trunk/linpha2/lib/classes/linpha.view.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.view.image.class.php 2008-03-16 08:51:13 UTC (rev 4902) +++ trunk/linpha2/lib/classes/linpha.view.image.class.php 2008-03-16 08:51:31 UTC (rev 4903) @@ -25,502 +25,193 @@ if(!defined('LINPHA_DIR')) { exit(1); } -define('LIN_SELECT_FIELDS', - "".LIN_PREFIX."photos.id AS id2, " . - "".LIN_PREFIX."photos.id AS id, ".LIN_PREFIX."photos.name AS name, " . - "".LIN_PREFIX."photos.img_type AS img_type, ".LIN_PREFIX."photos.md5sum AS md5sum, " . - "".LIN_PREFIX."photos.width AS width, ".LIN_PREFIX."photos.height AS height, " . - "".LIN_PREFIX."photos.filesize AS filesize, " . - "".LIN_PREFIX."photos.time_add AS time_add, ".LIN_PREFIX."photos.time_mod AS time_mod, " . - "".LIN_PREFIX."photos.time_exif AS time_exif, ".LIN_PREFIX."photos.stats_numbers AS stats_numbers, " . - "".LIN_PREFIX."photos.stats_views AS stats_views, ".LIN_PREFIX."photos.stats_downloads AS stats_downloads" -); +class LinViewImage { -class LinImgview { - -public $mode; // 'home', 'thumb', 'image' -public $modulename; // 'albums', 'browse', ... -public $tot_photos; -public $photos; -public $photos_filtered; -public $id_parent, $img_type, $filename, $md5sum, $org_width, $org_height; -private $nr_pages, $current_page; // only used if javascript disabled -private $newCommentAdded = false; // used for ajax - +public $comments = array(); +public $imageInfo = array(); +public $exif = array(); +private $imgData; + /** * constructor */ function __construct() { - + global $linTpl; // for html files + + if ($GLOBALS['linpha']->template->idCurrent == 0) { + return; + } + + if ( !isset($_GET['linTab']) || empty($_GET['linTab']) ) + { + return; + } + + $this->imgData = $GLOBALS['linpha']->db->GetRow("SELECT * FROM ".LIN_PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); + + + switch($_GET['linTab']) + { + case 'comments': + + if ( isset($_POST['linCmd']) && $_POST['linCmd']=='addComment') + { + $this->saveImageComment(); + } + + $this->getImageData('comments'); + require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/comments.html.php'); + break; + + case 'saveMetaData': + $this->saveImageData(); + break; + + case 'imageInfo': + $this->getImageData('imageinfo'); + require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/imageInfo.html.php'); + break; + case 'videoInfo': + $this->getImageData('videoInfo'); + require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/videoInfo.html.php'); + break; + + case 'gps': + $this->getImageData('gps'); + require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/gps.html.php'); + break; + case 'exif': + $this->getImageData('exif'); + require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/exif.html.php'); + break; + case 'iptcXmp': + $this->getImageData('iptcXmp'); + require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/iptcXmp.html.php'); + break; + + } + + /*echo '{'."\n"; + if ( isset($_POST['linCmd']) && $_POST['linCmd']=='add_comment') + { + if ($this->saveImageComment()) + { + echo '"CommentAdded": true, '; + echo '"CommentMsg": "'.htmlentities(i18n("Comment successfully added."), ENT_QUOTES).'", ' . "\n"; + $this->getImageInfos(); + } + else + { + echo '"CommentAdded": false, '; + echo '"CommentMsg": "'.htmlentities(i18n("Error adding comment."), ENT_QUOTES).'"' . "\n"; + } + } + else + { + $this->getImageInfos(); + } + echo '}'."\n";*/ } -/** - * set current view and set fileinfos of $GLOBALS['linpha']->template->idCurrent ($_GET['linId']) - * @param string $modulname (album, browse, search, ...) - */ -function setCurrentView($modulename) +function getImageData($what) { - $this->modulename = $modulename; - - $this->orderby = linGetSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_others_sortorder']); - - if( $GLOBALS['linpha']->template->idCurrent == 0 ) - { - /** - * on top view, reset current view - */ - if($this->modulename=='albums') - { - $this->mode = 'home'; - $this->orderby = linGetSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_home_firstsortorder']); - } - else // $this->modulename=='browse' | 'search' , others will come.. - { - $this->mode = 'thumb'; + switch($what) + { + case 'comments': + + /** + * get comments + */ + $query = $GLOBALS['linpha']->db->Execute( + "SELECT id, meta_time, meta_author, meta_comment " . + "FROM ".LIN_PREFIX."meta_comments " . + "WHERE md5sum = '".$this->imgData['md5sum']."'"); + + /*echo '"Comments": ['."\n"; + while($data = $query->FetchRow()) + { + echo '{ "time": "'.htmlentities(linStrftime($data['meta_time']), ENT_QUOTES).'",'; + echo '"author": "'.htmlentities($data['meta_author'], ENT_QUOTES).'",'; + echo '"text": "'.linHtmlTag($data['meta_comment'], ENT_QUOTES).'" }, '."\n"; + } + echo '], '."\n";*/ + + while($data = $query->FetchRow()) + { + $this->comments[] = array( + 'time' => htmlentities(linStrftime($data['meta_time']), ENT_QUOTES), + 'author' => htmlentities($data['meta_author'], ENT_QUOTES), + 'text' => linHtmlTag($data['meta_comment'], ENT_QUOTES) + ); + } + + break; + case 'imageinfo': + + /*echo '"Meta": ['."\n"; + foreach(LinMetaData::readInformations($this->, $flag_nr=10) as $data) + { + echo '{"name": "'.htmlentities($data['name'], ENT_QUOTES).'", '; + echo '"value": "'.htmlentities($data['value'], ENT_QUOTES).'"}, '."\n"; + } + echo ']'."\n";*/ + $this->imageInfo = LinMetaData::readInformations($this->imgData, $flag_nr=10); + + break; + case 'videoInfo': + $this->videoInfo = LinMetaData::readInformations($this->imgData, $flag_nr=11); + break; + + case 'exif': + break; - if( ! isset($_SESSION['mode_thumbview']) ) - { - $_SESSION['mode_thumbview'] = 'thumb'; - } - } - } - else - { - /** - * set file informations - */ - $current_data = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum, width, height FROM ".LIN_PREFIX."photos " . - "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); - /** - * check for valid id - */ - - if( isset($current_data['id']) ) - { - $this->img_type = $current_data['img_type']; - $this->filename = $current_data['name']; - $this->md5sum = $current_data['md5sum']; - $this->org_width = $current_data['width']; - $this->org_height = $current_data['height']; + } - /** - * switch between thumb_view and img_view - */ - if( $this->img_type == 0) - { - $this->mode = 'thumb'; - $this->id_parent = $current_data['id']; // use current_id as parent_id, because we want to see the content of the actual folder! - - if(! isset($_SESSION['mode_thumbview']) ) - { - $_SESSION['mode_thumbview'] = 'thumb'; - } - } - else - { - $this->mode = 'image'; - $this->id_parent = $current_data['parent_id']; // use parent_id on image view - - if( ! isset($_SESSION['mode_imageview']) ) - { - $_SESSION['mode_imageview'] = 'img'; - } - } - } - else // no valid id supplied - { - $this->mode = 'home'; - $GLOBALS['linpha']->template->idCurrent = 0; - } - } + + - if($this->mode == 'thumb' && isset($_GET['view'])) - { - $_SESSION['mode_thumbview'] = $_GET['view']; - } - if($this->mode == 'image' && isset($_GET['view'])) - { - $_SESSION['mode_imageview'] = $_GET['view']; - } - - /** - * set id_parent to a default value - */ - if( ! isset( $this->id_parent) ) - { - $this->id_parent = $GLOBALS['linpha']->template->idCurrent; - } } -/** - * main function to prepare desired layout view - */ -function buildImgView() +function saveImageComment() { - $this->filterPhotosNotPermitted(); - - /** - * set mode specific things - */ - switch($this->mode) - { - case 'home': - $this->viewHome(); - break; - case 'thumb': - switch($_SESSION['mode_thumbview']) - { - case 'thumb': - case 'thumbdetail': - $this->viewThumb(); - break; - case 'basket': - $this->viewBasket(); - break; - case 'albmeta': - $this->viewAlbMeta(); - break; - } - break; - case 'image': - switch($_SESSION['mode_imageview']) - { - case 'img': - $this->viewImg(); /* will exit in xml mode */ - break; - case 'meta': - $this->viewMeta(); - break; - } - break; - } - - /** - * doing some special commands - * - * should be done after viewImg(), because adminCommands() (force_import) uses some image informations - */ - if(isset($_GET['admin_cmd'])) { - $this->adminCommands(); - } - - if(isset($_GET['linMsg'])) - { - switch($_GET['linMsg']) - { - case 'basket_added': linSysLog(i18n("Images Added To Basket.")); break; - } - } - - /** - * set ref urls - * used in basket and ajax reloadmenu - */ - $_SESSION['ref_url_full'] = $GLOBALS['linpha']->template->URL_full; - $_SESSION['ref_url_base'] = $GLOBALS['linpha']->template->URL_base; - $_SESSION['ref_modulename'] = $this->modulename; - - /** - * set admin menu and more menu - * - this should be done after adminCommands, because of - * "nr images in basket" is changed in adminCommands() - * - * - this should be done after viewImg(), because of $org_width and $org_height in "View at" - */ - $this->setMenu(); - - /** - * at this point, there should be absolute no output - */ - include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); + /** + * image comments + */ + if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) + { + if( isset($_POST['inputAddCommentAuthor']) + && !empty($_POST['inputAddCommentAuthor']) + && ((isset($_POST['inputAddCommentText']) && !empty($_POST['inputAddCommentText'])) + || (isset($_POST['inputAddCommentTextarea']) && !empty($_POST['inputAddCommentTextarea'])))) + { + if( !empty($_POST['inputAddCommentTextarea'])) { + $comment = $_POST['inputAddCommentTextarea']; + } else { + $comment = $_POST['inputAddCommentText']; + } + + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_comments (meta_time, md5sum, meta_author, meta_comment)" . + "VALUES ('".time()."','".$this->imgData['md5sum']."','".LinSql::linAddslashes($_POST['inputAddCommentAuthor'])."'," . + "'".LinSql::linAddslashes($comment)."')"); + + linSysLog( i18n("Comment successfully added.") ); + return true; + } + } + + linSysLog( i18n("Error adding comment.") ); + return false; } -/** - * filter out files and folders not permitted and escape filename - * all other values dont have to be escaped - * (currently at least, have a look at LIN_SELECT_FIELDS) - */ -function filterPhotosNotPermitted() +function saveImageData() { - $this->photos_filtered = Array(); - - if(isset($this->photos)) - { - foreach($this->photos AS $key=>$value) - { - if( ! ($this->mode == 'image' && $value['img_type']== '0' ) ) // exclude subfolders from img_view - { - if( LinSql::photoIsAllowed( $value['id'] ) ) - { - /** - * escape name here - * -> we do not have to do it in the templates - */ - $value['name'] = htmlspecialchars($value['name'],ENT_QUOTES); - $this->photos_filtered[] = $value; - - //print_r($value); - } - } - } - } - - unset($this->photos); + LinMetaData::saveModifiedMetaData(); } -/** - * create optional top menu - */ -function setMenu() -{ - - /** - * Menu Admin - */ - if($GLOBALS['linpha']->sql->isAdmin()) - { - $GLOBALS['linpha']->template->menu['admin']['import'] = - array( - 'name' => i18n("Import"), - 'link' => array( - array('name' => i18n("Start Import Of This Folder/File"), 'link' => LINPHA_CLIENT.'/admin/?cat=maintenance_import&album_select[]='.$this->id_parent), - array('name' => i18n("Detect File Changes"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=force_import') - ) - ); - $GLOBALS['linpha']->template->menu['admin']['permissions'] = - array( - 'name' => i18n("Permissions"), - 'link' => array( - array('name' => i18n("Set Permissions"), 'link' => LINPHA_CLIENT.'/admin/?cat=permissions_view&cmd=edit&linId='.$GLOBALS['linpha']->template->idCurrent) - ) - ); - - - if($this->mode == 'thumb' || $this->mode == 'image') - { - /** - * append to "admin - import" entry - */ - $GLOBALS['linpha']->template->menu['admin']['import']['link'][] = array( - 'name' => i18n("Recreate This Thumbnail"), - 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' - ); - } - } - - /** - * Menu More - */ - if($this->mode != 'home') - { - /** - * more than one time used stuff - */ - $array = linGetSortOrders(); - foreach($array as $value) // i18n() already called - { - $array_sort_orders_links[] = array('name' => $value, 'link' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); - } - - $open_basket_link = LINPHA_LINK.'&linCat=basket'; - - switch($this->mode) - { - case 'thumb': - - $GLOBALS['linpha']->template->menu['more']['basket'] = - array( - 'name' => i18n("Basket"), - 'link' => array( - array('name' => i18n("Add All To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all'), - array('name' => i18n("Switch To Basket View"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), - array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) - ) - ); - - if( linUseAjax() ) - { - $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectsizes']); - foreach($array as $value) - { - $array_tn_sizes_links[] = array('name' => $value.' '.i18n("Pixel"), 'link' => 'javascript:myLinThumbnails.setTnSize('.$value.')'); - } - - $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectnrimages']); - foreach($array as $value) - { - $array_nr_links[] = array('name' => $value, 'link' =>"javascript:myLinThumbnails.setNrImages('".$value."')"); - } - - $array_views_links[] = array('name' => i18n("Normal"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumb'); - $array_views_links[] = array('name' => i18n("Detail"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumbdetail'); - - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - array('name' => i18n("View"), 'link' => $array_views_links), - array('name' => i18n("Thumb Size"), 'link' => $array_tn_sizes_links), - array('name' => i18n("Thumb Nr"), 'link' => $array_nr_links) - ) - ); - } - else - { - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - ) - ); - } - - if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; - } - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['metainfo'] = - array( - 'name' => i18n("Metainfo"), - 'link' => array( - array('name' => i18n("Edit Album Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=albmeta'), - ) - ); - } - break; - case 'image': - - $GLOBALS['linpha']->template->menu['more']['basket'] = - array( - 'name' => i18n("Basket"), - 'link' => array( - array('name' => i18n("Add To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this'), - array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) - ) - ); - $GLOBALS['linpha']->template->menu['more']['view'] = - array( - 'name' => i18n("View"), - 'link' => array( - array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), - array('name' => i18n("View at"), 'link' => - array( - array('name' => '640x480', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=640&height=480', 'target' => '_blank'), - array('name' => '800x600', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=800&height=600', 'target' => '_blank'), - array('name' => '1024x768', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1024&height=768', 'target' => '_blank'), - array('name' => '1280x800', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=800', 'target' => '_blank'), - array('name' => '1280x960', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=960', 'target' => '_blank'), - array('name' => '1280x1024', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=1024', 'target' => '_blank'), - array('name' => '1600x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1600&height=1200', 'target' => '_blank'), - array('name' => '1920x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1920&height=1200', 'target' => '_blank'), - array('id' => 'linLiViewAtFullscreen', 'name' => $this->org_width.'x'.$this->org_height.' ('.i18n("Fullscreen").')', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width='.$this->org_width.'&height='.$this->org_height, 'target' => '_blank'), - ) - ) - ) - ); - - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['name'] = i18n("Rotate Left"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; - $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['name'] = i18n("Rotate Right"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; - } - - if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) - { - $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; - } - - - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) - { - $GLOBALS['linpha']->template->menu['more']['metainfo'] = - array( - 'name' => i18n("Metainfo"), - 'link' => array( - array('name' => i18n("Edit Image Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=meta') - ) - ); - } - - break; - } - } - - /** - * Icons - */ - if($this->mode == 'thumb') - { - /** - * basket icons - */ - if( $GLOBALS['linpha']->sql->checkPermission('basket_download')) - { - $GLOBALS['linpha']->template->menu['icon_download'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=download'; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) - { - $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=print'; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) - { - $GLOBALS['linpha']->template->menu['icon_mail'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_all_with_checkout&checkout_as=mail'; - } - /** - * slideshow icon - */ - if( linUseAjax() ) { - $GLOBALS['linpha']->template->menu['icon_slideshow'] = 'javascript:myLinThumbnails.loadSlideshow()'; - } - } - elseif($this->mode == 'image') - { - /** - * basket icons - */ - if( $GLOBALS['linpha']->sql->checkPermission('download')) - { - $GLOBALS['linpha']->template->menu['icon_download'] = LINPHA_LINK.'&linCat=download&linId='.$GLOBALS['linpha']->template->idCurrent; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) - { - $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_this_with_checkout&checkout_as=print'; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) - { - $GLOBALS['linpha']->template->menu['icon_mail'] = $GLOBALS['linpha']->template->URL_full. - '&admin_cmd=basket_add_this_with_checkout&checkout_as=mail'; - } - - /** - * slideshow icon - */ - if( linUseAjax() ) { - $GLOBALS['linpha']->template->menu['icon_slideshow'] = 'javascript:myLinThumbnails.fullscreenStart()'; - } - } -} - /** * method for special admin commands, like rotating images, import stuff etc. * @uses LinImgview::buildImgView() @@ -588,687 +279,13 @@ } } -/** - * define thumbnail view - */ -function viewThumb() -{ - $this->viewThumbSetSubFolders(); - - /** - * create thumbnail info text (filename, description, etc.) - */ - $i=0; - foreach($this->photos_filtered AS $key=>$photo_value) - { - if($_SESSION['mode_thumbview'] == 'thumbdetail') { - $flag_nr = 14; // flag nr of thumbdetail - } else { - $flag_nr = 13; // flag nr of thumb - } - - $array_image_infos = LinMetaData::readInformations($photo_value,$flag_nr); - - $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] = ''; - $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] = ''; - $index = 'before'; - $i=0; - foreach($array_image_infos AS $value) - { - /** - * got thumbnail, switch to index after - */ - if($value['value']=='thumbnail') - { - $index = 'after'; - } - else - { - $i++; - if($index == 'before') - { - $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] .= $value['value'].'<br />'; // $value['value'] is already escaped - } - elseif($index == 'after') - { - $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] .= $value['value'].'<br />'; // $value['value'] is already escaped - } - } - } - - $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['title'] = $photo_value['name']; // $photo_value['name'] is already escaped - } - $this->nr_text_lines = $i; // used in LinThumbnails.js to calculate the space for the thumb height - - /** - * switch between javascript - */ - if( linUseAjax() ) - { - /** - * create javascript object containing all thumb informations - */ - - $GLOBALS['linpha']->template->setModuleName('view_thumb'); - $GLOBALS['linpha']->template->output['page_nr_left'] = ''; - $GLOBALS['linpha']->template->output['page_nr_right'] = ''; - $GLOBALS['linpha']->template->output['page_nr'] = ''; - - /** - * create files db - * this is a normal javascript array - * just another kind of definition... - */ - $GLOBALS['linpha']->template->output['files_db'] = 'var linImgIds = ['."\n"; - if($this->tot_photos > 0) // check if not all entries were folders - { - foreach($this->photos_filtered AS $key=>$value) - { - if( ( $GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] && $value['img_type'] != 0 ) - OR !$GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] ) - { - $before = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['before']; - $after = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['after']; - $title = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['title']; - - $array_files_db[] = '{ id: "'.$value['id'].'", before: "'.str_replace('"','\"',$before).'", after: "'.str_replace('"','\"',$after).'", title: "'.str_replace('"','\"',$title).'" }'; - } - } - $GLOBALS['linpha']->template->output['files_db'] .= implode($array_files_db,", \n"); - - } - $GLOBALS['linpha']->template->output['files_db'] .= "\n".'];'; - } - else - { - $GLOBALS['linpha']->template->setModuleName('static.view_thumb'); - $GLOBALS['linpha']->template->overrideModule('css','view_thumb'); - - $this->viewThumbNojs(); - } -} - -/** - * thumbnail view with javascript disabled (static) - * @uses LinImgView::viewThumb() - */ -function viewThumbNojs() +function indexImage() // @TODO from where to call { - /** - * prepare variables - */ - $max_photos_per_page = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrrows'] * $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols']; - $this->nr_pages = ceil( $this->tot_photos / $max_photos_per_page ); - if(isset($_GET['pn']) && $_GET['pn'] > 1) - { - $this->current_page = $_GET['pn']; - } - else - { - $_GET['pn'] = 1; - $this->current_page = 1; - } - - - $this->viewThumbNojsWritePageNumbers(); - - /** - * create array $this->photos_show which contains only the photos of the current page - */ - if($this->tot_photos > 0) // only if not all entries were folders - { - $img_nr = 1; - $i = 0; - $startup_img_nr = ($this->current_page - 1)*$max_photos_per_page; - - foreach($this->photos_filtered AS $value) - { - if($i >= $startup_img_nr && $img_nr <= $max_photos_per_page // add images only while in current page - && ( ( $GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] && $value['img_type'] != 0 ) // add images only if no folder because they are shown separate - OR !$GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] ) ) // add folders only if they are not shown separate - { - $this->photos_show[] = $value; - $img_nr++; - } - $i++; - } - } -} - -/** - * setup page numbers (only used if static) - */ -function viewThumbNojsWritePageNumbers() -{ - /** - * writing page numbers - */ - $start_nr = 1; - - /** - * write left and right '...' if more than 10 pages - */ - $left_dots = ""; - $right_dots = ""; - if($this->nr_pages > 10) - { - $start_nr = $_GET['pn']; - - if($_GET['pn'] >= $this->nr_pages-5) // we reached end of album - { - $start_nr = $this->nr_pages-10; - $left_dots = "... "; - } - elseif($start_nr <=5 ) // we are at the beginning - { - $this->nr_pages = 10; - $start_nr = 1; - $right_dots = " ..."; - } - else - { - $this->nr_pages = $start_nr+5; - $start_nr -= 5; - if($_GET['pn']!="6") : $left_dots="... "; endif; - $right_dots=" ..."; - } - } - - $GLOBALS['linpha']->template->output['page_nr'] = $left_dots; - - for($i=$start_nr; $i <= $this->nr_pages; $i++) - { - if($i == $this->current_page) - { - $GLOBALS['linpha']->template->output['page_nr'] .= $i.' '; - } - else - { - $GLOBALS['linpha']->template->output['page_nr'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.$i.'">'.$i.'</a> '; - } - } - - $GLOBALS['linpha']->template->output['page_nr'] .= $right_dots; - - /** - * write starting ' << ' and ' < ' - */ - if($this->current_page != 1) - { - $GLOBALS['linpha']->template->output['page_nr_left'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn=1"><<</a> ' . - '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page-1).'"><</a> '; - } - else - { - $GLOBALS['linpha']->template->output['page_nr_left'] = '<< <'; - } - - /** - * write ending '>' and '>>' - */ - if($this->current_page != $this->nr_pages && $this->nr_pages != 0) // need check nr_pages != 0 because we don't need links if nr_pages == 0! - { - $GLOBALS['linpha']->template->output['page_nr_right'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page+1).'">></a> ' . - '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->nr_pages).'">>></a> '; - } - else - { - $GLOBALS['linpha']->template->output['page_nr_right'] = '> >>'; - } -} - -/** - * print sub folders AND calculate tot_photos - * @todo should we show subfolders separate..? - * i think this is useless if we can set automatically view = thumbdetail - */ -function viewThumbSetSubFolders() -{ - $output_folders = ''; - $nr_folders = 0; - - if( ! isset($GLOBALS['linpha']->template->output['navigation'] ) ) - { - $GLOBALS['linpha']->template->output['navigation'] = ''; - } - - if($GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate']) - { - foreach($this->photos_filtered AS $key=>$value) - { - if($value['img_type'] == 0) - { - $GLOBALS['linpha']->template->output['navigation'] .= '<a href="'.LINPHA_LINK.'&linCat=alb&linId='.$value['id'].'">'.$value['name'].'</a><br />'; - $nr_folders++; - } - } - } - - /** - * set tot_photos - * subtract number of folders if they are shown separate - */ - $this->tot_photos = count($this->photos_filtered) - $nr_folders; -} - -/** - * setup detailed thumbdetail view - */ -function viewThumbdetail() -{ - $GLOBALS['linpha']->template->setModuleName('view_thumbdetail'); -} - -/** - * setup main/home view layout - */ -function viewHome() -{ - $GLOBALS['linpha']->template->setModuleName('home'); - - /** - * set welcome text - */ - if($GLOBALS['linpha']->sql->config->value['sys_style_home_usedefaultwelcometext']) - { - $GLOBALS['linpha']->template->output['welcome'] = '<h1 class="linStyle">'.i18n("Welcome").'</h1>'. - i18n("Hi, this is the home of \"The PHP Photo Archive\" <a href=\"http://linpha.sf.net\">aka LinPHA</a>.").'<br />'; - } - else - { - $data = $GLOBALS['linpha']->db->GetRow("SELECT meta_comment FROM ".LIN_PREFIX."meta_comments WHERE md5sum='welcometext'"); - if(isset($data['meta_comment'])) - { - $GLOBALS['linpha']->template->output['welcome'] = $data['meta_comment']; - } - else - { - $GLOBALS['linpha']->template->output['welcome'] = ''; - } - } - - /** - * new images - */ - $days = $GLOBALS['linpha']->sql->config->value['sys_style_home_newimagesage']; - $days_in_sec = $days*60*60*24; - $lower_date = time()-$days_in_sec; - $this->viewHomeSetImages('new_images','sys_style_home_newimagesnr',' AND time_add > '.LinSql::linAddslashes($lower_date)); - - /** - * random images - */ - $this->viewHomeSetImages('random_images','sys_style_home_nrrandomimages',''); - - /** - * browse by date - */ - $this->viewHomeSetBrowseByDate(); - - /** - * album informations - */ - foreach($this->photos_filtered AS $photo_key=>$photo_value) - { - $array_image_infos = LinMetaData::readInformations($photo_value,$flag_nr=12); - - $this->photos_filtered[$photo_key]['album_infos'] = ''; - foreach($array_image_infos AS $key=>$value) - { - if($key == 'builtin_stats_numbers') - { - $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].' '.i18n("Photos").'<br />'; - } - elseif($key == 'builtin_first_comment') - { - $this->photos_filtered[$photo_key]['album_infos'] .= '<div class="linDivFolderComment">'.$value['value']; - if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { - $this->photos_filtered[$photo_key]['album_infos'] .= ' <a href="'.$GLOBALS['linpha']->template->URL_base.'&linId='.$photo_value['id'].'&view=albmeta'.'">Edit</a>'; - } - $this->photos_filtered[$photo_key]['album_infos'] .= '</div>'; - } - else - { - $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].'<br />'; - } - } - } -} - -/** - * setup browse by date feature - */ -function viewHomeSetBrowseByDate() -{ - if($GLOBALS['linpha']->sql->config->value['sys_style_home_showbrowsebydate']) - { - $GLOBALS['linpha']->template->output['browse_by_date'] = ''; - - $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal) AS min , max(datetimeoriginal) AS max " . - "FROM ".LIN_PREFIX."meta_exif"); - if(isset($data['min']) && isset($data['max']) && !empty($data['min']) && !empty($data['max']) ) - { - /** - * get min and max year - */ - $min_year = substr($data['min'],0,4); - $max_year = substr($data['max'],0,4); - /** - * get years between - */ - for($i = $min_year; $i <= $max_year; $i++) - { - /** - * exclude all wrong/empty/... dates - */ - if($i > 1900) - { - $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) AS datetime FROM ".LIN_PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); - if($data['datetime']>0) - { - $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_LINK.'&linCat=browse&year='.$i.'">'.$i.'</a> ('.$data['datetime'].'), '; - } - } - } - } - } -} - -/** - * setup random and new imgages view - */ -function viewHomeSetImages($key,$optionname,$sql) -{ - $GLOBALS['linpha']->template->output[$key] = array(); - - if($GLOBALS['linpha']->sql->config->value[$optionname] != 0) - { - switch(LIN_DB_TYPE) - { - case 'mysql': - $str_random = 'rand()'; - break; - case 'postgres': - $str_random = 'random()'; - break; - case 'sqlite': - $str_random = 'random()'; - break; - case 'oci8po': - $str_random = $GLOBALS['linpha']->db->random; - break; - } - - $nr_images = $GLOBALS['linpha']->sql->config->value[$optionname]; - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999".$sql." ORDER BY ".$str_random); - - for($i = 1; $i <= $nr_images ; ) - { - $data = $query->FetchRow(); - if(isset($data['id'])) - { - $path = LinSql::getFullImagePath( $data['id'] ); - - if(file_exists($path) && LinSql::photoIsAllowed($data['id'])) - { - $GLOBALS['linpha']->template->output[$key][] = array('id'=>$data['id'],'path'=>$path); - $i++; - } - } - else - { - break; - } - } - } -} - -/** - * setup basket view - */ -function viewBasket() -{ - $GLOBALS['linpha']->template->setModuleName('view_basket'); - $GLOBALS['linpha']->template->overrideModule('css','view_thumb'); // used the same css definitions as view_thumb - - $this->viewThumbSetSubFolders(); - $this->viewThumbNojs(); -} - -/** - * setup comment view - */ -function viewAlbMeta() -{ - $GLOBALS['linpha']->template->setModuleName('view_albmeta'); - - /** - * save data - */ - if( isset( $_POST['cmd'] ) && $_POST['cmd']=="add_comment") - { - /** - * check if comment exists - * - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT id " . - "FROM ".LIN_PREFIX."meta_comments " . - "WHERE md5sum = '".LinSql::linAddslashes($this->md5sum)."'"); - - if( $query->EOF ) // insert - { - $GLOBALS['linpha']->db->Execute( - "INSERT into ".LIN_PREFIX."meta_comments " . - "(meta_time, md5sum, meta_author, meta_comment) " . - "VALUES " . - "('".time()."', '".LinSql::linAddslashes($this->md5sum)."', " . - "'".LinSql::linAddslashes($_POST['author'])."', '".LinSql::linAddslashes($_POST['comment'])."')" - ); - } - else // update - { - $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."meta_comments SET ". - "meta_time = '".time()."', ". - "meta_author = '".LinSql::linAddslashes($_POST['author'])."', " . - "meta_comment = '".LinSql::linAddslashes($_POST['comment'])."' " . - "WHERE md5sum = '".LinSql::linAddslashes($this->md5sum)."'"); - } - } - - /** - * get data - */ - $data = $GLOBALS['linpha']->db->GetRow( - "SELECT id, meta_time, meta_author, meta_comment " . - "FROM ".LIN_PREFIX."meta_comments " . - "WHERE md5sum = '".$this->md5sum."'" - ); - if(isset($data['meta_author'])) - { - $GLOBALS['linpha']->template->output['comment_author'] = $data['meta_author']; - } - else - { - $GLOBALS['linpha']->template->output['comment_author'] = $_SESSION['user_name']; - } - - if(isset($data['meta_comment'])) - { - $GLOBALS['linpha']->template->output['comment_text'] = $data['meta_comment']; - } - else - { - $GLOBALS['linpha']->template->output['comment_text'] = ''; - } - - /** - * save modified MetaData - */ - LinMetaData::saveModifiedMetaData(); -} - -/** - * setup image view - */ -function viewImg() -{ - $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); - - if( LinIdentify::isVideo( $this->img_type )) // in video mode, the video thumbnail is shown instead of the image - { - $this->img_width = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; - $this->img_height = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; - } - else - { - $max_width = $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; - $max_height = $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; - $array = LinImage::scaleToFit($this->org_width,$this->org_height,$max_width,$max_height); - - $this->img_width = $array['w']; - $this->img_height = $array['h']; - } - - $this->viewImgCommon(); - $this->viewImgComments(); - - if( linUseAjax() ) - { - $GLOBALS['linpha']->template->setModuleName('view_img'); - - if(isset($_GET['xml'])) - { - $this->viewImgXml(); - exit(); - } - } - else - { - $GLOBALS['linpha']->template->setModuleName('static.view_img'); - $GLOBALS['linpha']->template->overrideModule('css','view_img'); - } -} - -/** - * generate xml data for ajax image view - */ -function viewImgXml() -{ - header('Content-type: text/xml'); - echo '<?xml version="1.0" ?>'."\n"; - ?> -<root> -<imgid><?php echo $GLOBALS['linpha']->template->idCurrent; ?></imgid> -<filetype><?php echo LinIdentify::getShortFileType( $this->img_type ); ?></filetype> -<imgwidth><?php echo $this->org_width; ?></imgwidth> -<imgheight><?php echo $this->org_height; ?></imgheight> -<imgnr><?php printf(i18n("Image %s of %s"),$this->current_key+1,count($this->photos_filtered)); ?></imgnr> -<title><?php /* oh, what an evil hack */ echo str_replace('<','<',$GLOBALS['linpha']->template->linpha_title." :: ".$GLOBALS['linpha']->template->output['title']); ?></title> -<?php - if(isset($this->xmldata['prev_thumb'])) { - foreach($this->xmldata['prev_thumb'] AS $value) - { - echo '<prevthumb>'.$value.'</prevthumb>'."\n"; - } - } - if(isset($this->xmldata['next_thumb'])) { - foreach($this->xmldata['next_thumb'] AS $value) - { - echo '<nextthumb>'.$value.'</nextthumb>'."\n"; - } - } - - foreach($GLOBALS['linpha']->template->output['image_infos'] AS $value) - { ?> -<meta> - <name><?php echo $value['name']; ?></name><value><?php echo htmlspecialchars($value['value']); ?></value> -</meta> -<?php - } - - if($this->newCommentAdded) - { - echo '<commentadded>'.i18n("Comment successfully added.").'</commentadded>'."\n"; - } - - while($data = $GLOBALS['linpha']->template->output['image_comments']->FetchRow()) - { ?> -<comment> - <time><?php echo htmlspecialchars(linStrftime($data['meta_time'])); ?></time> - <author><?php echo htmlspecialchars($data['meta_author'],ENT_QUOTES); ?></author> - <text><?php echo str_replace('<','<',linHtmlTag($data['meta_comment'],ENT_QUOTES) ); ?></text> -</comment> -<?php } ?> -</root> - -<?php - -} // end viewImgAjax() - -/** - * stuff used in viewImg() and viewMeta() - */ -function viewImgCommon() -{ - $this->viewImgSetPrevNextThumb(); - - $this->viewImgStoreImageInformation(); - - $GLOBALS['linpha']->template->output['image_infos'] = - LinMetaData::readInformations($this->photos_filtered[$this->current_key], - $flag_nr=10); - -} - -/** - * get/save image comments - */ -function viewImgComments() -{ - /** - * image comments - */ - if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) - { - /** - * save comment - */ - if( isset( $_POST['cmd'] ) && $_POST['cmd']=='add_comment' - && isset($_POST['inputAddCommentAuthor']) - && !empty($_POST['inputAddCommentAuthor']) - && ((isset($_POST['inputAddCommentText']) && !empty($_POST['inputAddCommentText'])) - || (isset($_POST['inputAddCommentTextarea']) && !empty($_POST['inputAddCommentTextarea'])))) - { - if( !empty($_POST['inputAddCommentTextarea'])) { - $comment = $_POST['inputAddCommentTextarea']; - } else { - $comment = $_POST['inputAddCommentText']; - } - - $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_comments (meta_time, md5sum, meta_author, meta_comment)" . - "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->md5sum."','".LinSql::linAddslashes($_POST['inputAddCommentAuthor'])."'," . - "'".LinSql::linAddslashes($comment)."')"); - $this->newCommentAdded = true; // used for ajax - } - - /** - * get comments - */ - $GLOBALS['linpha']->template->output['image_comments'] = $GLOBALS['linpha']->db->Execute("SELECT id, meta_time, meta_author, meta_comment FROM ".LIN_PREFIX."meta_comments " . - "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); - } -} - -/** - * store image informations in database if s - */ -function viewImgStoreImageInformation() -{ $array_meta = array('exif','iptc','xmp'); foreach($array_meta AS $value) { @@ -1302,117 +319,9 @@ } } -/** - * generate html code for the prev/next thumbnail - */ -function viewImgThumbHtml($key,$class) -{ - $id = $this->photos_filtered[$key]['id']; - $name = $this->photos_filtered[$key]['name']; - $str = '<div class="linDivThumbnavi_'.$class.'">' - . '<a href="'.$GLOBALS['linpha']->template->URL_base.'&linId='.$id.'">' - . '<img class="linImgThumbnavi_'.$class.'" src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$id.'" /></a>' - . '<br />'.$name.'</div>'."\n"; - - return $str; -} -/** - * set prev/next thumb for img_view and meta_view - */ -function viewImgSetPrevNextThumb() -{ - $nr_prev_next_thumbs = $GLOBALS['linpha']->sql->config->value['sys_style_image_nrprevnextthumbs']; - - /** - * search current key in array - */ - foreach($this->photos_filtered AS $key=>$value) - { - if($value['id'] == $GLOBALS['linpha']->template->idCurrent) - { - $this->current_key = $key; - break; - } - } - - /** - * ooh, something went wrong - */ - if(!isset($this->current_key)) - { - $this->current_key = 0; - } - - /** - * set prev thumbs - */ - $GLOBALS['linpha']->template->output['prev_thumb'] = ''; - for($i=$nr_prev_next_thumbs; $i > 0; $i--) - { - if($this->current_key >= $i) - { - if(isset($_GET['xml'])) - { - $this->xmldata['prev_thumb'][] = $this->photos_filtered[$this->current_key - $i]['id']; - } - else - { - $GLOBALS['linpha']->template->output['prev_thumb'] .= $this->viewImgThumbHtml( $this->current_key - $i , 'PrevNext' ); - } - } - } - - /** - * set next thumbs - */ - $GLOBALS['linpha']->template->output['next_thumb'] = ''; - for($i=0; $i < $nr_prev_next_thumbs; $i++) - { - if($this->current_key < ( count($this->photos_filtered) - ($i+1) ) ) - { - if(isset($_GET['xml'])) - { - $this->xmldata['next_thumb'][] = $this->photos_filtered[$this->current_key + ($i+1)]['id']; - } - else - { - $GLOBALS['linpha']->template->output['next_thumb'] .= $this->viewImgThumbHtml( $this->current_key + ($i+1) , 'PrevNext' ); - } - } - } - - /** - * set current image and thumb - */ - if(isset($_GET['xml'])) - { - } - else - { - $GLOBALS['linpha']->template->output['current_thumb'] = $this->viewImgThumbHtml( $this->current_key , 'Current' ); - } -} -/** - * setup MetaData view - */ -function viewMeta() -{ - $GLOBALS['linpha']->template->setModuleName('static.view_img'); - $GLOBALS['linpha']->template->overrideModule('css','view_img'); - - $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); - - /** - * save modified MetaData - */ - LinMetaData::saveModifiedMetaData(); - - $this->viewImgCommon(); -} - -} // end class linImgview +} // end class LinViewImage ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-16 08:51:18
|
Revision: 4902 http://linpha.svn.sourceforge.net/linpha/?rev=4902&view=rev Author: fangehrn Date: 2008-03-16 01:51:13 -0700 (Sun, 16 Mar 2008) Log Message: ----------- 2008-03-15 flo * fixed some IE bugs everything should now work fine on firefox/opera/IE 2008-03-13 flo * finished fullscreen/slideshow/navigation 2008-03-09 flo * re-design thumb and image view Modified Paths: -------------- trunk/linpha2/docs/dev/TODO.txt Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2008-03-15 18:36:35 UTC (rev 4901) +++ trunk/linpha2/docs/dev/TODO.txt 2008-03-16 08:51:13 UTC (rev 4902) @@ -29,34 +29,8 @@ ## Big Todos -- Switch to strict mode - - we should changed html type to strict mode: - old: - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> - <html> - - new: - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> - - the xmlns:v="urn:schemas-microsoft-com:vml" is required for google maps - - - but then we need to adapt the linpha styles because some stuff will not work anymore - -- Common Tasks - - Switch to UTF8 as default - Tests: - file headers, content: x - SVN commit/update: x - - data from uft8 mysql table x - data from non utf8 mysql table x - - date from other file (utf8/non utf8) x - - - Use Effekts is sometimes hardcoded, make use of config - setting sys_style_image_useeffects in all places where used +- Use Effekts is sometimes hardcoded, make use of config + setting sys_style_image_useeffects in all places where used - Installer - OSX testing @@ -108,6 +82,32 @@ DONE ############################################################################ +- Switch to strict mode + - we should changed html type to strict mode: + old: + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> + <html> + + new: + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> + + the xmlns:v="urn:schemas-microsoft-com:vml" is required for google maps + + - but then we need to adapt the linpha styles because some stuff will not work anymore + +- Common Tasks + - Switch to UTF8 as default + Tests: + file headers, content: x + SVN commit/update: x + + data from uft8 mysql table x + data from non utf8 mysql table x + + date from other file (utf8/non utf8) x + - fix (adodb) error handler - php session This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-15 18:36:43
|
Revision: 4901 http://linpha.svn.sourceforge.net/linpha/?rev=4901&view=rev Author: fangehrn Date: 2008-03-15 11:36:35 -0700 (Sat, 15 Mar 2008) Log Message: ----------- Added Paths: ----------- trunk/linpha2/lib/classes/linpha.view.image.class.php Copied: trunk/linpha2/lib/classes/linpha.view.image.class.php (from rev 4900, trunk/linpha2/lib/classes/linpha.imgview.class.php) =================================================================== --- trunk/linpha2/lib/classes/linpha.view.image.class.php (rev 0) +++ trunk/linpha2/lib/classes/linpha.view.image.class.php 2008-03-15 18:36:35 UTC (rev 4901) @@ -0,0 +1,1418 @@ +<?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * This class takes care of all different views (thumb view, menus...) + * @package Image + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + +define('LIN_SELECT_FIELDS', + "".LIN_PREFIX."photos.id AS id2, " . + "".LIN_PREFIX."photos.id AS id, ".LIN_PREFIX."photos.name AS name, " . + "".LIN_PREFIX."photos.img_type AS img_type, ".LIN_PREFIX."photos.md5sum AS md5sum, " . + "".LIN_PREFIX."photos.width AS width, ".LIN_PREFIX."photos.height AS height, " . + "".LIN_PREFIX."photos.filesize AS filesize, " . + "".LIN_PREFIX."photos.time_add AS time_add, ".LIN_PREFIX."photos.time_mod AS time_mod, " . + "".LIN_PREFIX."photos.time_exif AS time_exif, ".LIN_PREFIX."photos.stats_numbers AS stats_numbers, " . + "".LIN_PREFIX."photos.stats_views AS stats_views, ".LIN_PREFIX."photos.stats_downloads AS stats_downloads" +); + +class LinImgview { + +public $mode; // 'home', 'thumb', 'image' +public $modulename; // 'albums', 'browse', ... +public $tot_photos; +public $photos; +public $photos_filtered; +public $id_parent, $img_type, $filename, $md5sum, $org_width, $org_height; +private $nr_pages, $current_page; // only used if javascript disabled +private $newCommentAdded = false; // used for ajax + +/** + * constructor + */ +function __construct() +{ + +} + +/** + * set current view and set fileinfos of $GLOBALS['linpha']->template->idCurrent ($_GET['linId']) + * @param string $modulname (album, browse, search, ...) + */ +function setCurrentView($modulename) +{ + $this->modulename = $modulename; + + $this->orderby = linGetSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_others_sortorder']); + + if( $GLOBALS['linpha']->template->idCurrent == 0 ) + { + /** + * on top view, reset current view + */ + if($this->modulename=='albums') + { + $this->mode = 'home'; + $this->orderby = linGetSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_home_firstsortorder']); + } + else // $this->modulename=='browse' | 'search' , others will come.. + { + $this->mode = 'thumb'; + + if( ! isset($_SESSION['mode_thumbview']) ) + { + $_SESSION['mode_thumbview'] = 'thumb'; + } + } + } + else + { + /** + * set file informations + */ + $current_data = $GLOBALS['linpha']->db->GetRow("SELECT id, name, img_type, parent_id, md5sum, width, height FROM ".LIN_PREFIX."photos " . + "WHERE id = '".LinSql::linAddslashes($GLOBALS['linpha']->template->idCurrent)."'"); + /** + * check for valid id + */ + + if( isset($current_data['id']) ) + { + $this->img_type = $current_data['img_type']; + $this->filename = $current_data['name']; + $this->md5sum = $current_data['md5sum']; + $this->org_width = $current_data['width']; + $this->org_height = $current_data['height']; + + /** + * switch between thumb_view and img_view + */ + if( $this->img_type == 0) + { + $this->mode = 'thumb'; + $this->id_parent = $current_data['id']; // use current_id as parent_id, because we want to see the content of the actual folder! + + if(! isset($_SESSION['mode_thumbview']) ) + { + $_SESSION['mode_thumbview'] = 'thumb'; + } + } + else + { + $this->mode = 'image'; + $this->id_parent = $current_data['parent_id']; // use parent_id on image view + + if( ! isset($_SESSION['mode_imageview']) ) + { + $_SESSION['mode_imageview'] = 'img'; + } + } + } + else // no valid id supplied + { + $this->mode = 'home'; + $GLOBALS['linpha']->template->idCurrent = 0; + } + } + + if($this->mode == 'thumb' && isset($_GET['view'])) + { + $_SESSION['mode_thumbview'] = $_GET['view']; + } + if($this->mode == 'image' && isset($_GET['view'])) + { + $_SESSION['mode_imageview'] = $_GET['view']; + } + + /** + * set id_parent to a default value + */ + if( ! isset( $this->id_parent) ) + { + $this->id_parent = $GLOBALS['linpha']->template->idCurrent; + } +} + +/** + * main function to prepare desired layout view + */ +function buildImgView() +{ + $this->filterPhotosNotPermitted(); + + /** + * set mode specific things + */ + switch($this->mode) + { + case 'home': + $this->viewHome(); + break; + case 'thumb': + switch($_SESSION['mode_thumbview']) + { + case 'thumb': + case 'thumbdetail': + $this->viewThumb(); + break; + case 'basket': + $this->viewBasket(); + break; + case 'albmeta': + $this->viewAlbMeta(); + break; + } + break; + case 'image': + switch($_SESSION['mode_imageview']) + { + case 'img': + $this->viewImg(); /* will exit in xml mode */ + break; + case 'meta': + $this->viewMeta(); + break; + } + break; + } + + /** + * doing some special commands + * + * should be done after viewImg(), because adminCommands() (force_import) uses some image informations + */ + if(isset($_GET['admin_cmd'])) { + $this->adminCommands(); + } + + if(isset($_GET['linMsg'])) + { + switch($_GET['linMsg']) + { + case 'basket_added': linSysLog(i18n("Images Added To Basket.")); break; + } + } + + /** + * set ref urls + * used in basket and ajax reloadmenu + */ + $_SESSION['ref_url_full'] = $GLOBALS['linpha']->template->URL_full; + $_SESSION['ref_url_base'] = $GLOBALS['linpha']->template->URL_base; + $_SESSION['ref_modulename'] = $this->modulename; + + /** + * set admin menu and more menu + * - this should be done after adminCommands, because of + * "nr images in basket" is changed in adminCommands() + * + * - this should be done after viewImg(), because of $org_width and $org_height in "View at" + */ + $this->setMenu(); + + /** + * at this point, there should be absolute no output + */ + include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); +} + +/** + * filter out files and folders not permitted and escape filename + * all other values dont have to be escaped + * (currently at least, have a look at LIN_SELECT_FIELDS) + */ +function filterPhotosNotPermitted() +{ + $this->photos_filtered = Array(); + + if(isset($this->photos)) + { + foreach($this->photos AS $key=>$value) + { + if( ! ($this->mode == 'image' && $value['img_type']== '0' ) ) // exclude subfolders from img_view + { + if( LinSql::photoIsAllowed( $value['id'] ) ) + { + /** + * escape name here + * -> we do not have to do it in the templates + */ + $value['name'] = htmlspecialchars($value['name'],ENT_QUOTES); + $this->photos_filtered[] = $value; + + //print_r($value); + } + } + } + } + + unset($this->photos); +} + +/** + * create optional top menu + */ +function setMenu() +{ + + + /** + * Menu Admin + */ + if($GLOBALS['linpha']->sql->isAdmin()) + { + $GLOBALS['linpha']->template->menu['admin']['import'] = + array( + 'name' => i18n("Import"), + 'link' => array( + array('name' => i18n("Start Import Of This Folder/File"), 'link' => LINPHA_CLIENT.'/admin/?cat=maintenance_import&album_select[]='.$this->id_parent), + array('name' => i18n("Detect File Changes"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=force_import') + ) + ); + + $GLOBALS['linpha']->template->menu['admin']['permissions'] = + array( + 'name' => i18n("Permissions"), + 'link' => array( + array('name' => i18n("Set Permissions"), 'link' => LINPHA_CLIENT.'/admin/?cat=permissions_view&cmd=edit&linId='.$GLOBALS['linpha']->template->idCurrent) + ) + ); + + + if($this->mode == 'thumb' || $this->mode == 'image') + { + /** + * append to "admin - import" entry + */ + $GLOBALS['linpha']->template->menu['admin']['import']['link'][] = array( + 'name' => i18n("Recreate This Thumbnail"), + 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' + ); + } + } + + /** + * Menu More + */ + if($this->mode != 'home') + { + /** + * more than one time used stuff + */ + $array = linGetSortOrders(); + foreach($array as $value) // i18n() already called + { + $array_sort_orders_links[] = array('name' => $value, 'link' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); + } + + $open_basket_link = LINPHA_LINK.'&linCat=basket'; + + switch($this->mode) + { + case 'thumb': + + $GLOBALS['linpha']->template->menu['more']['basket'] = + array( + 'name' => i18n("Basket"), + 'link' => array( + array('name' => i18n("Add All To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all'), + array('name' => i18n("Switch To Basket View"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), + array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) + ) + ); + + if( linUseAjax() ) + { + $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectsizes']); + foreach($array as $value) + { + $array_tn_sizes_links[] = array('name' => $value.' '.i18n("Pixel"), 'link' => 'javascript:myLinThumbnails.setTnSize('.$value.')'); + } + + $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectnrimages']); + foreach($array as $value) + { + $array_nr_links[] = array('name' => $value, 'link' =>"javascript:myLinThumbnails.setNrImages('".$value."')"); + } + + $array_views_links[] = array('name' => i18n("Normal"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumb'); + $array_views_links[] = array('name' => i18n("Detail"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumbdetail'); + + $GLOBALS['linpha']->template->menu['more']['view'] = + array( + 'name' => i18n("View"), + 'link' => array( + array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), + array('name' => i18n("View"), 'link' => $array_views_links), + array('name' => i18n("Thumb Size"), 'link' => $array_tn_sizes_links), + array('name' => i18n("Thumb Nr"), 'link' => $array_nr_links) + ) + ); + } + else + { + $GLOBALS['linpha']->template->menu['more']['view'] = + array( + 'name' => i18n("View"), + 'link' => array( + array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), + ) + ); + } + + if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) + { + $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; + } + + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) + { + $GLOBALS['linpha']->template->menu['more']['metainfo'] = + array( + 'name' => i18n("Metainfo"), + 'link' => array( + array('name' => i18n("Edit Album Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=albmeta'), + ) + ); + } + break; + case 'image': + + $GLOBALS['linpha']->template->menu['more']['basket'] = + array( + 'name' => i18n("Basket"), + 'link' => array( + array('name' => i18n("Add To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this'), + array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) + ) + ); + $GLOBALS['linpha']->template->menu['more']['view'] = + array( + 'name' => i18n("View"), + 'link' => array( + array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), + array('name' => i18n("View at"), 'link' => + array( + array('name' => '640x480', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=640&height=480', 'target' => '_blank'), + array('name' => '800x600', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=800&height=600', 'target' => '_blank'), + array('name' => '1024x768', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1024&height=768', 'target' => '_blank'), + array('name' => '1280x800', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=800', 'target' => '_blank'), + array('name' => '1280x960', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=960', 'target' => '_blank'), + array('name' => '1280x1024', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=1024', 'target' => '_blank'), + array('name' => '1600x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1600&height=1200', 'target' => '_blank'), + array('name' => '1920x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1920&height=1200', 'target' => '_blank'), + array('id' => 'linLiViewAtFullscreen', 'name' => $this->org_width.'x'.$this->org_height.' ('.i18n("Fullscreen").')', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width='.$this->org_width.'&height='.$this->org_height, 'target' => '_blank'), + ) + ) + ) + ); + + + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) + { + $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['name'] = i18n("Rotate Left"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; + $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['name'] = i18n("Rotate Right"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; + } + + if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) + { + $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; + } + + + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) + { + $GLOBALS['linpha']->template->menu['more']['metainfo'] = + array( + 'name' => i18n("Metainfo"), + 'link' => array( + array('name' => i18n("Edit Image Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=meta') + ) + ); + } + + break; + } + } + + /** + * Icons + */ + if($this->mode == 'thumb') + { + /** + * basket icons + */ + if( $GLOBALS['linpha']->sql->checkPermission('basket_download')) + { + $GLOBALS['linpha']->template->menu['icon_download'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_all_with_checkout&checkout_as=download'; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) + { + $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_all_with_checkout&checkout_as=print'; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) + { + $GLOBALS['linpha']->template->menu['icon_mail'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_all_with_checkout&checkout_as=mail'; + } + /** + * slideshow icon + */ + if( linUseAjax() ) { + $GLOBALS['linpha']->template->menu['icon_slideshow'] = 'javascript:myLinThumbnails.loadSlideshow()'; + } + } + elseif($this->mode == 'image') + { + /** + * basket icons + */ + if( $GLOBALS['linpha']->sql->checkPermission('download')) + { + $GLOBALS['linpha']->template->menu['icon_download'] = LINPHA_LINK.'&linCat=download&linId='.$GLOBALS['linpha']->template->idCurrent; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) + { + $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_this_with_checkout&checkout_as=print'; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) + { + $GLOBALS['linpha']->template->menu['icon_mail'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_this_with_checkout&checkout_as=mail'; + } + + /** + * slideshow icon + */ + if( linUseAjax() ) { + $GLOBALS['linpha']->template->menu['icon_slideshow'] = 'javascript:myLinThumbnails.fullscreenStart()'; + } + } +} + +/** + * method for special admin commands, like rotating images, import stuff etc. + * @uses LinImgview::buildImgView() + */ +function adminCommands() +{ + switch($_GET['admin_cmd']) + { + case 'recreate': + if($GLOBALS['linpha']->sql->isAdmin()) + { + $thumbnail = new LinImage(); + $_GET['force'] = true; + $thumbnail->createThumbnail($GLOBALS['linpha']->template->idCurrent); + } + break; + case 'force_import': // called in viewImg + LinImport::updateEntry( $GLOBALS['linpha']->template->idCurrent , dirname($this->src_file) , $this->filename ); + break; + case 'rotate_left': + if($GLOBALS['linpha']->sql->isAdmin()) + { + LinImage::rotateImageByMenuCall('-90', $GLOBALS['linpha']->template->idCurrent); + } + break; + case 'rotate_right': + if($GLOBALS['linpha']->sql->isAdmin()) + { + LinImage::rotateImageByMenuCall('90', $GLOBALS['linpha']->template->idCurrent); + } + break; + case 'basket_add_all': + case 'basket_add_all_with_checkout': + /** + * coming from imgview, mode=viewThumb + * the permission check with photoIsAllowed() is done while checking out + */ + foreach($this->photos_filtered AS $value) + { + if($value['img_type']!=0) + { + $_SESSION['basket_ids'][] = $value['id']; + } + } + + if($_GET['admin_cmd'] == 'basket_add_all_with_checkout') + { + header("Location: ".LINPHA_LINK."&linCat=basket&checkout_as=".$_GET['checkout_as']); + exit(); + } + break; + case 'basket_add_this': + case 'basket_add_this_with_checkout': + /** + * coming from imgview, mode=viewImg + */ + $_SESSION['basket_ids'][] = $GLOBALS['linpha']->template->idCurrent; + + if($_GET['admin_cmd'] == 'basket_add_this_with_checkout') + { + header("Location: ".LINPHA_LINK."&linCat=basket&checkout_as=".$_GET['checkout_as']); + exit(); + } + break; + } +} + +/** + * define thumbnail view + */ +function viewThumb() +{ + $this->viewThumbSetSubFolders(); + + /** + * create thumbnail info text (filename, description, etc.) + */ + $i=0; + + foreach($this->photos_filtered AS $key=>$photo_value) + { + if($_SESSION['mode_thumbview'] == 'thumbdetail') { + $flag_nr = 14; // flag nr of thumbdetail + } else { + $flag_nr = 13; // flag nr of thumb + } + + $array_image_infos = LinMetaData::readInformations($photo_value,$flag_nr); + + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] = ''; + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] = ''; + $index = 'before'; + $i=0; + foreach($array_image_infos AS $value) + { + /** + * got thumbnail, switch to index after + */ + if($value['value']=='thumbnail') + { + $index = 'after'; + } + else + { + $i++; + if($index == 'before') + { + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['before'] .= $value['value'].'<br />'; // $value['value'] is already escaped + } + elseif($index == 'after') + { + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['after'] .= $value['value'].'<br />'; // $value['value'] is already escaped + } + } + } + + $GLOBALS['linpha']->template->output['thumb_infos'][$photo_value['id']]['title'] = $photo_value['name']; // $photo_value['name'] is already escaped + } + + $this->nr_text_lines = $i; // used in LinThumbnails.js to calculate the space for the thumb height + + /** + * switch between javascript + */ + if( linUseAjax() ) + { + /** + * create javascript object containing all thumb informations + */ + + $GLOBALS['linpha']->template->setModuleName('view_thumb'); + + $GLOBALS['linpha']->template->output['page_nr_left'] = ''; + $GLOBALS['linpha']->template->output['page_nr_right'] = ''; + $GLOBALS['linpha']->template->output['page_nr'] = ''; + + + /** + * create files db + * this is a normal javascript array + * just another kind of definition... + */ + $GLOBALS['linpha']->template->output['files_db'] = 'var linImgIds = ['."\n"; + if($this->tot_photos > 0) // check if not all entries were folders + { + foreach($this->photos_filtered AS $key=>$value) + { + if( ( $GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] && $value['img_type'] != 0 ) + OR !$GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] ) + { + $before = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['before']; + $after = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['after']; + $title = $GLOBALS['linpha']->template->output['thumb_infos'][$value['id']]['title']; + + $array_files_db[] = '{ id: "'.$value['id'].'", before: "'.str_replace('"','\"',$before).'", after: "'.str_replace('"','\"',$after).'", title: "'.str_replace('"','\"',$title).'" }'; + } + } + + $GLOBALS['linpha']->template->output['files_db'] .= implode($array_files_db,", \n"); + + } + $GLOBALS['linpha']->template->output['files_db'] .= "\n".'];'; + } + else + { + $GLOBALS['linpha']->template->setModuleName('static.view_thumb'); + $GLOBALS['linpha']->template->overrideModule('css','view_thumb'); + + $this->viewThumbNojs(); + } +} + +/** + * thumbnail view with javascript disabled (static) + * @uses LinImgView::viewThumb() + */ +function viewThumbNojs() +{ + /** + * prepare variables + */ + $max_photos_per_page = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrrows'] * $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols']; + $this->nr_pages = ceil( $this->tot_photos / $max_photos_per_page ); + if(isset($_GET['pn']) && $_GET['pn'] > 1) + { + $this->current_page = $_GET['pn']; + } + else + { + $_GET['pn'] = 1; + $this->current_page = 1; + } + + + $this->viewThumbNojsWritePageNumbers(); + + /** + * create array $this->photos_show which contains only the photos of the current page + */ + if($this->tot_photos > 0) // only if not all entries were folders + { + $img_nr = 1; + $i = 0; + $startup_img_nr = ($this->current_page - 1)*$max_photos_per_page; + + foreach($this->photos_filtered AS $value) + { + if($i >= $startup_img_nr && $img_nr <= $max_photos_per_page // add images only while in current page + && ( ( $GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] && $value['img_type'] != 0 ) // add images only if no folder because they are shown separate + OR !$GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate'] ) ) // add folders only if they are not shown separate + { + $this->photos_show[] = $value; + $img_nr++; + } + $i++; + } + } +} + +/** + * setup page numbers (only used if static) + */ +function viewThumbNojsWritePageNumbers() +{ + /** + * writing page numbers + */ + $start_nr = 1; + + /** + * write left and right '...' if more than 10 pages + */ + $left_dots = ""; + $right_dots = ""; + if($this->nr_pages > 10) + { + $start_nr = $_GET['pn']; + + if($_GET['pn'] >= $this->nr_pages-5) // we reached end of album + { + $start_nr = $this->nr_pages-10; + $left_dots = "... "; + } + elseif($start_nr <=5 ) // we are at the beginning + { + $this->nr_pages = 10; + $start_nr = 1; + $right_dots = " ..."; + } + else + { + $this->nr_pages = $start_nr+5; + $start_nr -= 5; + if($_GET['pn']!="6") : $left_dots="... "; endif; + $right_dots=" ..."; + } + } + + $GLOBALS['linpha']->template->output['page_nr'] = $left_dots; + + for($i=$start_nr; $i <= $this->nr_pages; $i++) + { + if($i == $this->current_page) + { + $GLOBALS['linpha']->template->output['page_nr'] .= $i.' '; + } + else + { + $GLOBALS['linpha']->template->output['page_nr'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.$i.'">'.$i.'</a> '; + } + } + + $GLOBALS['linpha']->template->output['page_nr'] .= $right_dots; + + /** + * write starting ' << ' and ' < ' + */ + if($this->current_page != 1) + { + $GLOBALS['linpha']->template->output['page_nr_left'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn=1"><<</a> ' . + '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page-1).'"><</a> '; + } + else + { + $GLOBALS['linpha']->template->output['page_nr_left'] = '<< <'; + } + + /** + * write ending '>' and '>>' + */ + if($this->current_page != $this->nr_pages && $this->nr_pages != 0) // need check nr_pages != 0 because we don't need links if nr_pages == 0! + { + $GLOBALS['linpha']->template->output['page_nr_right'] = '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->current_page+1).'">></a> ' . + '<a href="'.$GLOBALS['linpha']->template->URL_full.'&pn='.($this->nr_pages).'">>></a> '; + } + else + { + $GLOBALS['linpha']->template->output['page_nr_right'] = '> >>'; + } +} + +/** + * print sub folders AND calculate tot_photos + * @todo should we show subfolders separate..? + * i think this is useless if we can set automatically view = thumbdetail + */ +function viewThumbSetSubFolders() +{ + $output_folders = ''; + $nr_folders = 0; + + if( ! isset($GLOBALS['linpha']->template->output['navigation'] ) ) + { + $GLOBALS['linpha']->template->output['navigation'] = ''; + } + + if($GLOBALS['linpha']->sql->config->value['sys_style_thumb_showsubfoldersseparate']) + { + foreach($this->photos_filtered AS $key=>$value) + { + if($value['img_type'] == 0) + { + $GLOBALS['linpha']->template->output['navigation'] .= '<a href="'.LINPHA_LINK.'&linCat=alb&linId='.$value['id'].'">'.$value['name'].'</a><br />'; + $nr_folders++; + } + } + } + + /** + * set tot_photos + * subtract number of folders if they are shown separate + */ + $this->tot_photos = count($this->photos_filtered) - $nr_folders; +} + +/** + * setup detailed thumbdetail view + */ +function viewThumbdetail() +{ + $GLOBALS['linpha']->template->setModuleName('view_thumbdetail'); +} + +/** + * setup main/home view layout + */ +function viewHome() +{ + $GLOBALS['linpha']->template->setModuleName('home'); + + /** + * set welcome text + */ + if($GLOBALS['linpha']->sql->config->value['sys_style_home_usedefaultwelcometext']) + { + $GLOBALS['linpha']->template->output['welcome'] = '<h1 class="linStyle">'.i18n("Welcome").'</h1>'. + i18n("Hi, this is the home of \"The PHP Photo Archive\" <a href=\"http://linpha.sf.net\">aka LinPHA</a>.").'<br />'; + } + else + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT meta_comment FROM ".LIN_PREFIX."meta_comments WHERE md5sum='welcometext'"); + if(isset($data['meta_comment'])) + { + $GLOBALS['linpha']->template->output['welcome'] = $data['meta_comment']; + } + else + { + $GLOBALS['linpha']->template->output['welcome'] = ''; + } + } + + /** + * new images + */ + $days = $GLOBALS['linpha']->sql->config->value['sys_style_home_newimagesage']; + $days_in_sec = $days*60*60*24; + $lower_date = time()-$days_in_sec; + $this->viewHomeSetImages('new_images','sys_style_home_newimagesnr',' AND time_add > '.LinSql::linAddslashes($lower_date)); + + /** + * random images + */ + $this->viewHomeSetImages('random_images','sys_style_home_nrrandomimages',''); + + /** + * browse by date + */ + $this->viewHomeSetBrowseByDate(); + + /** + * album informations + */ + foreach($this->photos_filtered AS $photo_key=>$photo_value) + { + $array_image_infos = LinMetaData::readInformations($photo_value,$flag_nr=12); + + $this->photos_filtered[$photo_key]['album_infos'] = ''; + foreach($array_image_infos AS $key=>$value) + { + if($key == 'builtin_stats_numbers') + { + $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].' '.i18n("Photos").'<br />'; + } + elseif($key == 'builtin_first_comment') + { + $this->photos_filtered[$photo_key]['album_infos'] .= '<div class="linDivFolderComment">'.$value['value']; + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { + $this->photos_filtered[$photo_key]['album_infos'] .= ' <a href="'.$GLOBALS['linpha']->template->URL_base.'&linId='.$photo_value['id'].'&view=albmeta'.'">Edit</a>'; + } + $this->photos_filtered[$photo_key]['album_infos'] .= '</div>'; + } + else + { + $this->photos_filtered[$photo_key]['album_infos'] .= $value['value'].'<br />'; + } + } + } +} + +/** + * setup browse by date feature + */ +function viewHomeSetBrowseByDate() +{ + if($GLOBALS['linpha']->sql->config->value['sys_style_home_showbrowsebydate']) + { + $GLOBALS['linpha']->template->output['browse_by_date'] = ''; + + $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal) AS min , max(datetimeoriginal) AS max " . + "FROM ".LIN_PREFIX."meta_exif"); + if(isset($data['min']) && isset($data['max']) && !empty($data['min']) && !empty($data['max']) ) + { + /** + * get min and max year + */ + $min_year = substr($data['min'],0,4); + $max_year = substr($data['max'],0,4); + /** + * get years between + */ + for($i = $min_year; $i <= $max_year; $i++) + { + /** + * exclude all wrong/empty/... dates + */ + if($i > 1900) + { + $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) AS datetime FROM ".LIN_PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); + if($data['datetime']>0) + { + $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_LINK.'&linCat=browse&year='.$i.'">'.$i.'</a> ('.$data['datetime'].'), '; + } + } + } + } + } +} + +/** + * setup random and new imgages view + */ +function viewHomeSetImages($key,$optionname,$sql) +{ + $GLOBALS['linpha']->template->output[$key] = array(); + + if($GLOBALS['linpha']->sql->config->value[$optionname] != 0) + { + switch(LIN_DB_TYPE) + { + case 'mysql': + $str_random = 'rand()'; + break; + case 'postgres': + $str_random = 'random()'; + break; + case 'sqlite': + $str_random = 'random()'; + break; + case 'oci8po': + $str_random = $GLOBALS['linpha']->db->random; + break; + } + + $nr_images = $GLOBALS['linpha']->sql->config->value[$optionname]; + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999".$sql." ORDER BY ".$str_random); + + for($i = 1; $i <= $nr_images ; ) + { + $data = $query->FetchRow(); + if(isset($data['id'])) + { + $path = LinSql::getFullImagePath( $data['id'] ); + + if(file_exists($path) && LinSql::photoIsAllowed($data['id'])) + { + $GLOBALS['linpha']->template->output[$key][] = array('id'=>$data['id'],'path'=>$path); + $i++; + } + } + else + { + break; + } + } + } +} + +/** + * setup basket view + */ +function viewBasket() +{ + $GLOBALS['linpha']->template->setModuleName('view_basket'); + $GLOBALS['linpha']->template->overrideModule('css','view_thumb'); // used the same css definitions as view_thumb + + $this->viewThumbSetSubFolders(); + $this->viewThumbNojs(); +} + +/** + * setup comment view + */ +function viewAlbMeta() +{ + $GLOBALS['linpha']->template->setModuleName('view_albmeta'); + + /** + * save data + */ + if( isset( $_POST['cmd'] ) && $_POST['cmd']=="add_comment") + { + /** + * check if comment exists + * + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id " . + "FROM ".LIN_PREFIX."meta_comments " . + "WHERE md5sum = '".LinSql::linAddslashes($this->md5sum)."'"); + + if( $query->EOF ) // insert + { + $GLOBALS['linpha']->db->Execute( + "INSERT into ".LIN_PREFIX."meta_comments " . + "(meta_time, md5sum, meta_author, meta_comment) " . + "VALUES " . + "('".time()."', '".LinSql::linAddslashes($this->md5sum)."', " . + "'".LinSql::linAddslashes($_POST['author'])."', '".LinSql::linAddslashes($_POST['comment'])."')" + ); + } + else // update + { + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."meta_comments SET ". + "meta_time = '".time()."', ". + "meta_author = '".LinSql::linAddslashes($_POST['author'])."', " . + "meta_comment = '".LinSql::linAddslashes($_POST['comment'])."' " . + "WHERE md5sum = '".LinSql::linAddslashes($this->md5sum)."'"); + } + } + + /** + * get data + */ + $data = $GLOBALS['linpha']->db->GetRow( + "SELECT id, meta_time, meta_author, meta_comment " . + "FROM ".LIN_PREFIX."meta_comments " . + "WHERE md5sum = '".$this->md5sum."'" + ); + if(isset($data['meta_author'])) + { + $GLOBALS['linpha']->template->output['comment_author'] = $data['meta_author']; + } + else + { + $GLOBALS['linpha']->template->output['comment_author'] = $_SESSION['user_name']; + } + + if(isset($data['meta_comment'])) + { + $GLOBALS['linpha']->template->output['comment_text'] = $data['meta_comment']; + } + else + { + $GLOBALS['linpha']->template->output['comment_text'] = ''; + } + + /** + * save modified MetaData + */ + LinMetaData::saveModifiedMetaData(); +} + +/** + * setup image view + */ +function viewImg() +{ + $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); + + if( LinIdentify::isVideo( $this->img_type )) // in video mode, the video thumbnail is shown instead of the image + { + $this->img_width = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; + $this->img_height = $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; + } + else + { + $max_width = $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; + $max_height = $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; + $array = LinImage::scaleToFit($this->org_width,$this->org_height,$max_width,$max_height); + + $this->img_width = $array['w']; + $this->img_height = $array['h']; + } + + $this->viewImgCommon(); + $this->viewImgComments(); + + if( linUseAjax() ) + { + $GLOBALS['linpha']->template->setModuleName('view_img'); + + if(isset($_GET['xml'])) + { + $this->viewImgXml(); + exit(); + } + } + else + { + $GLOBALS['linpha']->template->setModuleName('static.view_img'); + $GLOBALS['linpha']->template->overrideModule('css','view_img'); + } +} + +/** + * generate xml data for ajax image view + */ +function viewImgXml() +{ + header('Content-type: text/xml'); + echo '<?xml version="1.0" ?>'."\n"; + ?> +<root> +<imgid><?php echo $GLOBALS['linpha']->template->idCurrent; ?></imgid> +<filetype><?php echo LinIdentify::getShortFileType( $this->img_type ); ?></filetype> +<imgwidth><?php echo $this->org_width; ?></imgwidth> +<imgheight><?php echo $this->org_height; ?></imgheight> +<imgnr><?php printf(i18n("Image %s of %s"),$this->current_key+1,count($this->photos_filtered)); ?></imgnr> +<title><?php /* oh, what an evil hack */ echo str_replace('<','<',$GLOBALS['linpha']->template->linpha_title." :: ".$GLOBALS['linpha']->template->output['title']); ?></title> +<?php + if(isset($this->xmldata['prev_thumb'])) { + foreach($this->xmldata['prev_thumb'] AS $value) + { + echo '<prevthumb>'.$value.'</prevthumb>'."\n"; + } + } + if(isset($this->xmldata['next_thumb'])) { + foreach($this->xmldata['next_thumb'] AS $value) + { + echo '<nextthumb>'.$value.'</nextthumb>'."\n"; + } + } + + foreach($GLOBALS['linpha']->template->output['image_infos'] AS $value) + { ?> +<meta> + <name><?php echo $value['name']; ?></name><value><?php echo htmlspecialchars($value['value']); ?></value> +</meta> +<?php + } + + if($this->newCommentAdded) + { + echo '<commentadded>'.i18n("Comment successfully added.").'</commentadded>'."\n"; + } + + while($data = $GLOBALS['linpha']->template->output['image_comments']->FetchRow()) + { ?> +<comment> + <time><?php echo htmlspecialchars(linStrftime($data['meta_time'])); ?></time> + <author><?php echo htmlspecialchars($data['meta_author'],ENT_QUOTES); ?></author> + <text><?php echo str_replace('<','<',linHtmlTag($data['meta_comment'],ENT_QUOTES) ); ?></text> +</comment> +<?php } ?> +</root> + +<?php + +} // end viewImgAjax() + +/** + * stuff used in viewImg() and viewMeta() + */ +function viewImgCommon() +{ + $this->viewImgSetPrevNextThumb(); + + $this->viewImgStoreImageInformation(); + + $GLOBALS['linpha']->template->output['image_infos'] = + LinMetaData::readInformations($this->photos_filtered[$this->current_key], + $flag_nr=10); + +} + +/** + * get/save image comments + */ +function viewImgComments() +{ + /** + * image comments + */ + if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) + { + /** + * save comment + */ + if( isset( $_POST['cmd'] ) && $_POST['cmd']=='add_comment' + && isset($_POST['inputAddCommentAuthor']) + && !empty($_POST['inputAddCommentAuthor']) + && ((isset($_POST['inputAddCommentText']) && !empty($_POST['inputAddCommentText'])) + || (isset($_POST['inputAddCommentTextarea']) && !empty($_POST['inputAddCommentTextarea'])))) + { + if( !empty($_POST['inputAddCommentTextarea'])) { + $comment = $_POST['inputAddCommentTextarea']; + } else { + $comment = $_POST['inputAddCommentText']; + } + + $GLOBALS['linpha']->db->Execute("INSERT into ".LIN_PREFIX."meta_comments (meta_time, md5sum, meta_author, meta_comment)" . + "VALUES ('".time()."','".$GLOBALS['linpha']->imgview->md5sum."','".LinSql::linAddslashes($_POST['inputAddCommentAuthor'])."'," . + "'".LinSql::linAddslashes($comment)."')"); + $this->newCommentAdded = true; // used for ajax + } + + /** + * get comments + */ + $GLOBALS['linpha']->template->output['image_comments'] = $GLOBALS['linpha']->db->Execute("SELECT id, meta_time, meta_author, meta_comment FROM ".LIN_PREFIX."meta_comments " . + "WHERE md5sum = '".$GLOBALS['linpha']->imgview->md5sum."'"); + } +} + +/** + * store image informations in database if s + */ +function viewImgStoreImageInformation() +{ + $array_meta = array('exif','iptc','xmp'); + foreach($array_meta AS $value) + { + if(!isset($MetaData)) + { + $MetaData = new LinMetaData(); + } + + /** + * read exif/iptc/xmp from file if no entry + */ + if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) + { + $MetaData->saveData($value, $this->src_file, $this->md5sum ); + } + + /** + * Read image geodata. This depends on the maps plugin. So we only + * run this additionally import if maps plugin is enabled and admin + * selected "autoimport". + * This should prevent all others from suffering performance issues + * during import + */ + if(isset($GLOBALS['linpha']->sql->config->value['plugins_maps_enable']) + && $GLOBALS['linpha']->sql->config->value['plugins_maps_enable_geotagged'] + && $GLOBALS['linpha']->sql->config->value['plugins_maps_geotagged_autoimport']) + { + $MetaData->singleImportGeoData($this->md5sum, $this->src_file); + error_log("DOING GEODATA AUTOIMPORT",'',0); + } + } +} + +/** + * generate html code for the prev/next thumbnail + */ +function viewImgThumbHtml($key,$class) +{ + $id = $this->photos_filtered[$key]['id']; + $name = $this->photos_filtered[$key]['name']; + + $str = '<div class="linDivThumbnavi_'.$class.'">' + . '<a href="'.$GLOBALS['linpha']->template->URL_base.'&linId='.$id.'">' + . '<img class="linImgThumbnavi_'.$class.'" src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$id.'" /></a>' + . '<br />'.$name.'</div>'."\n"; + + return $str; +} + +/** + * set prev/next thumb for img_view and meta_view + */ +function viewImgSetPrevNextThumb() +{ + $nr_prev_next_thumbs = $GLOBALS['linpha']->sql->config->value['sys_style_image_nrprevnextthumbs']; + + /** + * search current key in array + */ + foreach($this->photos_filtered AS $key=>$value) + { + if($value['id'] == $GLOBALS['linpha']->template->idCurrent) + { + $this->current_key = $key; + break; + } + } + + /** + * ooh, something went wrong + */ + if(!isset($this->current_key)) + { + $this->current_key = 0; + } + + /** + * set prev thumbs + */ + $GLOBALS['linpha']->template->output['prev_thumb'] = ''; + for($i=$nr_prev_next_thumbs; $i > 0; $i--) + { + if($this->current_key >= $i) + { + if(isset($_GET['xml'])) + { + $this->xmldata['prev_thumb'][] = $this->photos_filtered[$this->current_key - $i]['id']; + } + else + { + $GLOBALS['linpha']->template->output['prev_thumb'] .= $this->viewImgThumbHtml( $this->current_key - $i , 'PrevNext' ); + } + } + } + + /** + * set next thumbs + */ + $GLOBALS['linpha']->template->output['next_thumb'] = ''; + for($i=0; $i < $nr_prev_next_thumbs; $i++) + { + if($this->current_key < ( count($this->photos_filtered) - ($i+1) ) ) + { + if(isset($_GET['xml'])) + { + $this->xmldata['next_thumb'][] = $this->photos_filtered[$this->current_key + ($i+1)]['id']; + } + else + { + $GLOBALS['linpha']->template->output['next_thumb'] .= $this->viewImgThumbHtml( $this->current_key + ($i+1) , 'PrevNext' ); + } + } + } + + + /** + * set current image and thumb + */ + if(isset($_GET['xml'])) + { + } + else + { + $GLOBALS['linpha']->template->output['current_thumb'] = $this->viewImgThumbHtml( $this->current_key , 'Current' ); + } +} + +/** + * setup MetaData view + */ +function viewMeta() +{ + $GLOBALS['linpha']->template->setModuleName('static.view_img'); + $GLOBALS['linpha']->template->overrideModule('css','view_img'); + + $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); + + /** + * save modified MetaData + */ + LinMetaData::saveModifiedMetaData(); + + $this->viewImgCommon(); +} + +} // end class linImgview +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-09 19:36:08
|
Revision: 4900 http://linpha.svn.sourceforge.net/linpha/?rev=4900&view=rev Author: fangehrn Date: 2008-03-09 12:35:50 -0700 (Sun, 09 Mar 2008) Log Message: ----------- Added Paths: ----------- trunk/linpha2/templates/default/slideshow.js.php Copied: trunk/linpha2/templates/default/slideshow.js.php (from rev 4899, trunk/linpha2/templates/default/fragments.php) =================================================================== --- trunk/linpha2/templates/default/slideshow.js.php (rev 0) +++ trunk/linpha2/templates/default/slideshow.js.php 2008-03-09 19:35:50 UTC (rev 4900) @@ -0,0 +1,205 @@ +<?php + +switch($fragment) +{ + +/** + * the slideshow controls + */ +case 'slideshow': + ?> + <div id="linDivSlideshowControls"> + <div style="float: left; margin-left: 10px; "> + <a href="javascript:myLinImage.moveFirst()"><img id="linSsImgFirst" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_first.gif" width="25" height="25" border="0" alt="First" title="<?php echo i18n("First"); ?>" /></a> + <a href="javascript:myLinImage.movePrev()"><img id="linSsImgPrev" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_previous.gif" width="25" height="25" border="0" alt="Previous" title="<?php echo i18n("Previous"); ?>" /></a> + <a href="javascript:myLinImage.slideshowStartStop()"><img id="linSsImgStart" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_play.gif" width="25" height="25" border="0" alt="Play" title="<?php echo i18n("Play/Pause"); ?>" /></a> + <!--<a href="javascript:myLinImage.slideshowStop()"><img id="linSsImgStop" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_stop.gif" width="25" height="25" border="0" alt="Stop" title="<?php echo i18n("Stop"); ?>" /></a>--> + <a href="javascript:myLinImage.moveNext()"><img id="linSsImgNext" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_next.gif" width="25" height="25" border="0" alt="Next" title="<?php echo i18n("Next"); ?>" /></a> + <a href="javascript:myLinImage.moveLast()"><img id="linSsImgLast" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_last.gif" width="25" height="25" border="0" alt="Last" title="<?php echo i18n("Last"); ?>" /></a> + </div> + + <div style="float: left; margin-left: 40px; "> + <select id="linSsDelay" name="delay" size="1" class="linForms" onchange="myLinImage.slideshowChangeDelay()" title="<?php echo i18n("Delay"); ?>"> + <option value="3">3 s</option> + <option value="4">4 s</option> + <option value="5" selected="selected">5 s</option> + <option value="10">10 s</option> + <option value="15">15 s</option> + <option value="30">30 s</option> + <option value="45">45 s</option> + <option value="60">60 s</option> + </select> + </div> + + <div style="float: left; margin-left: 10px; "> + <a href="javascript:myLinImage.slideshowChangeLoop()"><img id="linSsImgLoop" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_loop.gif" width="25" height="25" border="0" alt="Loop" title="<?php echo i18n("Enable/disable Loop"); ?>" /></a> + <!--<a href="javascript:myLinImage.slideshowChangeLoop()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_noloop.gif" width="25" height="25" border="0" /></a>--> + <a href="javascript:myLinImage.slideshowChangeRandom()"><img id="linSsImgRandom" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_norandom.gif" width="25" height="25" border="0" alt="Random" title="<?php echo i18n("Enable/disable Random Play Order"); ?>" /></a> + <!--<a href="javascript:myLinImage.slideshowChangeRandom()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_random.gif" width="25" height="25" border="0" /></a>--> + </div> + + <div id="linDivSlideshowImgNr" style="float: left; margin-left: 40px; "></div> + + <div id="linDivSlideshowExit" style="float: left; margin-left: 40px; "> + <a href="javascript:myLinImage.fullscreenStop()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_stop.gif" width="25" height="25" border="0" alt="Exit" title="<?php echo i18n("Exit Fullscreen"); ?>" ></a> + </div> + + <div style="clear: both;"></div> + </div> + <?php echo $linTpl->divRoundCorners('bottom','alpha'); ?> +<?php +break; + + +/** + * view meta + */ +case 'edit_meta': + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { ?> + + <?php + /** + * @todo thats not the correct way including css files... :-/ + */ + ?> + <link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'.$this->template_name.'/themes/default/css/admin.css'; ?>' type='text/css'> + + <?php if($GLOBALS['linpha']->imgview->img_type!=0) { ?> + <ul class="linUlMenu"> + <li><a id="linAMetaLinpha" href="javascript:showMetaLinpha()">LinPHA MetaData</a></li> + <li><a id="linAMetaIptc" href="javascript:showMetaIptc()">IPTC MetaData</a></li> + <li><a id="linAMetaXmp" href="javascript:showMetaXmp()">XMP MetaData</a></li> + </ul> + <?php } /* end if img_type!=0 */ ?> + + <div id="linDivMetaLinpha"> + <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> + <table border="0" style="float: left;"> + <?php echo $linTpl->output['meta_linpha']; ?> + <tr> + <td rowspan="2"> + <br /> + <input type="hidden" name="linCmd" value="linInsertMetaLinpha" /> + <input type="submit" class="linButton" name="submit" value="<?php echo i18n("Submit"); ?>" /> + </td> + </tr> + </table> + </form> + </div> + + <?php if($GLOBALS['linpha']->imgview->img_type!=0) { ?> + <div id="linDivMetaIptc"> + <?php if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { + echo '<br />'; + if($meta_edit_possible) { ?> + <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> + <table border="0"> + <?php + include(LINPHA_DIR.'/lib/include/metadata_iptc_edit.php'); + ?> + <tr> + <td rowspan="2"> + <br /> + <input type="hidden" name="linCmd" value="linInsertMetaIptc" /> + <input type="submit" class="linButton" name="submit" value="<?php echo i18n("Submit"); ?>" /> + </td> + </tr> + </form> + </table> + <br> + <br> + <p>Powered by: <a href="http://owl.phy.queensu.ca/~phil/exiftool/" >ExifTool</a></p> + <?php + } else { + echo i18n("Error: File not writable. Please check the file permissions."); /* @todo use unified language string */ + } + } else { + echo i18n("IPTC Is Currently Disabled.").'<br /><br />'; + if($GLOBALS['linpha']->sql->isAdmin()) { + echo '<a href="'.LINPHA_CLIENT.'/admin/?cat=metadata_define_iptc">'.i18n("Enable IPTC").'</a>'; + echo '<br /><br />'; + } + } ?> + </div> + <?php } /* end if img_type!=0 */ ?> + + <?php if($GLOBALS['linpha']->imgview->img_type!=0) { ?> + <div id="linDivMetaXmp"> + <?php if($GLOBALS['linpha']->sql->config->value['sys_image_xmp']) { + echo '<br />'; + if($meta_edit_possible) { ?> + <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> + <table border="0"> + <?php + include(LINPHA_DIR.'/lib/include/metadata_xmp_edit.php'); + ?> + <tr> + <td rowspan="2"> + <br /> + <input type="hidden" name="linCmd" value="linInsertMetaXmp" /> + <input type="submit" class="linButton" name="submit" value="<?php echo i18n("Submit"); ?>" /> + </td> + </tr> + </form> + </table> + <br> + <br> + <p>Powered by: <a href="http://owl.phy.queensu.ca/~phil/exiftool/" >ExifTool</a></p> + <?php + } else { + echo i18n("Error: File not writable. Please check the file permissions."); /* @todo use unified language string */ + } + } else { + echo i18n("XMP Is Currently Disabled.").'<br /><br />'; + if($GLOBALS['linpha']->sql->isAdmin()) { + echo '<a href="'.LINPHA_CLIENT.'/admin/?cat=metadata_define_xmp">'.i18n("Enable XMP").'</a>'; + echo '<br /><br />'; + } + } ?> + </div> + <?php } /* end if img_type!=0 */ ?> + </form> + + <div style="clear: both;"></div> + + <?php if($GLOBALS['linpha']->imgview->img_type!=0) { ?> + <script language="JavaScript" type="text/javascript"> + <!-- + function showMetaLinpha() + { + $('linAMetaLinpha').className = 'current'; + $('linAMetaIptc').className = ''; + $('linAMetaXmp').className = ''; + Element.hide('linDivMetaIptc'); + Element.hide('linDivMetaXmp'); + Element.show('linDivMetaLinpha'); + } + function showMetaIptc() + { + $('linAMetaLinpha').className = ''; + $('linAMetaXmp').className = ''; + $('linAMetaIptc').className = 'current'; + Element.hide('linDivMetaLinpha'); + Element.hide('linDivMetaXmp'); + Element.show('linDivMetaIptc'); + } + function showMetaXmp() + { + $('linAMetaLinpha').className = ''; + $('linAMetaIptc').className = ''; + $('linAMetaXmp').className = 'current'; + Element.hide('linDivMetaLinpha'); + Element.hide('linDivMetaIptc'); + Element.show('linDivMetaXmp'); + } + showMetaLinpha(); + --> + </script> + <?php } /* end if img_type!=0 */ ?> + + <?php } /* end if checkPermission('metadata_edit') */ ?> + + <?php +break; +} +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-09 17:32:53
|
Revision: 4899 http://linpha.svn.sourceforge.net/linpha/?rev=4899&view=rev Author: fangehrn Date: 2008-03-09 10:32:48 -0700 (Sun, 09 Mar 2008) Log Message: ----------- Added Paths: ----------- trunk/linpha2/lib/js/LinYUIAlbumNavigation.js Copied: trunk/linpha2/lib/js/LinYUIAlbumNavigation.js (from rev 4898, trunk/linpha2/lib/js/LinImage.js) =================================================================== --- trunk/linpha2/lib/js/LinYUIAlbumNavigation.js (rev 0) +++ trunk/linpha2/lib/js/LinYUIAlbumNavigation.js 2008-03-09 17:32:48 UTC (rev 4899) @@ -0,0 +1,1186 @@ + +/** + * class and global definitions + */ +var LinImage = Class.create(); +var myLinImage; + +LinImage.prototype = { + + /** + * initialize() + * + * Constructor runs on completion of the DOM loading. + */ + initialize: function() + { + /*this.imgInfoColorNotActive = $('linDivInfoLink').style.color; + this.imgInfoColorActive = $('linHrefInfoLink').style.color;*/ + this.imgInfoShowHide = 'hide'; + + + this.fullscreenActive = false; + this.fullscreenOldMaxWidth, this.fullscreenOldMaxHeight, this.previousBodyOverflow; + this.slideshowActive = false; + this.ssCurrentTimerID; + this.ssCurrentDelay = 5000; + this.ssRandom = false; + this.ssLoop = false; + + this.xmlDoc = new Array(); + this.nextThumbs = new Array(); + this.prevThumbs = new Array(); + this.preloadImageSrc = new Array(); // image array, will contain a lot of preloaded images + this.finishedPreloadedImages = new Array(); // set to true after preload completed + this.preloadXmlFinished = new Array(); + + this.currentFileType; // 1 = image, 2 = video, 3 = others + + this.curLocationHash; + //this.timerResize; + }, + + + // ----------------------------------------------------------------------------------- + // functions to load xml data of images + // ----------------------------------------------------------------------------------- + + loadImage: function(imgId) { + if(IdCurrent != imgId) + { + IdCurrent = imgId; + //myLinGlobal.menuNeedsUpdating = true; // IdCurrent changed, update menu on next hover of the menu + location.hash = 'idCurrent='+IdCurrent; + } + + this.curLocationHash = location.hash; // update current Hash, this value is periodically checked to reload the image if neccessary + + // do not load the data again if it is already cached + if(this.preloadXmlFinished[imgId] && typeof this.xmlDoc[imgId] != "undefined" ) // use typeof to work in IE + { + this.changeImage(); + } + else + { + this.loadImageXml(imgId); + } + }, + + loadImageXml: function(imgId) { + myLinGlobal.AjaxPost(linUrlBase + '&linId=' + imgId + '&xml', '', myLinImage.loadImageContinue); + }, + + loadImageContinue: function(t) { + var loadedimgid = t.responseXML.documentElement.getElementsByTagName('imgid').item(0).firstChild.data; + + // save xml data + myLinImage.xmlDoc[loadedimgid] = t.responseXML.documentElement; + myLinImage.preloadXmlFinished[loadedimgid] = true; + + if( loadedimgid == IdCurrent ) // coming from loadImage() + { + myLinImage.changeImage(); + } + else // coming from preloadImage() + { + myLinImage.preloadImage(loadedimgid); + } + }, + + + // ----------------------------------------------------------------------------------- + // Navigation functions + // ----------------------------------------------------------------------------------- + + movePrev: function() { + if( this.slideshowActive ) + { + clearTimeout(this.ssCurrentTimerID); + } + + if(this.prevThumbs[ this.prevThumbs.length - 1 ]) + { + Element.setOpacity('linSsImgPrev',0.7); + new Effect.Appear('linSsImgPrev', { duration: 0.5, from: 0.7, to: 1.0 }); + myLinImage.loadImage(this.prevThumbs[ this.prevThumbs.length - 1 ]); + + if( this.slideshowActive ) + { + clearTimeout(this.ssCurrentTimerID); + this.ssCurrentTimerID = setTimeout("myLinImage.slideshowPlay()", this.ssCurrentDelay); + } + } + else // end reached, do nothing but enable keyboard navigation again + { + myLinImage.enableKeyboardNav(); + } + + if( this.slideshowActive ) + { + this.ssCurrentTimerID = setTimeout("myLinImage.slideshowPlay()", this.ssCurrentDelay); + } + }, + moveNext: function() { + if( this.slideshowActive ) + { + clearTimeout(this.ssCurrentTimerID); + } + + if(this.nextThumbs[0]) + { + Element.setOpacity('linSsImgNext',0.7); + new Effect.Appear('linSsImgNext', { duration: 0.5, from: 0.7, to: 1.0 }); + myLinImage.loadImage(this.nextThumbs[0]); + } + else if( this.ssLoop ) + { + Element.setOpacity('linSsImgNext',0.7); + new Effect.Appear('linSsImgNext', { duration: 0.5, from: 0.7, to: 1.0 }); + this.moveFirst(); + } + else // end reached, do nothing but enable keyboard navigation again + { + myLinImage.enableKeyboardNav(); + } + + if( this.slideshowActive ) + { + this.ssCurrentTimerID = setTimeout("myLinImage.slideshowPlay()", this.ssCurrentDelay); + } + }, + moveFirst: function() { + if( this.slideshowActive ) + { + clearTimeout(this.ssCurrentTimerID); + } + + Element.setOpacity('linSsImgFirst',0.7); + new Effect.Appear('linSsImgFirst', { duration: 0.5, from: 0.7, to: 1.0 }); + myLinImage.loadImage( firstImgId ); + + if( this.slideshowActive ) + { + this.ssCurrentTimerID = setTimeout("myLinImage.slideshowPlay()", this.ssCurrentDelay); + } + }, + moveLast: function() { + if( this.slideshowActive ) + { + clearTimeout(this.ssCurrentTimerID); + } + + Element.setOpacity('linSsImgLast',0.7); + new Effect.Appear('linSsImgLast', { duration: 0.5, from: 0.7, to: 1.0 }); + myLinImage.loadImage( lastImgId ); + + if( this.slideshowActive ) + { + this.ssCurrentTimerID = setTimeout("myLinImage.slideshowPlay()", this.ssCurrentDelay); + } + }, + + // ----------------------------------------------------------------------------------- + // Change image functions + // ----------------------------------------------------------------------------------- + + /** + * changeImage() + */ + changeImage: function() { + + /** + * set height of outer div to prevent the whole page getting smaller, and if the image is loaded getting bigger again + * but in fullscreen, we want no activities in background + */ + if(! this.fullscreenActive) { + $('linDivMainimage').style.height = $('linImgMainimage').style.height; + //$('linDivMain').style.height = $('linDivMain').offsetHeight; + //alert($('linDivMain').offsetHeight); + } + + /** + * hide elements during transition + */ + this.hideImgInfoNow(); // hide text info link immediately + Element.hide('linImgMainimage'); // hide mainimage while changing image to prevent flicker + Element.hide('linDivInfoLink'); + + this.currentFileType = this.xmlDoc[IdCurrent].getElementsByTagName('filetype').item(0).firstChild.data; + + switch( this.currentFileType ) + { + case '1': // image + + if(! this.finishedPreloadedImages[IdCurrent] ) + { + Element.show('linDivloading'); + } + + //$('linImgMainimage').style.marginLeft = 0; // restore left margin, set when viewing videos + + /** + * calc image width and height + */ + var orgWidth = this.xmlDoc[IdCurrent].getElementsByTagName('imgwidth').item(0).firstChild.data; + var orgHeight = this.xmlDoc[IdCurrent].getElementsByTagName('imgheight').item(0).firstChild.data; + var sizeArray = this.scaleToFit(orgWidth,orgHeight,maxImageWidth,maxImageHeight,1); + var imgWidth = sizeArray[0]; + var imgHeight = sizeArray[1]; + + /** + * preload image + */ + var currentImgSrc = imageSrc + IdCurrent + '&width=' + imgWidth + '&height=' + imgHeight; + imgPreloader = new Image(); + + /** + * once image is preloaded, resize image container + * + * pay attention with the other image preloader! + * if imgWidth and imgWidth was not set with trailing 'var' it got overlapping with the other variables + * and this caused the image not resized correctly in resizeImageContainer() !!! + */ + imgPreloader.onload=function(){ + myLinImage.finishedPreloadedImages[IdCurrent] = true; + $('linImgMainimage').src = currentImgSrc; + myLinImage.resizeImageContainer(imgWidth, imgHeight); + } + imgPreloader.src = currentImgSrc; + + break; + case '2': // video + + //$('linImgMainimage').style.marginLeft = 200; + + /** + * show video thumbnail + */ + $('linImgMainimage').src = thumbSrc + IdCurrent ; + $('linImgMainimage').style.width = 'auto'; + $('linImgMainimage').style.height = 'auto'; + + /** + * show image and set div height + */ + this.showImage(); + + break; + case '0': // others + break; + } + }, + + /** + * resizeImageContainer() + */ + resizeImageContainer: function( imgWidth, imgHeight) { + + // get current height and width + /*this.wCur = $('linImgMainimage').offsetWidth; + this.hCur = $('linImgMainimage').offsetHeight; + + // scalars based on change from old to new + this.xScale = ((imgWidth + (borderSize * 2)) / this.wCur) * 100; + this.yScale = ((imgHeight + (borderSize * 2)) / this.hCur) * 100; + + // calculate size difference between new and old image, and resize if necessary + wDiff = (this.wCur - borderSize * 2) - imgWidth; + hDiff = (this.hCur - borderSize * 2) - imgHeight; + + if(!( hDiff == 0)){ new Effect.Scale('linImgMainimage', this.yScale, {scaleX: false, duration: resizeDuration, queue: 'front'}); } + if(!( wDiff == 0)){ new Effect.Scale('linImgMainimage', this.xScale, {scaleY: false, delay: resizeDuration, duration: resizeDuration}); } + + // if new and old image are same size and no scaling transition is necessary, + // do a quick pause to prevent image flicker. + if((hDiff == 0) && (wDiff == 0)){ + if (navigator.appVersion.indexOf("MSIE")!=-1){ pause(250); } else { pause(100);} + }*/ + + $('linImgMainimage').style.width = imgWidth + 'px'; + $('linImgMainimage').style.height = imgHeight + 'px'; + + + /*Element.setHeight('prevLink', imgHeight); + Element.setHeight('nextLink', imgHeight); + Element.setWidth( 'imageDataContainer', imgWidth + (borderSize * 2));*/ + + /** + * show panorama link + * the only reason why do this at this point is, because this is only done on images + * and we just know the width and height + */ + if( imgWidth/imgHeight >= 2 || imgHeight/imgWidth >= 2 ) + { + Element.show('linHrefPanoLink'); + } + + this.showImage(); + }, + + /** + * showImage() + * + * Display image and begin preloading next images. + */ + showImage: function(){ + Element.hide('linDivloading'); + + if( useEffects ) + { + new Effect.Appear('linImgMainimage', { duration: 0.2, afterFinish: function(){ myLinImage.setImageData(); } }); + } + else + { + Element.show('linImgMainimage'); + this.setImageData() + } + + if(! this.fullscreenActive) + { + $('linDivMainimage').style.height = $('linImgMainimage').style.height; // reset to correct height to prevent trouble if image is bigger or smaller + //$('linDivMain').style.height = 'auto'; + } + }, + + /** + * setImageData() + */ + setImageData: function() + { + this.enableKeyboardNav(); + + /** + * set title + */ + if( typeof $('linDivTitle') != 'undefined' ) + { + $('linDivTitle').innerHTML = this.xmlDoc[IdCurrent].getElementsByTagName('title').item(0).firstChild.data; + } + + /** + * update the menu + * + * replace the image ids in the menu + * replace( /linId=[0-9]* /g , "linId=" + IdCurrent ); + * its just an search/replace of 'linId=x' in the menu + * its very fast (about 0 - 15ms) and its executed every time the image changes + * + * but only in menuMore and menuAdmin, because we have in menuLogin + * linId='+IdCurrent, and ooh this will create very unexpected results..!! + */ + /*if( typeof $('linMenuAdmin') != 'undefined' ) + {*/ + //$('linMenuAdmin').innerHTML = $('linMenuAdmin').innerHTML.replace( /linId=[0-9]*/g , "linId=" + IdCurrent ); + /*}*/ + + /** + * menuMore + */ + /*if( typeof $('linMenuMore') != 'undefined' ) + {*/ + //$('linMenuMore').innerHTML = $('linMenuMore').innerHTML.replace( /linId=[0-9]*/g , "linId=" + IdCurrent ); + + // replace the width and height dimensions of the view at fullscreen link + //var orgWidth = this.xmlDoc[IdCurrent].getElementsByTagName('imgwidth').item(0).firstChild.data; + //var orgHeight = this.xmlDoc[IdCurrent].getElementsByTagName('imgheight').item(0).firstChild.data; + //$('linLiViewAtFullscreen').innerHTML = $('linLiViewAtFullscreen').innerHTML.replace( /width=[0-9]*/ , "width=" + orgWidth ); + //$('linLiViewAtFullscreen').innerHTML = $('linLiViewAtFullscreen').innerHTML.replace( /height=[0-9]*/ , "height=" + orgHeight ); + //$('linLiViewAtFullscreen').innerHTML = $('linLiViewAtFullscreen').innerHTML.replace( /[0-9]*x[0-9]*/ , orgWidth + "x" + orgHeight ); + /*}*/ + + /** + * set current thumb + */ + $('linDivThumbnavi_Current').innerHTML = '<a href="javascript:myLinImage.loadImage(' + IdCurrent + ')"><img class="linImgThumbnavi_Current" src="' + thumbSrc + IdCurrent + '" /></a>'; + + /** + * set prev thumbs + */ + $('linDivThumbnavi_Prev').innerHTML = ''; + this.prevThumbs = new Array(); + if(this.xmlDoc[IdCurrent].getElementsByTagName('prevthumb').length > 0) + { + for(var i = 0; i < this.xmlDoc[IdCurrent].getElementsByTagName('prevthumb').length; i++) + { + var thumbId = this.xmlDoc[IdCurrent].getElementsByTagName('prevthumb').item(i).firstChild.data; + this.prevThumbs[i] = thumbId; + this.setPrevNextThumb(thumbId, 'linDivThumbnavi_Prev'); + } + } + + /** + * set next thumbs + */ + $('linDivThumbnavi_Next').innerHTML = ''; + this.nextThumbs = new Array(); + if(this.xmlDoc[IdCurrent].getElementsByTagName('nextthumb').length > 0) + { + for(var i = 0; i < this.xmlDoc[IdCurrent].getElementsByTagName('nextthumb').length; i++) + { + var thumbId = this.xmlDoc[IdCurrent].getElementsByTagName('nextthumb').item(i).firstChild.data; + this.nextThumbs[i] = thumbId; + this.setPrevNextThumb(thumbId, 'linDivThumbnavi_Next'); + } + } + + /** + * set meta data + */ + $('linDivMeta').innerHTML = ''; + if(this.xmlDoc[IdCurrent].getElementsByTagName('meta').length > 0) + { + var table = Builder.node('table', {id: 'linTableMeta'} ); + var tbody = Builder.node('tbody'); + + for(var i = 0; i < this.xmlDoc[IdCurrent].getElementsByTagName('meta').length; i++) + { + var meta = this.xmlDoc[IdCurrent].getElementsByTagName('meta').item(i); + var metaname = meta.getElementsByTagName('name').item(0).firstChild.data; + if(meta.getElementsByTagName('value').item(0).hasChildNodes()) { // prevent error in IE + var metavalue = meta.getElementsByTagName('value').item(0).firstChild.data; + } else { + var metavalue = ''; + } + + var tr = Builder.node('tr'); + var tdleft = Builder.node('td', {className: 'linTdMetaLeftColumn'}, metaname ); + var tdright = Builder.node('td', metavalue ); + + tr.appendChild(tdleft); + tr.appendChild(tdright); + tbody.appendChild(tr); + } + + table.appendChild(tbody); + + $('linDivMeta').appendChild(table); + + } + + /** + * file type specific meta data stuff + */ + switch( this.currentFileType ) + { + case '1': // image + this.setImageInfoLink(); // show the "info" link, must be called after Appear('linImgMainimage') + + //Element.hide('linDivVideoLink'); + //Element.show('linDivExifLink'); + //$('linAMetaExif').href = '#' + $('linAMetaExif').href; + //myLinGlobal.enableTab( 'linDivTab', 3, 'linAMetaExif' ); + + break; + case '2': // video + + //Element.show('linDivVideoLink'); + //Element.hide('linDivExifLink'); + //$('linAMetaExif').href = $('linAMetaExif').href.substring(1); + //$('linAMetaExif').href = '#' + $('linAMetaExif').href; + + //myLinGlobal.disableTab( 'linDivTab', 3, 'linAMetaExif' ); + + /*$('linDivMetaOuter').style.top = $('linImgMainimage').offsetTop + 'px'; + $('linDivMetaOuter').style.height = $('linImgMainimage').offsetHeight + 'px'; // 'auto' + Element.show('linDivMetaOuter');*/ + + break; + } + + this.initTextareaAddComment(); + this.setComments(); + + /** + * set image nr + * currently only in slideshow used + */ + $('linDivSlideshowImgNr').innerHTML = this.xmlDoc[IdCurrent].getElementsByTagName('imgnr').item(0).firstChild.data; + + + /** + * and at last, start preloading next and previous images + */ + this.preloadXml(); + + + }, + + /** + * setPrevNextThumb() + * + * code to generate a thumbnail with a <div><a><img> tag + */ + setPrevNextThumb: function(thumbId, divId) + { + var ElemImg = Builder.node('img', {id: 'thumb'+thumbId, className: 'linImgThumbnavi_PrevNext', src: thumbSrc + thumbId}); + var ElemA = Builder.node('a', {href: 'javascript:myLinImage.loadImage(' + thumbId + ')'}); + var ElemDiv = Builder.node('div', {className: 'linDivThumbnavi_PrevNext'}); + + ElemA.appendChild( ElemImg ); + ElemDiv.appendChild( ElemA ); + $(divId).appendChild(ElemDiv); + + if(! this.finishedPreloadedImages[thumbId]) { + Element.setOpacity('thumb'+thumbId,0.5); + } + + }, + + + // ----------------------------------------------------------------------------------- + // Keyboard actions + // ----------------------------------------------------------------------------------- + + /** + * enableKeyboardNav() + */ + enableKeyboardNav: function() { + document.onkeydown = this.keyboardAction; + }, + + /** + * disableKeyboardNav() + */ + disableKeyboardNav: function() { + document.onkeydown = ''; + }, + + /** + * keyboardAction() + * + * very nice + * http://www.mediaevent.de/javascript/needful_tables.html + */ + keyboardAction: function(e) { + + if (e == null) { // ie + keycode = event.keyCode; + ctrlKey = event.ctrlKey; + } else { // mozilla + keycode = e.which; + ctrlKey = e.ctrlKey; + } + + /*if( ctrlKey ) + { + alert('ctrl pressed'); + return; + }*/ + + //alert(keycode); + + key = String.fromCharCode(keycode).toLowerCase(); + + //if ((keycode == 39) && (ctrlKey == true)) // ctrl + arrow right + if (keycode == 34) // page down + { + myLinImage.disableKeyboardNav(); + myLinImage.moveNext(); + return false; + } + //else if ((keycode == 37) && (ctrlKey == true)) // ctrl + arrow left + else if (keycode == 33) // page up + { + myLinImage.disableKeyboardNav(); + myLinImage.movePrev(); + return false; + } + else if ((keycode == 32) && (ctrlKey == true)) // ctrl + space + { + myLinImage.slideshowStartStop(); + } + else if ((keycode == 122)) // F11 + { + if( myLinImage.fullscreenActive ) { + $('linDivSlideshowExit').show(); // hide exit button to force exit again with F11 + myLinImage.fullscreenStop(); + } else { + $('linDivSlideshowExit').hide(); + myLinImage.fullscreenStart(); + } + } + else if ((keycode == 36) && (ctrlKey == true)) // ctrl + home + //else if (keycode == 36) // home + { + myLinImage.moveFirst(); + return false; + } + else if ((keycode == 35) && (ctrlKey == true)) // ctrl + end + //else if (keycode == 35) // end + { + myLinImage.moveLast(); + return false; + } + else if( myLinImage.fullscreenActive && ((key == 'f') || (key == 'x') || (key == 'o') || (key == 'c') ) ) // close fullscreen + { + myLinImage.fullscreenStop(); + } + else if(myLinImage.fullscreenActive && key == 's') // start/stop slideshow + { + myLinImage.slideshowStartStop(); + } + else if(myLinImage.fullscreenActive && key == 'p') // display previous image + { + myLinImage.disableKeyboardNav(); + myLinImage.movePrev(); + } + else if(myLinImage.fullscreenActive && key == 'n') // display next image + { + myLinImage.disableKeyboardNav(); + myLinImage.moveNext(); + } + }, + + + // ----------------------------------------------------------------------------------- + // Preload functions + // ----------------------------------------------------------------------------------- + + /** + * preloadXml() + * Preload previous and next images. + * + * normally, loadImageXml() will call also preloadImage() + * but we also need to call preloadImage() if the Xml data is preloaded, + * but not yet the image (this may occur if we change to fullscreen, + * then, the images need to be re preloaded all + */ + preloadXml: function() { + + // preload nextthumb from left to right + if(this.xmlDoc[IdCurrent].getElementsByTagName('nextthumb').length > 0) + { + for(var i = 0; i < this.xmlDoc[IdCurrent].getElementsByTagName('nextthumb').length; i++) + { + var imgId = this.xmlDoc[IdCurrent].getElementsByTagName('nextthumb').item(i).firstChild.data; + + if(! this.preloadXmlFinished[imgId]) + { + this.loadImageXml(imgId); + } + else if(! this.finishedPreloadedImages[imgId] ) + { + this.preloadImage(imgId); + } + } + } + + // preload prevthumb from right to left + if(this.xmlDoc[IdCurrent].getElementsByTagName('prevthumb').length > 0) + { + for(var i = this.xmlDoc[IdCurrent].getElementsByTagName('prevthumb').length-1; i >= 0; i--) + { + var imgId = this.xmlDoc[IdCurrent].getElementsByTagName('prevthumb').item(i).firstChild.data; + + if(! this.preloadXmlFinished[imgId]) + { + this.loadImageXml(imgId); + } + else if(! this.finishedPreloadedImages[imgId] ) + { + this.preloadImage(imgId); + } + } + } + }, + + /** + * preloadImage() + * + * will be called after getting the xml data + */ + preloadImage: function(imgId) + { + if(! this.finishedPreloadedImages[imgId] ) + { + switch(this.xmlDoc[imgId].getElementsByTagName('filetype').item(0).firstChild.data) + { + case '1': // image + /** + * set image width and height + */ + var orgWidth = this.xmlDoc[imgId].getElementsByTagName('imgwidth').item(0).firstChild.data; + var orgHeight = this.xmlDoc[imgId].getElementsByTagName('imgheight').item(0).firstChild.data; + var sizeArray = this.scaleToFit(orgWidth,orgHeight,maxImageWidth,maxImageHeight,1); + var imgWidth = sizeArray[0]; + var imgHeight = sizeArray[1]; + + /** + * preload image + */ + this.preloadImageSrc[imgId] = new Image(); + + this.preloadImageSrc[imgId].onload=function(){ + myLinImage.preloadImageFinished(imgId); + } + this.preloadImageSrc[imgId].src = imageSrc + imgId + '&width=' + imgWidth + '&height=' + imgHeight; + + break; + case '2': // video + this.preloadImageFinished(imgId); + break; + case '0': // other + break; + } + } + }, + + preloadImageFinished: function(imgId) { + + this.finishedPreloadedImages[imgId] = true; + + if( $('thumb'+imgId) ) // maybe its not here anymore + { + new Effect.Appear('thumb'+imgId, { duration: 0.5, from: 0.5, to: 1.0 }); + } + + }, + + + // ----------------------------------------------------------------------------------- + // Slideshow functions + // ----------------------------------------------------------------------------------- + + fullscreenStart: function() + { + this.fullscreenActive = true; + + /** + * save old values to restore if slideshow ends + */ + this.fullscreenOldMaxWidth = maxImageWidth; + this.fullscreenOldMaxHeight = maxImageHeight; + + /** + * disable scrollbars + */ + this.previousBodyOverflow = document.getElementsByTagName("body")[0].style.overflow; + document.getElementsByTagName("body")[0].style.overflow='hidden'; + + /** + * start slideshow with some superduper effects + */ + Effect.Appear('linDivSlideshowOverlay', { queue: 'end', duration: 1.0, from: 0.0, to: 0.9 }); + Effect.BlindDown('linDivSlideshowControlsOuter', { queue: 'end'} ); + Element.show('linDivSlideshowImage'); + + /** + * steal the mainimage + */ + $('linDivMainimage').innerHTML = ''; + $('linDivSlideshowImage').innerHTML = '<img id="linImgMainimage" style="display: none;" class="linImgSlideshow">'; + + /** + * reload image with new position and size + */ + //this.resizeWindow(); + //linOnResizeCreateTrigger(); + linOnResizeWrapper(); + }, + fullscreenStop: function() + { + this.fullscreenActive = false; + + /** + * restore max image size + */ + maxImageWidth = this.fullscreenOldMaxWidth; + maxImageHeight = this.fullscreenOldMaxHeight; + + /** + * re-enable scrollbars + */ + document.getElementsByTagName("body")[0].style.overflow = this.previousBodyOverflow; + + /** + * delete preloaded images after stopping fullscreen + */ + this.finishedPreloadedImages = new Array(); + + /** + * end slideshow with some superduper effects + */ + Effect.Fold('linDivSlideshowControlsOuter', { queue: 'end'} ); + Effect.Fade('linDivSlideshowOverlay', { queue: 'end', duration: 0.5, from: 0.9, to: 0.0 } ); + Element.hide('linDivSlideshowImage'); + + /** + * give back the mainimage + */ + $('linDivSlideshowImage').innerHTML = ''; + $('linDivMainimage').innerHTML = '<img id="linImgMainimage" style="display: none;">'; + + /** + * reload image with old position and size + */ + this.loadImage( IdCurrent ); + }, + + slideshowStartStop: function() + { + // start Slideshow + if(! this.slideshowActive) + { + this.slideshowActive = true; + Element.setOpacity('linSsImgStart',0.7); + this.ssCurrentTimerID = setTimeout("myLinImage.slideshowPlay()", this.ssCurrentDelay); + } + else // stop Slideshow + { + this.slideshowActive = false; + Element.setOpacity('linSsImgStart',1); + clearTimeout(this.ssCurrentTimerID); + } + }, + slideshowPlay: function() + { + if(this.nextThumbs[0] || this.ssLoop) + { + this.moveNext(); + //this.ssCurrentTimerID = setTimeout("myLinImage.slideshowPlay()", this.ssCurrentDelay); + } + else + { + // force stop slideshow + this.slideshowActive = true; + this.slideshowStartStop(); + } + }, + + slideshowChangeDelay: function() + { + this.ssCurrentDelay = $('linSsDelay').options[ $('linSsDelay').selectedIndex ].value * 1000; + //document.optionsForm.delay.options[document.optionsForm.delay.selectedIndex].value * 1000; + }, + slideshowChangeLoop: function() + { + if(! this.ssLoop) { + this.ssLoop = true; + Element.setOpacity('linSsImgLoop',0.7); + } else { + this.ssLoop = false; + Element.setOpacity('linSsImgLoop',1); + } + }, + slideshowChangeRandom: function() + { + if(! this.ssRandom) { + this.ssRandom = true; + Element.setOpacity('linSsImgRandom',0.7); + } else { + this.ssRandom = false; + Element.setOpacity('linSsImgRandom',1); + } + alert('This feature is currently not implemented, do we really need that?'); + }, + + + // ----------------------------------------------------------------------------------- + // Image info functions + // ----------------------------------------------------------------------------------- + + /** + * setImageInfoLink() + * + * positions the info link on bottom right of the image + * could only be done after image is not hidden anymore + * + * if this can be done without javascript, please tell me + */ + setImageInfoLink: function() + { + $('linDivInfoLink').style.top = ($('linImgMainimage').offsetTop + $('linImgMainimage').offsetHeight + 3) + 'px'; + $('linDivInfoLink').style.left = ($('linImgMainimage').offsetLeft + $('linImgMainimage').offsetWidth - 200) + 'px'; // 200: width of linDivInfoLink, value set view_img.css width = 200px; can't get width with javascript because element is hidden + Element.show('linDivInfoLink'); + }, + + /** + * DEPRECATED + * showImgInfo() + * + * fade out the image, show the meta infos, sets the color of the "Info" link to another + * + * idea: + * swap the colors of <a> and <div> tag (id 'linHrefInfoLink' and 'linDivInfoLink' + * so it is possible to set the colors in the css template (and not in javascript file) + + showImgInfo: function() + { + // make visible/invisible + if( this.imgInfoShowHide == 'hide' ) + { + this.imgInfoShowHide = 'show'; + + // set position + $('linDivMetaOuter').style.top = $('linImgMainimage').offsetTop + 'px'; + $('linDivMetaOuter').style.height = $('linImgMainimage').offsetHeight + 'px'; + + new Effect.Appear('linDivMetaOuter', { duration: 0.3 }); //, from: 0.0, to: 1.0 + new Effect.Fade('linDivMainimage', { duration: 0.3, from: 1.0, to: 0.2 }); + + $('linHrefInfoLink').style.color = this.imgInfoColorNotActive; + } + else + { + this.imgInfoShowHide = 'hide'; + + new Effect.Fade('linDivMetaOuter', { duration: 0.3 }); // , from: 1.0, to: 0.0 + new Effect.Appear('linDivMainimage', { duration: 0.3, from: 0.2, to: 1.0 }); + + $('linHrefInfoLink').style.color = this.imgInfoColorActive; + } + },*/ + hideImgInfoNow: function() + { + //Element.hide('linDivMetaOuter'); + Element.hide('linHrefPanoLink'); + Element.hide('linDivVideoLink'); + + //Element.setOpacity('linDivMainimage',1); + this.imgInfoShowHide = 'hide'; + + //$('linHrefInfoLink').style.color = this.imgInfoColorActive; + }, + + /** + * returns an array(width, height) with the correct size to fit + * in dst_w and dst_h + */ + scaleToFit: function(src_w,src_h,dst_w,dst_h,no_increase) + { + if(src_h == 0 || src_w == 0) + { + return new Array(0, 0); + } + + var img_relation = src_w / src_h; + + // Image is smaller than screen, no resize required + if ((src_w <= dst_w) && (src_h <= dst_h) && no_increase) + { + var returnarray = new Array( Math.round(src_w), Math.round(src_h) ); + } + else + { + /* + The image is way bigger than the screen, resize maintaining aspect ratio + + $src_w, $src_h: original image sizes + $dst_w, $dst_h: screen width and height + $img_relation = $src_w/$src_h; + + Either $dst_w decisive or $dst_h, usually $dst_h + */ + + var tmp_height = dst_w / img_relation; // calc the new height with screen width + if (tmp_height > dst_h) // we were wrong, it's still widther than screen -> $dst_h is decisive + { + var returnarray = new Array( Math.round(img_relation*dst_h), Math.round(dst_h) ); + } + else + { + var returnarray = new Array( Math.round(dst_w), Math.round(tmp_height) ); + } + } + + return returnarray; + }, + + + // ----------------------------------------------------------------------------------- + // Comments + // ----------------------------------------------------------------------------------- + + setComments: function() + { + $('linDivComments').innerHTML = ''; + + if(this.xmlDoc[IdCurrent].getElementsByTagName('comment').length > 0) + { + for(var i = 0; i < this.xmlDoc[IdCurrent].getElementsByTagName('comment').length; i++) + { + var tagcomment = this.xmlDoc[IdCurrent].getElementsByTagName('comment').item(i); + var commenttime = document.createTextNode( tagcomment.getElementsByTagName('time').item(0).firstChild.data + ' by ' ); + var commentauthor = document.createTextNode( tagcomment.getElementsByTagName('author').item(0).firstChild.data ); +// var commenttext = document.createTextNode( tagcomment.getElementsByTagName('text').item(0).firstChild.data ); + + var commenttextdiv = Builder.node('div', {id: 'linComment'+i}); + + $('linDivComments').appendChild(commenttime); + $('linDivComments').appendChild(commentauthor); + $('linDivComments').appendChild( document.createElement("hr") ); + $('linDivComments').appendChild(commenttextdiv); + $('linDivComments').appendChild( document.createElement("br") ); + $('linDivComments').appendChild( document.createElement("br") ); + + $('linComment'+i).innerHTML = tagcomment.getElementsByTagName('text').item(0).firstChild.data; + } + } + }, + + saveComment: function(t) + { + // not use 'this.' doesnt work if call from ajax success function + + myLinImage.xmlDoc[IdCurrent] = t.responseXML.documentElement; + + if(myLinImage.xmlDoc[IdCurrent].getElementsByTagName('commentadded').length > 0) + { + myLinImage.initTextareaAddComment(); + myLinGlobal.linSyslog( myLinImage.xmlDoc[IdCurrent].getElementsByTagName('commentadded').item(0).firstChild.data ); + } + + //myLinImage.loadImage(IdCurrent); + myLinImage.setComments(); + }, + + /** + * openTextarea() + * + * opens the bigger textarea to enter longer image comments + * this function is defined in view_img_static.html.php too + */ + openTextarea: function() + { + Element.show('linDivAddCommentTextarea'); + Element.hide('linDivAddCommentText'); + + $('linInputAddCommentTextarea').value = $('linInputAddCommentText').value; + }, + + initTextareaAddComment: function() + { + Element.hide('linDivAddCommentTextarea'); + Element.show('linDivAddCommentText'); + + $('linInputAddCommentTextarea').value = ''; + $('linInputAddCommentText').value = ''; + }, + + + // ----------------------------------------------------------------------------------- + // Meta functions + // ----------------------------------------------------------------------------------- + + updateLinId: function(elemId) + { + elemId.href = elemId.href.replace( /linId=[0-9]*/g , "linId=" + IdCurrent ); + } + + + // ----------------------------------------------------------------------------------- + // Common used functions + // ----------------------------------------------------------------------------------- + + /** + * resizeWindow, use this wrapper function because internet explorer triggers the resize event to fast + */ + /*resizeWindow: function () + { + clearTimeout(this.timerResize); + this.timerResize = setTimeout(linImageWrapper,250); + }*/ +} + +/** + * linImageWrapper() + * + * use this wrapper function if called from setTimeout() + * because 'this.' would not work otherwise + */ +function linOnResizeWrapper() +{ + if(myLinImage.fullscreenActive) + { + /** + * delete preloaded images after starting fullscreen and resizing window + */ + myLinImage.finishedPreloadedImages = new Array(); + + myLinGlobal.setWindowSize(); + maxImageWidth = myLinGlobal.linInnerWidth - 70; + maxImageHeight = myLinGlobal.linInnerHeight - 120; + + myLinImage.loadImage( IdCurrent ); + } + else + { + myLinImage.setImageInfoLink(); + // myLinGlobal.setMainHeight(); + } +} + +/** + * init on finished page load + */ +function initLinImage() +{ + $('linDivMainimage').style.height = startImgHeight + 'px'; // initial sets correct height at begin and not after the image is loaded + myLinImage = new LinImage(); + + /** + * doing something very important! + * rebuild the browsers histroy back, forware and reload functions + * if we have a #idCurrent=xyz in the url use this as the id + */ + if( document.location.hash.indexOf('idCurrent') != -1 ) + { + IdCurrent = document.location.hash.substr(11); + } + + /** + * and again something important + * rebuild the browsers histroy back, forware and reload functions + * periodically check if the url has changed + * if so, load the new id + */ + myLinImage.curLocationHash = location.hash; + window.setInterval(function() + { + if (myLinImage.curLocationHash != location.hash) + { + if( document.location.hash.substr(11) != '' ) + { + IdCurrent = document.location.hash.substr(11); + + } + else // location.hash contains no '#idCurrent', we're back on start + { + IdCurrent = startIdCurrent; + } + + myLinImage.loadImage(IdCurrent); + } + }, 1000); + + + /** + * append the slideshow divs to the body + * we need to append to body to be sure to get the real fullscreen + * even if we are locked in another div + */ + var objBody = document.getElementsByTagName("body").item(0); + objBody.appendChild( Builder.node('div', {id: "linDivSlideshowOverlay", style: "display: none;"}) ); + objBody.appendChild( Builder.node('div', {id: "linDivSlideshowImage", style: "display: none;"}) ); + objBody.appendChild( Builder.node('div', {id: "linDivSlideshowControlsOuter", style: "display: none;"}) ); + + $('linDivSlideshowControlsOuter').innerHTML = linSlideshowHtml; + + + // automatically start slideshow if requested (coming from thumbview) + if( document.location.search.indexOf('slideshow') != -1 ) + { + myLinImage.fullscreenStart(); + } + else + { + myLinImage.loadImage(IdCurrent); + // setMainHeight(); // defined in LinGlobal.js + // window.onresize = onWindowResize; + // Event.observe(window, 'resize', onWindowResize, false); + Event.observe(window, 'resize', linOnResizeCreateTrigger, false); + } +} + +Event.observe(window, 'load', initLinImage, false); + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-07 20:16:26
|
Revision: 4898 http://linpha.svn.sourceforge.net/linpha/?rev=4898&view=rev Author: fangehrn Date: 2008-03-07 12:16:10 -0800 (Fri, 07 Mar 2008) Log Message: ----------- 2008-03-07 flo * started using YUI tabview (oh this was easy) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/js/LinGlobal.js trunk/linpha2/lib/js/LinImage.js trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/view_img.head.php trunk/linpha2/templates/default/view_img.html.php Added Paths: ----------- trunk/linpha2/templates/default/static.view_img.html.php trunk/linpha2/templates/default/static.view_thumb.html.php Removed Paths: ------------- trunk/linpha2/templates/default/view_img_static.html.php trunk/linpha2/templates/default/view_thumb_static.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/ChangeLog 2008-03-07 20:16:10 UTC (rev 4898) @@ -1,5 +1,6 @@ 2008-03-07 flo + * started using YUI tabview (oh this was easy) * fixed some bugs * implemented dynamic menu reload * added static login form (for non javascript browsers) Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/index.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -71,7 +71,10 @@ case 'geodata': require_once(LINPHA_DIR.'/lib/modules/module.geodata.php'); break; -case 'empty': +case 'viewer': + require_once(LINPHA_DIR.'/lib/modules/module.viewer.php'); + break; + case 'empty': require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); break; Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -686,7 +686,7 @@ } else { - $GLOBALS['linpha']->template->setModuleName('view_thumb_static'); + $GLOBALS['linpha']->template->setModuleName('static.view_thumb'); $GLOBALS['linpha']->template->overrideModule('css','view_thumb'); $this->viewThumbNojs(); @@ -1149,7 +1149,7 @@ } else { - $GLOBALS['linpha']->template->setModuleName('view_img_static'); + $GLOBALS['linpha']->template->setModuleName('static.view_img'); $GLOBALS['linpha']->template->overrideModule('css','view_img'); } } @@ -1401,7 +1401,7 @@ */ function viewMeta() { - $GLOBALS['linpha']->template->setModuleName('view_img_static'); + $GLOBALS['linpha']->template->setModuleName('static.view_img'); $GLOBALS['linpha']->template->overrideModule('css','view_img'); $this->src_file = LinSql::getFullImagePath( $GLOBALS['linpha']->template->idCurrent ); Modified: trunk/linpha2/lib/js/LinGlobal.js =================================================================== --- trunk/linpha2/lib/js/LinGlobal.js 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/lib/js/LinGlobal.js 2008-03-07 20:16:10 UTC (rev 4898) @@ -100,7 +100,7 @@ // Handle 404 on404: function(t) { - alert('Error 404: location "' + t.statusText + '" was not found.'); + alert('Error 404: ' + t.statusText); }, // Handle other errors onFailure: function(t) { @@ -203,7 +203,7 @@ /** * menu tab functions - */ + openTab: function( className, tabNr ) { divElems = document.getElementsByTagName('div'); for(i = 0, n = 0; i < divElems.length; i++) @@ -233,7 +233,7 @@ //this.tabs[ className ][ tabNr ] = ''; //this.tabs.className.tabNr = ''; $(elemAId).style.color = ''; - }, + },*/ /** * popup functions Modified: trunk/linpha2/lib/js/LinImage.js =================================================================== --- trunk/linpha2/lib/js/LinImage.js 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/lib/js/LinImage.js 2008-03-07 20:16:10 UTC (rev 4898) @@ -465,7 +465,7 @@ case '1': // image this.setImageInfoLink(); // show the "info" link, must be called after Appear('linImgMainimage') - Element.hide('linDivVideoLink'); + //Element.hide('linDivVideoLink'); //Element.show('linDivExifLink'); //$('linAMetaExif').href = '#' + $('linAMetaExif').href; //myLinGlobal.enableTab( 'linDivTab', 3, 'linAMetaExif' ); @@ -473,7 +473,7 @@ break; case '2': // video - Element.show('linDivVideoLink'); + //Element.show('linDivVideoLink'); //Element.hide('linDivExifLink'); //$('linAMetaExif').href = $('linAMetaExif').href.substring(1); //$('linAMetaExif').href = '#' + $('linAMetaExif').href; @@ -903,19 +903,15 @@ * idea: * swap the colors of <a> and <div> tag (id 'linHrefInfoLink' and 'linDivInfoLink' * so it is possible to set the colors in the css template (and not in javascript file) - */ + showImgInfo: function() { - /** - * make visible/invisible - */ + // make visible/invisible if( this.imgInfoShowHide == 'hide' ) { this.imgInfoShowHide = 'show'; - /** - * set position - */ + // set position $('linDivMetaOuter').style.top = $('linImgMainimage').offsetTop + 'px'; $('linDivMetaOuter').style.height = $('linImgMainimage').offsetHeight + 'px'; @@ -933,12 +929,14 @@ $('linHrefInfoLink').style.color = this.imgInfoColorActive; } - }, + },*/ hideImgInfoNow: function() { //Element.hide('linDivMetaOuter'); Element.hide('linHrefPanoLink'); - Element.setOpacity('linDivMainimage',1); + Element.hide('linDivVideoLink'); + + //Element.setOpacity('linDivMainimage',1); this.imgInfoShowHide = 'hide'; //$('linHrefInfoLink').style.color = this.imgInfoColorActive; Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/templates/default/global.html.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -56,7 +56,7 @@ <?php $linTpl->includeFile('body'); ?> -<?php echo microtime(true)-$GLOBALS['linStartTime']; ?> +<?php /*echo microtime(true)-$GLOBALS['linStartTime'];*/ ?> </body> </html> <?php Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/templates/default/menu.html.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -124,6 +124,10 @@ reset($linTpl->menuFinal); for($i=1; list($key, $menuEntry) = each($linTpl->menuFinal); $i++) { + if ($key=='more') { + continue; // static mode hasn't a 'more' menu + } + if (isset( $menu[$key.'_img'] )) { echo '<a href="'.$menuEntry['link'].'" class="linAIconMenu">'.$menu[$key.'_img'].' '.'</a>'; // icons } else { Copied: trunk/linpha2/templates/default/static.view_img.html.php (from rev 4895, trunk/linpha2/templates/default/view_img_static.html.php) =================================================================== --- trunk/linpha2/templates/default/static.view_img.html.php (rev 0) +++ trunk/linpha2/templates/default/static.view_img.html.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -0,0 +1,107 @@ + +<!-- navigation --> +<?php if(isset($linTpl->output['navigation']) && !empty($linTpl->output['navigation'])) { ?> + <?php echo $linTpl->divRoundCorners('top','main'); ?> + + <div id="linDivNavigation"> + <?php echo $linTpl->output['navigation']; ?> + </div> + + <?php echo $linTpl->divRoundCorners('bottom','main'); ?> +<?php } ?> + +<!-- thumbnails --> +<?php echo $linTpl->divRoundCorners('top','main'); ?> + + <div id="linDivThumbnavi"> + <div id="linDivThumbnavi_Prev"> + <?php echo $linTpl->output['prev_thumb']; ?> + </div> + <div id="linDivThumbnavi_Current"> + <?php echo $linTpl->output['current_thumb']; ?> + </div> + <div id="linDivThumbnavi_Next"> + <?php echo $linTpl->output['next_thumb']; ?> + </div> + </div> + +<?php echo $linTpl->divRoundCorners('bottom','main'); ?> + +<?php echo $linTpl->divRoundCorners('top','main'); ?> + <div id="linDivMain"> + <?php if($_SESSION['mode_imageview']=='meta') { ?> + <!-- edit meta data - include view_meta.html --> + <a href="<?php echo $linTpl->URL_full.'&view=img'; ?>"><?php echo i18n("<< Back To Default View");?></a> + <br /><br /> + <h1 class="linStyle"><?php echo i18n("Edit Image Imformation")?></h1> + <?php LinMetaData::showEditMetaData(); + } else { ?> + + <!-- show image --> + <div id="linDivMainimage"> + <img id="linImgMainimage" width="<?php echo $GLOBALS['linpha']->imgview->img_width; ?>" height="<?php echo $GLOBALS['linpha']->imgview->img_height; + ?>" src="<?php echo LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent. + '&max_width='.$GLOBALS['linpha']->imgview->img_width.'&max_height='.$GLOBALS['linpha']->imgview->img_height; ?>" /> + </div> + <br /><br /> + + <!-- comments --> + <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> + <!-- show add comment form --> + <div id="linDivAddComment"> + <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> + <?php echo i18n("Add Comment"); ?>:<br /> + <div id="linDivAddCommentText"> + <input type="text" id="linInputAddCommentText" class="linForms" name="inputAddCommentText" value="" tabindex="1" style="width: 300px" /> + <a href="javascript:linOpenTextarea()">(+)</a> + </div> + <div id="linDivAddCommentTextarea" style="display: none;"> + <textarea id="linInputAddCommentTextarea" class="linForms" name="inputAddCommentTextarea" tabindex="1" rows="10" style="width: 300px"></textarea> + </div> + + <?php echo i18n("Name"); ?>: <input type="text" class="linForms" name="inputAddCommentAuthor" value="" tabindex="2" size="10" style="width: 100px" maxlength="255" /> + + <input type="hidden" name="cmd" value="add_comment" /> + <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Submit"); ?>" tabindex="2" /> + </form> + </div> + <script language="JavaScript" type="text/javascript"> + function linOpenTextarea() + { + document.getElementById('linInputAddCommentTextarea').style.display = 'block'; + document.getElementById('linDivAddCommentText').style.display = 'none'; + + document.getElementById('linInputAddCommentTextarea').value = document.getElementById('linInputAddCommentText').value; + } + </script> + + <br /><br /> + <?php } /* end if checkPermission('metadata_comments') */ ?> + + <!-- show image comments --> + <div id="linDivComments"> + <?php while($data = $linTpl->output['image_comments']->FetchRow()) { ?> + <?php echo linStrftime($data['meta_time']).' '.i18n("by").' '.htmlspecialchars($data['meta_author'],ENT_QUOTES); ?> + <hr /> + <?php echo linHtmlTag($data['meta_comment'],ENT_QUOTES); ?> + <br /><br /> + <?php } ?> + </div> + + <?php } /* end if view!=meta */ ?> + </div> + +<?php echo $linTpl->divRoundCorners('top','bottom'); ?> + +<?php echo $linTpl->divRoundCorners('top','main'); ?> + <div id="linDivMetaStatic"> + <table id="linTableMeta"> + <?php + foreach($linTpl->output['image_infos'] AS $value) + { + echo '<tr><td class="linTdMetaLeftColumn">'.$value['name'].'</strong></td><td>'.$value['value'].'</td></tr>'; + } + ?> + </table> + </div> +<?php echo $linTpl->divRoundCorners('botom','main'); ?> \ No newline at end of file Copied: trunk/linpha2/templates/default/static.view_thumb.html.php (from rev 4895, trunk/linpha2/templates/default/view_thumb_static.html.php) =================================================================== --- trunk/linpha2/templates/default/static.view_thumb.html.php (rev 0) +++ trunk/linpha2/templates/default/static.view_thumb.html.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -0,0 +1,52 @@ + +<!-- navigation --> +<?php if(isset($linTpl->output['navigation']) && !empty($linTpl->output['navigation'])) { ?> + <?php echo $linTpl->divRoundCorners('top','main'); ?> + + <div id="linDivNavigation"> + <?php echo $linTpl->output['navigation']; ?> + </div> + + <?php echo $linTpl->divRoundCorners('bottom','main'); ?> +<?php } ?> + +<!-- main --> +<?php echo $linTpl->divRoundCorners('top','main'); ?> + + <div id="linDivPagenrOuter"> + <div id="linDivPagenr"> + <div id="linDivPagenrLeft" class="linDivPagenrAll"><?php echo $linTpl->output['page_nr_left']; ?></div> + <div id="linDivPagenrMiddle" class="linDivPagenrAll linDivPagenrMiddle"><?php echo $linTpl->output['page_nr']; ?></div> + <div id="linDivPagenrRight" class="linDivPagenrAll"><?php echo $linTpl->output['page_nr_right']; ?></div> + </div> + </div> + + <div id="linDivMain"> + + <?php + if( isset($GLOBALS['linpha']->imgview->photos_show)) + { + for($i=1; list($key,$value) = each($GLOBALS['linpha']->imgview->photos_show); $i++) + { + if( ($i-1) % $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols'] == 0) { + echo '<div style="clear: left;"></div>'; // add clear float for line break + } + ?> + + <div class="linDivThumb"> + <?php echo $linTpl->output['thumb_infos'][$value['id']]['before']; ?> + <div class="linDivImg"> + <a href="<?php echo $linTpl->URL_base.'&linId='.$value['id']; ?>"> + <img src="<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='.$value['id']; ?>" width="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" height="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" alt="<?php echo $linTpl->output['thumb_infos'][$value['id']]['title']; ?>" title="<?php echo $linTpl->output['thumb_infos'][$value['id']]['title']; ?>" class="linImgThumb" /></a> + </div> + <div class="linDivText"><?php echo $linTpl->output['thumb_infos'][$value['id']]['after']; ?></div> + </div> + <?php + } + } + ?> + + </div> + <div style="clear: both;"></div> + +<?php echo $linTpl->divRoundCorners('bottom','main'); ?> Modified: trunk/linpha2/templates/default/view_img.head.php =================================================================== --- trunk/linpha2/templates/default/view_img.head.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/templates/default/view_img.head.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -22,3 +22,18 @@ <script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinImage.js"> </script> + + +<!-- YUI Dependencies --> +<!-- Sam Skin CSS for TabView --> +<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.0/build/tabview/assets/skins/sam/tabview.css"> + +<!-- JavaScript Dependencies for Tabview: --> +<script type="text/javascript" src="http://yui.yahooapis.com/2.5.0/build/yahoo-dom-event/yahoo-dom-event.js"></script> +<script type="text/javascript" src="http://yui.yahooapis.com/2.5.0/build/element/element-beta-min.js"></script> + +<!-- OPTIONAL: Connection (required for dynamic loading of data) --> +<script type="text/javascript" src="http://yui.yahooapis.com/2.5.0/build/connection/connection-min.js"></script> + +<!-- Source file for TabView --> +<script type="text/javascript" src="http://yui.yahooapis.com/2.5.0/build/tabview/tabview-min.js"></script> Modified: trunk/linpha2/templates/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/default/view_img.html.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/templates/default/view_img.html.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -23,7 +23,7 @@ <!-- main --> <?php echo $linTpl->divRoundCorners('top','main'); ?> - <div id="linDivMain"> + <div id="linDivMain" class="yui-skin-sam"> <div id="linDivloading"> <img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/loading.gif"> </div> @@ -37,72 +37,157 @@ <div id="linDivInfoLink" style="display: none; color: grey;"> <a id="linHrefPanoLink" href="<?php echo LINPHA_LINK.'linCat=panorama&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank" style="color: black;"><?php echo i18n("Panorama"); ?></a> + <div id="linDivVideoLink"> + <a href="<?php echo LINPHA_LINK.'linCat=video&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Play Video"); ?></a> + <a href="<?php echo LINPHA_LINK.'linCat=download&linId='.$linTpl->idCurrent; ?>&isDownload=true" onclick="javascript:myLinImage.updateLinId(this)"><?php echo i18n("Download Video"); ?></a> + </div> <?php /*<a id="linHrefInfoLink" href="javascript:myLinImage.showImgInfo()" style="color: black;">Info</a>*/ ?> </div> <br /><br /> - - <div id="linDivTabs"> - <a href="javascript:myLinGlobal.openTab('linDivTab',0)">Comments</a> | - <a href="javascript:myLinGlobal.openTab('linDivTab',1)">Rating</a> | - <a href="javascript:myLinGlobal.openTab('linDivTab',2)">Info</a> | - <a id="linAMetaExif" href="javascript:myLinGlobal.openTab('linDivTab',3)">EXIF</a> - <br /><br /> - - <div class="linDivTab"> - <!-- comments --> - <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> - <!-- show add comment form --> - <div id="linDivAddComment"> - <form action="" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinImage.saveComment); return false;"> - <?php echo i18n("Add Comment"); ?>:<br /> - <div id="linDivAddCommentText"> - <input type="text" id="linInputAddCommentText" class="linForms" name="inputAddCommentText" value="" tabindex="1" style="width: 300px" /> - <a href="javascript:myLinImage.openTextarea()">(+)</a> - </div> - <div id="linDivAddCommentTextarea" style="display: none;"> - <textarea id="linInputAddCommentTextarea" class="linForms" name="inputAddCommentTextarea" tabindex="1" rows="10" style="width: 300px"></textarea> - </div> - <?php echo i18n("Name"); ?>: <input type="text" class="linForms" name="inputAddCommentAuthor" value="" tabindex="2" size="10" style="width: 100px" maxlength="255" /> - - <input type="hidden" name="cmd" value="add_comment" /> - <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Submit"); ?>" tabindex="2" /> - </form> - </div> - - <br /> - <?php } /* end if checkPermission('metadata_comments') */ ?> - - <!-- show image comments --> - <div id="linDivComments"></div> - </div> - <div class="linDivTab"> - Rating - </div> - <div class="linDivTab"> - Info - <div id="linDivMeta"></div> + <div id="linDivTabs" class="yui-navset"> + <ul class="yui-nav"> + <li class="selected"><a href=""><em><?php echo i18n("Comments"); ?></em></a></li> + </ul> + <div class="yui-content" style="height: 200px; overflow: auto;"> + <div><p> + <!-- comments --> + <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> + <!-- show add comment form --> + <div id="linDivAddComment"> + <form action="" method="POST" onsubmit="myLinGlobal.AjaxPost(linUrlBase + '&linId=' + IdCurrent + '&xml', Form.serialize(this),myLinImage.saveComment); return false;"> + <?php echo i18n("Add Comment"); ?>:<br /> + <div id="linDivAddCommentText"> + <input type="text" id="linInputAddCommentText" class="linForms" name="inputAddCommentText" value="" tabindex="1" style="width: 300px" /> + <a href="javascript:myLinImage.openTextarea()">(+)</a> + </div> + <div id="linDivAddCommentTextarea" style="display: none;"> + <textarea id="linInputAddCommentTextarea" class="linForms" name="inputAddCommentTextarea" tabindex="1" rows="10" style="width: 300px"></textarea> + </div> + + <?php echo i18n("Name"); ?>: <input type="text" class="linForms" name="inputAddCommentAuthor" value="" tabindex="2" size="10" style="width: 100px" maxlength="255" /> + + <input type="hidden" name="cmd" value="add_comment" /> + <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Submit"); ?>" tabindex="2" /> + </form> + </div> + + <br /> + <?php } /* end if checkPermission('metadata_comments') */ ?> + + <!-- show image comments --> + <div id="linDivComments"></div> + </p></div> + - <div id="linDivVideoLink" class="linDivMetaLinks"> - <a href="<?php echo LINPHA_LINK.'linCat=video&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Play Video"); ?></a> - <br /> - <a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a> - <br /> - <a href="<?php echo LINPHA_LINK.'linCat=download&linId='.$linTpl->idCurrent; ?>&isDownload=true" onclick="javascript:myLinImage.updateLinId(this)"><?php echo i18n("Download Video"); ?></a> - </div> + </div> + </div> - </div> - <div class="linDivTab"> - EXIF - - <div id="linDivExifLink" class="linDivMetaLinks"><a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a></div> - </div> - <script type="text/javascript"> - //myLinGlobal.openTab('linDivTab',0); - </script> - </div> + + <script type="text/javascript"> + var myTabs = new YAHOO.widget.TabView("linDivTabs"); + + myTabs.addTab( new YAHOO.widget.Tab({ + label: '<?php echo i18n("Image Info"); ?>', + content: '<div id="linDivMeta"></div>' + })); + myTabs.addTab( new YAHOO.widget.Tab({ + label: '<?php echo i18n("GPS Info"); ?>', + content: 'GPS' + })); + myTabs.addTab( new YAHOO.widget.Tab({ + label: '<?php echo i18n("EXIF"); ?>', + content: 'EXIF' + })); + myTabs.addTab( new YAHOO.widget.Tab({ + label: '<?php echo i18n("ITPC/XMP"); ?>', + content: 'ITPC/XMP' + })); + + + myTabs.addTab( new YAHOO.widget.Tab({ + label: '<?php echo i18n("Edit Meta Data"); ?>', + content: 'edit' + })); + myTabs.addTab( new YAHOO.widget.Tab({ + label: '<?php echo i18n("Edit ITPC/XMP"); ?>', + content: 'edit' + })); + + + myTabs.addTab( new YAHOO.widget.Tab({ + label: '<?php echo i18n("Video Info"); ?>', + content: '<div id="linDivMeta"></div>' + })); + + /* + <li><a href=""><em><?php echo i18n("Rating"); ?></em></a></li> + <li><a href=""><em><?php echo i18n("Fileinfo"); ?></em></a></li> + <li><a href=""><em><?php echo i18n("GPS Info"); ?></em></a></li> + <li><a href=""><em><?php echo i18n("EXIF"); ?></em></a></li> + <li><a href=""><em><?php echo i18n("IPTC/XMP"); ?></em></a></li> + + <div><p><?php echo i18n("Rating"); ?></p></div> + + <div><p> + <?php echo i18n("Fileinfo"); ?> + <div id="linDivMeta"></div> + + + </p></div> + + <div><p><?php echo i18n("GPS Info"); ?></p></div> + + <div><p> + <?php echo i18n("EXIF"); ?> + <div id="linDivExifLink" class="linDivMetaLinks"><a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a></div> + </p></div> + + <div><p><?php echo i18n("IPTC/XMP"); ?></p></div> + + */ + /*alert( myTabs ); + alert( myTabs.get(0) ); + alert( myTabs.get(0).set('content','hiho') );*/ + //var tab0 = myTabs.get(0); + //alert(tab0); + //tabView.removeTab(tabView.get('activeTab')); + </script> + + + <div id="container"></div> + + <script type="text/javascript"> + /*var tabView = new YAHOO.widget.TabView(); + + tabView.addTab( new YAHOO.widget.Tab({ + label: 'lorem', + content: '<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat.</p>', + active: true + })); + + tabView.addTab( new YAHOO.widget.Tab({ + label: 'ipsum', + content: '<ul><li><a href="#">Lorem ipsum dolor sit amet.</a></li><li><a href="#">Lorem ipsum dolor sit amet.</a></li><li><a href="#">Lorem ipsum dolor sit amet.</a></li><li><a href="#">Lorem ipsum dolor sit amet.</a></li></ul>' + + })); + + tabView.addTab( new YAHOO.widget.Tab({ + label: 'dolor', + content: '<form action="#"><fieldset><legend>Lorem Ipsum</legend><label for="foo"> <input id="foo" name="foo"></label><input type="submit" value="submit"></fieldset></form>' + })); + + tabView.appendTo('container');*/ + + //tabView.removeTab(tabView.get('activeTab')); + //tabView.getTab(0).set('content','hiho'); + //tabView.getTab(0).set('disabled',true); + //tabView.getTab(0).set('contentVisible',false); + + </script> + </div> <?php echo $linTpl->divRoundCorners('bottom','main'); ?> \ No newline at end of file Deleted: trunk/linpha2/templates/default/view_img_static.html.php =================================================================== --- trunk/linpha2/templates/default/view_img_static.html.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/templates/default/view_img_static.html.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -1,107 +0,0 @@ - -<!-- navigation --> -<?php if(isset($linTpl->output['navigation']) && !empty($linTpl->output['navigation'])) { ?> - <?php echo $linTpl->divRoundCorners('top','main'); ?> - - <div id="linDivNavigation"> - <?php echo $linTpl->output['navigation']; ?> - </div> - - <?php echo $linTpl->divRoundCorners('bottom','main'); ?> -<?php } ?> - -<!-- thumbnails --> -<?php echo $linTpl->divRoundCorners('top','main'); ?> - - <div id="linDivThumbnavi"> - <div id="linDivThumbnavi_Prev"> - <?php echo $linTpl->output['prev_thumb']; ?> - </div> - <div id="linDivThumbnavi_Current"> - <?php echo $linTpl->output['current_thumb']; ?> - </div> - <div id="linDivThumbnavi_Next"> - <?php echo $linTpl->output['next_thumb']; ?> - </div> - </div> - -<?php echo $linTpl->divRoundCorners('bottom','main'); ?> - -<?php echo $linTpl->divRoundCorners('top','main'); ?> - <div id="linDivMain"> - <?php if($_SESSION['mode_imageview']=='meta') { ?> - <!-- edit meta data - include view_meta.html --> - <a href="<?php echo $linTpl->URL_full.'&view=img'; ?>"><?php echo i18n("<< Back To Default View");?></a> - <br /><br /> - <h1 class="linStyle"><?php echo i18n("Edit Image Imformation")?></h1> - <?php LinMetaData::showEditMetaData(); - } else { ?> - - <!-- show image --> - <div id="linDivMainimage"> - <img id="linImgMainimage" width="<?php echo $GLOBALS['linpha']->imgview->img_width; ?>" height="<?php echo $GLOBALS['linpha']->imgview->img_height; - ?>" src="<?php echo LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent. - '&max_width='.$GLOBALS['linpha']->imgview->img_width.'&max_height='.$GLOBALS['linpha']->imgview->img_height; ?>" /> - </div> - <br /><br /> - - <!-- comments --> - <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> - <!-- show add comment form --> - <div id="linDivAddComment"> - <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> - <?php echo i18n("Add Comment"); ?>:<br /> - <div id="linDivAddCommentText"> - <input type="text" id="linInputAddCommentText" class="linForms" name="inputAddCommentText" value="" tabindex="1" style="width: 300px" /> - <a href="javascript:linOpenTextarea()">(+)</a> - </div> - <div id="linDivAddCommentTextarea" style="display: none;"> - <textarea id="linInputAddCommentTextarea" class="linForms" name="inputAddCommentTextarea" tabindex="1" rows="10" style="width: 300px"></textarea> - </div> - - <?php echo i18n("Name"); ?>: <input type="text" class="linForms" name="inputAddCommentAuthor" value="" tabindex="2" size="10" style="width: 100px" maxlength="255" /> - - <input type="hidden" name="cmd" value="add_comment" /> - <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Submit"); ?>" tabindex="2" /> - </form> - </div> - <script language="JavaScript" type="text/javascript"> - function linOpenTextarea() - { - document.getElementById('linInputAddCommentTextarea').style.display = 'block'; - document.getElementById('linDivAddCommentText').style.display = 'none'; - - document.getElementById('linInputAddCommentTextarea').value = document.getElementById('linInputAddCommentText').value; - } - </script> - - <br /><br /> - <?php } /* end if checkPermission('metadata_comments') */ ?> - - <!-- show image comments --> - <div id="linDivComments"> - <?php while($data = $linTpl->output['image_comments']->FetchRow()) { ?> - <?php echo linStrftime($data['meta_time']).' '.i18n("by").' '.htmlspecialchars($data['meta_author'],ENT_QUOTES); ?> - <hr /> - <?php echo linHtmlTag($data['meta_comment'],ENT_QUOTES); ?> - <br /><br /> - <?php } ?> - </div> - - <?php } /* end if view!=meta */ ?> - </div> - -<?php echo $linTpl->divRoundCorners('top','bottom'); ?> - -<?php echo $linTpl->divRoundCorners('top','main'); ?> - <div id="linDivMetaStatic"> - <table id="linTableMeta"> - <?php - foreach($linTpl->output['image_infos'] AS $value) - { - echo '<tr><td class="linTdMetaLeftColumn">'.$value['name'].'</strong></td><td>'.$value['value'].'</td></tr>'; - } - ?> - </table> - </div> -<?php echo $linTpl->divRoundCorners('botom','main'); ?> \ No newline at end of file Deleted: trunk/linpha2/templates/default/view_thumb_static.html.php =================================================================== --- trunk/linpha2/templates/default/view_thumb_static.html.php 2008-03-07 15:53:42 UTC (rev 4897) +++ trunk/linpha2/templates/default/view_thumb_static.html.php 2008-03-07 20:16:10 UTC (rev 4898) @@ -1,52 +0,0 @@ - -<!-- navigation --> -<?php if(isset($linTpl->output['navigation']) && !empty($linTpl->output['navigation'])) { ?> - <?php echo $linTpl->divRoundCorners('top','main'); ?> - - <div id="linDivNavigation"> - <?php echo $linTpl->output['navigation']; ?> - </div> - - <?php echo $linTpl->divRoundCorners('bottom','main'); ?> -<?php } ?> - -<!-- main --> -<?php echo $linTpl->divRoundCorners('top','main'); ?> - - <div id="linDivPagenrOuter"> - <div id="linDivPagenr"> - <div id="linDivPagenrLeft" class="linDivPagenrAll"><?php echo $linTpl->output['page_nr_left']; ?></div> - <div id="linDivPagenrMiddle" class="linDivPagenrAll linDivPagenrMiddle"><?php echo $linTpl->output['page_nr']; ?></div> - <div id="linDivPagenrRight" class="linDivPagenrAll"><?php echo $linTpl->output['page_nr_right']; ?></div> - </div> - </div> - - <div id="linDivMain"> - - <?php - if( isset($GLOBALS['linpha']->imgview->photos_show)) - { - for($i=1; list($key,$value) = each($GLOBALS['linpha']->imgview->photos_show); $i++) - { - if( ($i-1) % $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols'] == 0) { - echo '<div style="clear: left;"></div>'; // add clear float for line break - } - ?> - - <div class="linDivThumb"> - <?php echo $linTpl->output['thumb_infos'][$value['id']]['before']; ?> - <div class="linDivImg"> - <a href="<?php echo $linTpl->URL_base.'&linId='.$value['id']; ?>"> - <img src="<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='.$value['id']; ?>" width="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" height="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" alt="<?php echo $linTpl->output['thumb_infos'][$value['id']]['title']; ?>" title="<?php echo $linTpl->output['thumb_infos'][$value['id']]['title']; ?>" class="linImgThumb" /></a> - </div> - <div class="linDivText"><?php echo $linTpl->output['thumb_infos'][$value['id']]['after']; ?></div> - </div> - <?php - } - } - ?> - - </div> - <div style="clear: both;"></div> - -<?php echo $linTpl->divRoundCorners('bottom','main'); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-07 15:53:44
|
Revision: 4897 http://linpha.svn.sourceforge.net/linpha/?rev=4897&view=rev Author: fangehrn Date: 2008-03-07 07:53:42 -0800 (Fri, 07 Mar 2008) Log Message: ----------- 2008-03-07 flo * fixed some bugs * implemented dynamic menu reload Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/js/LinGlobal.js trunk/linpha2/lib/js/LinImage.js trunk/linpha2/lib/plugins/maps/LinMaps.js trunk/linpha2/lib/plugins/maps/class.googlemaps.js trunk/linpha2/templates/default/maps.head.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/view_img.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/ChangeLog 2008-03-07 15:53:42 UTC (rev 4897) @@ -1,5 +1,7 @@ 2008-03-07 flo + * fixed some bugs + * implemented dynamic menu reload * added static login form (for non javascript browsers) 2008-02-25 flo Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -304,7 +304,7 @@ /** * append to "admin - import" entry */ - $GLOBALS['linpha']->template->menu['admin']['import']['value'][] = array( + $GLOBALS['linpha']->template->menu['admin']['import']['link'][] = array( 'name' => i18n("Recreate This Thumbnail"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' ); @@ -383,8 +383,8 @@ if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) { $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['value'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; } if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) @@ -433,17 +433,17 @@ if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][0]['name'] = i18n("Rotate Left"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][0]['value'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; - $GLOBALS['linpha']->template->menu['more']['edit']['value'][1]['name'] = i18n("Rotate Right"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][1]['value'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; + $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['name'] = i18n("Rotate Left"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][0]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; + $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['name'] = i18n("Rotate Right"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][1]['link'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; } if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) { $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['value'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['name'] = i18n("Open Filemanager"); + $GLOBALS['linpha']->template->menu['more']['edit']['link'][2]['link'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; } Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -281,6 +281,14 @@ } if (isset($this->arrayDefaultMenuEntries[$menuEntry])) { + + if ($menuEntry == 'admin' && !$GLOBALS['linpha']->sql->isAdmin()) { + continue; + } + if ($menuEntry == 'settings' && !$GLOBALS['linpha']->sql->isLoggedIn()) { + continue; + } + if ($menuEntry == 'more') { $link = ''; } elseif($menuEntry == 'admin') { @@ -288,6 +296,7 @@ } else { $link = LINPHA_LINK.'&linCat='.$menuEntry; } + $this->menuFinal[ $menuEntry ] = array( 'name' => $this->arrayDefaultMenuEntries[$menuEntry], 'link' => $link Modified: trunk/linpha2/lib/js/LinGlobal.js =================================================================== --- trunk/linpha2/lib/js/LinGlobal.js 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/js/LinGlobal.js 2008-03-07 15:53:42 UTC (rev 4897) @@ -84,7 +84,7 @@ } }, - AjaxPost: function(parameters,successFunction) + AjaxPost: function(url, parameters, successFunction) { var opt = { // Use POST @@ -108,17 +108,17 @@ } } - new Ajax.Request(xmlUrl + '&linId=' + IdCurrent + '&xml', opt); + new Ajax.Request(url, opt); }, - reloadMenu: function() + /*reloadMenu: function() { if( this.menuNeedsUpdating ) { new Ajax.Updater('menu', LINPHA_LINK + '&linCat=ajax&reloadmenu&linId='+IdCurrent, {method: 'get', asynchronous:true, evalScripts:true}); this.menuNeedsUpdating = false; } - }, + },*/ /** * setWindowSize() Modified: trunk/linpha2/lib/js/LinImage.js =================================================================== --- trunk/linpha2/lib/js/LinImage.js 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/js/LinImage.js 2008-03-07 15:53:42 UTC (rev 4897) @@ -67,16 +67,7 @@ }, loadImageXml: function(imgId) { - // http://wiki.script.aculo.us/scriptaculous/show/Ajax.Request - new Ajax.Request( - xmlUrl + '&linId=' + imgId + '&xml', - { - method:'get', - asynchronous:true, - onSuccess:this.loadImageContinue, - onFailure: function(t) { alert('Error ' + t.status + ' -- ' + t.statusText); } - } - ); + myLinGlobal.AjaxPost(linUrlBase + '&linId=' + imgId + '&xml', '', myLinImage.loadImageContinue); }, loadImageContinue: function(t) { Modified: trunk/linpha2/lib/plugins/maps/LinMaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/LinMaps.js 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/plugins/maps/LinMaps.js 2008-03-07 15:53:42 UTC (rev 4897) @@ -20,6 +20,8 @@ this.markersData = false; this.markersObj = new Array(); this.imagesObj = new Array(); + + this.ajaxUrl = linUrlBase + '&linId=' + IdCurrent + '&xml'; }, /** @@ -27,7 +29,7 @@ */ loadMarkers: function() { - myLinGlobal.AjaxPost('cmd=loadMarkers',myLinMaps.showMarkers); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=loadMarkers',myLinMaps.showMarkers); }, showMarkers: function(t) { @@ -102,7 +104,7 @@ deleteMarker: function(markerId) { - myLinGlobal.AjaxPost('cmd=deleteMarker&markerId='+markerId,myLinMaps.deleteMarkerFinish); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=deleteMarker&markerId='+markerId,myLinMaps.deleteMarkerFinish); }, deleteMarkerFinish: function(t) { @@ -135,14 +137,14 @@ assignAlbum: function(markerId,albId) { - myLinGlobal.AjaxPost('cmd=assignAlbum&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbum&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); }, assignAlbumChange: function(markerId,albId) { - myLinGlobal.AjaxPost('cmd=assignAlbumChange&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbumChange&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); }, assignAlbumDelete: function(markerId,albId) { - myLinGlobal.AjaxPost('cmd=assignAlbumDelete&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbumDelete&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish); }, assignAlbumFinish: function(t) { @@ -162,7 +164,7 @@ loadAlbums: function() { - myLinGlobal.AjaxPost('cmd=loadAlbums',myLinMaps.showAlbums); + myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=loadAlbums',myLinMaps.showAlbums); }, showAlbums: function(t) { @@ -192,7 +194,7 @@ this.toggleNav(); } - myLinGlobal.AjaxPost('cmd=loadImages&albId='+albId,myLinMaps.showImages); + myLinGlobal.AjaxPost(this.ajaxUrl, 'cmd=loadImages&albId='+albId,myLinMaps.showImages); }, showImages: function(t) Modified: trunk/linpha2/lib/plugins/maps/class.googlemaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2008-03-07 15:53:42 UTC (rev 4897) @@ -27,7 +27,7 @@ var mapDefaultZoom = 4; var mapDefaultLat = 49.9801; var mapDefaultLng = 10.8731; - + geocoder = new GClientGeocoder(); googlemap = new google.maps.Map2(document.getElementById("linDivMapObject")); @@ -179,7 +179,7 @@ inputForm.setAttribute("action",""); inputForm.setAttribute("method","POST"); inputForm.setAttribute("id","linFormEditMarker"); - inputForm.onsubmit = function() {myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;}; + inputForm.onsubmit = function() {myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, Form.serialize(this),myLinMaps.saveMarker); return false;}; inputForm.innerHTML = $('linDivEditMarker').innerHTML; myLinMaps.editMarker.bindInfoWindow( inputForm ); // The marker.bindInfoWindow*() methods create GEvent listeners that perform the corresponding marker.openInfoWindow*() calls when the marker is clicked. Modified: trunk/linpha2/templates/default/maps.head.php =================================================================== --- trunk/linpha2/templates/default/maps.head.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/templates/default/maps.head.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -1,6 +1,5 @@ <script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=effects,builder,dragdrop"></script> <script language="JavaScript" type="text/javascript"> -var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; var thumbSrc = '<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='; ?>'; var maxImageWidth = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; ?>; Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/templates/default/menu.html.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -9,13 +9,14 @@ var myMenu = <?php linSetMenuJS(); ?>; cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); -function linRedrawMenu() +function linRedrawMenu(t) { - cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); + myMenuReload = eval('(' + t.responseText + ')'); + cmDraw ('linDivMenu', myMenuReload, 'hbr', cmThemePanel); } function linReloadMenu(form_params) { - myLinGlobal.AjaxPost(form_params, linRedrawMenu, LINPHA_CLIENT + '/?linCat=ajax&reloadmenu&linId=' + IdCurrent); + myLinGlobal.AjaxPost(LINPHA_LINK + 'linCat=ajax&reloadmenu&linId=' + IdCurrent, form_params, linRedrawMenu); } --> </script> @@ -33,9 +34,10 @@ $html_login = '<td class="ThemePanelMenuItemLeft"></td><td colspan="2">'; if (linUseAjax()) { - $html_login .= '<form action="" method="POST" onsubmit="new Ajax.Updater(\'linDivMenu\', '. + /*$html_login .= '<form action="" method="POST" onsubmit="new Ajax.Updater(\'linDivMenu\', '. 'LINPHA_CLIENT + \'/?linCat=ajax&reloadmenu&linId=\'+IdCurrent, {method: \'post\', '. - 'asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;">'; + 'asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;">';*/ + $html_login .= '<form action="" method="POST" onsubmit="linReloadMenu(Form.serialize(this)); return false;">'; } else { $html_login .= '<form action="'.$linTpl->URL_full.'" method="POST">'; } Modified: trunk/linpha2/templates/default/view_img.head.php =================================================================== --- trunk/linpha2/templates/default/view_img.head.php 2008-03-07 15:11:53 UTC (rev 4896) +++ trunk/linpha2/templates/default/view_img.head.php 2008-03-07 15:53:42 UTC (rev 4897) @@ -1,6 +1,5 @@ <script language="JavaScript" type="text/javascript"> -var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; var thumbSrc = '<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='; ?>'; var maxImageWidth = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; ?>; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-03-07 15:12:02
|
Revision: 4896 http://linpha.svn.sourceforge.net/linpha/?rev=4896&view=rev Author: fangehrn Date: 2008-03-07 07:11:53 -0800 (Fri, 07 Mar 2008) Log Message: ----------- 2008-03-07 flo * added static login form (for non javascript browsers) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/modules/module.empty.php trunk/linpha2/templates/default/default.html.php trunk/linpha2/templates/default/menu.html.php Added Paths: ----------- trunk/linpha2/lib/modules/module.login.php trunk/linpha2/templates/default/static.login.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-25 23:07:07 UTC (rev 4895) +++ trunk/linpha2/ChangeLog 2008-03-07 15:11:53 UTC (rev 4896) @@ -1,4 +1,7 @@ +2008-03-07 flo + * added static login form (for non javascript browsers) + 2008-02-25 flo * fixed login menu * fixed some menu related bugs Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-02-25 23:07:07 UTC (rev 4895) +++ trunk/linpha2/index.php 2008-03-07 15:11:53 UTC (rev 4896) @@ -35,6 +35,9 @@ case 'alb': require_once(LINPHA_DIR.'/lib/modules/module.albums.php'); break; +case 'login': + require_once(LINPHA_DIR.'/lib/modules/module.login.php'); + break; case 'search': require_once(LINPHA_DIR.'/lib/modules/module.search.php'); break; Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-25 23:07:07 UTC (rev 4895) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-03-07 15:11:53 UTC (rev 4896) @@ -296,7 +296,7 @@ */ if( isset($_POST['cmd']) ) { - if($_POST['cmd']=='logout') + if($_POST['cmd']=='logout' && isset($_SESSION['user_name'])) // check for $_SESSION['user_name'] if the user reloads the page after logout { linLog(LOG_TYPE_USER,LOG_NOTICE,'logout','User '.$_SESSION['user_name'].': logged out'); Modified: trunk/linpha2/lib/modules/module.empty.php =================================================================== --- trunk/linpha2/lib/modules/module.empty.php 2008-02-25 23:07:07 UTC (rev 4895) +++ trunk/linpha2/lib/modules/module.empty.php 2008-03-07 15:11:53 UTC (rev 4896) @@ -25,37 +25,8 @@ if(!defined('LINPHA_DIR')) { exit(1); } -echo $_SERVER['PHP_SELF'].'<br />'; +$linpha->template->output['default'] = '<br />'; - -if( isset($_SERVER['PATH_INFO']) ) -{ - echo $_SERVER['PATH_INFO'].'<br />'; - - $name = substr($_SERVER['PATH_INFO'],1); - echo $name.'<br />'; - - $id = LinSql::getIdFromFullFilename($name); - - - echo '<br /><br /><br />'; - - if($id === false) - { - echo 'false!'; - } - else - { - echo 'not false!<br />'; - echo $id.'<br />'; - } -} - - -exit(); - -$linpha->template->output['default'] = ''; - $linpha->template->setModuleName('default'); $linpha->template->URL_full = LINPHA_LINK.'&linCat=empty'; $linpha->template->output['title'] = i18n("empty"); Added: trunk/linpha2/lib/modules/module.login.php =================================================================== --- trunk/linpha2/lib/modules/module.login.php (rev 0) +++ trunk/linpha2/lib/modules/module.login.php 2008-03-07 15:11:53 UTC (rev 4896) @@ -0,0 +1,33 @@ +<?php +/* + * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> + * Florian Angehrn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/** + * Filemanager + * @package Modules + */ + +if(!defined('LINPHA_DIR')) { exit(1); } + +$linpha->template->setModuleName('static.login'); +$linpha->template->URL_full = LINPHA_LINK.'&linCat=login'; +$linpha->template->output['title'] = i18n("Login"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); + +?> \ No newline at end of file Modified: trunk/linpha2/templates/default/default.html.php =================================================================== --- trunk/linpha2/templates/default/default.html.php 2008-02-25 23:07:07 UTC (rev 4895) +++ trunk/linpha2/templates/default/default.html.php 2008-03-07 15:11:53 UTC (rev 4896) @@ -7,4 +7,4 @@ ?> </div> -<?php echo $linTpl->divRoundCorners('top','main'); ?> +<?php echo $linTpl->divRoundCorners('bottom','main'); ?> Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-02-25 23:07:07 UTC (rev 4895) +++ trunk/linpha2/templates/default/menu.html.php 2008-03-07 15:11:53 UTC (rev 4896) @@ -20,7 +20,7 @@ --> </script> <?php -linSetMenuNoJS(); + linSetMenuNoJS(); } function linSetMenuJS() @@ -37,7 +37,7 @@ 'LINPHA_CLIENT + \'/?linCat=ajax&reloadmenu&linId=\'+IdCurrent, {method: \'post\', '. 'asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;">'; } else { - $html_login .= '<form action="'.$this->URL_full.'" method="POST">'; + $html_login .= '<form action="'.$linTpl->URL_full.'" method="POST">'; } if ($GLOBALS['linpha']->sql->isLoggedIn()) { Added: trunk/linpha2/templates/default/static.login.html.php =================================================================== --- trunk/linpha2/templates/default/static.login.html.php (rev 0) +++ trunk/linpha2/templates/default/static.login.html.php 2008-03-07 15:11:53 UTC (rev 4896) @@ -0,0 +1,45 @@ +<?php echo $linTpl->divRoundCorners('top','main'); ?> + <div id="linDivMain"> +<br /><br /> +<form action="<?php echo $linTpl->URL_full; ?>" method="POST"> +<?php +if ($GLOBALS['linpha']->sql->isLoggedIn()) { + echo i18n("Welcome").' '.$_SESSION['user_name'].' ('.$_SESSION['user_displayname'].')'; + ?> + <br /> + <input type="hidden" name="cmd" value="logout" /> + <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Logout"); ?>" /> + <?php + +} else { + ?> + <br /><label for="linFormUsername" style="display: block; float: left; width: 80px;"> + <?php echo i18n("Username"); ?>: </label> + <input style="width: 105px;" class="linForms" type="text" name="username" value="" id="linFormUsername" /> + + <br /><label for="linFormPassword" style="display: block; float: left; width: 80px;"> + <?php echo i18n("Password"); ?>: </label> + <input style="width: 105px;" class="linForms" type="password" name="password" value="" id="linFormPassword" /> + <br /><br /> + + <?php + if ($GLOBALS['linpha']->sql->config->value['sys_session_autologin']) { + ?> + <label for="linFormCheckboxRemember"> + <input type="checkbox" name="rememberme" value="true" id="linFormCheckboxRemember" /> + <?php echo i18n("Remember Me"); ?> + </label> + <?php + } + ?> + + <input type="hidden" name="cmd" value="login" /> + <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Login"); ?>" /><br /><br /> + <div style="font-size: smaller; border: 0px;"><?php echo i18n("You must have cookies enabled to log in."); ?></div> + <?php +} +?> +</form> +<br /><br /> + </div> +<?php echo $linTpl->divRoundCorners('bottom','main'); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: bzrudi <bz...@us...> - 2008-02-27 07:41:59
|
Update of /cvsroot/linpha/linpha/functions In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv23795/functions Modified Files: image.php Log Message: fixed -> Notice: Constant GETID3_HELPERAPPSDIR already defined in create_all_thumbs.php Index: image.php =================================================================== RCS file: /cvsroot/linpha/linpha/functions/image.php,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -d -r1.116 -r1.117 *** image.php 20 Feb 2007 11:54:06 -0000 1.116 --- image.php 27 Feb 2008 07:41:54 -0000 1.117 *************** *** 591,595 **** */ include_once(TOP_DIR.'/plugins/getid3/getid3.php'); ! define('GETID3_HELPERAPPSDIR', TOP_DIR); // needs to be set to a valid dir, otherwise it doesn't work under windows $getID3 = new getID3; $file_info = $getID3->analyze($src_file); --- 591,600 ---- */ include_once(TOP_DIR.'/plugins/getid3/getid3.php'); ! if(!defined('GETID3_HELPERAPPSDIR')) ! { ! // needs to be set to a valid dir, otherwise it doesn't ! // work under windows ! define('GETID3_HELPERAPPSDIR', TOP_DIR); ! } $getID3 = new getID3; $file_info = $getID3->analyze($src_file); |
From: <fan...@us...> - 2008-02-25 23:07:14
|
Revision: 4895 http://linpha.svn.sourceforge.net/linpha/?rev=4895&view=rev Author: fangehrn Date: 2008-02-25 15:07:07 -0800 (Mon, 25 Feb 2008) Log Message: ----------- 2008-02-25 flo * fixed login menu * fixed some menu related bugs reload menu after login does not yet work * added utf-8 database charset for postgres and oracle Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/permissions_readwrite.php trunk/linpha2/admin/settings_plugins.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/modules/module.ajax.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/themes/default/menu/theme.js Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/ChangeLog 2008-02-25 23:07:07 UTC (rev 4895) @@ -1,4 +1,10 @@ +2008-02-25 flo + * fixed login menu + * fixed some menu related bugs + reload menu after login does not yet work + * added utf-8 database charset for postgres and oracle + 2008-02-22 flo * implemented jscookmenu * changed templates with new rounded corners Modified: trunk/linpha2/admin/permissions_readwrite.php =================================================================== --- trunk/linpha2/admin/permissions_readwrite.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/admin/permissions_readwrite.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -232,7 +232,7 @@ <?php -} // end if plugin_filemanager_enable +} // end if plugins_filemanager_enable /** * print the permission entries Modified: trunk/linpha2/admin/settings_plugins.php =================================================================== --- trunk/linpha2/admin/settings_plugins.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/admin/settings_plugins.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -13,7 +13,7 @@ */ if($cat3=='enable' && isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') { - $GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT'] = true; + $GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT'] = true; // disable syslog foreach($arrPlugins as $value) { @@ -86,9 +86,17 @@ } } - } + /** + * add menu entry + */ + if (strpos($GLOBALS['linpha']->sql->config->value['sys_style_menu_list'], 'plugins_'.$value)===false) { + $GLOBALS['linpha']->sql->config->updateConfig('sys_style_menu_list', + $GLOBALS['linpha']->sql->config->value['sys_style_menu_list'].',plugins_'.$value + ); + } + } // end if valid plugin } - } + } // end foreach unset($GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT']); // set plugins_*_enable to '1' Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -138,6 +138,7 @@ $GLOBALS['linpha']->db->Execute("SET character_set_server='utf8'"); break; case "postgres": + $GLOBALS['linpha']->db->charSet = 'UTF-8'; // character set to use - only for interbase, postgres and oci8 (http://phplens.com/adodb/code.initialization.html) if(isset($db_password)) { $GLOBALS['linpha']->db->Connect("host=$db_hostname port=$db_port user=$db_username password=$db_password dbname=$db_name"); @@ -148,6 +149,7 @@ } break; case "oci8po": + $GLOBALS['linpha']->db->charSet = 'UTF-8'; // character set to use - only for interbase, postgres and oci8 (http://phplens.com/adodb/code.initialization.html) $GLOBALS['linpha']->db->PConnect($db_hostname, $db_username, $db_password, $db_name); break; } Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -33,7 +33,7 @@ public $URL_base, $URL_full, $idCurrent; public $hideMenu = false, $hideTitle = false; - public $menu, $menuFinal, $nofMenuEntries = 0; + public $menu = array(), $menuFinal, $nofMenuEntries = 0; public $arrayDefaultMenuEntries; public $bgcolor, $bodybgcolor, $fontcolor, $albumsbgcolor, $linkscolor, $linkshovercolor; @@ -273,7 +273,7 @@ foreach($arrayMenuEntries as $menuEntry) { - if ($menuEntry == 'more' || $menuEntry == 'admin' || $menuEntry == 'settings') + if ($menuEntry == 'more') { if (!isset($this->menu[$menuEntry])) { continue; @@ -281,12 +281,19 @@ } if (isset($this->arrayDefaultMenuEntries[$menuEntry])) { + if ($menuEntry == 'more') { + $link = ''; + } elseif($menuEntry == 'admin') { + $link = LINPHA_CLIENT.'/admin/'; + } else { + $link = LINPHA_LINK.'&linCat='.$menuEntry; + } $this->menuFinal[ $menuEntry ] = array( 'name' => $this->arrayDefaultMenuEntries[$menuEntry], - 'link' => LINPHA_LINK.'&linCat='.$menuEntry + 'link' => $link ); - } elseif ( strpos($menuEntry, 'plugin_') !== false ) { - $menuEntry = substr($menuEntry, 7); + } elseif ( strpos($menuEntry, 'plugins_') !== false ) { + $menuEntry = substr($menuEntry, 8); $this->menuFinal[ $menuEntry ] = array( 'name' => i18n(ucfirst($menuEntry)), // this will not be detected by the language translater, but thats no problem because this plugin name is for sure somewhere else 'link' => LINPHA_LINK.'&linCat='.$menuEntry @@ -344,7 +351,13 @@ foreach ($this->menu as $key=>$arrayMenuEntry) { if (strpos($key,'icon_')===false) { - $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', null, null, null, "."\n"; + if (empty($this->menuFinal[$key]['link'])) { + $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', null, null, null, "."\n"; + } else { + $link = linConvertAmp($this->menuFinal[$key]['link']); + $link = str_replace("'",'\\\'', $link); + $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', '".$link."', null, null, "."\n"; + } $this->createJSCookMenuEntry($key, $arrayMenuEntry); $this->menuJSCook[$key][] = "]"; } Modified: trunk/linpha2/lib/modules/module.ajax.php =================================================================== --- trunk/linpha2/lib/modules/module.ajax.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/lib/modules/module.ajax.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -64,9 +64,11 @@ */ elseif(isset($_GET['reloadmenu'])) { - if( isset($_SESSION['ref_url_base']) ) + if( isset($_SESSION['ref_url_base']) ) { - include_once(LINPHA_DIR . '/lib/classes/linpha.imgview.class.php'); + // call imgview to get menu details + + include_once(LINPHA_DIR . '/lib/classes/linpha.imgview.class.php'); $linpha->imgview = new linImgview(); $linpha->imgview->setCurrentView($_SESSION['ref_modulename']); @@ -79,8 +81,10 @@ else // return a default menu { } - - $linpha->template->printMenus('home,search,login,more,icons,settings,admin',$comingfrom_ajax=true); + + $linTpl->includeFile('menu'); + $linTpl->setMenu(); + linSetMenuJS(); } exit(); // important if linpha is included from another webpage Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/templates/default/global.html.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -49,7 +49,7 @@ <!-- menu --> <?php if (!$linTpl->hideMenu) { ?> <div id="linDivMenu"> - <?php $linTpl->includeFile('menu'); ?> + <?php $linTpl->includeFile('menu'); linDrawMenu(); ?> </div> <!-- end menu --> <?php } ?> Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/templates/default/menu.html.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -1,127 +1,122 @@ <?php -/* +function linDrawMenu() +{ + global $linTpl; + $linTpl->setMenu(); ?> - <ul> - <li><span><?php echo i18n("Search"); ?> </span> - <ul> - <li><a href="<?php echo LINPHA_LINK; ?>&linCat=search"><?php echo i18n("Extended Search"); ?></a></li> - <li> - <div> - <form method="GET" action="<?php echo LINPHA_LINK; ?>&linCat=search"> - <input type="text" class="linForms" name="search_text" value="" /> - <input type="hidden" name="button[meta][all]" value="1" /> - <input type="hidden" name="cmd" value="search" /> - <input type="hidden" name="linCat" value="search" /> - <input type="submit" name="submit" class="linButton linInputMenu" value="<?php echo i18n("Search"); ?>" /> - </form> - </div> - </li> - </ul> - </li> - </ul> - <ul> - <li> - <span><?php echo i18n("Login"); ?> </span> - <ul id="linMenuLogin"> - <li> - <div> - <?php if( linUseAjax() ) { ?> - <form action="" method="POST" onsubmit="new Ajax.Updater('linDivMenu', LINPHA_CLIENT + '/?linCat=ajax&reloadmenu&linId='+IdCurrent, {method: 'post', asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;"> - <?php } else { ?> - <form action="<?php echo $this->URL_full; ?>" method="POST"> - <?php } - if($GLOBALS['linpha']->sql->isLoggedIn()) { ?> - <?php echo i18n("Welcome").' '.$_SESSION['user_name'].' ('.$_SESSION['user_displayname'].')<br />'; ?> - <input type="hidden" name="cmd" value="logout" /> - <input type="submit" name="submit" value="<?php echo i18n("Logout"); ?>" /> - <?php } else { ?> - <!-- login infos --> - <br /> - <label for="linFormUsername" style="display: block; float: left; width: 80px;"><?php echo i18n("Username"); ?>: </label><input style="width: 105px;" class="linForms" type="text" name="username" value="" id="linFormUsername" /><br /> - <label for="linFormPassword" style="display: block; float: left; width: 80px;"><?php echo i18n("Password"); ?>: </label><input style="width: 105px;" class="linForms" type="password" name="password" value="" id="linFormPassword" /><br /> - <?php if($GLOBALS['linpha']->sql->config->value['sys_session_autologin']) { ?><input type="checkbox" name="rememberme" value="true" id="linFormCheckboxRemember" /><label for="linFormCheckboxRemember"><?php echo i18n("Remember Me"); ?></label><?php } ?> - <input type="hidden" name="cmd" value="login" /> - <input type="submit" name="submit" class="linButton linInputMenu" value="<?php echo i18n("Login"); ?>" /><br /><br /> - <div style="font-size: smaller; border: 0px;"><?php echo i18n("You must have cookies enabled to log in."); ?></div> - <?php } ?> - - </form> - </div> - </li> - </ul> - </li> - </ul> - <!-- icons --> - <div> - <?php if( isset( $this->output['menu_Icons'] ) ) { - echo $this->output['menu_Icons']; - } ?> - </div> -<?php -*/ - -$menu['search'] = "['<img src=\"".LINPHA_CLIENT."/lib/graphics/xmag.jpg\" width=\"15\" height=\"15\" />', '".i18n("Search")."', null, null, null," . "\n" . - "[_cmNoClick, '<td class=\"ThemePanelMenuItemLeft\"></td><td colspan=\"2\"><form action=\"\">" . - "<input type=\"text\" size=\"10\" name=\"searchwhat\" value=\"\"/><input type=\"submit\" value=\"search\" /></form></td>']," . "\n" . - "_cmSplit, [null, 'Extended Search', '".LINPHA_LINK."&linCat=search', null, null]" . "\n" . - "]"; -$menu['login'] = "[null, '".i18n("Login")."', null, null, null," . "\n" . - "[_cmNoClick, '<td class=\"ThemePanelMenuItemLeft\"></td><td colspan=\"2\"><form action=\"\">" . - "<input type=\"text\" size=\"10\" name=\"searchwhat\" value=\"\"/><input type=\"submit\" value=\"search\" /></form></td>']," . "\n" . - "_cmSplit, [null, 'Extended Search', '".LINPHA_LINK."&linCat=search', null, null]" . "\n" . - "]"; -$menu['icon_slideshow_img'] = '<img src="'.$linTpl->themeFile("images/slideshow.png").'" alt="" title="'.i18n("Play Slideshow").'" class="linImgMenu" />'; -$menu['icon_download_img'] = '<img src="'.$linTpl->themeFile("images/download.png").'" alt="" title="'.i18n("Download Images").'" class="linImgMenu" />'; -$menu['icon_mail_img'] = '<img src="'.$linTpl->themeFile("images/slideshow.png").'" alt="" title="'.i18n("Mail Images").'" class="linImgMenu" />'; -$menu['icon_print_img'] = '<img src="'.$linTpl->themeFile("images/print.png").'" alt="" title="'.i18n("Print Images").'" class="linImgMenu" />'; - -$linTpl->setMenu(); -$linTpl->createJSCookMenu(); -?> <script type="text/javascript"> <!-- -var myMenu = -[ +var myMenu = <?php linSetMenuJS(); ?>; +cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); + +function linRedrawMenu() +{ + cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); +} +function linReloadMenu(form_params) +{ + myLinGlobal.AjaxPost(form_params, linRedrawMenu, LINPHA_CLIENT + '/?linCat=ajax&reloadmenu&linId=' + IdCurrent); +} +--> +</script> <?php -reset($linTpl->menuFinal); -list($key, $menuEntry) = each($linTpl->menuFinal); -$prevIsIcon = false; -if (isset( $menu[$key] )) { - echo $menu[$key]; -} elseif (isset($linTpl->menuJSCook[$key])) { - echo $linTpl->menuJSCook[$key]; -} elseif (isset( $menu[$key.'_img'] )) { - echo "['".$menu[$key.'_img']."', ' ', '".$menuEntry['link']."', null, null]"; - $prevIsIcon = true; -} else { - echo "[null, '".$menuEntry['name']."', '".$menuEntry['link']."', null, null]"; +linSetMenuNoJS(); } -for($i=1; list($key, $menuEntry) = each($linTpl->menuFinal); $i++) +function linSetMenuJS() { - if (isset( $menu[$key.'_img'] ) && $prevIsIcon) { - echo ','."\n"; + global $linTpl; + $linTpl->createJSCookMenu(); + + $html_search = '<td class="ThemePanelMenuItemLeft"></td><td colspan="2"><form action="">' . + '<input type="text" size="10" name="searchwhat" value="" /><input type="submit" value="'.i18n("search").'" /></form></td>'; + + $html_login = '<td class="ThemePanelMenuItemLeft"></td><td colspan="2">'; + if (linUseAjax()) { + $html_login .= '<form action="" method="POST" onsubmit="new Ajax.Updater(\'linDivMenu\', '. + 'LINPHA_CLIENT + \'/?linCat=ajax&reloadmenu&linId=\'+IdCurrent, {method: \'post\', '. + 'asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;">'; } else { - echo ',_cmSplit,'."\n"; + $html_login .= '<form action="'.$this->URL_full.'" method="POST">'; } + if ($GLOBALS['linpha']->sql->isLoggedIn()) { + $html_login .= i18n("Welcome").' '.$_SESSION['user_name'].' ('.$_SESSION['user_displayname'].')<br />' . + '<input type="hidden" name="cmd" value="logout" />' . + '<input type="submit" name="submit" class="linButton" value="'.i18n("Logout").'" />'; + } else { + $html_login .= '<br /><label for="linFormUsername" style="display: block; float: left; width: 80px;">' . + i18n("Username").': </label><input style="width: 105px;" class="linForms" type="text" name="username" value="" id="linFormUsername" />' . + '<br /><label for="linFormPassword" style="display: block; float: left; width: 80px;">' . + i18n("Password").': </label><input style="width: 105px;" class="linForms" type="password" name="password" value="" id="linFormPassword" />' . + '<br /><br />'; + + if ($GLOBALS['linpha']->sql->config->value['sys_session_autologin']) { + $html_login .= '<label for="linFormCheckboxRemember">' . + '<input type="checkbox" name="rememberme" value="true" id="linFormCheckboxRemember" />' . + i18n("Remember Me").'</label>'; + } + + $html_login .= '<input type="hidden" name="cmd" value="login" />' . + '<input type="submit" name="submit" class="linButton" value="'.i18n("Login").'" /><br /><br />' . + '<div style="font-size: smaller; border: 0px;">'.i18n("You must have cookies enabled to log in.").'</div>'; + } + $html_login .= '</form></td>'; + + $menu['search'] = "['<img src=\"".LINPHA_CLIENT."/lib/graphics/xmag.jpg\" width=\"15\" height=\"15\" />', '".i18n("Search")."', null, null, null," . "\n" . + "[_cmNoClick, '".str_replace("'",'\\\'', $html_search)."']," . "\n" . + "_cmSplit, [null, 'Extended Search', '".LINPHA_LINK."&linCat=search', null, null]" . "\n" . + "]"; + $menu['login'] = "[null, '".i18n("Login")."', null, null, null," . "\n" . + "[_cmNoClick, '".str_replace("'",'\\\'', $html_login)."']" . "\n" . + "]"; + $menu['icon_slideshow_img'] = '<img src="'.$linTpl->themeFile("images/slideshow.png").'" alt="" title="'.i18n("Play Slideshow").'" class="linImgMenu" />'; + $menu['icon_download_img'] = '<img src="'.$linTpl->themeFile("images/download.png").'" alt="" title="'.i18n("Download Images").'" class="linImgMenu" />'; + $menu['icon_mail_img'] = '<img src="'.$linTpl->themeFile("images/slideshow.png").'" alt="" title="'.i18n("Mail Images").'" class="linImgMenu" />'; + $menu['icon_print_img'] = '<img src="'.$linTpl->themeFile("images/print.png").'" alt="" title="'.i18n("Print Images").'" class="linImgMenu" />'; + + echo '['; + reset($linTpl->menuFinal); + list($key, $menuEntry) = each($linTpl->menuFinal); $prevIsIcon = false; if (isset( $menu[$key] )) { echo $menu[$key]; } elseif (isset($linTpl->menuJSCook[$key])) { - echo implode('',$linTpl->menuJSCook[$key]); + echo $linTpl->menuJSCook[$key]; } elseif (isset( $menu[$key.'_img'] )) { echo "['".$menu[$key.'_img']."', ' ', '".$menuEntry['link']."', null, null]"; $prevIsIcon = true; } else { - echo "[null, '".$menuEntry['name']."', '".$menuEntry['link']."', null, null]"; + echo "[null, '".$menuEntry['name']."', '".linConvertAmp($menuEntry['link'])."', null, null]"; } + + for($i=1; list($key, $menuEntry) = each($linTpl->menuFinal); $i++) + { + if (isset( $menu[$key.'_img'] ) && $prevIsIcon) { + echo ','."\n"; + } else { + echo ',_cmSplit,'."\n"; + } + + $prevIsIcon = false; + if (isset( $menu[$key] )) { + echo $menu[$key]; + } elseif (isset($linTpl->menuJSCook[$key])) { + echo implode('',$linTpl->menuJSCook[$key]); + } elseif (isset( $menu[$key.'_img'] )) { + echo "['".$menu[$key.'_img']."', ' ', '".$menuEntry['link']."', null, null]"; + $prevIsIcon = true; + } else { + echo "[null, '".$menuEntry['name']."', '".linConvertAmp($menuEntry['link'])."', null, null]"; + } + } + echo ']'; } + +function linSetMenuNoJS() +{ + global $linTpl; ?> -]; -cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); ---> -</script> <noscript> <?php reset($linTpl->menuFinal); @@ -139,3 +134,6 @@ } ?> </noscript> +<?php +} +?> \ No newline at end of file Modified: trunk/linpha2/templates/default/themes/default/menu/theme.js =================================================================== --- trunk/linpha2/templates/default/themes/default/menu/theme.js 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/templates/default/themes/default/menu/theme.js 2008-02-25 23:07:07 UTC (rev 4895) @@ -58,6 +58,8 @@ // also for the other lvls offsetSubAdjust: [0, -2], + delay: 500, + effect: new CMFadingEffect (8, 4) // rest use default settings This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-02-25 14:55:41
|
Revision: 4894 http://linpha.svn.sourceforge.net/linpha/?rev=4894&view=rev Author: bzrudi Date: 2008-02-25 06:55:38 -0800 (Mon, 25 Feb 2008) Log Message: ----------- PGSQL doesn't like boolean (L) operator, so just make it I(1) to get rid of it. Please note that this creates a TINYINT(4) on MySQL and a INT(2) on PG. However we don't need to take care of it anyway. Modified Paths: -------------- trunk/linpha2/lib/include/sql/sql.tables.php Modified: trunk/linpha2/lib/include/sql/sql.tables.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.tables.php 2008-02-22 09:26:52 UTC (rev 4893) +++ trunk/linpha2/lib/include/sql/sql.tables.php 2008-02-25 14:55:38 UTC (rev 4894) @@ -102,7 +102,7 @@ "option_name C(255) NOTNULL DEFAULT '' UNIQUE INDEX, " . "option_value C(255) NOTNULL DEFAULT '', " . "user_id I DEFAULT 0, " . - "override I DEFAULT 0", + "override I1 DEFAULT 0", LIN_PREFIX.'users' => "id I AUTO KEY, " . @@ -140,11 +140,11 @@ "time_add I(10) DEFAULT 0, " . "time_mod I(10) DEFAULT 0, " . "time_exif I(10) DEFAULT 0, " . - "rotate I DEFAULT 0, " . + "rotate I1 DEFAULT 0, " . "stats_numbers I DEFAULT 0, " . "stats_views I DEFAULT 0, " . "stats_downloads I DEFAULT 0, " . - "geodata I DEFAULT 0", + "geodata I1 DEFAULT 0", LIN_PREFIX.'photos_cache' => "id I AUTO KEY, " . @@ -153,8 +153,8 @@ "img_height I DEFAULT 0, " . "img_quality I DEFAULT 0, " . "img_size I DEFAULT 0, " . - "is_rotated I DEFAULT 0, " . - "has_watermark I DEFAULT 0, " . + "is_rotated I1 DEFAULT 0, " . + "has_watermark I1 DEFAULT 0, " . "time_add I(10) DEFAULT 0, " . "time_use I(10) DEFAULT 0, " . "time_creating I(10) DEFAULT 0, " . @@ -170,7 +170,7 @@ "id I AUTO KEY, " . "field_id I DEFAULT 0, " . "name C(255) NOTNULL, " . - "isprivate L DEFAULT 0", + "isprivate I1 DEFAULT 0", LIN_PREFIX.'meta_exif' => "md5sum C(32) KEY, " . @@ -358,7 +358,7 @@ LIN_PREFIX.'meta_comments' => "id I AUTO KEY, " . "md5sum C(32) NOTNULL INDEX idx_meco_md5, " . - "meta_time I DEFAULT 0, " . + "meta_time I(10) DEFAULT 0, " . "meta_author C(255) DEFAULT '', " . "meta_comment I DEFAULT 0", @@ -369,4 +369,5 @@ "meta_data C(255) DEFAULT ''", ); -?> \ No newline at end of file +/* vi: set ts=4 sw=4 sts=4 */ +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-22 09:27:05
|
Revision: 4893 http://linpha.svn.sourceforge.net/linpha/?rev=4893&view=rev Author: fangehrn Date: 2008-02-22 01:26:52 -0800 (Fri, 22 Feb 2008) Log Message: ----------- Modified Paths: -------------- trunk/misc/design/14cornersSchill/colorsettings.php trunk/misc/design/14cornersSchill/global.css Modified: trunk/misc/design/14cornersSchill/colorsettings.php =================================================================== --- trunk/misc/design/14cornersSchill/colorsettings.php 2008-02-22 09:26:16 UTC (rev 4892) +++ trunk/misc/design/14cornersSchill/colorsettings.php 2008-02-22 09:26:52 UTC (rev 4893) @@ -5,9 +5,9 @@ * force caching in browser * works in firefox and internet explorer */ -Header("Last-Modified: " . gmdate("D, d M Y H:i:s",mktime (0,0,0,1,1,2000)) . " GMT"); // Date in the past -Header("Expires: Mon, 26 Jul 2100 05:00:00 GMT"); // In other words... never expire the image -Header("Cache-Control: max-age=10000000, s-maxage=1000000, proxy-revalidate, must-revalidate"); +header("Last-Modified: " . gmdate("D, d M Y H:i:s", gmmktime(0,0,0,1,1,2000))); // Date in the past +header("Expires: Mon, 26 Jul 2100 05:00:00 GMT"); // In other words... never expire the image +header("Cache-Control: max-age=10000000, s-maxage=1000000, proxy-revalidate, must-revalidate"); /* @@ -62,7 +62,7 @@ } .linForms { - background-color: #<?php echo $_GET['fieldscolor']; ?>; + background-color: #<?php echo $_GET['forms']; ?>; border: 1px solid grey; } Modified: trunk/misc/design/14cornersSchill/global.css =================================================================== --- trunk/misc/design/14cornersSchill/global.css 2008-02-22 09:26:16 UTC (rev 4892) +++ trunk/misc/design/14cornersSchill/global.css 2008-02-22 09:26:52 UTC (rev 4893) @@ -10,7 +10,6 @@ padding: 0px; } - h1.linStyle { font-size: 1.5em; font-family: Verdana, Arial, Helvetica, sans-serif; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-22 09:26:25
|
Revision: 4892 http://linpha.svn.sourceforge.net/linpha/?rev=4892&view=rev Author: fangehrn Date: 2008-02-22 01:26:16 -0800 (Fri, 22 Feb 2008) Log Message: ----------- 2008-02-22 flo * implemented jscookmenu * changed templates with new rounded corners (not yet finished, found another problem when the page is too long) * temporary fix for "lindivtab undefined" 2008-02-20 flo * moved func.watermark.php to classes/linpha.color.class.php they are used at several other places * fixed some php stricts notices * implemented new rounded corners * changed to html strict * fixed some html strict javascript bugs Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/include/sql/sql.data.php trunk/linpha2/lib/js/LinGlobal.js trunk/linpha2/lib/js/LinImage.js trunk/linpha2/lib/plugins/maps/LinMaps.js trunk/linpha2/templates/default/basket.html.php trunk/linpha2/templates/default/default.html.php trunk/linpha2/templates/default/fragments.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/home.html.php trunk/linpha2/templates/default/maps.html.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/search.html.php trunk/linpha2/templates/default/themes/default/colorsettings.php trunk/linpha2/templates/default/themes/default/css/global.css trunk/linpha2/templates/default/themes/default/css/home.css trunk/linpha2/templates/default/view_albmeta.html.php trunk/linpha2/templates/default/view_basket.html.php trunk/linpha2/templates/default/view_img.html.php trunk/linpha2/templates/default/view_img_static.html.php trunk/linpha2/templates/default/view_thumb.html.php trunk/linpha2/templates/default/view_thumb_static.html.php trunk/linpha2/templates/misc/box.php Added Paths: ----------- trunk/linpha2/lib/js/JSCookMenu/ trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.yui.js trunk/linpha2/lib/js/JSCookMenu/effect.js trunk/linpha2/templates/default/menu.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-21 20:36:08 UTC (rev 4891) +++ trunk/linpha2/ChangeLog 2008-02-22 09:26:16 UTC (rev 4892) @@ -1,7 +1,17 @@ +2008-02-22 flo + * implemented jscookmenu + * changed templates with new rounded corners + (not yet finished, found another problem when the page is too long) + * temporary fix for "lindivtab undefined" + 2008-02-20 flo * moved func.watermark.php to classes/linpha.color.class.php they are used at several other places + * fixed some php stricts notices + * implemented new rounded corners + * changed to html strict + * fixed some html strict javascript bugs 2008-02-17 flo * implemented adodb datadict Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-02-21 20:36:08 UTC (rev 4891) +++ trunk/linpha2/index.php 2008-02-22 09:26:16 UTC (rev 4892) @@ -31,6 +31,7 @@ */ switch($_GET['linCat']) { +case 'home': case 'alb': require_once(LINPHA_DIR.'/lib/modules/module.albums.php'); break; Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-02-21 20:36:08 UTC (rev 4891) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-02-22 09:26:16 UTC (rev 4892) @@ -274,50 +274,39 @@ */ function setMenu() { - /** - * Menu My Settings - */ - if($GLOBALS['linpha']->sql->isLoggedIn()) - { - if( isset($GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable']) - && $GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable'] == 1 ) - { - $GLOBALS['linpha']->template->output['menu_My Settings']['filemanager'] = - array('name' => i18n("Filemanager"), 'value' => LINPHA_LINK.'&linCat=filemanager'); - } - } + /** * Menu Admin */ if($GLOBALS['linpha']->sql->isAdmin()) { - $GLOBALS['linpha']->template->output['menu_Admin']['import'] = + $GLOBALS['linpha']->template->menu['admin']['import'] = array( 'name' => i18n("Import"), - 'value' => array( - array('name' => i18n("Start Import Of This Folder/File"), 'value' => LINPHA_CLIENT.'/admin/?cat=maintenance_import&album_select[]='.$this->id_parent), - array('name' => i18n("Detect File Changes"), 'value' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=force_import') + 'link' => array( + array('name' => i18n("Start Import Of This Folder/File"), 'link' => LINPHA_CLIENT.'/admin/?cat=maintenance_import&album_select[]='.$this->id_parent), + array('name' => i18n("Detect File Changes"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=force_import') ) ); - $GLOBALS['linpha']->template->output['menu_Admin']['permissions'] = + $GLOBALS['linpha']->template->menu['admin']['permissions'] = array( 'name' => i18n("Permissions"), - 'value' => array( - array('name' => i18n("Set Permissions"), 'value' => LINPHA_CLIENT.'/admin/?cat=permissions_view&cmd=edit&linId='.$GLOBALS['linpha']->template->idCurrent) + 'link' => array( + array('name' => i18n("Set Permissions"), 'link' => LINPHA_CLIENT.'/admin/?cat=permissions_view&cmd=edit&linId='.$GLOBALS['linpha']->template->idCurrent) ) ); - if($this->mode == 'thumb' OR $this->mode == 'image') + if($this->mode == 'thumb' || $this->mode == 'image') { /** * append to "admin - import" entry */ - $GLOBALS['linpha']->template->output['menu_Admin']['import']['value'][] = array( + $GLOBALS['linpha']->template->menu['admin']['import']['value'][] = array( 'name' => i18n("Recreate This Thumbnail"), - 'value' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' + 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=recreate' ); } } @@ -331,9 +320,9 @@ * more than one time used stuff */ $array = linGetSortOrders(); - foreach($array AS $value) // i18n() already called + foreach($array as $value) // i18n() already called { - $array_sort_orders_links[] = array('name' => $value, 'value' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); + $array_sort_orders_links[] = array('name' => $value, 'link' => $GLOBALS['linpha']->template->URL_full.'&order_by='.$value); } $open_basket_link = LINPHA_LINK.'&linCat=basket'; @@ -342,99 +331,99 @@ { case 'thumb': - $GLOBALS['linpha']->template->output['menu_More']['basket'] = + $GLOBALS['linpha']->template->menu['more']['basket'] = array( 'name' => i18n("Basket"), - 'value' => array( - array('name' => i18n("Add All To Basket"), 'value' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all'), - array('name' => i18n("Switch To Basket View"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), - array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'value' => $open_basket_link) + 'link' => array( + array('name' => i18n("Add All To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all'), + array('name' => i18n("Switch To Basket View"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=basket'), + array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) ) ); if( linUseAjax() ) { $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectsizes']); - foreach($array AS $value) + foreach($array as $value) { - $array_tn_sizes_links[] = array('name' => $value.' '.i18n("Pixel"), 'value' => 'javascript:myLinThumbnails.setTnSize('.$value.')'); + $array_tn_sizes_links[] = array('name' => $value.' '.i18n("Pixel"), 'link' => 'javascript:myLinThumbnails.setTnSize('.$value.')'); } $array = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_thumb_selectnrimages']); - foreach($array AS $value) + foreach($array as $value) { - $array_nr_links[] = array('name' => $value, 'value' =>"javascript:myLinThumbnails.setNrImages('".$value."')"); + $array_nr_links[] = array('name' => $value, 'link' =>"javascript:myLinThumbnails.setNrImages('".$value."')"); } - $array_views_links[] = array('name' => i18n("Normal"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=thumb'); - $array_views_links[] = array('name' => i18n("Detail"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=thumbdetail'); + $array_views_links[] = array('name' => i18n("Normal"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumb'); + $array_views_links[] = array('name' => i18n("Detail"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=thumbdetail'); - $GLOBALS['linpha']->template->output['menu_More']['view'] = + $GLOBALS['linpha']->template->menu['more']['view'] = array( 'name' => i18n("View"), - 'value' => array( - array('name' => i18n("Sort"), 'value' => $array_sort_orders_links), - array('name' => i18n("View"), 'value' => $array_views_links), - array('name' => i18n("Thumb Size"), 'value' => $array_tn_sizes_links), - array('name' => i18n("Thumb Nr"), 'value' => $array_nr_links) + 'link' => array( + array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), + array('name' => i18n("View"), 'link' => $array_views_links), + array('name' => i18n("Thumb Size"), 'link' => $array_tn_sizes_links), + array('name' => i18n("Thumb Nr"), 'link' => $array_nr_links) ) ); } else { - $GLOBALS['linpha']->template->output['menu_More']['view'] = + $GLOBALS['linpha']->template->menu['more']['view'] = array( 'name' => i18n("View"), - 'value' => array( - array('name' => i18n("Sort"), 'value' => $array_sort_orders_links), + 'link' => array( + array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), ) ); } if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) { - $GLOBALS['linpha']->template->output['menu_More']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][2]['value'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; + $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); + $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['name'] = i18n("Open Filemanager"); + $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['value'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; } if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { - $GLOBALS['linpha']->template->output['menu_More']['metainfo'] = + $GLOBALS['linpha']->template->menu['more']['metainfo'] = array( 'name' => i18n("Metainfo"), - 'value' => array( - array('name' => i18n("Edit Album Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=albmeta'), + 'link' => array( + array('name' => i18n("Edit Album Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=albmeta'), ) ); } break; case 'image': - $GLOBALS['linpha']->template->output['menu_More']['basket'] = + $GLOBALS['linpha']->template->menu['more']['basket'] = array( 'name' => i18n("Basket"), - 'value' => array( - array('name' => i18n("Add To Basket"), 'value' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this'), - array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'value' => $open_basket_link) + 'link' => array( + array('name' => i18n("Add To Basket"), 'link' => $GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this'), + array('name' => i18n("Open Basket").' ('.count($_SESSION['basket_ids']).' '.i18n("Images").')', 'link' => $open_basket_link) ) ); - $GLOBALS['linpha']->template->output['menu_More']['view'] = + $GLOBALS['linpha']->template->menu['more']['view'] = array( 'name' => i18n("View"), - 'value' => array( - array('name' => i18n("Sort"), 'value' => $array_sort_orders_links), - array('name' => i18n("View at"), 'value' => + 'link' => array( + array('name' => i18n("Sort"), 'link' => $array_sort_orders_links), + array('name' => i18n("View at"), 'link' => array( - array('name' => '640x480', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=640&height=480', 'target' => '_blank'), - array('name' => '800x600', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=800&height=600', 'target' => '_blank'), - array('name' => '1024x768', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1024&height=768', 'target' => '_blank'), - array('name' => '1280x800', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=800', 'target' => '_blank'), - array('name' => '1280x960', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=960', 'target' => '_blank'), - array('name' => '1280x1024', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=1024', 'target' => '_blank'), - array('name' => '1600x1200', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1600&height=1200', 'target' => '_blank'), - array('name' => '1920x1200', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1920&height=1200', 'target' => '_blank'), - array('id' => 'linLiViewAtFullscreen', 'name' => $this->org_width.'x'.$this->org_height.' ('.i18n("Fullscreen").')', 'value' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width='.$this->org_width.'&height='.$this->org_height, 'target' => '_blank'), + array('name' => '640x480', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=640&height=480', 'target' => '_blank'), + array('name' => '800x600', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=800&height=600', 'target' => '_blank'), + array('name' => '1024x768', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1024&height=768', 'target' => '_blank'), + array('name' => '1280x800', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=800', 'target' => '_blank'), + array('name' => '1280x960', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=960', 'target' => '_blank'), + array('name' => '1280x1024', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1280&height=1024', 'target' => '_blank'), + array('name' => '1600x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1600&height=1200', 'target' => '_blank'), + array('name' => '1920x1200', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width=1920&height=1200', 'target' => '_blank'), + array('id' => 'linLiViewAtFullscreen', 'name' => $this->org_width.'x'.$this->org_height.' ('.i18n("Fullscreen").')', 'link' => LINPHA_CLIENT.'/get_image.php?linId='.$GLOBALS['linpha']->template->idCurrent.'&width='.$this->org_width.'&height='.$this->org_height, 'target' => '_blank'), ) ) ) @@ -443,28 +432,28 @@ if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { - $GLOBALS['linpha']->template->output['menu_More']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][0]['name'] = i18n("Rotate Left"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][0]['value'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][1]['name'] = i18n("Rotate Right"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][1]['value'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; + $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); + $GLOBALS['linpha']->template->menu['more']['edit']['value'][0]['name'] = i18n("Rotate Left"); + $GLOBALS['linpha']->template->menu['more']['edit']['value'][0]['value'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_left'; + $GLOBALS['linpha']->template->menu['more']['edit']['value'][1]['name'] = i18n("Rotate Right"); + $GLOBALS['linpha']->template->menu['more']['edit']['value'][1]['value'] = $GLOBALS['linpha']->template->URL_full.'&admin_cmd=rotate_right'; } if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) { - $GLOBALS['linpha']->template->output['menu_More']['edit']['name'] = i18n("Edit"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][2]['name'] = i18n("Open Filemanager"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][2]['value'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; + $GLOBALS['linpha']->template->menu['more']['edit']['name'] = i18n("Edit"); + $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['name'] = i18n("Open Filemanager"); + $GLOBALS['linpha']->template->menu['more']['edit']['value'][2]['value'] = LINPHA_LINK.'&linCat=filemanager&linId='.$this->id_parent; } if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { - $GLOBALS['linpha']->template->output['menu_More']['metainfo'] = + $GLOBALS['linpha']->template->menu['more']['metainfo'] = array( 'name' => i18n("Metainfo"), - 'value' => array( - array('name' => i18n("Edit Image Information"), 'value' => $GLOBALS['linpha']->template->URL_full.'&view=meta') + 'link' => array( + array('name' => i18n("Edit Image Information"), 'link' => $GLOBALS['linpha']->template->URL_full.'&view=meta') ) ); } @@ -476,39 +465,32 @@ /** * Icons */ - $GLOBALS['linpha']->template->output['menu_Icons'] = ''; if($this->mode == 'thumb') { - /** - * basket icons - */ - if( $GLOBALS['linpha']->sql->checkPermission('basket_download')) - { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all_with_checkout&checkout_as=download">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/download.png').'" border="0" title="'.i18n("Download Images").'" />' - .'</a>'."\n"; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) - { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all_with_checkout&checkout_as=print">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/print.png').'" border="0" title="'.i18n("Print Images").'" />' - .'</a>'."\n"; - } - if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) - { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all_with_checkout&checkout_as=mail">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/slideshow.png').'" border="0" title="'.i18n("Mail Images").'" />' - .'</a>'."\n"; - } - /** - * slideshow icon - */ - if( linUseAjax() ) { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="javascript:myLinThumbnails.loadSlideshow()">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/slideshow.png').'" border="0" title="'.i18n("Play Slideshow").'" />' - .'</a>'."\n"; - } - + /** + * basket icons + */ + if( $GLOBALS['linpha']->sql->checkPermission('basket_download')) + { + $GLOBALS['linpha']->template->menu['icon_download'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_all_with_checkout&checkout_as=download'; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) + { + $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_all_with_checkout&checkout_as=print'; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) + { + $GLOBALS['linpha']->template->menu['icon_mail'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_all_with_checkout&checkout_as=mail'; + } + /** + * slideshow icon + */ + if( linUseAjax() ) { + $GLOBALS['linpha']->template->menu['icon_slideshow'] = 'javascript:myLinThumbnails.loadSlideshow()'; + } } elseif($this->mode == 'image') { @@ -517,30 +499,24 @@ */ if( $GLOBALS['linpha']->sql->checkPermission('download')) { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.LINPHA_LINK.'&linCat=download&linId='.$GLOBALS['linpha']->template->idCurrent.'">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/download.png').'" border="0" title="'.i18n("Download Image").'" />' - .'</a>'."\n"; + $GLOBALS['linpha']->template->menu['icon_download'] = LINPHA_LINK.'&linCat=download&linId='.$GLOBALS['linpha']->template->idCurrent; } if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this_with_checkout&checkout_as=print">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/print.png').'" border="0" title="'.i18n("Print Image").'" />' - .'</a>'."\n"; + $GLOBALS['linpha']->template->menu['icon_print'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_this_with_checkout&checkout_as=print'; } if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this_with_checkout&checkout_as=mail">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/slideshow.png').'" border="0" title="'.i18n("Mail Image").'" />' - .'</a>'."\n"; + $GLOBALS['linpha']->template->menu['icon_mail'] = $GLOBALS['linpha']->template->URL_full. + '&admin_cmd=basket_add_this_with_checkout&checkout_as=mail'; } /** * slideshow icon */ if( linUseAjax() ) { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="javascript:myLinImage.fullscreenStart()">'. - '<img src="'.$GLOBALS['linpha']->template->themeFile('images/slideshow.png').'" border="0" title="'.i18n("Play Slideshow").'" />' - .'</a>'."\n"; + $GLOBALS['linpha']->template->menu['icon_slideshow'] = 'javascript:myLinThumbnails.fullscreenStart()'; } } } Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-21 20:36:08 UTC (rev 4891) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-22 09:26:16 UTC (rev 4892) @@ -221,62 +221,13 @@ } /** - * start template - * this must be at execatly this place, because: - * 1. it needs to be after the database is connected, because - * in the constructor of linTemplate() are configs from the db read - * 2. we need the template already in startSession(), because of the - * syslog after loggin in - * - * the same with the language file + * include language file + * must be after dbConnnect, but before login */ - $GLOBALS['linpha']->template = new linTemplate(); - global $linTpl; - $linTpl = $GLOBALS['linpha']->template; // this is just a reference - linIncludeLanguageFile(); /** - * set idCurrent - * add support for static links - * linpha2/index.php/album1/file.jpg - * will set the correct id - */ - if(isset($_GET['linId'])) - { - $GLOBALS['linpha']->template->idCurrent = intval($_GET['linId']); - } - else - { - /** - * u-oh... take care when handling with $_SERVER['PATH_INFO'], it is not secure - * and may contain cross site scripting. in common.php all htmlentities have been - * replaced - * - * LinSql::getIdFromFullFilename does not output to the browser, always uses addslashes() - * and returns false if it is not a valid album, so as far as i know it's safe to use it this way - */ - if( isset($_SERVER['PATH_INFO']) ) - { - $id = LinSql::getIdFromFullFilename( substr($_SERVER['PATH_INFO'],1) ); // PATH_INFO starts with a '/' -> remove this - - if($id === false) - { - $GLOBALS['linpha']->template->idCurrent = 0; - } - else - { - $GLOBALS['linpha']->template->idCurrent = $id; - } - } - else - { - $GLOBALS['linpha']->template->idCurrent = 0; - } - } - - /** * maybe the session is already started * this should be no problem, hopefully */ @@ -327,7 +278,7 @@ if($data = $query->FetchRow()) { linLog(LOG_TYPE_USER,LOG_NOTICE,'login','User '.$data['username'].': successfully logged in (cookie).'); - linSysLog(i18n("Successfully Logged In!")); + $sysLogMsg[] = i18n("Successfully Logged In!"); $this->setUserInformation($data['username'],$_COOKIE['linpha_userid'],$data['display_name']); } @@ -363,13 +314,13 @@ setcookie('linpha_password'); // delete cookie linpha_password } - linSysLog(i18n("Logged out.")); + $sysLogMsg[] = i18n("Logged out."); } elseif($_POST['cmd']=='login') { if( !isset($_POST['username']) OR !isset($_POST['password']) OR empty($_POST['username']) OR empty($_POST['password'])) { - linSysLog(i18n("Please Fill In All Fields!")); + $sysLogMsg[] = i18n("Please Fill In All Fields!"); } else { @@ -388,7 +339,7 @@ */ linLog(LOG_TYPE_USER,LOG_NOTICE,'login','User '.$_POST['username'].': successfully logged in.'); - linSysLog(i18n("Successfully Logged In!")); + $sysLogMsg[] = i18n("Successfully Logged In!"); $this->setUserInformation($_POST['username'],$data['id'],$data['display_name']); @@ -408,9 +359,8 @@ /** * failed login */ - linLog(LOG_TYPE_USER,LOG_WARNING,'login','User '.$_POST['username'].': login failed!'); - linSysLog(i18n("Login Failed!")); + $sysLogMsg[] = i18n("Login Failed!"); } } } @@ -491,6 +441,24 @@ $GLOBALS['linpha']->sql->config->value[$data['option_name']] = $data['option_value']; } } + + /** + * start template + * this must be after login stuff + * template requires login information + */ + $GLOBALS['linpha']->template = new linTemplate(); + global $linTpl; + $linTpl = $GLOBALS['linpha']->template; // this is just a reference + + /** + * add previously added log messages + */ + if (isset($sysLogMsg)) { + foreach($sysLogMsg as $msg) { + linSysLog($msg); + } + } } // end function startSession Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2008-02-21 20:36:08 UTC (rev 4891) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2008-02-22 09:26:16 UTC (rev 4892) @@ -31,13 +31,15 @@ public $layoutimagespath; public $output; public $URL_base, $URL_full, $idCurrent; + public $hideMenu = false, $hideTitle = false; + public $menu, $menuFinal, $nofMenuEntries = 0; + public $arrayDefaultMenuEntries; public $bgcolor, $bodybgcolor, $fontcolor, $albumsbgcolor, $linkscolor, $linkshovercolor; public $fnCallback = ''; - private $body_name; private $head_name; private $css_name; @@ -59,8 +61,69 @@ $this->albumsbgcolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_albumsbg']; $this->linkscolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_links']; $this->linkshovercolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_linkshover']; - $this->fieldscolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_fields']; + $this->formscolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_fields']; + /** + * set idCurrent + * add support for static links + * linpha2/index.php/album1/file.jpg + * will set the correct id + */ + if(isset($_GET['linId'])) + { + $this->idCurrent = intval($_GET['linId']); + } + else + { + /** + * u-oh... take care when handling with $_SERVER['PATH_INFO'], it is not secure + * and may contain cross site scripting. in common.php all htmlentities have been + * replaced + * + * LinSql::getIdFromFullFilename does not output to the browser, always uses addslashes() + * and returns false if it is not a valid album, so as far as i know it's safe to use it this way + */ + if( isset($_SERVER['PATH_INFO']) ) + { + $id = LinSql::getIdFromFullFilename( substr($_SERVER['PATH_INFO'],1) ); // PATH_INFO starts with a '/' -> remove this + + if($id === false) + { + $this->idCurrent = 0; + } + else + { + $this->idCurrent = $id; + } + } + else + { + $this->idCurrent = 0; + } + } + + /** + * Initial menu entries + */ + if($GLOBALS['linpha']->sql->isLoggedIn()) + { + if( isset($GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable']) + && $GLOBALS['linpha']->sql->config->value['plugins_filemanager_enable'] == 1 ) + { + $GLOBALS['linpha']->template->menu['settings']['filemanager'] = + array('name' => i18n("Filemanager"), 'link' => LINPHA_LINK.'&linCat=filemanager'); + } + } + + $this->arrayDefaultMenuEntries = array( + 'home' => i18n("Home"), + 'search' => i18n("Search"), + 'login' => i18n("Login"), + 'more' => i18n("More"), + 'admin' => i18n("Admin"), + 'settings' => i18n("Settings") + ); + } /** @@ -74,20 +137,23 @@ { case 'body': $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/'.$this->body_name.'.html.php'; - if(file_exists($filename)) - { + if (file_exists($filename)) { include_once( $filename ); } break; + case 'menu': + $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/menu.html.php'; + if (file_exists($filename)) { + include_once( $filename ); + } + + break; case 'head': /** * do some common definitions in head */ -?> -<!-- css includes --> -<?php /** * Prepare http url */ @@ -98,72 +164,48 @@ 'albumsbg' => ''.$this->albumsbgcolor.'', 'links' => ''.$this->linkscolor.'', 'linkshover' => ''.$this->linkshovercolor.'', - 'fieldscolor' => ''.$this->fieldscolor.'' + 'forms' => ''.$this->formscolor.'' ); +/** + * colorsettings.php + */ ?> -<!-- colorsettings.php --> - -<link rel='stylesheet' - href='<?php echo LINPHA_CLIENT.'/templates/'. +<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.'/templates/'. $this->template_name.'/themes/default/colorsettings.php?'. - http_build_query($urlParams);?>' type='text/css'> + http_build_query($urlParams);?>" type="text/css" /> +<?php +$filename = '/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/colorsettings.php'; +if ($this->layout_name != 'default' && file_exists(LINPHA_DIR.$filename)) { ?> +<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.$filename.'?'. + http_build_query($urlParams); ?>" type="text/css" /> +<?php } +/** + * global.css + */ +?> +<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.'/templates/'. + $this->template_name.'/themes/default/css/global.css'; ?>" type="text/css" /> +<?php +$filename = '/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/global.css'; +if ($this->layout_name != 'default' && file_exists(LINPHA_DIR.$filename)) { ?> +<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.$filename; ?>" type="text/css" /> +<?php } +/** + * body css + */ +?> +<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.'/templates/'. + $this->template_name.'/themes/default/css/'.$this->css_name.'.css'; ?>" type="text/css" /> +<?php +$filename = '/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/css/'.$this->css_name.'.css'; +if ($this->layout_name != 'default' && file_exists(LINPHA_DIR.$filename)) { ?> +<link rel="stylesheet" href="<?php echo LINPHA_CLIENT.$filename; ?>" type="text/css" /> +<?php } -<?php if($this->layout_name != 'default' && - file_exists(LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'. - $this->layout_name.'/colorsettings.php')) - { ?> - - <link rel='stylesheet' - href='<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/'.$this->layout_name."/colorsettings.php?". - http_build_query($urlParams); ?>' type='text/css'> -<?php } ?> - -<!-- global.css --> - -<link rel='stylesheet' - href='<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/default/css/global.css'; ?>' type='text/css'> - -<?php if($this->layout_name != 'default' && - file_exists(LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'. - $this->layout_name.'/css/global.css')) - { ?> - <link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/'.$this->layout_name.'/css/global.css'; ?>' - type='text/css'> -<?php } ?> - -<!-- body css --> - -<link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/default/css/'.$this->css_name.'.css'; ?>' - type='text/css'> - -<?php if($this->layout_name != 'default' && - file_exists(LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'. - $this->layout_name.'/css/'.$this->css_name.'.css')) - { ?> - <link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'. - $this->template_name.'/themes/'.$this->layout_name.'/css/'. - $this->css_name.'.css'; ?>' type='text/css'> -<?php } ?> - - <!--[if IE]> - <style type="text/css" media="screen"> - #menu ul { width: 1em; } /* this will be a *min* width */ - #menu ul ul { width: 12em; } - #menu ul li { float: left; width: 100%; } -<?php /* </style> - <![endif]--> - <!--[if lt IE 7]> - <style type="text/css" media="screen">*/ ?> - body { behavior: url(<?php echo LINPHA_CLIENT; ?>/templates/misc/csshover.htc); font-size: 100%; } - #menu ul li a { height: 1%; } - #menu a, #menu span { font: bold 0.7em/1.4em arial, helvetica, sans-serif; } - </style> - <![endif]--> - +/** + * javascript + */ +?> <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/prototype.js"></script> <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinGlobal.js"></script> <script type="text/javascript" language="JavaScript"> @@ -172,6 +214,7 @@ var linUrlBase = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; var startIdCurrent = <?php echo $this->idCurrent; ?>; var IdCurrent = startIdCurrent; +var myThemePanelBase = '<?php echo $this->themeFile('menu/'); ?>'; <?php if(! isset($_SESSION['use_js']) && ! isset($_SESSION['disable_ajax'])) { //echo "var checkAjaxCompatibility = true;"."\n"; @@ -181,11 +224,17 @@ }*/ ?> </script> +<?php +/* menu must be after myThemePanelBase definition */ +$filename = LINPHA_DIR.'/templates/'.$this->template_name.'/menu.head.php'; +if (file_exists($filename)) { + include_once( $filename ); +} +?> <?php $filename = LINPHA_DIR.'/templates/'.$this->template_name.'/'.$this->head_name.'.head.php'; - if(file_exists($filename)) - { + if (file_exists($filename)) { include_once( $filename ); } @@ -217,229 +266,175 @@ } } - /** - * print the whole menu - * @uses global.html.php, module.ajax.php - */ - function printMenus($modules,$comingfrom_ajax=false) - { - $array = explode(',',$modules); - foreach($array AS $value) - { - switch($value) - { - case 'more': - if( isset( $this->output['menu_More'] ) ) { - $this->printMenu("More",i18n("More")); - } - break; - case 'settings': - if($GLOBALS['linpha']->sql->isLoggedIn()) { - echo '<!-- my settings -->'."\n"; - $this->printMenu("My Settings",i18n("My Settings"),LINPHA_LINK."&linCat=settings"); - } - break; - case 'admin': - if($GLOBALS['linpha']->sql->isLoggedIn()) { - echo '<!-- admin links -->'."\n"; - $this->printMenu("Admin",i18n("Admin"),LINPHA_CLIENT."/admin/"); - } - break; - default: // all other, like home, search, login, guestbook, icons, more - $fragment = 'menu_'.$value; - include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); - break; - } - } - - if($comingfrom_ajax && isset($this->output['sys_log']) && !empty($this->output['sys_log'])) - { - echo '<script language="JavaScript" type="text/javascript">myLinGlobal.linSyslog("'.$this->output['sys_log'].'");</script>'; - } - } - /** - * print the main menu entries (more, admin, ...) - */ - function printMenu($index,$text,$link='') - { - if( ! isset( $GLOBALS['linpha']->template->output['menu_'.$index] ) ) - { - echo "\n".'<ul>'."\n"; - echo "\t".'<li><a href="'.$link.'">'.$text.'</a>'."\n"; - echo "\n".'</ul>'."\n"; - } - else - { - echo "\n".'<ul>'."\n"; - if(!empty($link)) - { - echo "\t".'<li><a href="'.$link.'">'.$text.'</a>'."\n"; - } - else - { - echo "\t".'<li><span>'.$text.' </span>'."\n"; - } - echo "\n".'<ul id="linMenu'.$index.'" onmouseover="myLinGlobal.reloadMenu()">'."\n"; - - foreach($GLOBALS['linpha']->template->output['menu_'.$index] AS $key=>$value) - { - if(!is_array($value['value'])) - { - if(isset($value['target'])) { - $target_str = ' target="'.$value['target'].'"'; - } else { - $target_str = ''; - } - - if(isset($value['id'])) { - $id_str = ' id="'.$value['id'].'"'; - } else { - $id_str = ''; - } + function setMenu() + { + $arrayMenuEntries = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_menu_list']); + + foreach($arrayMenuEntries as $menuEntry) + { + if ($menuEntry == 'more' || $menuEntry == 'admin' || $menuEntry == 'settings') + { + if (!isset($this->menu[$menuEntry])) { + continue; + } + } + + if (isset($this->arrayDefaultMenuEntries[$menuEntry])) { + $this->menuFinal[ $menuEntry ] = array( + 'name' => $this->arrayDefaultMenuEntries[$menuEntry], + 'link' => LINPHA_LINK.'&linCat='.$menuEntry + ); + } elseif ( strpos($menuEntry, 'plugin_') !== false ) { + $menuEntry = substr($menuEntry, 7); + $this->menuFinal[ $menuEntry ] = array( + 'name' => i18n(ucfirst($menuEntry)), // this will not be detected by the language translater, but thats no problem because this plugin name is for sure somewhere else + 'link' => LINPHA_LINK.'&linCat='.$menuEntry + ); + } elseif ( strpos($menuEntry, 'icon_') !== false ) { + if (isset($this->menu[$menuEntry])) { + $this->menuFinal[ $menuEntry ] = array( + 'name' => $menuEntry, + 'link' => $this->menu[$menuEntry] + ); + } + } elseif ( strpos($GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink1'], $menuEntry) !== false ) { + $arrayMenu = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink1']); + $this->menuFinal[ $menuEntry ] = array( + 'name' => $arrayMenu[1], + 'link' => $arrayMenu[2] + ); + } elseif ( strpos($GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink2'], $menuEntry) !== false ) { + $arrayMenu = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink2']); + $this->menuFinal[ $menuEntry ] = array( + 'name' => $arrayMenu[1], + 'link' => $arrayMenu[2] + ); + } elseif ( strpos($GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink3'], $menuEntry) !== false ) { + $arrayMenu = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink3']); + $this->menuFinal[ $menuEntry ] = array( + 'name' => $arrayMenu[1], + 'link' => $arrayMenu[2] + ); + } elseif ( strpos($GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink4'], $menuEntry) !== false ) { + $arrayMenu = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink4']); + $this->menuFinal[ $menuEntry ] = array( + 'name' => $arrayMenu[1], + 'link' => $arrayMenu[2] + ); + } elseif ( strpos($GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink5'], $menuEntry) !== false ) { + $arrayMenu = explode(',',$GLOBALS['linpha']->sql->config->value['sys_style_menu_userlink5']); + $this->menuFinal[ $menuEntry ] = array( + 'name' => $arrayMenu[1], + 'link' => $arrayMenu[2] + ); + } else { + $this->menuFinal[ $menuEntry ] = array( + 'name' => $menuEntry, + 'link' => LINPHA_LINK.'&linCat='.$menuEntry + ); + } + + $this->nofMenuEntries++; + } + } + + function createJSCookMenu() + { + foreach ($this->menu as $key=>$arrayMenuEntry) + { + if (strpos($key,'icon_')===false) { + $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', null, null, null, "."\n"; + $this->createJSCookMenuEntry($key, $arrayMenuEntry); + $this->menuJSCook[$key][] = "]"; + } + } + } + + function createJSCookMenuEntry($key, &$arrayMenuEntry) + { + //print_r($arrayMenuEntry); + + foreach ($arrayMenuEntry as $arraySubMenuEntry) + { + $this->menuJSCook[$key][] = "[null, '".htmlentities($arraySubMenuEntry['name'], ENT_QUOTES)."', "; + if (is_array($arraySubMenuEntry['link'])) { + $this->menuJSCook[$key][] = "null, null, null, "."\n"; + $this->createJSCookMenuEntry($key, $arraySubMenuEntry['link']); + } else { + $link = linConvertAmp($arraySubMenuEntry['link']); + $link = str_replace("'",'\\\'', $link); + $this->menuJSCook[$key][] = "'".$link."', null, null,"; + } + + $this->menuJSCook[$key][] = "],"."\n"; + } + /* + [null, 'More', null, null, 'Some more options', + [null, 'Basket', null, null, 'Download/Mail/Print a batch of images', + [null, 'Add All To Basket', 'url', 'target', 'description'], + [null, 'Switch To Basket View', 'url', 'target', 'description'], + [null, 'Open Basket (0 Images)', 'url', 'target', 'description'] + ], + [null, 'View', null, null, 'description', + [null, 'Sort', 'url', 'target', 'description', + [null, 'Name Asc', 'url', 'target', 'description'], + [null, 'Name Desc', 'url', 'target', 'description'], + [null, 'Date Asc', 'url', 'target', 'description'], + [null, 'Date Desc', 'url', 'target', 'description'] + ], + [null, 'View', 'url', 'target', 'description', + [null, 'Normal', 'url', 'target', 'description'], + [null, 'Detail', 'url', 'target', 'description'] + ], + [null, 'Thumb Size', 'url', 'target', 'description', + [null, '50 Pixel', 'url', 'target', 'description'], + [null, '75 Pixel', 'url', 'target', 'description'], + [null, '100 Pixel', 'url', 'target', 'description'], + [null, '150 Pixel', 'url', 'target', 'description'], + [null, '200 Pixel', 'url', 'target', 'description'], + [null, '250 Pixel', 'url', 'target', 'description'], + [null, '300 Pixel', 'url', 'target', 'description'], + [null, '400 Pixel', 'url', 'target', 'description'], + [null, '500 Pixel', 'url', 'target', 'description'] + ], + [null, 'Thumb Nr', 'url', 'target', 'description' + [null, 'auto', 'url', 'target', 'description'], + [null, '10', 'url', 'target', 'description'], + [null, '25', 'url', 'target', 'description'], + [null, '50', 'url', 'target', 'description'], + [null, '100', 'url', 'target', 'description'], + [null, '200', 'url', 'target', 'description'], + [null, 'all', 'url', 'target', 'description'] + ] + ], + ], + */ + } - echo "\t".'<li'.$id_str.'><a href="'.$value['value'].'"'.$target_str.'>'.$value['name'].'</a></li>'."\n"; - } - else - { - echo "\t".'<li><span>'.$value['name'].' </span>'."\n"; - - echo "\t".'<ul>'."\n"; - - foreach($value['value'] AS $sub_value) - { - if(!is_array($sub_value['value'])) - { - if(isset($sub_value['target'])) { - $target_str = ' target="'.$sub_value['target'].'"'; - } else { - $target_str = ''; - } - - if(isset($sub_value['id'])) { - $id_str = ' id="'.$sub_value['id'].'"'; - } else { - $id_str = ''; - } - - echo "\t\t".'<li'.$id_str.'><a href="'.$sub_value['value'].'"'.$target_str.'>'.$sub_value['name'].'</a></li>'."\n"; - } - else - { - echo "\t\t".'<li><span>'.$sub_value['name'].' </span>'."\n"; - - echo "\t\t".'<ul>'."\n"; - - foreach($sub_value['value'] AS $subsub_value) - { - if(isset($subsub_value['target'])) { - $target_str = ' target="'.$subsub_value['target'].'"'; - } else { - $target_str = ''; - } - - if(isset($subsub_value['id'])) { - $id_str = ' id="'.$subsub_value['id'].'"'; - } else { - $id_str = ''; - } - - echo "\t\t\t".'<li'.$id_str.'><a href="'.$subsub_value['value'].'"'.$target_str.'>'.$subsub_value['name'].'</a></li>'."\n"; - - } - - echo "\t\t".'</ul>'."\n"; - echo "\t\t".'</li>'."\n"; - } - } - - echo "\t".'</ul>'."\n"; - echo "\t".'</li>'."\n"; - } - } - - echo "\t".'</ul>'."\n"; - echo "\t".'</li>'."\n"; - echo '</ul>'."\n"; - } - } - - /** - * rounded corner stuff - */ - function divRoundCorners($top_bottom,$alpha='',$type='') - { - $size = 15; - - if(empty($type)) // default - { - $color = $this->bgcolor; - $bgcolor = $this->bodybgcolor; - } - elseif($type=='albums') - { - $color = $this->albumsbgcolor; - $bgcolor = $this->bgcolor; - } - - if($top_bottom == 'top') - { - $alignleft = 'tl'; - $alignright = 'tr'; - } - elseif($top_bottom == 'bottom') - { - $alignleft = 'bl'; - $alignright = 'br'; - } + /** + * rounded corner stuff + */ + function divRoundCorners($top_bottom,$type='') + { + if ($type=='main') { + $class = 'linCornMain'; + } elseif($type=='album') { + $class = 'linCornFolder'; + } else { + $class = ''; + } - /** - * Prepare http url - */ - $lcornerParam = array( - 'color' => ''.$color.'', - 'bgcolor' => ''.$bgcolor.'', - 'size' => ''.$size.'', - 'align' => ''.$alignleft.'' - ); - - $rcornerParam = array( - 'color' => ''.$color.'', - 'bgcolor' => ''.$bgcolor.'', - 'size' => ''.$size.'', - 'align' => ''.$alignright.'' - ); - - if(empty($alpha)) // default - { - $str = '<div style="background: - url('.LINPHA_CLIENT.'/templates/misc/roundcorners.php?'. - http_build_query($rcornerParam).') no-repeat top right;">'; - - $str .= '<img src="'.LINPHA_CLIENT.'/templates/misc/roundcorners.php?'. - http_build_query($lcornerParam).'" - alt="" width="'.$size.'" height="'.$size.'" />'; - - $str .= '</div>'; - } - else // currently only used in slideshow, sucks with IE - { - $str = '<div style="position: relative; background: - url('.LINPHA_CLIENT.'/templates/misc/roundcorners.php?'. - http_build_query($rcornerParam).'&alpha) no-repeat top right;">'; - - $str .= '<div class="roundAlphabottomInner"> </div>'; - - $str .= '<img src="'.LINPHA_CLIENT.'/templates/misc/roundcorners.php?'. - http_build_query($lcornerParam).'&alpha" - alt="" width="'.$size.'" height="'.$size.'" class="AlphaCorner" />'; - - $str .= '</div>'; - } + if ($top_bottom == 'top') + { + return '<div class="linCorn '.$class.'"><div class="linCornC"><div class="linCornT"></div>'; + } + elseif($top_bottom == 'bottom') + { + return '</div><div class="linCornB"><div></div></div></div>'; + } + } - return $str; - } - function themeFile( $filename ) { if( file_exists( LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/'.$filename ) ) Modified: trunk/linpha2/lib/include/sql/sql.data.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.data.php 2008-02-21 20:36:08 UTC (rev 4891) +++ trunk/linpha2/lib/include/sql/sql.data.php 2008-02-22 09:26:16 UTC (rev 4892) @@ -99,6 +99,13 @@ 'sys_style_layout_template' => 'default', 'sys_style_layout_title' => 'Linpha 2.0', + 'sys_style_menu_list' => 'home,search,login,more,icon_slideshow,icon_download,icon_mail,icon_print,admin,settings', + 'sys_style_menu_userlink1' => '', + 'sys_style_menu_userlink2' => '', + 'sys_style_menu_userlink3' => '', + 'sys_style_menu_userlink4' => '', + 'sys_style_menu_userlink5' => '', + 'sys_style_others_sortorder' => 'nameasc', ); Added: trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js =================================================================== --- trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js (rev 0) +++ trunk/linpha2/lib/js/JSCookMenu/JSCookMenu.js 2008-02-22 09:26:16 UTC (rev 4892) @@ -0,0 +1,1658 @@ +/* + JSCookMenu v2.0.3 (c) Copyright 2002-2006 by Heng Yuan + + http://jscook.sourceforge.net/JSCookMenu/ + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +// default node properties +var _cmNodeProperties = +{ + // theme prefix + prefix: '', + + // main menu display attributes + // + // Note. When the menu bar is horizontal, + // mainFolderLeft and mainFolderRight are + // put in <span></span>. When the menu + // bar is vertical, they would be put in + // a separate TD cell. + + // HTML code to the left of the folder item + mainFolderLeft: '', + // HTML code to the right of the folder item + mainFolderRight: '', + // HTML code to the left of the regular item + mainItemLeft: '', + // HTML code to the right of the regular item + mainItemRight: '', + + // sub menu display attributes + + // HTML code to the left of the folder item + folderLeft: '', + // HTML code to the right of the folder item + folderRight: '', + // HTML code to the left of the regular item + itemLeft: '', + // HTML code to the right of the regular item + itemRight: '', + // cell spacing for main menu + mainSpacing: 0, + // cell spacing for sub menus + subSpacing: 0, + + // optional settings + // If not set, use the default + + // auto disappear time for submenus in milli-seconds + delay: 500, + + // 1st layer sub menu starting index + zIndexStart: 1000, + // z-index incremental step for subsequent layers + zIndexInc: 5, + + // sub menu header appears before the sub menu table + subMenuHeader: null, + // sub menu header appears after the sub menu table + subMenuFooter: null, + + // submenu location adjustments + // + // offsetHMainAdjust for adjusting the first submenu + // of a 'hbr' menu. + // offsetVMainAdjust for adjusting the first submenu + // of a 'vbr' menu. + // offsetSubAdjust for subsequent level of submenus + // + offsetHMainAdjust: [0, 0], + offsetVMainAdjust: [0, 0], + offsetSubAdjust: [0, 0], + + // act on click to open sub menu + // not yet implemented + // 0 : use default behavior + // 1 : hover open in all cases + // 2 : click on main, hover on sub + // 3 : click open in all cases (illegal as of 1.5) + clickOpen: 1, + + // special effects on open/closing a sub menu + effect: null +}; + +// Globals +var _cmIDCount = 0; +var _cmIDName = 'cmSubMenuID'; // for creating submenu id + +var _cmTimeOut = null; // how long the menu would stay +var _cmCurrentItem = null; // the current menu item being selected; + +var _cmNoAction = new Object (); // indicate that the item cannot be hovered. +var _cmNoClick = new Object (); // similar to _cmNoAction but does not respond to mouseup/mousedown events +var _cmSplit = new Object (); // indicate that the item is a menu split + +var _cmMenuList = new Array (); // a list of the current menus +var _cmItemList = new Array (); // a simple list of items + +var _cmFrameList = new Array (); // a pool of reusable iframes +var _cmFrameListSize = 0; // keep track of the actual size +var _cmFrameIDCount = 0; // keep track of the frame id +var _cmFrameMasking = true; // use the frame masking + +// disable iframe masking for IE7 +/*@cc_on + @if (@_jscript_version >= 5.6) + if (_cmFrameMasking) + { + var v = navigator.appVersion; + var i = v.indexOf ("MSIE "); + if (i >= 0) + { + if (parseInt (navigator.appVersion.substring (i + 5)) >= 7) + _cmFrameMasking = false; + } + } + @end +@*/ + +var _cmClicked = false; // for onClick + +// flag for turning on off hiding objects +// +// 0: automatic +// 1: hiding +// 2: no hiding +var _cmHideObjects = 0; + +// Utility function to do a shallow copy a node property +function cmClone (nodeProperties) +{ + var returnVal = new Object (); + for (v in nodeProperties) + returnVal[v] = nodeProperties[v]; + return returnVal; +} + +// +// store the new menu information into a structure to retrieve it later +// +function cmAllocMenu (id, menu, orient, nodeProperties, prefix) +{ + var info = new Object (); + info.div = id; + info.menu = menu; + info.orient = orient; + info.nodeProperties = nodeProperties; + info.prefix = prefix; + var menuID = _cmMenuList.length; + _cmMenuList[menuID] = info; + return menuID; +} + +// +// request a frame +// +function cmAllocFrame () +{ + if (_cmFrameListSize > 0) + return cmGetObject (_cmFrameList[--_cmFrameListSize]); + var frameObj = document.createElement ('iframe'); + var id = _cmFrameIDCount++; + frameObj.id = 'cmFrame' + id; + frameObj.frameBorder = '0'; + frameObj.style.display = 'none'; + frameObj.src = 'javascript:false'; + document.body.appendChild (frameObj); + frameObj.style.filter = 'alpha(opacity=0)'; + frameObj.style.zIndex = 99; + frameObj.style.position = 'absolute'; + frameObj.style.border = '0'; + frameObj.scrolling = 'no'; + return frameObj; +} + +// +// make a frame resuable later +// +function cmFreeFrame (frameObj) +{ + _cmFrameList[_cmFrameListSize++] = frameObj.id; +} + +////////////////////////////////////////////////////////////////////// +// +// Drawing Functions and Utilit... [truncated message content] |
From: <fan...@us...> - 2008-02-21 20:36:39
|
Revision: 4891 http://linpha.svn.sourceforge.net/linpha/?rev=4891&view=rev Author: fangehrn Date: 2008-02-21 12:36:08 -0800 (Thu, 21 Feb 2008) Log Message: ----------- added files for jscookmenu Added Paths: ----------- trunk/linpha2/templates/default/themes/default/menu/ trunk/linpha2/templates/default/themes/default/menu/arrow.gif trunk/linpha2/templates/default/themes/default/menu/arrowdown.gif trunk/linpha2/templates/default/themes/default/menu/blank.gif trunk/linpha2/templates/default/themes/default/menu/theme.css trunk/linpha2/templates/default/themes/default/menu/theme.js Added: trunk/linpha2/templates/default/themes/default/menu/arrow.gif =================================================================== (Binary files differ) Property changes on: trunk/linpha2/templates/default/themes/default/menu/arrow.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/templates/default/themes/default/menu/arrowdown.gif =================================================================== (Binary files differ) Property changes on: trunk/linpha2/templates/default/themes/default/menu/arrowdown.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/templates/default/themes/default/menu/blank.gif =================================================================== (Binary files differ) Property changes on: trunk/linpha2/templates/default/themes/default/menu/blank.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/linpha2/templates/default/themes/default/menu/theme.css =================================================================== --- trunk/linpha2/templates/default/themes/default/menu/theme.css (rev 0) +++ trunk/linpha2/templates/default/themes/default/menu/theme.css 2008-02-21 20:36:08 UTC (rev 4891) @@ -0,0 +1,282 @@ +/* ThemePanelMenu Style Sheet */ + +.ThemePanelMenu,.ThemePanelSubMenuTable +{ + /*font-family: verdana, arial, sans-serif;*/ + /*font-size: 13px;*/ + + cursor: pointer; /* default*/ + white-space: nowrap; +} + +.ThemePanelSubMenu +{ + z-index: 0; + position: absolute; + visibility: hidden; + display: block; + overflow: hidden; + + border: 0; + background-color: inherit; +} + +.ThemePanelSubMenuShadow +{ + z-index: -1; + position: absolute; + top: 3px; + left: 3px; + width: 100%; + height: 300em; + background-color: black; + opacity: 0.5; + border: 0; + margin: 0; +} + +.ThemePanelSubMenuBorder +{ + border: 1px solid #9C9A9C; + background-color: #F7F3F7; + padding: 1px; + margin: 0px 3px 3px 0px; +} + +.ThemePanelSubMenuTable +{ + border-collapse: separate; +} + +.ThemePanelMenuItem,.ThemePanelMenuItemHover,.ThemePanelMenuItemActive +{ + cursor: default; + white-space: nowrap; +} + +.ThemePanelMainItem, +.ThemePanelMenuItem +{ + /*background-color: #F7F3F7;*/ + white-space: nowrap; +} + +.ThemePanelMainItemHover, +.ThemePanelMainItemActive, +.ThemePanelMenuItemHover, +.ThemePanelMenuItemActive +{ + background-color: #C6C6C3; + white-space: nowrap; +} + +/* horizontal main menu sub components */ +/* panel doesn't really support horizontal menus */ +/* there are simpler approaches, but the setting here allows me to + set a background image for the menu without lines all over it */ + +.ThemePanelMainFolderLeft, +.ThemePanelMainItemLeft +{ + padding: 3px 0px 3px 3px; + border: 0; + white-space: nowrap; + background-color: inherit; +} + +.ThemePanelMainFolderText, +.ThemePanelMainItemText +{ + padding: 3px 7px 3px 5px; + + border: 0; + white-space: nowrap; + background-color: inherit; +} + +.ThemePanelMainItemRight, +.ThemePanelMainFolderRight +{ + padding: 3px 1px 3px 0px; + + border: 0; + white-space: nowrap; + background-color: inherit; +} + +/* hoover and active border */ +.ThemePanelMainItemHover .ThemePanelMainFolderLeft, +.ThemePanelMainItemActive .ThemePanelMainFolderLeft, +.ThemePanelMainItemHover .ThemePanelMainItemLeft, +.ThemePanelMainItemActive .ThemePanelMainItemLeft, +.ThemePanelMainItemHover .ThemePanelMainFolderText, +.ThemePanelMainItemActive .ThemePanelMainFolderText, +.ThemePanelMainItemHover .ThemePanelMainItemText, +.ThemePanelMainItemActive .ThemePanelMainItemText, +.ThemePanelMainItemHover .ThemePanelMainFolderRight, +.ThemePanelMainItemActive .ThemePanelMainFolderRight, +.ThemePanelMainItemHover .ThemePanelMainItemRight, +.ThemePanelMainItemActive .ThemePanelMainItemRight +{ + border-color: #9C9A9C; +} + +.ThemePanelMainItemHover .ThemePanelMainFolderLeft, +.ThemePanelMainItemActive .ThemePanelMainFolderLeft, +.ThemePanelMainItemHover .ThemePanelMainItemLeft, +.ThemePanelMainItemActive .ThemePanelMainItemLeft +{ + border-width: 1px 0px 1px 1px; + border-style: solid; + padding: 2px 0px 2px 2px; +} + +.ThemePanelMainItemHover .ThemePanelMainFolderText, +.ThemePanelMainItemActive .ThemePanelMainFolderText, +.ThemePanelMainItemHover .ThemePanelMainItemText, +.ThemePanelMainItemActive .ThemePanelMainItemText +{ + border-width: 1px 0px 1px 0px; + border-style: solid; + padding: 2px 7px 2px 5px; +} + +.ThemePanelMainItemHover .ThemePanelMainFolderRight, +.ThemePanelMainItemActive .ThemePanelMainFolderRight, +.ThemePanelMainItemHover .ThemePanelMainItemRight, +.ThemePanelMainItemActive .ThemePanelMainItemRight +{ + border-width: 1px 1px 1px 0px; + border-style: solid; + padding: 2px 0px 2px 0px; +} + +/* sub menus sub components */ + +.ThemePanelMenuFolderLeft, +.ThemePanelMenuItemLeft +{ + padding: 3px 0px 3px 3px; + border: 0; + white-space: nowrap; + background-color: inherit; +} + +.ThemePanelMenuFolderText, +.ThemePanelMenuItemText +{ + padding: 3px 3px 3px 5px; + + border: 0; + white-space: nowrap; + background-color: inherit; +} + +.ThemePanelMenuItemRight, +.ThemePanelMenuFolderRight +{ + padding: 3px 1px 3px 0px; + + border: 0; + white-space: nowrap; + background-color: inherit; +} + +/* hoover and active border */ +.ThemePanelMenuItemHover .ThemePanelMenuFolderLeft, +.ThemePanelMenuItemActive .ThemePanelMenuFolderLeft, +.ThemePanelMenuItemHover .ThemePanelMenuItemLeft, +.ThemePanelMenuItemActive .ThemePanelMenuItemLeft, +.ThemePanelMenuItemHover .ThemePanelMenuFolderText, +.ThemePanelMenuItemActive .ThemePanelMenuFolderText, +.ThemePanelMenuItemHover .ThemePanelMenuItemText, +.ThemePanelMenuItemActive .ThemePanelMenuItemText, +.ThemePanelMenuItemHover .ThemePanelMenuFolderRight, +.ThemePanelMenuItemActive .ThemePanelMenuFolderRight, +.ThemePanelMenuItemHover .ThemePanelMenuItemRight, +.ThemePanelMenuItemActive .ThemePanelMenuItemRight +{ + border-color: #9C9A9C; +} + +.ThemePanelMenuItemHover .ThemePanelMenuFolderLeft, +.ThemePanelMenuItemActive .ThemePanelMenuFolderLeft, +.ThemePanelMenuItemHover .ThemePanelMenuItemLeft, +.ThemePanelMenuItemActive .ThemePanelMenuItemLeft +{ + border-width: 1px 0px 1px 1px; + border-style: solid; + padding: 2px 0px 2px 2px; +} + +.ThemePanelMenuItemHover .ThemePanelMenuFolderText, +.ThemePanelMenuItemActive .ThemePanelMenuFolderText, +.ThemePanelMenuItemHover .ThemePanelMenuItemText, +.ThemePanelMenuItemActive .ThemePanelMenuItemText +{ + border-width: 1px 0px 1px 0px; + border-style: solid; + padding: 2px 3px 2px 5px; +} + +.ThemePanelMenuItemHover .ThemePanelMenuFolderRight, +.ThemePanelMenuItemActive .ThemePanelMenuFolderRight, +.ThemePanelMenuItemHover .ThemePanelMenuItemRight, +.ThemePanelMenuItemActive .ThemePanelMenuItemRight +{ + border-width: 1px 1px 1px 0px; + border-style: solid; + padding: 2px 0px 2px 0px; +} + +td.ThemePanelMenuSplit +{ + padding: 0px; + margin: 0px; + height: 7px; + border: 0px; + background-color: inherit; + overflow: hidden; +} + +div.ThemePanelMenuSplit +{ + display: block; + margin: 3px; + height: 1px; + width: 100%; + overflow: hidden; + background-color: inherit; + + border-style: solid; + border-width: 1px 0px 0px 0px; + border-color: #9C9A9C; +} + +/* image shadow animation */ + +/* + seq1: image for normal + seq2: image for hover and active + + To use, in the icon field, input the following: + <img class="seq1" src="normal.gif" /><img class="seq2" src="hover.gif" /> +*/ + +.ThemePanelMenuItem img.seq1 +{ + display: inline; +} + +.ThemePanelMenuItemHover seq2, +.ThemePanelMenuItemActive seq2 +{ + display: inline; +} + +.ThemePanelMenuItem .seq2, +.ThemePanelMenuItemHover .seq1, +.ThemePanelMenuItemActive .seq1 +{ + display: none; +} Added: trunk/linpha2/templates/default/themes/default/menu/theme.js =================================================================== --- trunk/linpha2/templates/default/themes/default/menu/theme.js (rev 0) +++ trunk/linpha2/templates/default/themes/default/menu/theme.js 2008-02-21 20:36:08 UTC (rev 4891) @@ -0,0 +1,76 @@ + +// directory of where all the images are +var cmThemePanelBase = ''; + +// the follow block allows user to re-define theme base directory +// before it is loaded. +try +{ + if (myThemePanelBase) + { + cmThemePanelBase = myThemePanelBase; + } +} +catch (e) +{ +} + +var cmThemePanel = +{ + prefix: 'ThemePanel', + // main menu display attributes + // + // Note. When the menu bar is horizontal, + // mainFolderLeft and mainFolderRight are + // put in <span></span>. When the menu + // bar is vertical, they would be put in + // a separate TD cell. + + // HTML code to the left of the folder item + mainFolderLeft: '<img alt="" src="' + cmThemePanelBase + 'blank.gif">', + // HTML code to the right of the folder item + mainFolderRight: '<img alt="" src="' + cmThemePanelBase + 'arrowdown.gif">', + // HTML code to the left of the regular item + mainItemLeft: '<img alt="" src="' + cmThemePanelBase + 'blank.gif">', + // HTML code to the right of the regular item + mainItemRight: '<img alt="" src="' + cmThemePanelBase + 'blank.gif">', + + // sub menu display attributes + + // HTML code to the left of the folder item + folderLeft: '<img alt="" src="' + cmThemePanelBase + 'blank.gif">', + // HTML code to the right of the folder item + folderRight: '<span style="border: 0; width: 24px;"><img alt="" src="' + cmThemePanelBase + 'arrow.gif"></span>', + // HTML code to the left of the regular item + itemLeft: '<img alt="" src="' + cmThemePanelBase + 'blank.gif">', + // HTML code to the right of the regular item + itemRight: '<img alt="" src="' + cmThemePanelBase + 'blank.gif">', + // cell spacing for main menu + mainSpacing: 0, + // cell spacing for sub menus + subSpacing: 0, + + subMenuHeader: '<div class="ThemePanelSubMenuShadow"></div><div class="ThemePanelSubMenuBorder">', + subMenuFooter: '</div>', + + // move the first lvl of vbr submenu up a bit + offsetVMainAdjust: [0, -2], + // also for the other lvls + offsetSubAdjust: [0, -2], + + effect: new CMFadingEffect (8, 4) + + // rest use default settings +}; + +// for sub menu horizontal split +var cmThemePanelHSplit = [_cmNoClick, '<td colspan="3" class="ThemePanelMenuSplit"><div class="ThemePanelMenuSplit"></div></td>']; +// for vertical main menu horizontal split +var cmThemePanelMainHSplit = [_cmNoClick, '<td colspan="3" class="ThemePanelMenuSplit"><div class="ThemePanelMenuSplit"></div></td>']; +// for horizontal main menu vertical split +var cmThemePanelMainVSplit = [_cmNoClick, '|']; + +/* IE can't do negative margin on tables */ +/* not needed?! cpu goes up to 100%!! @ c c _ o n + cmThemePanel.subMenuHeader = '<div class="ThemePanelSubMenuShadow" style="background-color: #aaaaaa;filter: alpha(opacity=50);"></div><div class="ThemePanelSubMenuBorder">'; +@*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-20 21:37:35
|
Revision: 4890 http://linpha.svn.sourceforge.net/linpha/?rev=4890&view=rev Author: fangehrn Date: 2008-02-20 13:37:31 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Added Paths: ----------- trunk/linpha2/templates/default/menu.html.php Copied: trunk/linpha2/templates/default/menu.html.php (from rev 4889, trunk/linpha2/templates/default/fragments.php) =================================================================== --- trunk/linpha2/templates/default/menu.html.php (rev 0) +++ trunk/linpha2/templates/default/menu.html.php 2008-02-20 21:37:31 UTC (rev 4890) @@ -0,0 +1,318 @@ +<?php + +switch($fragment) +{ + +case 'menu_home': /* menu item 'home' */ +?> + <ul style="margin-left: 50px;"> + <li><a href="<?php echo LINPHA_LINK; ?>&linCat=alb"><?php echo i18n("Home"); ?></a></li> + </ul> +<?php +break; + +case 'menu_search': /* menu item 'search' */ +?> + <ul> + <li><span><?php echo i18n("Search"); ?> </span> + <ul> + <li><a href="<?php echo LINPHA_LINK; ?>&linCat=search"><?php echo i18n("Extended Search"); ?></a></li> + <li> + <div> + <form method="GET" action="<?php echo LINPHA_LINK; ?>&linCat=search"> + <input type="text" class="linForms" name="search_text" value="" /> + <input type="hidden" name="button[meta][all]" value="1" /> + <input type="hidden" name="cmd" value="search" /> + <input type="hidden" name="linCat" value="search" /> + <input type="submit" name="submit" class="linButton linInputMenu" value="<?php echo i18n("Search"); ?>" /> + </form> + </div> + </li> + </ul> + </li> + </ul> +<?php +break; + +case 'menu_login': /* menu item 'login' */ +?> + <ul> + <li> + <span><?php echo i18n("Login"); ?> </span> + <ul id="linMenuLogin"> + <li> + <div> + <?php if( linUseAjax() ) { ?> + <form action="" method="POST" onsubmit="new Ajax.Updater('linDivMenu', LINPHA_CLIENT + '/?linCat=ajax&reloadmenu&linId='+IdCurrent, {method: 'post', asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;"> + <?php } else { ?> + <form action="<?php echo $this->URL_full; ?>" method="POST"> + <?php } + if($GLOBALS['linpha']->sql->isLoggedIn()) { ?> + <?php echo i18n("Welcome").' '.$_SESSION['user_name'].' ('.$_SESSION['user_displayname'].')<br />'; ?> + <input type="hidden" name="cmd" value="logout" /> + <input type="submit" name="submit" value="<?php echo i18n("Logout"); ?>" /> + <?php } else { ?> + <!-- login infos --> + <br /> + <label for="linFormUsername" style="display: block; float: left; width: 80px;"><?php echo i18n("Username"); ?>: </label><input style="width: 105px;" class="linForms" type="text" name="username" value="" id="linFormUsername" /><br /> + <label for="linFormPassword" style="display: block; float: left; width: 80px;"><?php echo i18n("Password"); ?>: </label><input style="width: 105px;" class="linForms" type="password" name="password" value="" id="linFormPassword" /><br /> + <?php if($GLOBALS['linpha']->sql->config->value['sys_session_autologin']) { ?><input type="checkbox" name="rememberme" value="true" id="linFormCheckboxRemember" /><label for="linFormCheckboxRemember"><?php echo i18n("Remember Me"); ?></label><?php } ?> + <input type="hidden" name="cmd" value="login" /> + <input type="submit" name="submit" class="linButton linInputMenu" value="<?php echo i18n("Login"); ?>" /><br /><br /> + <div style="font-size: smaller; border: 0px;"><?php echo i18n("You must have cookies enabled to log in."); ?></div> + <?php } ?> + + </form> + </div> + </li> + </ul> + </li> + </ul> +<?php +break; + +case 'menu_icons': /* menu item 'icons' */ +?> + <!-- icons --> + <div> + <?php if( isset( $this->output['menu_Icons'] ) ) { + echo $this->output['menu_Icons']; + } ?> + </div> +<?php +break; + +case 'menu_guestbook': /* menu item 'guestbook' */ +if( false ) +{ +?> + <!-- guestbook --> + <ul> + <li> + <a href="<?php echo LINPHA_LINK.'&linCat=guestbook'; ?>"><?php echo i18n("Guestbook"); ?></a> + </li> + </ul> +<?php +} +break; + +case 'menu_empty1': /* menu item 'emtpy1' */ +?> + <ul> + <li> + <a href="#">Add here your own Menu items and enable it in the admin settings or template file</a> + </li> + </ul> +<?php +break; + +case 'menu_empty2': /* menu item 'empty2' */ +?> + <ul> + <li> + <a href="#">Add here your own Menu items and enable it in the admin settings or template file</a> + </li> + </ul> +<?php +break; + +/** + * the slideshow controls + */ +case 'slideshow': + ?> + <div id="linDivSlideshowControls"> + <div style="float: left; margin-left: 10px; "> + <a href="javascript:myLinImage.moveFirst()"><img id="linSsImgFirst" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_first.gif" width="25" height="25" border="0" alt="First" title="<?php echo i18n("First"); ?>" /></a> + <a href="javascript:myLinImage.movePrev()"><img id="linSsImgPrev" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_previous.gif" width="25" height="25" border="0" alt="Previous" title="<?php echo i18n("Previous"); ?>" /></a> + <a href="javascript:myLinImage.slideshowStartStop()"><img id="linSsImgStart" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_play.gif" width="25" height="25" border="0" alt="Play" title="<?php echo i18n("Play/Pause"); ?>" /></a> + <!--<a href="javascript:myLinImage.slideshowStop()"><img id="linSsImgStop" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_stop.gif" width="25" height="25" border="0" alt="Stop" title="<?php echo i18n("Stop"); ?>" /></a>--> + <a href="javascript:myLinImage.moveNext()"><img id="linSsImgNext" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_next.gif" width="25" height="25" border="0" alt="Next" title="<?php echo i18n("Next"); ?>" /></a> + <a href="javascript:myLinImage.moveLast()"><img id="linSsImgLast" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_last.gif" width="25" height="25" border="0" alt="Last" title="<?php echo i18n("Last"); ?>" /></a> + </div> + + <div style="float: left; margin-left: 40px; "> + <select id="linSsDelay" name="delay" size="1" class="linForms" onchange="myLinImage.slideshowChangeDelay()" title="<?php echo i18n("Delay"); ?>"> + <option value="3">3 s</option> + <option value="4">4 s</option> + <option value="5" selected="selected">5 s</option> + <option value="10">10 s</option> + <option value="15">15 s</option> + <option value="30">30 s</option> + <option value="45">45 s</option> + <option value="60">60 s</option> + </select> + </div> + + <div style="float: left; margin-left: 10px; "> + <a href="javascript:myLinImage.slideshowChangeLoop()"><img id="linSsImgLoop" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_loop.gif" width="25" height="25" border="0" alt="Loop" title="<?php echo i18n("Enable/disable Loop"); ?>" /></a> + <!--<a href="javascript:myLinImage.slideshowChangeLoop()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_noloop.gif" width="25" height="25" border="0" /></a>--> + <a href="javascript:myLinImage.slideshowChangeRandom()"><img id="linSsImgRandom" src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_norandom.gif" width="25" height="25" border="0" alt="Random" title="<?php echo i18n("Enable/disable Random Play Order"); ?>" /></a> + <!--<a href="javascript:myLinImage.slideshowChangeRandom()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_random.gif" width="25" height="25" border="0" /></a>--> + </div> + + <div id="linDivSlideshowImgNr" style="float: left; margin-left: 40px; "></div> + + <div id="linDivSlideshowExit" style="float: left; margin-left: 40px; "> + <a href="javascript:myLinImage.fullscreenStop()"><img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/ss_stop.gif" width="25" height="25" border="0" alt="Exit" title="<?php echo i18n("Exit Fullscreen"); ?>" ></a> + </div> + + <div style="clear: both;"></div> + </div> + <?php echo $linTpl->divRoundCorners('bottom','alpha'); ?> +<?php +break; + + +/** + * view meta + */ +case 'edit_meta': + if($GLOBALS['linpha']->sql->checkPermission('metadata_edit')) { ?> + + <?php + /** + * @todo thats not the correct way including css files... :-/ + */ + ?> + <link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'.$this->template_name.'/themes/default/css/admin.css'; ?>' type='text/css'> + + <?php if($GLOBALS['linpha']->imgview->img_type!=0) { ?> + <ul class="linUlMenu"> + <li><a id="linAMetaLinpha" href="javascript:showMetaLinpha()">LinPHA MetaData</a></li> + <li><a id="linAMetaIptc" href="javascript:showMetaIptc()">IPTC MetaData</a></li> + <li><a id="linAMetaXmp" href="javascript:showMetaXmp()">XMP MetaData</a></li> + </ul> + <?php } /* end if img_type!=0 */ ?> + + <div id="linDivMetaLinpha"> + <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> + <table border="0" style="float: left;"> + <?php echo $linTpl->output['meta_linpha']; ?> + <tr> + <td rowspan="2"> + <br /> + <input type="hidden" name="linCmd" value="linInsertMetaLinpha" /> + <input type="submit" class="linButton" name="submit" value="<?php echo i18n("Submit"); ?>" /> + </td> + </tr> + </table> + </form> + </div> + + <?php if($GLOBALS['linpha']->imgview->img_type!=0) { ?> + <div id="linDivMetaIptc"> + <?php if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) { + echo '<br />'; + if($meta_edit_possible) { ?> + <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> + <table border="0"> + <?php + include(LINPHA_DIR.'/lib/include/metadata_iptc_edit.php'); + ?> + <tr> + <td rowspan="2"> + <br /> + <input type="hidden" name="linCmd" value="linInsertMetaIptc" /> + <input type="submit" class="linButton" name="submit" value="<?php echo i18n("Submit"); ?>" /> + </td> + </tr> + </form> + </table> + <br> + <br> + <p>Powered by: <a href="http://owl.phy.queensu.ca/~phil/exiftool/" >ExifTool</a></p> + <?php + } else { + echo i18n("Error: File not writable. Please check the file permissions."); /* @todo use unified language string */ + } + } else { + echo i18n("IPTC Is Currently Disabled.").'<br /><br />'; + if($GLOBALS['linpha']->sql->isAdmin()) { + echo '<a href="'.LINPHA_CLIENT.'/admin/?cat=metadata_define_iptc">'.i18n("Enable IPTC").'</a>'; + echo '<br /><br />'; + } + } ?> + </div> + <?php } /* end if img_type!=0 */ ?> + + <?php if($GLOBALS['linpha']->imgview->img_type!=0) { ?> + <div id="linDivMetaXmp"> + <?php if($GLOBALS['linpha']->sql->config->value['sys_image_xmp']) { + echo '<br />'; + if($meta_edit_possible) { ?> + <form action="<?php echo $linTpl->URL_full; ?>" method="POST"> + <table border="0"> + <?php + include(LINPHA_DIR.'/lib/include/metadata_xmp_edit.php'); + ?> + <tr> + <td rowspan="2"> + <br /> + <input type="hidden" name="linCmd" value="linInsertMetaXmp" /> + <input type="submit" class="linButton" name="submit" value="<?php echo i18n("Submit"); ?>" /> + </td> + </tr> + </form> + </table> + <br> + <br> + <p>Powered by: <a href="http://owl.phy.queensu.ca/~phil/exiftool/" >ExifTool</a></p> + <?php + } else { + echo i18n("Error: File not writable. Please check the file permissions."); /* @todo use unified language string */ + } + } else { + echo i18n("XMP Is Currently Disabled.").'<br /><br />'; + if($GLOBALS['linpha']->sql->isAdmin()) { + echo '<a href="'.LINPHA_CLIENT.'/admin/?cat=metadata_define_xmp">'.i18n("Enable XMP").'</a>'; + echo '<br /><br />'; + } + } ?> + </div> + <?php } /* end if img_type!=0 */ ?> + </form> + + <div style="clear: both;"></div> + + <?php if($GLOBALS['linpha']->imgview->img_type!=0) { ?> + <script language="JavaScript" type="text/javascript"> + <!-- + function showMetaLinpha() + { + $('linAMetaLinpha').className = 'current'; + $('linAMetaIptc').className = ''; + $('linAMetaXmp').className = ''; + Element.hide('linDivMetaIptc'); + Element.hide('linDivMetaXmp'); + Element.show('linDivMetaLinpha'); + } + function showMetaIptc() + { + $('linAMetaLinpha').className = ''; + $('linAMetaXmp').className = ''; + $('linAMetaIptc').className = 'current'; + Element.hide('linDivMetaLinpha'); + Element.hide('linDivMetaXmp'); + Element.show('linDivMetaIptc'); + } + function showMetaXmp() + { + $('linAMetaLinpha').className = ''; + $('linAMetaIptc').className = ''; + $('linAMetaXmp').className = 'current'; + Element.hide('linDivMetaLinpha'); + Element.hide('linDivMetaIptc'); + Element.show('linDivMetaXmp'); + } + showMetaLinpha(); + --> + </script> + <?php } /* end if img_type!=0 */ ?> + + <?php } /* end if checkPermission('metadata_edit') */ ?> + + <?php +break; +} +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-20 19:06:06
|
Revision: 4889 http://linpha.svn.sourceforge.net/linpha/?rev=4889&view=rev Author: fangehrn Date: 2008-02-20 11:05:55 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Added Paths: ----------- trunk/linpha2/templates/misc/roundCorners.css Copied: trunk/linpha2/templates/misc/roundCorners.css (from rev 4888, trunk/misc/design/14cornersSchill/roundCorners.css) =================================================================== --- trunk/linpha2/templates/misc/roundCorners.css (rev 0) +++ trunk/linpha2/templates/misc/roundCorners.css 2008-02-20 19:05:55 UTC (rev 4889) @@ -0,0 +1,50 @@ + +.linCorn { + position:relative; + margin:0px auto; + z-index:1; + margin-left:15px; /* default, width of left corner */ + margin-bottom:0.5em; /* spacing under dialog */ +} + +.linCorn .linCornC { + position:relative; + zoom:1; + _overflow-y:hidden; + padding:5px 15px 0px 0px; +} + +.linCorn .linCornT { + /* top+left vertical slice */ + position:absolute; + left:0px; + top:0px; + width:15px; /* top slice width */ + margin-left:-15px; + height:100%; + _height:1600px; /* arbitrary long height, IE 6 */ + background-position:top left; +} + +.linCorn .linCornB { + /* bottom */ + position:relative; + width:100%; +} + +.linCorn .linCornB, +.linCorn .linCornB div { + height:15px; /* height of bottom cap/shade */ + font-size:1px; +} + +.linCorn .linCornB { + background-position:bottom right; +} + +.linCorn .linCornB div { + position:relative; + width:15px; /* bottom corner width */ + margin-left:-15px; + background-position:bottom left; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-20 19:03:51
|
Revision: 4888 http://linpha.svn.sourceforge.net/linpha/?rev=4888&view=rev Author: fangehrn Date: 2008-02-20 11:03:49 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Added Paths: ----------- trunk/linpha2/templates/misc/box_test.php Copied: trunk/linpha2/templates/misc/box_test.php (from rev 4887, trunk/misc/design/14cornersSchill/box_test.php) =================================================================== --- trunk/linpha2/templates/misc/box_test.php (rev 0) +++ trunk/linpha2/templates/misc/box_test.php 2008-02-20 19:03:49 UTC (rev 4888) @@ -0,0 +1,6 @@ +<img src="box.php" width="200" height="100" /><br /><br /> +<img src="box.php?col=orange&r=50&w=100&h=100" /><br /><br /> +<img src="box.php?col=87CEFA&w=200&h=100" /><br /><br /> +<img src="box.php?col=red&r=5&w=50&h=25" /><br /><br /> +<img src="box.php?col=lightcyan&w=30&h=150" /><br /><br /> +<img src="box.php" /><br /><br /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-20 19:02:49
|
Revision: 4887 http://linpha.svn.sourceforge.net/linpha/?rev=4887&view=rev Author: fangehrn Date: 2008-02-20 11:02:48 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Added Paths: ----------- trunk/linpha2/templates/misc/box.php Copied: trunk/linpha2/templates/misc/box.php (from rev 4886, trunk/misc/design/14cornersSchill/box.php) =================================================================== --- trunk/linpha2/templates/misc/box.php (rev 0) +++ trunk/linpha2/templates/misc/box.php 2008-02-20 19:02:48 UTC (rev 4887) @@ -0,0 +1,60 @@ +<?php +if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','../../../linpha2'); } + +include_once( LINPHA_DIR.'/lib/classes/linpha.color.class.php' ); + +$col = (isset($_GET['col']) ? $_GET['col'] : '87CEFA'); +$rad = (isset($_GET['r']) ? intval($_GET['r']) : 15); +$width = (isset($_GET['w']) ? intval($_GET['w']) : 2000); +$height = (isset($_GET['h']) ? intval($_GET['h']) : 1000); + + +// create image +$image = imagecreate($width, $height); +$img_corners = imagecreate(2*$rad+1, 2*$rad+1); + +// create transparent background +$colourBlack = imagecolorallocate($img_corners, 255, 255, 255); +imagecolortransparent($img_corners, $colourBlack); + +$colourBlack2 = imagecolorallocate($image, 255, 255, 255); +imagecolortransparent($image, $colourBlack2); + + +// create colors +$rgb = LinColor::getRgbFromAll($col); +$color = imagecolorallocate($img_corners, $rgb['r'], $rgb['g'], $rgb['b']); // must be after imagecolortransparent() +$color2 = imagecolorallocate($image, $rgb['r'], $rgb['g'], $rgb['b']); // must be after imagecolortransparent() + +// fill image +imagefilledrectangle ($image, 0, $rad, $width-1, $height-$rad-1, $color ); +imagefilledrectangle ($image, $rad, 0, $width-$rad-1, $rad-1, $color ); +imagefilledrectangle ($image, $rad, $height-$rad, $width-$rad-1, $height, $color ); + +// draw and copy circle +imagefilledellipse($img_corners, $rad, $rad, ($rad*2)+1, ($rad*2)+1, $color); +imagecopy($image, $img_corners, 0, 0, 0, 0, $rad, $rad); +imagecopy($image, $img_corners, $width-$rad, 0, $rad+1, 0, $rad, $rad); +imagecopy($image, $img_corners, 0, $height-$rad, 0, $rad+1, $rad, $rad); +imagecopy($image, $img_corners, $width-$rad, $height-$rad, $rad+1, $rad+1, $rad, $rad); + + +// flush image +header('Content-type: image/gif'); + +/** + * force caching in browser + * works in firefox and internet explorer + */ +header("Last-Modified: " . gmdate("D, d M Y H:i:s",gmmktime (0,0,0,1,1,2000))); // Date in the past +header("Expires: Mon, 26 Jul 2100 05:00:00 GMT"); // In other words... never expire the image +header("Cache-Control: max-age=10000000, s-maxage=1000000, proxy-revalidate, must-revalidate"); + + +imagegif($image); + +imagedestroy($image); +imagedestroy($img_corners); + + +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-20 19:01:17
|
Revision: 4886 http://linpha.svn.sourceforge.net/linpha/?rev=4886&view=rev Author: fangehrn Date: 2008-02-20 11:01:10 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.color.class.php trunk/linpha2/lib/plugins/watermark/watermark.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-20 19:00:48 UTC (rev 4885) +++ trunk/linpha2/ChangeLog 2008-02-20 19:01:10 UTC (rev 4886) @@ -1,4 +1,8 @@ +2008-02-20 flo + * moved func.watermark.php to classes/linpha.color.class.php + they are used at several other places + 2008-02-17 flo * implemented adodb datadict - mysql works Modified: trunk/linpha2/lib/classes/linpha.color.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.color.class.php 2008-02-20 19:00:48 UTC (rev 4885) +++ trunk/linpha2/lib/classes/linpha.color.class.php 2008-02-20 19:01:10 UTC (rev 4886) @@ -19,157 +19,10 @@ if(!defined('LINPHA_DIR')) { exit(1); } -class LinWatermark +class LinColor { /** -* @author flo -* @todo adapt from linpha1 -*/ -static function needWatermark($imgid) -{ - if( $GLOBALS['linpha']->sql->config->value['plugins_active_wm'] - && $GLOBALS['linpha']->sql->config->value['plugins_wm_active'] - && !check_permissions('watermark',$imgid) ) - { - return true; - } else { - return false; - } -} - -/** - * returns array with all the configs and the default values, they are only defined here - */ -static function getWatermarkArray() -{ - return array ( - 'wm_active' => "0", - 'wm_watermark' => "0", - 'wm_text' => "Copyright 2007", - 'wm_font' => "", - 'wm_fontsize' => "20", - 'wm_fontcolor' => "white", - 'wm_align' => "southwest", - 'wm_horizontal' => "0", - 'wm_vertical' => "0", - 'wm_enable_shadow' => "1", - 'wm_shadow_size' => "1", - 'wm_shadow_fontsize' => "20", - 'wm_shadow_color' => "black", - 'wm_enable_rectangle' => "1", - 'wm_rectangle_color' => "darkgrey", - 'wm_height' => "30", - 'wm_width' => "145", - 'wm_img_img' => "", - 'wm_dissolve' => "75%", - 'wm_resize' => "30" - ); -} - -static function readWatermark() -{ - $arr_config = LinWatermark::getWatermarkArray(); - while(list($name,$value) = each($arr_config) ) - { - $arr_read[$name] = $GLOBALS['linpha']->sql->config->value['plugins_'.$name]; - } - return $arr_read; -} - -static function updateWatermark() -{ - $arr_config = LinWatermark::getWatermarkArray(); - while(list($name,$value) = each($arr_config) ) - { - $GLOBALS['linpha']->sql->config->updateConfig($name,$_POST[$name]); - } -} - -/** - * restore watermark settings to initial settings or to examples - */ -static function restoreWatermark() -{ - global $wm_restore_to; - - $arr_config = LinWatermark::getWatermarkArray(); - switch($_POST['setdefault']) - { - case 'initial': - break; - case 'settings1': - $arr_config['wm_watermark'] = 1; - $arr_config['wm_text'] = "(C) 2004 linpha.sf.net"; - $arr_config['wm_fontsize'] = "10"; - $arr_config['wm_fontcolor'] = "white"; - $arr_config['wm_align'] = "south"; - $arr_config['wm_horizontal'] = "0"; - $arr_config['wm_vertical'] = "0"; - $arr_config['wm_enable_rectangle'] = "1"; - $arr_config['wm_rectangle_color'] = "darkgrey"; - $arr_config['wm_enable_shadow'] = "2"; - $arr_config['wm_height'] = "20"; - $arr_config['wm_width'] = "2000"; - $arr_config['wm_resize'] = "no"; - break; - case 'settings2': - $arr_config['wm_watermark'] = 2; - $arr_config['wm_dissolve'] = "65%"; - $arr_config['wm_align'] = "southwest"; - $arr_config['wm_img_img'] = "linpha.png"; - $arr_config['wm_horizontal'] = "10"; - $arr_config['wm_vertical'] = "10"; - $arr_config['wm_resize'] = "30"; - - break; - case 'settings3': // maybe better for gd lib than for convert - $arr_config['wm_watermark'] = 1; - $arr_config['wm_dissolve'] = "100%"; - $arr_config['wm_align'] = "southwest"; - $arr_config['wm_text'] = "(C) 2004 linpha.sf.net"; - $arr_config['wm_fontsize'] = "20"; - $arr_config['wm_fontcolor'] = "white"; - $arr_config['wm_horizontal'] = "0"; - $arr_config['wm_vertical'] = "0"; - $arr_config['wm_enable_rectangle'] = "1"; - $arr_config['wm_rectangle_color'] = "darkgrey"; - $arr_config['wm_enable_shadow'] = "1"; - $arr_config['wm_shadow_size'] = "5"; - $arr_config['wm_shadow_fontsize'] = "2"; - $arr_config['wm_height'] = "30"; - $arr_config['wm_width'] = "260"; - $arr_config['wm_resize'] = "no"; - break; - } - while(list($name,$value) = each($arr_config) ) - { - $GLOBALS['linpha']->sql->config->updateConfig($name,$value); - } -} - -/** - * calcs the new height and width of the resized watermark - * $w, $h: size of the big image - * $org_width, $org_height: size of the watermark rectangle/image - * $resize: resize factor in percent - * - */ -static function wmArrResized($w,$h,$org_width,$org_height,$resize) -{ - $arr_resized['w'] = round($w * $resize/100); - $arr_resized['h'] = round($h * $resize/100); - - $no_increase = 0; - $array = LinImage::scaleToFit($org_height,$org_width,$arr_resized['h'],$arr_resized['w'],$no_increase); - - //error_log('w: '.$w.' h: '.$h.' arr_resized_w: '.$arr_resized['w'].' arr_resized_h: '.$arr_resized['h']. - // ' org_w: '.$org_width.' org_h: '.$org_height.' scaleToFit w: '.$array['w'].' h: '.$array['h']); - - return $array; -} - -/** * list with many available colors * http://mail.gnu.org/archive/html/emacs-diffs/2002-06/msg00158.html * @uses getRgbFromAll() @@ -392,13 +245,13 @@ switch(strlen($string)) { case 6: - if(LinWatermark::everyCharIsHex($string)) { + if(LinColor::everyCharIsHex($string)) { return 1; } break; case 7: if(substr($string,0,1)=="#") { - if(LinWatermark::everyCharIsHex(substr($string,1,6))) { + if(LinColor::everyCharIsHex(substr($string,1,6))) { return 1; } } @@ -440,13 +293,13 @@ */ static function getRgbFromAll($string) { - if( isset( LinWatermark::$Colors[$string]) ) + if( isset( LinColor::$Colors[$string]) ) { - return LinWatermark::getRgbFromHtml( LinWatermark::$Colors[$string] ); + return LinColor::getRgbFromHtml( LinColor::$Colors[$string] ); } - elseif(LinWatermark::isHtmlColor($string) ) + elseif(LinColor::isHtmlColor($string) ) { - return LinWatermark::getRgbFromHtml( $string ); + return LinColor::getRgbFromHtml( $string ); } else { @@ -461,7 +314,7 @@ */ static function getHtmlFromAll($string) { - if(LinWatermark::isHtmlColor($string)) + if(LinColor::isHtmlColor($string)) { if(substr($string,0,1)=="#") { @@ -474,9 +327,9 @@ } else { - if( isset( LinWatermark::$Colors[$string]) ) + if( isset( LinColor::$Colors[$string]) ) { - return substr(LinWatermark::$Colors[$string],1,6); + return substr(LinColor::$Colors[$string],1,6); } else { @@ -485,63 +338,5 @@ } } -/** - * @uses watermark_gd() - * calcs the position in pixel with a given align - * src_w, src_h: width and height from the textfield (or the small watermark image) - * dst_w, dst_h: width and height from the image - * pos_x, pos_y: additional adjust for the image - * - */ -static function calcAlign($align, $src_w, $src_h, $dst_w, $dst_h, $pos_x, $pos_y) -{ - - switch($align) - { - case "center": - $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); - $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); - break; - case "east": - $arr_pos['x'] = $dst_w-$src_w+($pos_x); - $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); - break; - case "west": - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); - break; - case "north": - $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); - $arr_pos['y'] = $pos_y; - break; - case "south": - $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); - $arr_pos['y'] = $dst_h-$src_h+($pos_y); - break; - case "northeast": - $arr_pos['x'] = $dst_w-$src_w+($pos_x); - $arr_pos['y'] = $pos_y; - break; - case "northwest": - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = $pos_y; - break; - case "southwest": - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = $dst_h-$src_h+($pos_y); - break; - case "southeast": - $arr_pos['x'] = $dst_w-$src_w+($pos_x); - $arr_pos['y'] = $dst_h-$src_h+($pos_y); - break; - default: - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = $pos_y; - break; - - } - return $arr_pos; } - -} ?> \ No newline at end of file Modified: trunk/linpha2/lib/plugins/watermark/watermark.class.php =================================================================== --- trunk/linpha2/lib/plugins/watermark/watermark.class.php 2008-02-20 19:00:48 UTC (rev 4885) +++ trunk/linpha2/lib/plugins/watermark/watermark.class.php 2008-02-20 19:01:10 UTC (rev 4886) @@ -170,323 +170,7 @@ } /** - * list with many available colors - * http://mail.gnu.org/archive/html/emacs-diffs/2002-06/msg00158.html - * @uses getRgbFromAll() - */ -static $Colors = array( - 'aliceblue'=>'#f0f8ff', - 'antiquewhite'=>'#faebd7', - 'aquamarine'=>'#7fffd4', - 'azure'=>'#f0ffff', - 'beige'=>'#f5f5dc', - 'bisque'=>'#ffe4c4', - 'black'=>'#000000', - 'blanchedalmond'=>'#ffebcd', - 'blue'=>'#0000ff', - 'blueviolet'=>'#8a2be2', - 'brown'=>'#a52a2a', - 'burlywood'=>'#deb887', - 'cadetblue'=>'#5f9ea0', - 'chartreuse'=>'#7fff00', - 'chocolate'=>'#d2691e', - 'coral'=>'#ff7f50', - 'cornflowerblue'=>'#6495ed', - 'cornsilk'=>'#fff8dc', - 'cyan'=>'#00ffff', - 'darkblue'=>'#00008b', - 'darkcyan'=>'#008b8b', - 'darkgoldenrod'=>'#b886011', - 'darkgray'=>'#a9a9a9', - 'darkgreen'=>'#006400', - 'darkgrey'=>'#a9a9a9', - 'darkkhaki'=>'#bdb76b', - 'darkmagenta'=>'#8b008b', - 'darkolivegreen'=>'#556b2f', - 'darkorange'=>'#ff8c00', - 'darkorchid'=>'#9932cc', - 'darkred'=>'#8b0000', - 'darksalmon'=>'#e9967a', - 'darkseagreen'=>'#8fbc8f', - 'darkslateblue'=>'#483d8b', - 'darkslategray'=>'#2f4f4f', - 'darkslategrey'=>'#2f4f4f', - 'darkturquoise'=>'#00ced1', - 'darkviolet'=>'#9400d3', - 'deeppink'=>'#ff1493', - 'deepskyblue'=>'#00bfff', - 'dimgray'=>'#696969', - 'dimgrey'=>'#696969', - 'dodgerblue'=>'#1e90ff', - 'firebrick'=>'#b22222', - 'floralwhite'=>'#fffaf0', - 'forestgreen'=>'#228b22', - 'gainsboro'=>'#dcdcdc', - 'ghostwhite'=>'#f8f8ff', - 'gold'=>'#ffd700', - 'goldenrod'=>'#daa520', - 'gray'=>'#bebebe', - 'green'=>'#00ff00', - 'greenyellow'=>'#adff2f', - 'honeydew'=>'#f0fff0', - 'hotpink'=>'#ff69b4', - 'indianred'=>'#cd5c5c', - 'ivory'=>'#fffff0', - 'khaki'=>'#f0e68c', - 'lavender'=>'#e6e6fa', - 'lavenderblush'=>'#fff0f5', - 'lawngreen'=>'#7cfc00', - 'lemonchiffon'=>'#fffacd', - 'lightblue'=>'#add8e6', - 'lightcoral'=>'#f08080', - 'lightcyan'=>'#e0ffff', - 'lightgoldenrod'=>'#eedd82', - 'lightgoldenrodyellow'=>'#fafad2', - 'lightgray'=>'#d3d3d3', - 'lightgreen'=>'#90ee90', - 'lightgrey'=>'#d3d3d3', - 'lightpink'=>'#ffb6c1', - 'lightred'=>'#ffc8c8', - 'lightsalmon'=>'#ffa07a', - 'lightseagreen'=>'#20b2aa', - 'lightskyblue'=>'#87cefa', - 'lightslateblue'=>'#8470ff', - 'lightslategray'=>'#778899', - 'lightsteelblue'=>'#b0c4de', - 'lightyellow'=>'#ffffe0', - 'limegreen'=>'#32cd32', - 'linen'=>'#faf0e6', - 'magenta'=>'#ff00ff', - 'maroon'=>'#b03060', - 'mediumaquamarine'=>'#66cdaa', - 'mediumblue'=>'#0000cd', - 'mediumorchid'=>'#ba55d3', - 'mediumpurple'=>'#9370db', - 'mediumseagreen'=>'#3cb371', - 'mediumslateblue'=>'#7b68ee', - 'mediumspringgreen'=>'#00fa9a', - 'mediumturquoise'=>'#48d1cc', - 'mediumvioletred'=>'#c71585', - 'midnightblue'=>'#191970', - 'mintcream'=>'#f5fffa', - 'mistyrose'=>'#ffe4e1', - 'moccasin'=>'#ffe4b5', - 'navajowhite'=>'#ffdead', - 'navy'=>'#000080', - 'navyblue'=>'#000080', - 'oldlace'=>'#fdf5e6', - 'olivedrab'=>'#6b8e23', - 'orange'=>'#ffa500', - 'orangered'=>'#ff4500', - 'orchid'=>'#da70d6', - 'palegoldenrod'=>'#eee8aa', - 'palegreen'=>'#98fb98', - 'paleturquoise'=>'#afeeee', - 'palevioletred'=>'#db7093', - 'papayawhip'=>'#ffefd5', - 'peachpuff'=>'#ffdab9', - 'peru'=>'#cd853f', - 'pink'=>'#ffc0cb', - 'plum'=>'#dda0dd', - 'powderblue'=>'#b0e0e6', - 'purple'=>'#a020f0', - 'red'=>'#ff0000', - 'rosybrown'=>'#bc8f8f', - 'royalblue'=>'#4169e1', - 'saddlebrown'=>'#8b4513', - 'salmon'=>'#fa8072', - 'sandybrown'=>'#f4a460', - 'seagreen'=>'#2e8b57', - 'seashell'=>'#fff5ee', - 'sienna'=>'#a0522d', - 'skyblue'=>'#87ceeb', - 'slateblue'=>'#6a5acd', - 'slategray'=>'#708090', - 'slategrey'=>'#708090', - 'snow'=>'#fffafa', - 'springgreen'=>'#00ff7f', - 'steelblue'=>'#4682b4', - 'tan'=>'#d2b48c', - 'thistle'=>'#d8bfd8', - 'tomato'=>'#ff6347', - 'turquoise'=>'#40e0d0', - 'violet'=>'#ee82ee', - 'violetred'=>'#d02090', - 'wheat'=>'#f5deb3', - 'white'=>'#ffffff', - 'yellow'=>'#ffff00', - 'yellowgreen'=>'#9acd32' -); - -/** - * not used anymore - */ -static function getHtmlColorFromRgb($r,$g,$b) -{ - if(strlen(dechex($r))==1) { - $r = '0'.$r; - } else { - $r = dechex($r); - } - if(strlen(dechex($g))==1) { - $g = '0'.$g; - } else { - $g = dechex($g); - } - if(strlen(dechex($b))==1) { - $b = '0'.$b; - } else { - $b = dechex($b); - } - - return '#'.$r.$g.$b; -} - -/** - * used to check if it is a valid html color - * @uses isHtmlColor() - */ -static function everyCharIsHex($string) -{ - for($i=0;$i<strlen($string);$i++) - { - $char = substr($string,$i,1); - $valid_color = false; - - if($char == "0") { // zero makes problems... '== 0' and '== "0"' is not the same... - $valid_color = true; - } - for($n=1;$n<=9;$n++) - { - if($char == $n) { - $valid_color = true; - } - } - - for($n='a';$n<='f';$n++) - { - if($char === $n) { - $valid_color = true; - } - } - - for($n='A';$n<='F';$n++) - { - if($char === $n) { - $valid_color = true; - } - } - if(!$valid_color) { - return 0; - } - } - return 1; -} - -/** - * used to check if it is a valid html color - * @uses getRgbFromAll() - */ -static function isHtmlColor($string) -{ - switch(strlen($string)) - { - case 6: - if(LinWatermark::everyCharIsHex($string)) { - return 1; - } - break; - case 7: - if(substr($string,0,1)=="#") { - if(LinWatermark::everyCharIsHex(substr($string,1,6))) { - return 1; - } - } - break; - } - return 0; -} - -/** - * converts a html color to an array with the rgb values - * it doesn't matter if the html color is '#00FF00' or '00FF00' - * @uses getRgbFromAll() - */ -static function getRgbFromHtml($string) -{ - switch(strlen($string)) - { - case 6: - break; - case 7: - $string = substr($string,1,6); - break; - } - $r_hex = substr($string,0,2); - $g_hex = substr($string,2,2); - $b_hex = substr($string,4,2); - $arr['r'] = hexdec($r_hex); - $arr['g'] = hexdec($g_hex); - $arr['b'] = hexdec($b_hex); - return $arr; -} - -/** - * returns an array with the rgb values - * it doesn't matter if the argument is 'darkblue', '#00FF55' or '00FF55' - * if it isn't a correct color, the color (0,0,0) is returned - * * @uses watermark_gd() - */ -static function getRgbFromAll($string) -{ - if( isset( LinWatermark::$Colors[$string]) ) - { - return LinWatermark::getRgbFromHtml( LinWatermark::$Colors[$string] ); - } - elseif(LinWatermark::isHtmlColor($string) ) - { - return LinWatermark::getRgbFromHtml( $string ); - } - else - { - array('r'=>0,'g'=>0,'b'=>0); - } -} - -/** - * return html color without '#' - * - * used in linpha2 - admin - settings_layout - */ -static function getHtmlFromAll($string) -{ - if(LinWatermark::isHtmlColor($string)) - { - if(substr($string,0,1)=="#") - { - return substr($string,1,6); - } - else - { - return $string; - } - } - else - { - if( isset( LinWatermark::$Colors[$string]) ) - { - return substr(LinWatermark::$Colors[$string],1,6); - } - else - { - return 'ffffff'; - } - } -} - -/** - * @uses watermark_gd() * calcs the position in pixel with a given align * src_w, src_h: width and height from the textfield (or the small watermark image) * dst_w, dst_h: width and height from the image This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-20 19:00:50
|
Revision: 4885 http://linpha.svn.sourceforge.net/linpha/?rev=4885&view=rev Author: fangehrn Date: 2008-02-20 11:00:48 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Modified Paths: -------------- trunk/misc/design/14cornersSchill/box.php Modified: trunk/misc/design/14cornersSchill/box.php =================================================================== --- trunk/misc/design/14cornersSchill/box.php 2008-02-20 18:41:18 UTC (rev 4884) +++ trunk/misc/design/14cornersSchill/box.php 2008-02-20 19:00:48 UTC (rev 4885) @@ -1,7 +1,7 @@ <?php -if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','../..'); } +if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','../../../linpha2'); } -include_once( './func.watermark.php' ); +include_once( LINPHA_DIR.'/lib/classes/linpha.color.class.php' ); $col = (isset($_GET['col']) ? $_GET['col'] : '87CEFA'); $rad = (isset($_GET['r']) ? intval($_GET['r']) : 15); @@ -22,7 +22,7 @@ // create colors -$rgb = LinWatermark::getRgbFromAll($col); +$rgb = LinColor::getRgbFromAll($col); $color = imagecolorallocate($img_corners, $rgb['r'], $rgb['g'], $rgb['b']); // must be after imagecolortransparent() $color2 = imagecolorallocate($image, $rgb['r'], $rgb['g'], $rgb['b']); // must be after imagecolortransparent() @@ -46,10 +46,11 @@ * force caching in browser * works in firefox and internet explorer */ -header("Last-Modified: " . gmdate("D, d M Y H:i:s",mktime (0,0,0,1,1,2000)) . " GMT"); // Date in the past +header("Last-Modified: " . gmdate("D, d M Y H:i:s",gmmktime (0,0,0,1,1,2000))); // Date in the past header("Expires: Mon, 26 Jul 2100 05:00:00 GMT"); // In other words... never expire the image header("Cache-Control: max-age=10000000, s-maxage=1000000, proxy-revalidate, must-revalidate"); - + + imagegif($image); imagedestroy($image); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-20 18:41:38
|
Revision: 4884 http://linpha.svn.sourceforge.net/linpha/?rev=4884&view=rev Author: fangehrn Date: 2008-02-20 10:41:18 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Added Paths: ----------- trunk/linpha2/lib/plugins/watermark/watermark.class.php Copied: trunk/linpha2/lib/plugins/watermark/watermark.class.php (from rev 4883, trunk/linpha2/lib/classes/linpha.color.class.php) =================================================================== --- trunk/linpha2/lib/plugins/watermark/watermark.class.php (rev 0) +++ trunk/linpha2/lib/plugins/watermark/watermark.class.php 2008-02-20 18:41:18 UTC (rev 4884) @@ -0,0 +1,547 @@ +<?php +/* +* Copyright (c) 2004 Heiko Rutenbeck <bz...@tu...> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +if(!defined('LINPHA_DIR')) { exit(1); } + +class LinWatermark +{ + +/** +* @author flo +* @todo adapt from linpha1 +*/ +static function needWatermark($imgid) +{ + if( $GLOBALS['linpha']->sql->config->value['plugins_active_wm'] + && $GLOBALS['linpha']->sql->config->value['plugins_wm_active'] + && !check_permissions('watermark',$imgid) ) + { + return true; + } else { + return false; + } +} + +/** + * returns array with all the configs and the default values, they are only defined here + */ +static function getWatermarkArray() +{ + return array ( + 'wm_active' => "0", + 'wm_watermark' => "0", + 'wm_text' => "Copyright 2007", + 'wm_font' => "", + 'wm_fontsize' => "20", + 'wm_fontcolor' => "white", + 'wm_align' => "southwest", + 'wm_horizontal' => "0", + 'wm_vertical' => "0", + 'wm_enable_shadow' => "1", + 'wm_shadow_size' => "1", + 'wm_shadow_fontsize' => "20", + 'wm_shadow_color' => "black", + 'wm_enable_rectangle' => "1", + 'wm_rectangle_color' => "darkgrey", + 'wm_height' => "30", + 'wm_width' => "145", + 'wm_img_img' => "", + 'wm_dissolve' => "75%", + 'wm_resize' => "30" + ); +} + +static function readWatermark() +{ + $arr_config = LinWatermark::getWatermarkArray(); + while(list($name,$value) = each($arr_config) ) + { + $arr_read[$name] = $GLOBALS['linpha']->sql->config->value['plugins_'.$name]; + } + return $arr_read; +} + +static function updateWatermark() +{ + $arr_config = LinWatermark::getWatermarkArray(); + while(list($name,$value) = each($arr_config) ) + { + $GLOBALS['linpha']->sql->config->updateConfig($name,$_POST[$name]); + } +} + +/** + * restore watermark settings to initial settings or to examples + */ +static function restoreWatermark() +{ + global $wm_restore_to; + + $arr_config = LinWatermark::getWatermarkArray(); + switch($_POST['setdefault']) + { + case 'initial': + break; + case 'settings1': + $arr_config['wm_watermark'] = 1; + $arr_config['wm_text'] = "(C) 2004 linpha.sf.net"; + $arr_config['wm_fontsize'] = "10"; + $arr_config['wm_fontcolor'] = "white"; + $arr_config['wm_align'] = "south"; + $arr_config['wm_horizontal'] = "0"; + $arr_config['wm_vertical'] = "0"; + $arr_config['wm_enable_rectangle'] = "1"; + $arr_config['wm_rectangle_color'] = "darkgrey"; + $arr_config['wm_enable_shadow'] = "2"; + $arr_config['wm_height'] = "20"; + $arr_config['wm_width'] = "2000"; + $arr_config['wm_resize'] = "no"; + break; + case 'settings2': + $arr_config['wm_watermark'] = 2; + $arr_config['wm_dissolve'] = "65%"; + $arr_config['wm_align'] = "southwest"; + $arr_config['wm_img_img'] = "linpha.png"; + $arr_config['wm_horizontal'] = "10"; + $arr_config['wm_vertical'] = "10"; + $arr_config['wm_resize'] = "30"; + + break; + case 'settings3': // maybe better for gd lib than for convert + $arr_config['wm_watermark'] = 1; + $arr_config['wm_dissolve'] = "100%"; + $arr_config['wm_align'] = "southwest"; + $arr_config['wm_text'] = "(C) 2004 linpha.sf.net"; + $arr_config['wm_fontsize'] = "20"; + $arr_config['wm_fontcolor'] = "white"; + $arr_config['wm_horizontal'] = "0"; + $arr_config['wm_vertical'] = "0"; + $arr_config['wm_enable_rectangle'] = "1"; + $arr_config['wm_rectangle_color'] = "darkgrey"; + $arr_config['wm_enable_shadow'] = "1"; + $arr_config['wm_shadow_size'] = "5"; + $arr_config['wm_shadow_fontsize'] = "2"; + $arr_config['wm_height'] = "30"; + $arr_config['wm_width'] = "260"; + $arr_config['wm_resize'] = "no"; + break; + } + while(list($name,$value) = each($arr_config) ) + { + $GLOBALS['linpha']->sql->config->updateConfig($name,$value); + } +} + +/** + * calcs the new height and width of the resized watermark + * $w, $h: size of the big image + * $org_width, $org_height: size of the watermark rectangle/image + * $resize: resize factor in percent + * + */ +static function wmArrResized($w,$h,$org_width,$org_height,$resize) +{ + $arr_resized['w'] = round($w * $resize/100); + $arr_resized['h'] = round($h * $resize/100); + + $no_increase = 0; + $array = LinImage::scaleToFit($org_height,$org_width,$arr_resized['h'],$arr_resized['w'],$no_increase); + + //error_log('w: '.$w.' h: '.$h.' arr_resized_w: '.$arr_resized['w'].' arr_resized_h: '.$arr_resized['h']. + // ' org_w: '.$org_width.' org_h: '.$org_height.' scaleToFit w: '.$array['w'].' h: '.$array['h']); + + return $array; +} + +/** + * list with many available colors + * http://mail.gnu.org/archive/html/emacs-diffs/2002-06/msg00158.html + * @uses getRgbFromAll() + */ +static $Colors = array( + 'aliceblue'=>'#f0f8ff', + 'antiquewhite'=>'#faebd7', + 'aquamarine'=>'#7fffd4', + 'azure'=>'#f0ffff', + 'beige'=>'#f5f5dc', + 'bisque'=>'#ffe4c4', + 'black'=>'#000000', + 'blanchedalmond'=>'#ffebcd', + 'blue'=>'#0000ff', + 'blueviolet'=>'#8a2be2', + 'brown'=>'#a52a2a', + 'burlywood'=>'#deb887', + 'cadetblue'=>'#5f9ea0', + 'chartreuse'=>'#7fff00', + 'chocolate'=>'#d2691e', + 'coral'=>'#ff7f50', + 'cornflowerblue'=>'#6495ed', + 'cornsilk'=>'#fff8dc', + 'cyan'=>'#00ffff', + 'darkblue'=>'#00008b', + 'darkcyan'=>'#008b8b', + 'darkgoldenrod'=>'#b886011', + 'darkgray'=>'#a9a9a9', + 'darkgreen'=>'#006400', + 'darkgrey'=>'#a9a9a9', + 'darkkhaki'=>'#bdb76b', + 'darkmagenta'=>'#8b008b', + 'darkolivegreen'=>'#556b2f', + 'darkorange'=>'#ff8c00', + 'darkorchid'=>'#9932cc', + 'darkred'=>'#8b0000', + 'darksalmon'=>'#e9967a', + 'darkseagreen'=>'#8fbc8f', + 'darkslateblue'=>'#483d8b', + 'darkslategray'=>'#2f4f4f', + 'darkslategrey'=>'#2f4f4f', + 'darkturquoise'=>'#00ced1', + 'darkviolet'=>'#9400d3', + 'deeppink'=>'#ff1493', + 'deepskyblue'=>'#00bfff', + 'dimgray'=>'#696969', + 'dimgrey'=>'#696969', + 'dodgerblue'=>'#1e90ff', + 'firebrick'=>'#b22222', + 'floralwhite'=>'#fffaf0', + 'forestgreen'=>'#228b22', + 'gainsboro'=>'#dcdcdc', + 'ghostwhite'=>'#f8f8ff', + 'gold'=>'#ffd700', + 'goldenrod'=>'#daa520', + 'gray'=>'#bebebe', + 'green'=>'#00ff00', + 'greenyellow'=>'#adff2f', + 'honeydew'=>'#f0fff0', + 'hotpink'=>'#ff69b4', + 'indianred'=>'#cd5c5c', + 'ivory'=>'#fffff0', + 'khaki'=>'#f0e68c', + 'lavender'=>'#e6e6fa', + 'lavenderblush'=>'#fff0f5', + 'lawngreen'=>'#7cfc00', + 'lemonchiffon'=>'#fffacd', + 'lightblue'=>'#add8e6', + 'lightcoral'=>'#f08080', + 'lightcyan'=>'#e0ffff', + 'lightgoldenrod'=>'#eedd82', + 'lightgoldenrodyellow'=>'#fafad2', + 'lightgray'=>'#d3d3d3', + 'lightgreen'=>'#90ee90', + 'lightgrey'=>'#d3d3d3', + 'lightpink'=>'#ffb6c1', + 'lightred'=>'#ffc8c8', + 'lightsalmon'=>'#ffa07a', + 'lightseagreen'=>'#20b2aa', + 'lightskyblue'=>'#87cefa', + 'lightslateblue'=>'#8470ff', + 'lightslategray'=>'#778899', + 'lightsteelblue'=>'#b0c4de', + 'lightyellow'=>'#ffffe0', + 'limegreen'=>'#32cd32', + 'linen'=>'#faf0e6', + 'magenta'=>'#ff00ff', + 'maroon'=>'#b03060', + 'mediumaquamarine'=>'#66cdaa', + 'mediumblue'=>'#0000cd', + 'mediumorchid'=>'#ba55d3', + 'mediumpurple'=>'#9370db', + 'mediumseagreen'=>'#3cb371', + 'mediumslateblue'=>'#7b68ee', + 'mediumspringgreen'=>'#00fa9a', + 'mediumturquoise'=>'#48d1cc', + 'mediumvioletred'=>'#c71585', + 'midnightblue'=>'#191970', + 'mintcream'=>'#f5fffa', + 'mistyrose'=>'#ffe4e1', + 'moccasin'=>'#ffe4b5', + 'navajowhite'=>'#ffdead', + 'navy'=>'#000080', + 'navyblue'=>'#000080', + 'oldlace'=>'#fdf5e6', + 'olivedrab'=>'#6b8e23', + 'orange'=>'#ffa500', + 'orangered'=>'#ff4500', + 'orchid'=>'#da70d6', + 'palegoldenrod'=>'#eee8aa', + 'palegreen'=>'#98fb98', + 'paleturquoise'=>'#afeeee', + 'palevioletred'=>'#db7093', + 'papayawhip'=>'#ffefd5', + 'peachpuff'=>'#ffdab9', + 'peru'=>'#cd853f', + 'pink'=>'#ffc0cb', + 'plum'=>'#dda0dd', + 'powderblue'=>'#b0e0e6', + 'purple'=>'#a020f0', + 'red'=>'#ff0000', + 'rosybrown'=>'#bc8f8f', + 'royalblue'=>'#4169e1', + 'saddlebrown'=>'#8b4513', + 'salmon'=>'#fa8072', + 'sandybrown'=>'#f4a460', + 'seagreen'=>'#2e8b57', + 'seashell'=>'#fff5ee', + 'sienna'=>'#a0522d', + 'skyblue'=>'#87ceeb', + 'slateblue'=>'#6a5acd', + 'slategray'=>'#708090', + 'slategrey'=>'#708090', + 'snow'=>'#fffafa', + 'springgreen'=>'#00ff7f', + 'steelblue'=>'#4682b4', + 'tan'=>'#d2b48c', + 'thistle'=>'#d8bfd8', + 'tomato'=>'#ff6347', + 'turquoise'=>'#40e0d0', + 'violet'=>'#ee82ee', + 'violetred'=>'#d02090', + 'wheat'=>'#f5deb3', + 'white'=>'#ffffff', + 'yellow'=>'#ffff00', + 'yellowgreen'=>'#9acd32' +); + +/** + * not used anymore + */ +static function getHtmlColorFromRgb($r,$g,$b) +{ + if(strlen(dechex($r))==1) { + $r = '0'.$r; + } else { + $r = dechex($r); + } + if(strlen(dechex($g))==1) { + $g = '0'.$g; + } else { + $g = dechex($g); + } + if(strlen(dechex($b))==1) { + $b = '0'.$b; + } else { + $b = dechex($b); + } + + return '#'.$r.$g.$b; +} + +/** + * used to check if it is a valid html color + * @uses isHtmlColor() + */ +static function everyCharIsHex($string) +{ + for($i=0;$i<strlen($string);$i++) + { + $char = substr($string,$i,1); + $valid_color = false; + + if($char == "0") { // zero makes problems... '== 0' and '== "0"' is not the same... + $valid_color = true; + } + for($n=1;$n<=9;$n++) + { + if($char == $n) { + $valid_color = true; + } + } + + for($n='a';$n<='f';$n++) + { + if($char === $n) { + $valid_color = true; + } + } + + for($n='A';$n<='F';$n++) + { + if($char === $n) { + $valid_color = true; + } + } + if(!$valid_color) { + return 0; + } + } + return 1; +} + +/** + * used to check if it is a valid html color + * @uses getRgbFromAll() + */ +static function isHtmlColor($string) +{ + switch(strlen($string)) + { + case 6: + if(LinWatermark::everyCharIsHex($string)) { + return 1; + } + break; + case 7: + if(substr($string,0,1)=="#") { + if(LinWatermark::everyCharIsHex(substr($string,1,6))) { + return 1; + } + } + break; + } + return 0; +} + +/** + * converts a html color to an array with the rgb values + * it doesn't matter if the html color is '#00FF00' or '00FF00' + * @uses getRgbFromAll() + */ +static function getRgbFromHtml($string) +{ + switch(strlen($string)) + { + case 6: + break; + case 7: + $string = substr($string,1,6); + break; + } + $r_hex = substr($string,0,2); + $g_hex = substr($string,2,2); + $b_hex = substr($string,4,2); + $arr['r'] = hexdec($r_hex); + $arr['g'] = hexdec($g_hex); + $arr['b'] = hexdec($b_hex); + return $arr; +} + +/** + * returns an array with the rgb values + * it doesn't matter if the argument is 'darkblue', '#00FF55' or '00FF55' + * if it isn't a correct color, the color (0,0,0) is returned + * + * @uses watermark_gd() + */ +static function getRgbFromAll($string) +{ + if( isset( LinWatermark::$Colors[$string]) ) + { + return LinWatermark::getRgbFromHtml( LinWatermark::$Colors[$string] ); + } + elseif(LinWatermark::isHtmlColor($string) ) + { + return LinWatermark::getRgbFromHtml( $string ); + } + else + { + array('r'=>0,'g'=>0,'b'=>0); + } +} + +/** + * return html color without '#' + * + * used in linpha2 - admin - settings_layout + */ +static function getHtmlFromAll($string) +{ + if(LinWatermark::isHtmlColor($string)) + { + if(substr($string,0,1)=="#") + { + return substr($string,1,6); + } + else + { + return $string; + } + } + else + { + if( isset( LinWatermark::$Colors[$string]) ) + { + return substr(LinWatermark::$Colors[$string],1,6); + } + else + { + return 'ffffff'; + } + } +} + +/** + * @uses watermark_gd() + * calcs the position in pixel with a given align + * src_w, src_h: width and height from the textfield (or the small watermark image) + * dst_w, dst_h: width and height from the image + * pos_x, pos_y: additional adjust for the image + * + */ +static function calcAlign($align, $src_w, $src_h, $dst_w, $dst_h, $pos_x, $pos_y) +{ + + switch($align) + { + case "center": + $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); + $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); + break; + case "east": + $arr_pos['x'] = $dst_w-$src_w+($pos_x); + $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); + break; + case "west": + $arr_pos['x'] = $pos_x; + $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); + break; + case "north": + $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); + $arr_pos['y'] = $pos_y; + break; + case "south": + $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); + $arr_pos['y'] = $dst_h-$src_h+($pos_y); + break; + case "northeast": + $arr_pos['x'] = $dst_w-$src_w+($pos_x); + $arr_pos['y'] = $pos_y; + break; + case "northwest": + $arr_pos['x'] = $pos_x; + $arr_pos['y'] = $pos_y; + break; + case "southwest": + $arr_pos['x'] = $pos_x; + $arr_pos['y'] = $dst_h-$src_h+($pos_y); + break; + case "southeast": + $arr_pos['x'] = $dst_w-$src_w+($pos_x); + $arr_pos['y'] = $dst_h-$src_h+($pos_y); + break; + default: + $arr_pos['x'] = $pos_x; + $arr_pos['y'] = $pos_y; + break; + + } + return $arr_pos; +} + +} +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-20 18:39:46
|
Revision: 4883 http://linpha.svn.sourceforge.net/linpha/?rev=4883&view=rev Author: fangehrn Date: 2008-02-20 10:39:37 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Added Paths: ----------- trunk/linpha2/lib/classes/linpha.color.class.php Removed Paths: ------------- trunk/linpha2/lib/classes/func.watermark.php Deleted: trunk/linpha2/lib/classes/func.watermark.php =================================================================== --- trunk/linpha2/lib/classes/func.watermark.php 2008-02-20 18:37:54 UTC (rev 4882) +++ trunk/linpha2/lib/classes/func.watermark.php 2008-02-20 18:39:37 UTC (rev 4883) @@ -1,547 +0,0 @@ -<?php -/* -* Copyright (c) 2004 Heiko Rutenbeck <bz...@tu...> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -if(!defined('LINPHA_DIR')) { exit(1); } - -class LinWatermark -{ - -/** -* @author flo -* @todo adapt from linpha1 -*/ -static function needWatermark($imgid) -{ - if( $GLOBALS['linpha']->sql->config->value['plugins_active_wm'] - && $GLOBALS['linpha']->sql->config->value['plugins_wm_active'] - && !check_permissions('watermark',$imgid) ) - { - return true; - } else { - return false; - } -} - -/** - * returns array with all the configs and the default values, they are only defined here - */ -static function getWatermarkArray() -{ - return array ( - 'wm_active' => "0", - 'wm_watermark' => "0", - 'wm_text' => "Copyright 2007", - 'wm_font' => "", - 'wm_fontsize' => "20", - 'wm_fontcolor' => "white", - 'wm_align' => "southwest", - 'wm_horizontal' => "0", - 'wm_vertical' => "0", - 'wm_enable_shadow' => "1", - 'wm_shadow_size' => "1", - 'wm_shadow_fontsize' => "20", - 'wm_shadow_color' => "black", - 'wm_enable_rectangle' => "1", - 'wm_rectangle_color' => "darkgrey", - 'wm_height' => "30", - 'wm_width' => "145", - 'wm_img_img' => "", - 'wm_dissolve' => "75%", - 'wm_resize' => "30" - ); -} - -static function readWatermark() -{ - $arr_config = LinWatermark::getWatermarkArray(); - while(list($name,$value) = each($arr_config) ) - { - $arr_read[$name] = $GLOBALS['linpha']->sql->config->value['plugins_'.$name]; - } - return $arr_read; -} - -static function updateWatermark() -{ - $arr_config = LinWatermark::getWatermarkArray(); - while(list($name,$value) = each($arr_config) ) - { - $GLOBALS['linpha']->sql->config->updateConfig($name,$_POST[$name]); - } -} - -/** - * restore watermark settings to initial settings or to examples - */ -static function restoreWatermark() -{ - global $wm_restore_to; - - $arr_config = LinWatermark::getWatermarkArray(); - switch($_POST['setdefault']) - { - case 'initial': - break; - case 'settings1': - $arr_config['wm_watermark'] = 1; - $arr_config['wm_text'] = "(C) 2004 linpha.sf.net"; - $arr_config['wm_fontsize'] = "10"; - $arr_config['wm_fontcolor'] = "white"; - $arr_config['wm_align'] = "south"; - $arr_config['wm_horizontal'] = "0"; - $arr_config['wm_vertical'] = "0"; - $arr_config['wm_enable_rectangle'] = "1"; - $arr_config['wm_rectangle_color'] = "darkgrey"; - $arr_config['wm_enable_shadow'] = "2"; - $arr_config['wm_height'] = "20"; - $arr_config['wm_width'] = "2000"; - $arr_config['wm_resize'] = "no"; - break; - case 'settings2': - $arr_config['wm_watermark'] = 2; - $arr_config['wm_dissolve'] = "65%"; - $arr_config['wm_align'] = "southwest"; - $arr_config['wm_img_img'] = "linpha.png"; - $arr_config['wm_horizontal'] = "10"; - $arr_config['wm_vertical'] = "10"; - $arr_config['wm_resize'] = "30"; - - break; - case 'settings3': // maybe better for gd lib than for convert - $arr_config['wm_watermark'] = 1; - $arr_config['wm_dissolve'] = "100%"; - $arr_config['wm_align'] = "southwest"; - $arr_config['wm_text'] = "(C) 2004 linpha.sf.net"; - $arr_config['wm_fontsize'] = "20"; - $arr_config['wm_fontcolor'] = "white"; - $arr_config['wm_horizontal'] = "0"; - $arr_config['wm_vertical'] = "0"; - $arr_config['wm_enable_rectangle'] = "1"; - $arr_config['wm_rectangle_color'] = "darkgrey"; - $arr_config['wm_enable_shadow'] = "1"; - $arr_config['wm_shadow_size'] = "5"; - $arr_config['wm_shadow_fontsize'] = "2"; - $arr_config['wm_height'] = "30"; - $arr_config['wm_width'] = "260"; - $arr_config['wm_resize'] = "no"; - break; - } - while(list($name,$value) = each($arr_config) ) - { - $GLOBALS['linpha']->sql->config->updateConfig($name,$value); - } -} - -/** - * calcs the new height and width of the resized watermark - * $w, $h: size of the big image - * $org_width, $org_height: size of the watermark rectangle/image - * $resize: resize factor in percent - * - */ -static function wmArrResized($w,$h,$org_width,$org_height,$resize) -{ - $arr_resized['w'] = round($w * $resize/100); - $arr_resized['h'] = round($h * $resize/100); - - $no_increase = 0; - $array = LinImage::scaleToFit($org_height,$org_width,$arr_resized['h'],$arr_resized['w'],$no_increase); - - //error_log('w: '.$w.' h: '.$h.' arr_resized_w: '.$arr_resized['w'].' arr_resized_h: '.$arr_resized['h']. - // ' org_w: '.$org_width.' org_h: '.$org_height.' scaleToFit w: '.$array['w'].' h: '.$array['h']); - - return $array; -} - -/** - * list with many available colors - * http://mail.gnu.org/archive/html/emacs-diffs/2002-06/msg00158.html - * @uses getRgbFromAll() - */ -static $Colors = array( - 'aliceblue'=>'#f0f8ff', - 'antiquewhite'=>'#faebd7', - 'aquamarine'=>'#7fffd4', - 'azure'=>'#f0ffff', - 'beige'=>'#f5f5dc', - 'bisque'=>'#ffe4c4', - 'black'=>'#000000', - 'blanchedalmond'=>'#ffebcd', - 'blue'=>'#0000ff', - 'blueviolet'=>'#8a2be2', - 'brown'=>'#a52a2a', - 'burlywood'=>'#deb887', - 'cadetblue'=>'#5f9ea0', - 'chartreuse'=>'#7fff00', - 'chocolate'=>'#d2691e', - 'coral'=>'#ff7f50', - 'cornflowerblue'=>'#6495ed', - 'cornsilk'=>'#fff8dc', - 'cyan'=>'#00ffff', - 'darkblue'=>'#00008b', - 'darkcyan'=>'#008b8b', - 'darkgoldenrod'=>'#b886011', - 'darkgray'=>'#a9a9a9', - 'darkgreen'=>'#006400', - 'darkgrey'=>'#a9a9a9', - 'darkkhaki'=>'#bdb76b', - 'darkmagenta'=>'#8b008b', - 'darkolivegreen'=>'#556b2f', - 'darkorange'=>'#ff8c00', - 'darkorchid'=>'#9932cc', - 'darkred'=>'#8b0000', - 'darksalmon'=>'#e9967a', - 'darkseagreen'=>'#8fbc8f', - 'darkslateblue'=>'#483d8b', - 'darkslategray'=>'#2f4f4f', - 'darkslategrey'=>'#2f4f4f', - 'darkturquoise'=>'#00ced1', - 'darkviolet'=>'#9400d3', - 'deeppink'=>'#ff1493', - 'deepskyblue'=>'#00bfff', - 'dimgray'=>'#696969', - 'dimgrey'=>'#696969', - 'dodgerblue'=>'#1e90ff', - 'firebrick'=>'#b22222', - 'floralwhite'=>'#fffaf0', - 'forestgreen'=>'#228b22', - 'gainsboro'=>'#dcdcdc', - 'ghostwhite'=>'#f8f8ff', - 'gold'=>'#ffd700', - 'goldenrod'=>'#daa520', - 'gray'=>'#bebebe', - 'green'=>'#00ff00', - 'greenyellow'=>'#adff2f', - 'honeydew'=>'#f0fff0', - 'hotpink'=>'#ff69b4', - 'indianred'=>'#cd5c5c', - 'ivory'=>'#fffff0', - 'khaki'=>'#f0e68c', - 'lavender'=>'#e6e6fa', - 'lavenderblush'=>'#fff0f5', - 'lawngreen'=>'#7cfc00', - 'lemonchiffon'=>'#fffacd', - 'lightblue'=>'#add8e6', - 'lightcoral'=>'#f08080', - 'lightcyan'=>'#e0ffff', - 'lightgoldenrod'=>'#eedd82', - 'lightgoldenrodyellow'=>'#fafad2', - 'lightgray'=>'#d3d3d3', - 'lightgreen'=>'#90ee90', - 'lightgrey'=>'#d3d3d3', - 'lightpink'=>'#ffb6c1', - 'lightred'=>'#ffc8c8', - 'lightsalmon'=>'#ffa07a', - 'lightseagreen'=>'#20b2aa', - 'lightskyblue'=>'#87cefa', - 'lightslateblue'=>'#8470ff', - 'lightslategray'=>'#778899', - 'lightsteelblue'=>'#b0c4de', - 'lightyellow'=>'#ffffe0', - 'limegreen'=>'#32cd32', - 'linen'=>'#faf0e6', - 'magenta'=>'#ff00ff', - 'maroon'=>'#b03060', - 'mediumaquamarine'=>'#66cdaa', - 'mediumblue'=>'#0000cd', - 'mediumorchid'=>'#ba55d3', - 'mediumpurple'=>'#9370db', - 'mediumseagreen'=>'#3cb371', - 'mediumslateblue'=>'#7b68ee', - 'mediumspringgreen'=>'#00fa9a', - 'mediumturquoise'=>'#48d1cc', - 'mediumvioletred'=>'#c71585', - 'midnightblue'=>'#191970', - 'mintcream'=>'#f5fffa', - 'mistyrose'=>'#ffe4e1', - 'moccasin'=>'#ffe4b5', - 'navajowhite'=>'#ffdead', - 'navy'=>'#000080', - 'navyblue'=>'#000080', - 'oldlace'=>'#fdf5e6', - 'olivedrab'=>'#6b8e23', - 'orange'=>'#ffa500', - 'orangered'=>'#ff4500', - 'orchid'=>'#da70d6', - 'palegoldenrod'=>'#eee8aa', - 'palegreen'=>'#98fb98', - 'paleturquoise'=>'#afeeee', - 'palevioletred'=>'#db7093', - 'papayawhip'=>'#ffefd5', - 'peachpuff'=>'#ffdab9', - 'peru'=>'#cd853f', - 'pink'=>'#ffc0cb', - 'plum'=>'#dda0dd', - 'powderblue'=>'#b0e0e6', - 'purple'=>'#a020f0', - 'red'=>'#ff0000', - 'rosybrown'=>'#bc8f8f', - 'royalblue'=>'#4169e1', - 'saddlebrown'=>'#8b4513', - 'salmon'=>'#fa8072', - 'sandybrown'=>'#f4a460', - 'seagreen'=>'#2e8b57', - 'seashell'=>'#fff5ee', - 'sienna'=>'#a0522d', - 'skyblue'=>'#87ceeb', - 'slateblue'=>'#6a5acd', - 'slategray'=>'#708090', - 'slategrey'=>'#708090', - 'snow'=>'#fffafa', - 'springgreen'=>'#00ff7f', - 'steelblue'=>'#4682b4', - 'tan'=>'#d2b48c', - 'thistle'=>'#d8bfd8', - 'tomato'=>'#ff6347', - 'turquoise'=>'#40e0d0', - 'violet'=>'#ee82ee', - 'violetred'=>'#d02090', - 'wheat'=>'#f5deb3', - 'white'=>'#ffffff', - 'yellow'=>'#ffff00', - 'yellowgreen'=>'#9acd32' -); - -/** - * not used anymore - */ -static function getHtmlColorFromRgb($r,$g,$b) -{ - if(strlen(dechex($r))==1) { - $r = '0'.$r; - } else { - $r = dechex($r); - } - if(strlen(dechex($g))==1) { - $g = '0'.$g; - } else { - $g = dechex($g); - } - if(strlen(dechex($b))==1) { - $b = '0'.$b; - } else { - $b = dechex($b); - } - - return '#'.$r.$g.$b; -} - -/** - * used to check if it is a valid html color - * @uses isHtmlColor() - */ -static function everyCharIsHex($string) -{ - for($i=0;$i<strlen($string);$i++) - { - $char = substr($string,$i,1); - $valid_color = false; - - if($char == "0") { // zero makes problems... '== 0' and '== "0"' is not the same... - $valid_color = true; - } - for($n=1;$n<=9;$n++) - { - if($char == $n) { - $valid_color = true; - } - } - - for($n='a';$n<='f';$n++) - { - if($char === $n) { - $valid_color = true; - } - } - - for($n='A';$n<='F';$n++) - { - if($char === $n) { - $valid_color = true; - } - } - if(!$valid_color) { - return 0; - } - } - return 1; -} - -/** - * used to check if it is a valid html color - * @uses getRgbFromAll() - */ -static function isHtmlColor($string) -{ - switch(strlen($string)) - { - case 6: - if(LinWatermark::everyCharIsHex($string)) { - return 1; - } - break; - case 7: - if(substr($string,0,1)=="#") { - if(LinWatermark::everyCharIsHex(substr($string,1,6))) { - return 1; - } - } - break; - } - return 0; -} - -/** - * converts a html color to an array with the rgb values - * it doesn't matter if the html color is '#00FF00' or '00FF00' - * @uses getRgbFromAll() - */ -static function getRgbFromHtml($string) -{ - switch(strlen($string)) - { - case 6: - break; - case 7: - $string = substr($string,1,6); - break; - } - $r_hex = substr($string,0,2); - $g_hex = substr($string,2,2); - $b_hex = substr($string,4,2); - $arr['r'] = hexdec($r_hex); - $arr['g'] = hexdec($g_hex); - $arr['b'] = hexdec($b_hex); - return $arr; -} - -/** - * returns an array with the rgb values - * it doesn't matter if the argument is 'darkblue', '#00FF55' or '00FF55' - * if it isn't a correct color, the color (0,0,0) is returned - * - * @uses watermark_gd() - */ -static function getRgbFromAll($string) -{ - if( isset( LinWatermark::$Colors[$string]) ) - { - return LinWatermark::getRgbFromHtml( LinWatermark::$Colors[$string] ); - } - elseif(LinWatermark::isHtmlColor($string) ) - { - return LinWatermark::getRgbFromHtml( $string ); - } - else - { - array('r'=>0,'g'=>0,'b'=>0); - } -} - -/** - * return html color without '#' - * - * used in linpha2 - admin - settings_layout - */ -static function getHtmlFromAll($string) -{ - if(LinWatermark::isHtmlColor($string)) - { - if(substr($string,0,1)=="#") - { - return substr($string,1,6); - } - else - { - return $string; - } - } - else - { - if( isset( LinWatermark::$Colors[$string]) ) - { - return substr(LinWatermark::$Colors[$string],1,6); - } - else - { - return 'ffffff'; - } - } -} - -/** - * @uses watermark_gd() - * calcs the position in pixel with a given align - * src_w, src_h: width and height from the textfield (or the small watermark image) - * dst_w, dst_h: width and height from the image - * pos_x, pos_y: additional adjust for the image - * - */ -static function calcAlign($align, $src_w, $src_h, $dst_w, $dst_h, $pos_x, $pos_y) -{ - - switch($align) - { - case "center": - $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); - $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); - break; - case "east": - $arr_pos['x'] = $dst_w-$src_w+($pos_x); - $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); - break; - case "west": - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); - break; - case "north": - $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); - $arr_pos['y'] = $pos_y; - break; - case "south": - $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); - $arr_pos['y'] = $dst_h-$src_h+($pos_y); - break; - case "northeast": - $arr_pos['x'] = $dst_w-$src_w+($pos_x); - $arr_pos['y'] = $pos_y; - break; - case "northwest": - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = $pos_y; - break; - case "southwest": - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = $dst_h-$src_h+($pos_y); - break; - case "southeast": - $arr_pos['x'] = $dst_w-$src_w+($pos_x); - $arr_pos['y'] = $dst_h-$src_h+($pos_y); - break; - default: - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = $pos_y; - break; - - } - return $arr_pos; -} - -} -?> \ No newline at end of file Copied: trunk/linpha2/lib/classes/linpha.color.class.php (from rev 4882, trunk/linpha2/lib/classes/func.watermark.php) =================================================================== --- trunk/linpha2/lib/classes/linpha.color.class.php (rev 0) +++ trunk/linpha2/lib/classes/linpha.color.class.php 2008-02-20 18:39:37 UTC (rev 4883) @@ -0,0 +1,547 @@ +<?php +/* +* Copyright (c) 2004 Heiko Rutenbeck <bz...@tu...> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +if(!defined('LINPHA_DIR')) { exit(1); } + +class LinWatermark +{ + +/** +* @author flo +* @todo adapt from linpha1 +*/ +static function needWatermark($imgid) +{ + if( $GLOBALS['linpha']->sql->config->value['plugins_active_wm'] + && $GLOBALS['linpha']->sql->config->value['plugins_wm_active'] + && !check_permissions('watermark',$imgid) ) + { + return true; + } else { + return false; + } +} + +/** + * returns array with all the configs and the default values, they are only defined here + */ +static function getWatermarkArray() +{ + return array ( + 'wm_active' => "0", + 'wm_watermark' => "0", + 'wm_text' => "Copyright 2007", + 'wm_font' => "", + 'wm_fontsize' => "20", + 'wm_fontcolor' => "white", + 'wm_align' => "southwest", + 'wm_horizontal' => "0", + 'wm_vertical' => "0", + 'wm_enable_shadow' => "1", + 'wm_shadow_size' => "1", + 'wm_shadow_fontsize' => "20", + 'wm_shadow_color' => "black", + 'wm_enable_rectangle' => "1", + 'wm_rectangle_color' => "darkgrey", + 'wm_height' => "30", + 'wm_width' => "145", + 'wm_img_img' => "", + 'wm_dissolve' => "75%", + 'wm_resize' => "30" + ); +} + +static function readWatermark() +{ + $arr_config = LinWatermark::getWatermarkArray(); + while(list($name,$value) = each($arr_config) ) + { + $arr_read[$name] = $GLOBALS['linpha']->sql->config->value['plugins_'.$name]; + } + return $arr_read; +} + +static function updateWatermark() +{ + $arr_config = LinWatermark::getWatermarkArray(); + while(list($name,$value) = each($arr_config) ) + { + $GLOBALS['linpha']->sql->config->updateConfig($name,$_POST[$name]); + } +} + +/** + * restore watermark settings to initial settings or to examples + */ +static function restoreWatermark() +{ + global $wm_restore_to; + + $arr_config = LinWatermark::getWatermarkArray(); + switch($_POST['setdefault']) + { + case 'initial': + break; + case 'settings1': + $arr_config['wm_watermark'] = 1; + $arr_config['wm_text'] = "(C) 2004 linpha.sf.net"; + $arr_config['wm_fontsize'] = "10"; + $arr_config['wm_fontcolor'] = "white"; + $arr_config['wm_align'] = "south"; + $arr_config['wm_horizontal'] = "0"; + $arr_config['wm_vertical'] = "0"; + $arr_config['wm_enable_rectangle'] = "1"; + $arr_config['wm_rectangle_color'] = "darkgrey"; + $arr_config['wm_enable_shadow'] = "2"; + $arr_config['wm_height'] = "20"; + $arr_config['wm_width'] = "2000"; + $arr_config['wm_resize'] = "no"; + break; + case 'settings2': + $arr_config['wm_watermark'] = 2; + $arr_config['wm_dissolve'] = "65%"; + $arr_config['wm_align'] = "southwest"; + $arr_config['wm_img_img'] = "linpha.png"; + $arr_config['wm_horizontal'] = "10"; + $arr_config['wm_vertical'] = "10"; + $arr_config['wm_resize'] = "30"; + + break; + case 'settings3': // maybe better for gd lib than for convert + $arr_config['wm_watermark'] = 1; + $arr_config['wm_dissolve'] = "100%"; + $arr_config['wm_align'] = "southwest"; + $arr_config['wm_text'] = "(C) 2004 linpha.sf.net"; + $arr_config['wm_fontsize'] = "20"; + $arr_config['wm_fontcolor'] = "white"; + $arr_config['wm_horizontal'] = "0"; + $arr_config['wm_vertical'] = "0"; + $arr_config['wm_enable_rectangle'] = "1"; + $arr_config['wm_rectangle_color'] = "darkgrey"; + $arr_config['wm_enable_shadow'] = "1"; + $arr_config['wm_shadow_size'] = "5"; + $arr_config['wm_shadow_fontsize'] = "2"; + $arr_config['wm_height'] = "30"; + $arr_config['wm_width'] = "260"; + $arr_config['wm_resize'] = "no"; + break; + } + while(list($name,$value) = each($arr_config) ) + { + $GLOBALS['linpha']->sql->config->updateConfig($name,$value); + } +} + +/** + * calcs the new height and width of the resized watermark + * $w, $h: size of the big image + * $org_width, $org_height: size of the watermark rectangle/image + * $resize: resize factor in percent + * + */ +static function wmArrResized($w,$h,$org_width,$org_height,$resize) +{ + $arr_resized['w'] = round($w * $resize/100); + $arr_resized['h'] = round($h * $resize/100); + + $no_increase = 0; + $array = LinImage::scaleToFit($org_height,$org_width,$arr_resized['h'],$arr_resized['w'],$no_increase); + + //error_log('w: '.$w.' h: '.$h.' arr_resized_w: '.$arr_resized['w'].' arr_resized_h: '.$arr_resized['h']. + // ' org_w: '.$org_width.' org_h: '.$org_height.' scaleToFit w: '.$array['w'].' h: '.$array['h']); + + return $array; +} + +/** + * list with many available colors + * http://mail.gnu.org/archive/html/emacs-diffs/2002-06/msg00158.html + * @uses getRgbFromAll() + */ +static $Colors = array( + 'aliceblue'=>'#f0f8ff', + 'antiquewhite'=>'#faebd7', + 'aquamarine'=>'#7fffd4', + 'azure'=>'#f0ffff', + 'beige'=>'#f5f5dc', + 'bisque'=>'#ffe4c4', + 'black'=>'#000000', + 'blanchedalmond'=>'#ffebcd', + 'blue'=>'#0000ff', + 'blueviolet'=>'#8a2be2', + 'brown'=>'#a52a2a', + 'burlywood'=>'#deb887', + 'cadetblue'=>'#5f9ea0', + 'chartreuse'=>'#7fff00', + 'chocolate'=>'#d2691e', + 'coral'=>'#ff7f50', + 'cornflowerblue'=>'#6495ed', + 'cornsilk'=>'#fff8dc', + 'cyan'=>'#00ffff', + 'darkblue'=>'#00008b', + 'darkcyan'=>'#008b8b', + 'darkgoldenrod'=>'#b886011', + 'darkgray'=>'#a9a9a9', + 'darkgreen'=>'#006400', + 'darkgrey'=>'#a9a9a9', + 'darkkhaki'=>'#bdb76b', + 'darkmagenta'=>'#8b008b', + 'darkolivegreen'=>'#556b2f', + 'darkorange'=>'#ff8c00', + 'darkorchid'=>'#9932cc', + 'darkred'=>'#8b0000', + 'darksalmon'=>'#e9967a', + 'darkseagreen'=>'#8fbc8f', + 'darkslateblue'=>'#483d8b', + 'darkslategray'=>'#2f4f4f', + 'darkslategrey'=>'#2f4f4f', + 'darkturquoise'=>'#00ced1', + 'darkviolet'=>'#9400d3', + 'deeppink'=>'#ff1493', + 'deepskyblue'=>'#00bfff', + 'dimgray'=>'#696969', + 'dimgrey'=>'#696969', + 'dodgerblue'=>'#1e90ff', + 'firebrick'=>'#b22222', + 'floralwhite'=>'#fffaf0', + 'forestgreen'=>'#228b22', + 'gainsboro'=>'#dcdcdc', + 'ghostwhite'=>'#f8f8ff', + 'gold'=>'#ffd700', + 'goldenrod'=>'#daa520', + 'gray'=>'#bebebe', + 'green'=>'#00ff00', + 'greenyellow'=>'#adff2f', + 'honeydew'=>'#f0fff0', + 'hotpink'=>'#ff69b4', + 'indianred'=>'#cd5c5c', + 'ivory'=>'#fffff0', + 'khaki'=>'#f0e68c', + 'lavender'=>'#e6e6fa', + 'lavenderblush'=>'#fff0f5', + 'lawngreen'=>'#7cfc00', + 'lemonchiffon'=>'#fffacd', + 'lightblue'=>'#add8e6', + 'lightcoral'=>'#f08080', + 'lightcyan'=>'#e0ffff', + 'lightgoldenrod'=>'#eedd82', + 'lightgoldenrodyellow'=>'#fafad2', + 'lightgray'=>'#d3d3d3', + 'lightgreen'=>'#90ee90', + 'lightgrey'=>'#d3d3d3', + 'lightpink'=>'#ffb6c1', + 'lightred'=>'#ffc8c8', + 'lightsalmon'=>'#ffa07a', + 'lightseagreen'=>'#20b2aa', + 'lightskyblue'=>'#87cefa', + 'lightslateblue'=>'#8470ff', + 'lightslategray'=>'#778899', + 'lightsteelblue'=>'#b0c4de', + 'lightyellow'=>'#ffffe0', + 'limegreen'=>'#32cd32', + 'linen'=>'#faf0e6', + 'magenta'=>'#ff00ff', + 'maroon'=>'#b03060', + 'mediumaquamarine'=>'#66cdaa', + 'mediumblue'=>'#0000cd', + 'mediumorchid'=>'#ba55d3', + 'mediumpurple'=>'#9370db', + 'mediumseagreen'=>'#3cb371', + 'mediumslateblue'=>'#7b68ee', + 'mediumspringgreen'=>'#00fa9a', + 'mediumturquoise'=>'#48d1cc', + 'mediumvioletred'=>'#c71585', + 'midnightblue'=>'#191970', + 'mintcream'=>'#f5fffa', + 'mistyrose'=>'#ffe4e1', + 'moccasin'=>'#ffe4b5', + 'navajowhite'=>'#ffdead', + 'navy'=>'#000080', + 'navyblue'=>'#000080', + 'oldlace'=>'#fdf5e6', + 'olivedrab'=>'#6b8e23', + 'orange'=>'#ffa500', + 'orangered'=>'#ff4500', + 'orchid'=>'#da70d6', + 'palegoldenrod'=>'#eee8aa', + 'palegreen'=>'#98fb98', + 'paleturquoise'=>'#afeeee', + 'palevioletred'=>'#db7093', + 'papayawhip'=>'#ffefd5', + 'peachpuff'=>'#ffdab9', + 'peru'=>'#cd853f', + 'pink'=>'#ffc0cb', + 'plum'=>'#dda0dd', + 'powderblue'=>'#b0e0e6', + 'purple'=>'#a020f0', + 'red'=>'#ff0000', + 'rosybrown'=>'#bc8f8f', + 'royalblue'=>'#4169e1', + 'saddlebrown'=>'#8b4513', + 'salmon'=>'#fa8072', + 'sandybrown'=>'#f4a460', + 'seagreen'=>'#2e8b57', + 'seashell'=>'#fff5ee', + 'sienna'=>'#a0522d', + 'skyblue'=>'#87ceeb', + 'slateblue'=>'#6a5acd', + 'slategray'=>'#708090', + 'slategrey'=>'#708090', + 'snow'=>'#fffafa', + 'springgreen'=>'#00ff7f', + 'steelblue'=>'#4682b4', + 'tan'=>'#d2b48c', + 'thistle'=>'#d8bfd8', + 'tomato'=>'#ff6347', + 'turquoise'=>'#40e0d0', + 'violet'=>'#ee82ee', + 'violetred'=>'#d02090', + 'wheat'=>'#f5deb3', + 'white'=>'#ffffff', + 'yellow'=>'#ffff00', + 'yellowgreen'=>'#9acd32' +); + +/** + * not used anymore + */ +static function getHtmlColorFromRgb($r,$g,$b) +{ + if(strlen(dechex($r))==1) { + $r = '0'.$r; + } else { + $r = dechex($r); + } + if(strlen(dechex($g))==1) { + $g = '0'.$g; + } else { + $g = dechex($g); + } + if(strlen(dechex($b))==1) { + $b = '0'.$b; + } else { + $b = dechex($b); + } + + return '#'.$r.$g.$b; +} + +/** + * used to check if it is a valid html color + * @uses isHtmlColor() + */ +static function everyCharIsHex($string) +{ + for($i=0;$i<strlen($string);$i++) + { + $char = substr($string,$i,1); + $valid_color = false; + + if($char == "0") { // zero makes problems... '== 0' and '== "0"' is not the same... + $valid_color = true; + } + for($n=1;$n<=9;$n++) + { + if($char == $n) { + $valid_color = true; + } + } + + for($n='a';$n<='f';$n++) + { + if($char === $n) { + $valid_color = true; + } + } + + for($n='A';$n<='F';$n++) + { + if($char === $n) { + $valid_color = true; + } + } + if(!$valid_color) { + return 0; + } + } + return 1; +} + +/** + * used to check if it is a valid html color + * @uses getRgbFromAll() + */ +static function isHtmlColor($string) +{ + switch(strlen($string)) + { + case 6: + if(LinWatermark::everyCharIsHex($string)) { + return 1; + } + break; + case 7: + if(substr($string,0,1)=="#") { + if(LinWatermark::everyCharIsHex(substr($string,1,6))) { + return 1; + } + } + break; + } + return 0; +} + +/** + * converts a html color to an array with the rgb values + * it doesn't matter if the html color is '#00FF00' or '00FF00' + * @uses getRgbFromAll() + */ +static function getRgbFromHtml($string) +{ + switch(strlen($string)) + { + case 6: + break; + case 7: + $string = substr($string,1,6); + break; + } + $r_hex = substr($string,0,2); + $g_hex = substr($string,2,2); + $b_hex = substr($string,4,2); + $arr['r'] = hexdec($r_hex); + $arr['g'] = hexdec($g_hex); + $arr['b'] = hexdec($b_hex); + return $arr; +} + +/** + * returns an array with the rgb values + * it doesn't matter if the argument is 'darkblue', '#00FF55' or '00FF55' + * if it isn't a correct color, the color (0,0,0) is returned + * + * @uses watermark_gd() + */ +static function getRgbFromAll($string) +{ + if( isset( LinWatermark::$Colors[$string]) ) + { + return LinWatermark::getRgbFromHtml( LinWatermark::$Colors[$string] ); + } + elseif(LinWatermark::isHtmlColor($string) ) + { + return LinWatermark::getRgbFromHtml( $string ); + } + else + { + array('r'=>0,'g'=>0,'b'=>0); + } +} + +/** + * return html color without '#' + * + * used in linpha2 - admin - settings_layout + */ +static function getHtmlFromAll($string) +{ + if(LinWatermark::isHtmlColor($string)) + { + if(substr($string,0,1)=="#") + { + return substr($string,1,6); + } + else + { + return $string; + } + } + else + { + if( isset( LinWatermark::$Colors[$string]) ) + { + return substr(LinWatermark::$Colors[$string],1,6); + } + else + { + return 'ffffff'; + } + } +} + +/** + * @uses watermark_gd() + * calcs the position in pixel with a given align + * src_w, src_h: width and height from the textfield (or the small watermark image) + * dst_w, dst_h: width and height from the image + * pos_x, pos_y: additional adjust for the image + * + */ +static function calcAlign($align, $src_w, $src_h, $dst_w, $dst_h, $pos_x, $pos_y) +{ + + switch($align) + { + case "center": + $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); + $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); + break; + case "east": + $arr_pos['x'] = $dst_w-$src_w+($pos_x); + $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); + break; + case "west": + $arr_pos['x'] = $pos_x; + $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); + break; + case "north": + $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); + $arr_pos['y'] = $pos_y; + break; + case "south": + $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); + $arr_pos['y'] = $dst_h-$src_h+($pos_y); + break; + case "northeast": + $arr_pos['x'] = $dst_w-$src_w+($pos_x); + $arr_pos['y'] = $pos_y; + break; + case "northwest": + $arr_pos['x'] = $pos_x; + $arr_pos['y'] = $pos_y; + break; + case "southwest": + $arr_pos['x'] = $pos_x; + $arr_pos['y'] = $dst_h-$src_h+($pos_y); + break; + case "southeast": + $arr_pos['x'] = $dst_w-$src_w+($pos_x); + $arr_pos['y'] = $dst_h-$src_h+($pos_y); + break; + default: + $arr_pos['x'] = $pos_x; + $arr_pos['y'] = $pos_y; + break; + + } + return $arr_pos; +} + +} +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-20 18:38:02
|
Revision: 4882 http://linpha.svn.sourceforge.net/linpha/?rev=4882&view=rev Author: fangehrn Date: 2008-02-20 10:37:54 -0800 (Wed, 20 Feb 2008) Log Message: ----------- Added Paths: ----------- trunk/linpha2/lib/classes/func.watermark.php Removed Paths: ------------- trunk/linpha2/lib/plugins/watermark/func.watermark.php Copied: trunk/linpha2/lib/classes/func.watermark.php (from rev 4881, trunk/linpha2/lib/plugins/watermark/func.watermark.php) =================================================================== --- trunk/linpha2/lib/classes/func.watermark.php (rev 0) +++ trunk/linpha2/lib/classes/func.watermark.php 2008-02-20 18:37:54 UTC (rev 4882) @@ -0,0 +1,547 @@ +<?php +/* +* Copyright (c) 2004 Heiko Rutenbeck <bz...@tu...> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +if(!defined('LINPHA_DIR')) { exit(1); } + +class LinWatermark +{ + +/** +* @author flo +* @todo adapt from linpha1 +*/ +static function needWatermark($imgid) +{ + if( $GLOBALS['linpha']->sql->config->value['plugins_active_wm'] + && $GLOBALS['linpha']->sql->config->value['plugins_wm_active'] + && !check_permissions('watermark',$imgid) ) + { + return true; + } else { + return false; + } +} + +/** + * returns array with all the configs and the default values, they are only defined here + */ +static function getWatermarkArray() +{ + return array ( + 'wm_active' => "0", + 'wm_watermark' => "0", + 'wm_text' => "Copyright 2007", + 'wm_font' => "", + 'wm_fontsize' => "20", + 'wm_fontcolor' => "white", + 'wm_align' => "southwest", + 'wm_horizontal' => "0", + 'wm_vertical' => "0", + 'wm_enable_shadow' => "1", + 'wm_shadow_size' => "1", + 'wm_shadow_fontsize' => "20", + 'wm_shadow_color' => "black", + 'wm_enable_rectangle' => "1", + 'wm_rectangle_color' => "darkgrey", + 'wm_height' => "30", + 'wm_width' => "145", + 'wm_img_img' => "", + 'wm_dissolve' => "75%", + 'wm_resize' => "30" + ); +} + +static function readWatermark() +{ + $arr_config = LinWatermark::getWatermarkArray(); + while(list($name,$value) = each($arr_config) ) + { + $arr_read[$name] = $GLOBALS['linpha']->sql->config->value['plugins_'.$name]; + } + return $arr_read; +} + +static function updateWatermark() +{ + $arr_config = LinWatermark::getWatermarkArray(); + while(list($name,$value) = each($arr_config) ) + { + $GLOBALS['linpha']->sql->config->updateConfig($name,$_POST[$name]); + } +} + +/** + * restore watermark settings to initial settings or to examples + */ +static function restoreWatermark() +{ + global $wm_restore_to; + + $arr_config = LinWatermark::getWatermarkArray(); + switch($_POST['setdefault']) + { + case 'initial': + break; + case 'settings1': + $arr_config['wm_watermark'] = 1; + $arr_config['wm_text'] = "(C) 2004 linpha.sf.net"; + $arr_config['wm_fontsize'] = "10"; + $arr_config['wm_fontcolor'] = "white"; + $arr_config['wm_align'] = "south"; + $arr_config['wm_horizontal'] = "0"; + $arr_config['wm_vertical'] = "0"; + $arr_config['wm_enable_rectangle'] = "1"; + $arr_config['wm_rectangle_color'] = "darkgrey"; + $arr_config['wm_enable_shadow'] = "2"; + $arr_config['wm_height'] = "20"; + $arr_config['wm_width'] = "2000"; + $arr_config['wm_resize'] = "no"; + break; + case 'settings2': + $arr_config['wm_watermark'] = 2; + $arr_config['wm_dissolve'] = "65%"; + $arr_config['wm_align'] = "southwest"; + $arr_config['wm_img_img'] = "linpha.png"; + $arr_config['wm_horizontal'] = "10"; + $arr_config['wm_vertical'] = "10"; + $arr_config['wm_resize'] = "30"; + + break; + case 'settings3': // maybe better for gd lib than for convert + $arr_config['wm_watermark'] = 1; + $arr_config['wm_dissolve'] = "100%"; + $arr_config['wm_align'] = "southwest"; + $arr_config['wm_text'] = "(C) 2004 linpha.sf.net"; + $arr_config['wm_fontsize'] = "20"; + $arr_config['wm_fontcolor'] = "white"; + $arr_config['wm_horizontal'] = "0"; + $arr_config['wm_vertical'] = "0"; + $arr_config['wm_enable_rectangle'] = "1"; + $arr_config['wm_rectangle_color'] = "darkgrey"; + $arr_config['wm_enable_shadow'] = "1"; + $arr_config['wm_shadow_size'] = "5"; + $arr_config['wm_shadow_fontsize'] = "2"; + $arr_config['wm_height'] = "30"; + $arr_config['wm_width'] = "260"; + $arr_config['wm_resize'] = "no"; + break; + } + while(list($name,$value) = each($arr_config) ) + { + $GLOBALS['linpha']->sql->config->updateConfig($name,$value); + } +} + +/** + * calcs the new height and width of the resized watermark + * $w, $h: size of the big image + * $org_width, $org_height: size of the watermark rectangle/image + * $resize: resize factor in percent + * + */ +static function wmArrResized($w,$h,$org_width,$org_height,$resize) +{ + $arr_resized['w'] = round($w * $resize/100); + $arr_resized['h'] = round($h * $resize/100); + + $no_increase = 0; + $array = LinImage::scaleToFit($org_height,$org_width,$arr_resized['h'],$arr_resized['w'],$no_increase); + + //error_log('w: '.$w.' h: '.$h.' arr_resized_w: '.$arr_resized['w'].' arr_resized_h: '.$arr_resized['h']. + // ' org_w: '.$org_width.' org_h: '.$org_height.' scaleToFit w: '.$array['w'].' h: '.$array['h']); + + return $array; +} + +/** + * list with many available colors + * http://mail.gnu.org/archive/html/emacs-diffs/2002-06/msg00158.html + * @uses getRgbFromAll() + */ +static $Colors = array( + 'aliceblue'=>'#f0f8ff', + 'antiquewhite'=>'#faebd7', + 'aquamarine'=>'#7fffd4', + 'azure'=>'#f0ffff', + 'beige'=>'#f5f5dc', + 'bisque'=>'#ffe4c4', + 'black'=>'#000000', + 'blanchedalmond'=>'#ffebcd', + 'blue'=>'#0000ff', + 'blueviolet'=>'#8a2be2', + 'brown'=>'#a52a2a', + 'burlywood'=>'#deb887', + 'cadetblue'=>'#5f9ea0', + 'chartreuse'=>'#7fff00', + 'chocolate'=>'#d2691e', + 'coral'=>'#ff7f50', + 'cornflowerblue'=>'#6495ed', + 'cornsilk'=>'#fff8dc', + 'cyan'=>'#00ffff', + 'darkblue'=>'#00008b', + 'darkcyan'=>'#008b8b', + 'darkgoldenrod'=>'#b886011', + 'darkgray'=>'#a9a9a9', + 'darkgreen'=>'#006400', + 'darkgrey'=>'#a9a9a9', + 'darkkhaki'=>'#bdb76b', + 'darkmagenta'=>'#8b008b', + 'darkolivegreen'=>'#556b2f', + 'darkorange'=>'#ff8c00', + 'darkorchid'=>'#9932cc', + 'darkred'=>'#8b0000', + 'darksalmon'=>'#e9967a', + 'darkseagreen'=>'#8fbc8f', + 'darkslateblue'=>'#483d8b', + 'darkslategray'=>'#2f4f4f', + 'darkslategrey'=>'#2f4f4f', + 'darkturquoise'=>'#00ced1', + 'darkviolet'=>'#9400d3', + 'deeppink'=>'#ff1493', + 'deepskyblue'=>'#00bfff', + 'dimgray'=>'#696969', + 'dimgrey'=>'#696969', + 'dodgerblue'=>'#1e90ff', + 'firebrick'=>'#b22222', + 'floralwhite'=>'#fffaf0', + 'forestgreen'=>'#228b22', + 'gainsboro'=>'#dcdcdc', + 'ghostwhite'=>'#f8f8ff', + 'gold'=>'#ffd700', + 'goldenrod'=>'#daa520', + 'gray'=>'#bebebe', + 'green'=>'#00ff00', + 'greenyellow'=>'#adff2f', + 'honeydew'=>'#f0fff0', + 'hotpink'=>'#ff69b4', + 'indianred'=>'#cd5c5c', + 'ivory'=>'#fffff0', + 'khaki'=>'#f0e68c', + 'lavender'=>'#e6e6fa', + 'lavenderblush'=>'#fff0f5', + 'lawngreen'=>'#7cfc00', + 'lemonchiffon'=>'#fffacd', + 'lightblue'=>'#add8e6', + 'lightcoral'=>'#f08080', + 'lightcyan'=>'#e0ffff', + 'lightgoldenrod'=>'#eedd82', + 'lightgoldenrodyellow'=>'#fafad2', + 'lightgray'=>'#d3d3d3', + 'lightgreen'=>'#90ee90', + 'lightgrey'=>'#d3d3d3', + 'lightpink'=>'#ffb6c1', + 'lightred'=>'#ffc8c8', + 'lightsalmon'=>'#ffa07a', + 'lightseagreen'=>'#20b2aa', + 'lightskyblue'=>'#87cefa', + 'lightslateblue'=>'#8470ff', + 'lightslategray'=>'#778899', + 'lightsteelblue'=>'#b0c4de', + 'lightyellow'=>'#ffffe0', + 'limegreen'=>'#32cd32', + 'linen'=>'#faf0e6', + 'magenta'=>'#ff00ff', + 'maroon'=>'#b03060', + 'mediumaquamarine'=>'#66cdaa', + 'mediumblue'=>'#0000cd', + 'mediumorchid'=>'#ba55d3', + 'mediumpurple'=>'#9370db', + 'mediumseagreen'=>'#3cb371', + 'mediumslateblue'=>'#7b68ee', + 'mediumspringgreen'=>'#00fa9a', + 'mediumturquoise'=>'#48d1cc', + 'mediumvioletred'=>'#c71585', + 'midnightblue'=>'#191970', + 'mintcream'=>'#f5fffa', + 'mistyrose'=>'#ffe4e1', + 'moccasin'=>'#ffe4b5', + 'navajowhite'=>'#ffdead', + 'navy'=>'#000080', + 'navyblue'=>'#000080', + 'oldlace'=>'#fdf5e6', + 'olivedrab'=>'#6b8e23', + 'orange'=>'#ffa500', + 'orangered'=>'#ff4500', + 'orchid'=>'#da70d6', + 'palegoldenrod'=>'#eee8aa', + 'palegreen'=>'#98fb98', + 'paleturquoise'=>'#afeeee', + 'palevioletred'=>'#db7093', + 'papayawhip'=>'#ffefd5', + 'peachpuff'=>'#ffdab9', + 'peru'=>'#cd853f', + 'pink'=>'#ffc0cb', + 'plum'=>'#dda0dd', + 'powderblue'=>'#b0e0e6', + 'purple'=>'#a020f0', + 'red'=>'#ff0000', + 'rosybrown'=>'#bc8f8f', + 'royalblue'=>'#4169e1', + 'saddlebrown'=>'#8b4513', + 'salmon'=>'#fa8072', + 'sandybrown'=>'#f4a460', + 'seagreen'=>'#2e8b57', + 'seashell'=>'#fff5ee', + 'sienna'=>'#a0522d', + 'skyblue'=>'#87ceeb', + 'slateblue'=>'#6a5acd', + 'slategray'=>'#708090', + 'slategrey'=>'#708090', + 'snow'=>'#fffafa', + 'springgreen'=>'#00ff7f', + 'steelblue'=>'#4682b4', + 'tan'=>'#d2b48c', + 'thistle'=>'#d8bfd8', + 'tomato'=>'#ff6347', + 'turquoise'=>'#40e0d0', + 'violet'=>'#ee82ee', + 'violetred'=>'#d02090', + 'wheat'=>'#f5deb3', + 'white'=>'#ffffff', + 'yellow'=>'#ffff00', + 'yellowgreen'=>'#9acd32' +); + +/** + * not used anymore + */ +static function getHtmlColorFromRgb($r,$g,$b) +{ + if(strlen(dechex($r))==1) { + $r = '0'.$r; + } else { + $r = dechex($r); + } + if(strlen(dechex($g))==1) { + $g = '0'.$g; + } else { + $g = dechex($g); + } + if(strlen(dechex($b))==1) { + $b = '0'.$b; + } else { + $b = dechex($b); + } + + return '#'.$r.$g.$b; +} + +/** + * used to check if it is a valid html color + * @uses isHtmlColor() + */ +static function everyCharIsHex($string) +{ + for($i=0;$i<strlen($string);$i++) + { + $char = substr($string,$i,1); + $valid_color = false; + + if($char == "0") { // zero makes problems... '== 0' and '== "0"' is not the same... + $valid_color = true; + } + for($n=1;$n<=9;$n++) + { + if($char == $n) { + $valid_color = true; + } + } + + for($n='a';$n<='f';$n++) + { + if($char === $n) { + $valid_color = true; + } + } + + for($n='A';$n<='F';$n++) + { + if($char === $n) { + $valid_color = true; + } + } + if(!$valid_color) { + return 0; + } + } + return 1; +} + +/** + * used to check if it is a valid html color + * @uses getRgbFromAll() + */ +static function isHtmlColor($string) +{ + switch(strlen($string)) + { + case 6: + if(LinWatermark::everyCharIsHex($string)) { + return 1; + } + break; + case 7: + if(substr($string,0,1)=="#") { + if(LinWatermark::everyCharIsHex(substr($string,1,6))) { + return 1; + } + } + break; + } + return 0; +} + +/** + * converts a html color to an array with the rgb values + * it doesn't matter if the html color is '#00FF00' or '00FF00' + * @uses getRgbFromAll() + */ +static function getRgbFromHtml($string) +{ + switch(strlen($string)) + { + case 6: + break; + case 7: + $string = substr($string,1,6); + break; + } + $r_hex = substr($string,0,2); + $g_hex = substr($string,2,2); + $b_hex = substr($string,4,2); + $arr['r'] = hexdec($r_hex); + $arr['g'] = hexdec($g_hex); + $arr['b'] = hexdec($b_hex); + return $arr; +} + +/** + * returns an array with the rgb values + * it doesn't matter if the argument is 'darkblue', '#00FF55' or '00FF55' + * if it isn't a correct color, the color (0,0,0) is returned + * + * @uses watermark_gd() + */ +static function getRgbFromAll($string) +{ + if( isset( LinWatermark::$Colors[$string]) ) + { + return LinWatermark::getRgbFromHtml( LinWatermark::$Colors[$string] ); + } + elseif(LinWatermark::isHtmlColor($string) ) + { + return LinWatermark::getRgbFromHtml( $string ); + } + else + { + array('r'=>0,'g'=>0,'b'=>0); + } +} + +/** + * return html color without '#' + * + * used in linpha2 - admin - settings_layout + */ +static function getHtmlFromAll($string) +{ + if(LinWatermark::isHtmlColor($string)) + { + if(substr($string,0,1)=="#") + { + return substr($string,1,6); + } + else + { + return $string; + } + } + else + { + if( isset( LinWatermark::$Colors[$string]) ) + { + return substr(LinWatermark::$Colors[$string],1,6); + } + else + { + return 'ffffff'; + } + } +} + +/** + * @uses watermark_gd() + * calcs the position in pixel with a given align + * src_w, src_h: width and height from the textfield (or the small watermark image) + * dst_w, dst_h: width and height from the image + * pos_x, pos_y: additional adjust for the image + * + */ +static function calcAlign($align, $src_w, $src_h, $dst_w, $dst_h, $pos_x, $pos_y) +{ + + switch($align) + { + case "center": + $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); + $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); + break; + case "east": + $arr_pos['x'] = $dst_w-$src_w+($pos_x); + $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); + break; + case "west": + $arr_pos['x'] = $pos_x; + $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); + break; + case "north": + $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); + $arr_pos['y'] = $pos_y; + break; + case "south": + $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); + $arr_pos['y'] = $dst_h-$src_h+($pos_y); + break; + case "northeast": + $arr_pos['x'] = $dst_w-$src_w+($pos_x); + $arr_pos['y'] = $pos_y; + break; + case "northwest": + $arr_pos['x'] = $pos_x; + $arr_pos['y'] = $pos_y; + break; + case "southwest": + $arr_pos['x'] = $pos_x; + $arr_pos['y'] = $dst_h-$src_h+($pos_y); + break; + case "southeast": + $arr_pos['x'] = $dst_w-$src_w+($pos_x); + $arr_pos['y'] = $dst_h-$src_h+($pos_y); + break; + default: + $arr_pos['x'] = $pos_x; + $arr_pos['y'] = $pos_y; + break; + + } + return $arr_pos; +} + +} +?> \ No newline at end of file Deleted: trunk/linpha2/lib/plugins/watermark/func.watermark.php =================================================================== --- trunk/linpha2/lib/plugins/watermark/func.watermark.php 2008-02-17 22:58:01 UTC (rev 4881) +++ trunk/linpha2/lib/plugins/watermark/func.watermark.php 2008-02-20 18:37:54 UTC (rev 4882) @@ -1,547 +0,0 @@ -<?php -/* -* Copyright (c) 2004 Heiko Rutenbeck <bz...@tu...> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -if(!defined('LINPHA_DIR')) { exit(1); } - -class LinWatermark -{ - -/** -* @author flo -* @todo adapt from linpha1 -*/ -static function needWatermark($imgid) -{ - if( $GLOBALS['linpha']->sql->config->value['plugins_active_wm'] - && $GLOBALS['linpha']->sql->config->value['plugins_wm_active'] - && !check_permissions('watermark',$imgid) ) - { - return true; - } else { - return false; - } -} - -/** - * returns array with all the configs and the default values, they are only defined here - */ -static function getWatermarkArray() -{ - return array ( - 'wm_active' => "0", - 'wm_watermark' => "0", - 'wm_text' => "Copyright 2007", - 'wm_font' => "", - 'wm_fontsize' => "20", - 'wm_fontcolor' => "white", - 'wm_align' => "southwest", - 'wm_horizontal' => "0", - 'wm_vertical' => "0", - 'wm_enable_shadow' => "1", - 'wm_shadow_size' => "1", - 'wm_shadow_fontsize' => "20", - 'wm_shadow_color' => "black", - 'wm_enable_rectangle' => "1", - 'wm_rectangle_color' => "darkgrey", - 'wm_height' => "30", - 'wm_width' => "145", - 'wm_img_img' => "", - 'wm_dissolve' => "75%", - 'wm_resize' => "30" - ); -} - -static function readWatermark() -{ - $arr_config = LinWatermark::getWatermarkArray(); - while(list($name,$value) = each($arr_config) ) - { - $arr_read[$name] = $GLOBALS['linpha']->sql->config->value['plugins_'.$name]; - } - return $arr_read; -} - -static function updateWatermark() -{ - $arr_config = LinWatermark::getWatermarkArray(); - while(list($name,$value) = each($arr_config) ) - { - $GLOBALS['linpha']->sql->config->updateConfig($name,$_POST[$name]); - } -} - -/** - * restore watermark settings to initial settings or to examples - */ -static function restoreWatermark() -{ - global $wm_restore_to; - - $arr_config = LinWatermark::getWatermarkArray(); - switch($_POST['setdefault']) - { - case 'initial': - break; - case 'settings1': - $arr_config['wm_watermark'] = 1; - $arr_config['wm_text'] = "(C) 2004 linpha.sf.net"; - $arr_config['wm_fontsize'] = "10"; - $arr_config['wm_fontcolor'] = "white"; - $arr_config['wm_align'] = "south"; - $arr_config['wm_horizontal'] = "0"; - $arr_config['wm_vertical'] = "0"; - $arr_config['wm_enable_rectangle'] = "1"; - $arr_config['wm_rectangle_color'] = "darkgrey"; - $arr_config['wm_enable_shadow'] = "2"; - $arr_config['wm_height'] = "20"; - $arr_config['wm_width'] = "2000"; - $arr_config['wm_resize'] = "no"; - break; - case 'settings2': - $arr_config['wm_watermark'] = 2; - $arr_config['wm_dissolve'] = "65%"; - $arr_config['wm_align'] = "southwest"; - $arr_config['wm_img_img'] = "linpha.png"; - $arr_config['wm_horizontal'] = "10"; - $arr_config['wm_vertical'] = "10"; - $arr_config['wm_resize'] = "30"; - - break; - case 'settings3': // maybe better for gd lib than for convert - $arr_config['wm_watermark'] = 1; - $arr_config['wm_dissolve'] = "100%"; - $arr_config['wm_align'] = "southwest"; - $arr_config['wm_text'] = "(C) 2004 linpha.sf.net"; - $arr_config['wm_fontsize'] = "20"; - $arr_config['wm_fontcolor'] = "white"; - $arr_config['wm_horizontal'] = "0"; - $arr_config['wm_vertical'] = "0"; - $arr_config['wm_enable_rectangle'] = "1"; - $arr_config['wm_rectangle_color'] = "darkgrey"; - $arr_config['wm_enable_shadow'] = "1"; - $arr_config['wm_shadow_size'] = "5"; - $arr_config['wm_shadow_fontsize'] = "2"; - $arr_config['wm_height'] = "30"; - $arr_config['wm_width'] = "260"; - $arr_config['wm_resize'] = "no"; - break; - } - while(list($name,$value) = each($arr_config) ) - { - $GLOBALS['linpha']->sql->config->updateConfig($name,$value); - } -} - -/** - * calcs the new height and width of the resized watermark - * $w, $h: size of the big image - * $org_width, $org_height: size of the watermark rectangle/image - * $resize: resize factor in percent - * - */ -static function wmArrResized($w,$h,$org_width,$org_height,$resize) -{ - $arr_resized['w'] = round($w * $resize/100); - $arr_resized['h'] = round($h * $resize/100); - - $no_increase = 0; - $array = LinImage::scaleToFit($org_height,$org_width,$arr_resized['h'],$arr_resized['w'],$no_increase); - - //error_log('w: '.$w.' h: '.$h.' arr_resized_w: '.$arr_resized['w'].' arr_resized_h: '.$arr_resized['h']. - // ' org_w: '.$org_width.' org_h: '.$org_height.' scaleToFit w: '.$array['w'].' h: '.$array['h']); - - return $array; -} - -/** - * list with many available colors - * http://mail.gnu.org/archive/html/emacs-diffs/2002-06/msg00158.html - * @uses getRgbFromAll() - */ -static $Colors = array( - 'aliceblue'=>'#f0f8ff', - 'antiquewhite'=>'#faebd7', - 'aquamarine'=>'#7fffd4', - 'azure'=>'#f0ffff', - 'beige'=>'#f5f5dc', - 'bisque'=>'#ffe4c4', - 'black'=>'#000000', - 'blanchedalmond'=>'#ffebcd', - 'blue'=>'#0000ff', - 'blueviolet'=>'#8a2be2', - 'brown'=>'#a52a2a', - 'burlywood'=>'#deb887', - 'cadetblue'=>'#5f9ea0', - 'chartreuse'=>'#7fff00', - 'chocolate'=>'#d2691e', - 'coral'=>'#ff7f50', - 'cornflowerblue'=>'#6495ed', - 'cornsilk'=>'#fff8dc', - 'cyan'=>'#00ffff', - 'darkblue'=>'#00008b', - 'darkcyan'=>'#008b8b', - 'darkgoldenrod'=>'#b886011', - 'darkgray'=>'#a9a9a9', - 'darkgreen'=>'#006400', - 'darkgrey'=>'#a9a9a9', - 'darkkhaki'=>'#bdb76b', - 'darkmagenta'=>'#8b008b', - 'darkolivegreen'=>'#556b2f', - 'darkorange'=>'#ff8c00', - 'darkorchid'=>'#9932cc', - 'darkred'=>'#8b0000', - 'darksalmon'=>'#e9967a', - 'darkseagreen'=>'#8fbc8f', - 'darkslateblue'=>'#483d8b', - 'darkslategray'=>'#2f4f4f', - 'darkslategrey'=>'#2f4f4f', - 'darkturquoise'=>'#00ced1', - 'darkviolet'=>'#9400d3', - 'deeppink'=>'#ff1493', - 'deepskyblue'=>'#00bfff', - 'dimgray'=>'#696969', - 'dimgrey'=>'#696969', - 'dodgerblue'=>'#1e90ff', - 'firebrick'=>'#b22222', - 'floralwhite'=>'#fffaf0', - 'forestgreen'=>'#228b22', - 'gainsboro'=>'#dcdcdc', - 'ghostwhite'=>'#f8f8ff', - 'gold'=>'#ffd700', - 'goldenrod'=>'#daa520', - 'gray'=>'#bebebe', - 'green'=>'#00ff00', - 'greenyellow'=>'#adff2f', - 'honeydew'=>'#f0fff0', - 'hotpink'=>'#ff69b4', - 'indianred'=>'#cd5c5c', - 'ivory'=>'#fffff0', - 'khaki'=>'#f0e68c', - 'lavender'=>'#e6e6fa', - 'lavenderblush'=>'#fff0f5', - 'lawngreen'=>'#7cfc00', - 'lemonchiffon'=>'#fffacd', - 'lightblue'=>'#add8e6', - 'lightcoral'=>'#f08080', - 'lightcyan'=>'#e0ffff', - 'lightgoldenrod'=>'#eedd82', - 'lightgoldenrodyellow'=>'#fafad2', - 'lightgray'=>'#d3d3d3', - 'lightgreen'=>'#90ee90', - 'lightgrey'=>'#d3d3d3', - 'lightpink'=>'#ffb6c1', - 'lightred'=>'#ffc8c8', - 'lightsalmon'=>'#ffa07a', - 'lightseagreen'=>'#20b2aa', - 'lightskyblue'=>'#87cefa', - 'lightslateblue'=>'#8470ff', - 'lightslategray'=>'#778899', - 'lightsteelblue'=>'#b0c4de', - 'lightyellow'=>'#ffffe0', - 'limegreen'=>'#32cd32', - 'linen'=>'#faf0e6', - 'magenta'=>'#ff00ff', - 'maroon'=>'#b03060', - 'mediumaquamarine'=>'#66cdaa', - 'mediumblue'=>'#0000cd', - 'mediumorchid'=>'#ba55d3', - 'mediumpurple'=>'#9370db', - 'mediumseagreen'=>'#3cb371', - 'mediumslateblue'=>'#7b68ee', - 'mediumspringgreen'=>'#00fa9a', - 'mediumturquoise'=>'#48d1cc', - 'mediumvioletred'=>'#c71585', - 'midnightblue'=>'#191970', - 'mintcream'=>'#f5fffa', - 'mistyrose'=>'#ffe4e1', - 'moccasin'=>'#ffe4b5', - 'navajowhite'=>'#ffdead', - 'navy'=>'#000080', - 'navyblue'=>'#000080', - 'oldlace'=>'#fdf5e6', - 'olivedrab'=>'#6b8e23', - 'orange'=>'#ffa500', - 'orangered'=>'#ff4500', - 'orchid'=>'#da70d6', - 'palegoldenrod'=>'#eee8aa', - 'palegreen'=>'#98fb98', - 'paleturquoise'=>'#afeeee', - 'palevioletred'=>'#db7093', - 'papayawhip'=>'#ffefd5', - 'peachpuff'=>'#ffdab9', - 'peru'=>'#cd853f', - 'pink'=>'#ffc0cb', - 'plum'=>'#dda0dd', - 'powderblue'=>'#b0e0e6', - 'purple'=>'#a020f0', - 'red'=>'#ff0000', - 'rosybrown'=>'#bc8f8f', - 'royalblue'=>'#4169e1', - 'saddlebrown'=>'#8b4513', - 'salmon'=>'#fa8072', - 'sandybrown'=>'#f4a460', - 'seagreen'=>'#2e8b57', - 'seashell'=>'#fff5ee', - 'sienna'=>'#a0522d', - 'skyblue'=>'#87ceeb', - 'slateblue'=>'#6a5acd', - 'slategray'=>'#708090', - 'slategrey'=>'#708090', - 'snow'=>'#fffafa', - 'springgreen'=>'#00ff7f', - 'steelblue'=>'#4682b4', - 'tan'=>'#d2b48c', - 'thistle'=>'#d8bfd8', - 'tomato'=>'#ff6347', - 'turquoise'=>'#40e0d0', - 'violet'=>'#ee82ee', - 'violetred'=>'#d02090', - 'wheat'=>'#f5deb3', - 'white'=>'#ffffff', - 'yellow'=>'#ffff00', - 'yellowgreen'=>'#9acd32' -); - -/** - * not used anymore - */ -static function getHtmlColorFromRgb($r,$g,$b) -{ - if(strlen(dechex($r))==1) { - $r = '0'.$r; - } else { - $r = dechex($r); - } - if(strlen(dechex($g))==1) { - $g = '0'.$g; - } else { - $g = dechex($g); - } - if(strlen(dechex($b))==1) { - $b = '0'.$b; - } else { - $b = dechex($b); - } - - return '#'.$r.$g.$b; -} - -/** - * used to check if it is a valid html color - * @uses isHtmlColor() - */ -static function everyCharIsHex($string) -{ - for($i=0;$i<strlen($string);$i++) - { - $char = substr($string,$i,1); - $valid_color = false; - - if($char == "0") { // zero makes problems... '== 0' and '== "0"' is not the same... - $valid_color = true; - } - for($n=1;$n<=9;$n++) - { - if($char == $n) { - $valid_color = true; - } - } - - for($n='a';$n<='f';$n++) - { - if($char === $n) { - $valid_color = true; - } - } - - for($n='A';$n<='F';$n++) - { - if($char === $n) { - $valid_color = true; - } - } - if(!$valid_color) { - return 0; - } - } - return 1; -} - -/** - * used to check if it is a valid html color - * @uses getRgbFromAll() - */ -static function isHtmlColor($string) -{ - switch(strlen($string)) - { - case 6: - if(LinWatermark::everyCharIsHex($string)) { - return 1; - } - break; - case 7: - if(substr($string,0,1)=="#") { - if(LinWatermark::everyCharIsHex(substr($string,1,6))) { - return 1; - } - } - break; - } - return 0; -} - -/** - * converts a html color to an array with the rgb values - * it doesn't matter if the html color is '#00FF00' or '00FF00' - * @uses getRgbFromAll() - */ -static function getRgbFromHtml($string) -{ - switch(strlen($string)) - { - case 6: - break; - case 7: - $string = substr($string,1,6); - break; - } - $r_hex = substr($string,0,2); - $g_hex = substr($string,2,2); - $b_hex = substr($string,4,2); - $arr['r'] = hexdec($r_hex); - $arr['g'] = hexdec($g_hex); - $arr['b'] = hexdec($b_hex); - return $arr; -} - -/** - * returns an array with the rgb values - * it doesn't matter if the argument is 'darkblue', '#00FF55' or '00FF55' - * if it isn't a correct color, the color (0,0,0) is returned - * - * @uses watermark_gd() - */ -static function getRgbFromAll($string) -{ - if( isset( LinWatermark::$Colors[$string]) ) - { - return LinWatermark::getRgbFromHtml( LinWatermark::$Colors[$string] ); - } - elseif(LinWatermark::isHtmlColor($string) ) - { - return LinWatermark::getRgbFromHtml( $string ); - } - else - { - array('r'=>0,'g'=>0,'b'=>0); - } -} - -/** - * return html color without '#' - * - * used in linpha2 - admin - settings_layout - */ -static function getHtmlFromAll($string) -{ - if(LinWatermark::isHtmlColor($string)) - { - if(substr($string,0,1)=="#") - { - return substr($string,1,6); - } - else - { - return $string; - } - } - else - { - if( isset( LinWatermark::$Colors[$string]) ) - { - return substr(LinWatermark::$Colors[$string],1,6); - } - else - { - return 'ffffff'; - } - } -} - -/** - * @uses watermark_gd() - * calcs the position in pixel with a given align - * src_w, src_h: width and height from the textfield (or the small watermark image) - * dst_w, dst_h: width and height from the image - * pos_x, pos_y: additional adjust for the image - * - */ -static function calcAlign($align, $src_w, $src_h, $dst_w, $dst_h, $pos_x, $pos_y) -{ - - switch($align) - { - case "center": - $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); - $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); - break; - case "east": - $arr_pos['x'] = $dst_w-$src_w+($pos_x); - $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); - break; - case "west": - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = ($dst_h-$src_h)/2+($pos_y); - break; - case "north": - $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); - $arr_pos['y'] = $pos_y; - break; - case "south": - $arr_pos['x'] = ($dst_w-$src_w)/2+($pos_x); - $arr_pos['y'] = $dst_h-$src_h+($pos_y); - break; - case "northeast": - $arr_pos['x'] = $dst_w-$src_w+($pos_x); - $arr_pos['y'] = $pos_y; - break; - case "northwest": - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = $pos_y; - break; - case "southwest": - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = $dst_h-$src_h+($pos_y); - break; - case "southeast": - $arr_pos['x'] = $dst_w-$src_w+($pos_x); - $arr_pos['y'] = $dst_h-$src_h+($pos_y); - break; - default: - $arr_pos['x'] = $pos_x; - $arr_pos['y'] = $pos_y; - break; - - } - return $arr_pos; -} - -} -?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-17 22:58:51
|
Revision: 4881 http://linpha.svn.sourceforge.net/linpha/?rev=4881&view=rev Author: fangehrn Date: 2008-02-17 14:58:01 -0800 (Sun, 17 Feb 2008) Log Message: ----------- Modified Paths: -------------- trunk/linpha2/ChangeLog Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-17 22:50:14 UTC (rev 4880) +++ trunk/linpha2/ChangeLog 2008-02-17 22:58:01 UTC (rev 4881) @@ -9,7 +9,11 @@ * changed mysql to utf8 - database creation - table creation - - database connection + - database connection + + * installer + - enabled sqlite manual mode + - fixed some navigation issues (especially with sqlite) 2008-02-13 flo * moved not needed files to the misc folder This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |