1
0
Эх сурвалжийг харах

#294 Cropper: integration into Persons & Orgs modules

Alex Trofimov 10 жил өмнө
parent
commit
73568376eb
30 өөрчлөгдсөн 322 нэмэгдсэн , 208 устгасан
  1. 10 0
      inc/classes/BxDolAccount.php
  2. 2 1
      inc/classes/BxDolMetatags.php
  3. 14 2
      inc/classes/BxDolStorage.php
  4. 45 18
      inc/classes/BxDolStorageQuery.php
  5. 7 4
      inc/classes/BxDolUploader.php
  6. 52 2
      modules/base/general/classes/BxBaseModGeneralFormEntry.php
  7. 30 0
      modules/base/general/js/forms.js
  8. 27 0
      modules/base/general/template/css/forms.css
  9. 2 3
      modules/base/profile/classes/BxBaseModProfileDb.php
  10. 52 21
      modules/base/profile/classes/BxBaseModProfileFormEntry.php
  11. 10 0
      modules/base/profile/classes/BxBaseModProfileFormsEntryHelper.php
  12. 1 0
      modules/base/profile/template/css/forms.css
  13. 9 0
      modules/base/profile/template/form_ghost_template.html
  14. 2 42
      modules/base/text/classes/BxBaseModTextFormEntry.php
  15. 0 30
      modules/base/text/js/forms.js
  16. 0 22
      modules/base/text/template/css/forms.css
  17. 11 11
      modules/base/text/template/form_ghost_template.html
  18. 1 1
      modules/boonex/albums/classes/BxAlbumsConfig.php
  19. 7 7
      modules/boonex/albums/template/form_ghost_template.html
  20. 2 2
      modules/boonex/market/classes/BxMarketFormEntry.php
  21. 15 15
      modules/boonex/market/template/form_ghost_template.html
  22. 11 11
      modules/boonex/market/template/form_ghost_template_file.html
  23. 2 1
      modules/boonex/organizations/classes/BxOrgsConfig.php
  24. 2 7
      modules/boonex/organizations/install/sql/install.sql
  25. 1 0
      modules/boonex/organizations/template/css/forms.css
  26. 1 0
      modules/boonex/organizations/template/form_ghost_template.html
  27. 2 1
      modules/boonex/persons/classes/BxPersonsConfig.php
  28. 2 7
      modules/boonex/persons/install/sql/install.sql
  29. 1 0
      modules/boonex/persons/template/css/forms.css
  30. 1 0
      modules/boonex/persons/template/form_ghost_template.html

+ 10 - 0
inc/classes/BxDolAccount.php

@@ -245,6 +245,16 @@ class BxDolAccount extends BxDol
         return $iId ? $iId : false;
     }
 
+    /**
+     * Get all profile ids associated with the account
+     */
+    public function getProfilesIds ()
+    {
+        $oProfileQuery = BxDolProfileQuery::getInstance();
+        $a = $oProfileQuery->getProfilesByAccount($this->_iAccountID);
+        return $a ? array_keys($a) : array();
+    }
+
     /**
      * Get all profiles associated with the account
      */

+ 2 - 1
inc/classes/BxDolMetatags.php

@@ -286,9 +286,10 @@ class BxDolMetatags extends BxDol implements iBxDolFactoryObject
             if (!($oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $sFormDisplay)))
                 return array();
 
-            foreach ($oForm->aInputs as $k => $a)
+            foreach ($oForm->aInputs as $k => $a) {
                 if ('textarea' == $a['type'])
                     $aFields[] = $a['name'];
+            }
         } 
         elseif (is_array($CNF['FIELDS_WITH_KEYWORDS'])) {
             $aFields = $CNF['FIELDS_WITH_KEYWORDS'];

+ 14 - 2
inc/classes/BxDolStorage.php

@@ -680,10 +680,17 @@ abstract class BxDolStorage extends BxDol implements iBxDolFactoryObject
      * Get ghost/orphaned files for particular user.
      * @param $iProfileId profile id
      * @param $iContentId content id, or false to not consider content id at all
+     * @param $isCheckAllAccountProfiles get all files associated with all account profiles
      * @return array of arrays
      */
-    public function getGhosts($iProfileId, $iContentId = false)
+    public function getGhosts($iProfileId, $iContentId = false, $isCheckAllAccountProfiles = false)
     {
+        if ($isCheckAllAccountProfiles && ($oProfile = BxDolProfile::getInstance($iProfileId))) {
+            $oAccount = $oProfile->getAccountObject();
+            $aProfiles = $oAccount->getProfilesIds();
+            return $this->_oDb->getGhosts($aProfiles, $iContentId);
+        }
+        
         return $this->_oDb->getGhosts($iProfileId, $iContentId);
     }
 
@@ -696,7 +703,12 @@ abstract class BxDolStorage extends BxDol implements iBxDolFactoryObject
      */
     public function updateGhostsContentId($mixedFileIds, $iProfileId, $iContentId)
     {
-        return $this->_oDb->updateGhostsContentId($mixedFileIds, $iProfileId, $iContentId);
+        $aProfiles = array();
+        if ($oProfile = BxDolProfile::getInstance($iProfileId)) {
+            $oAccount = $oProfile->getAccountObject();
+            $aProfiles = $oAccount->getProfilesIds();
+        }
+        return $this->_oDb->updateGhostsContentId($mixedFileIds, $iProfileId, $iContentId, $aProfiles);
     }
 
     /**

+ 45 - 18
inc/classes/BxDolStorageQuery.php

@@ -223,10 +223,23 @@ class BxDolStorageQuery extends BxDolDb
         return $iCount;
     }
 
-    public function updateGhostsContentId($mixedFileIds, $iProfileId, $iContentId)
+    public function updateGhostsContentId($mixedFileIds, $iProfileId, $iContentId, $aProfiles = array())
     {
-        $sQuery = $this->prepare("UPDATE `sys_storage_ghosts` SET `content_id` = ? WHERE `profile_id` = ? AND `object` = ? AND `id` IN (" . $this->implode_escape($mixedFileIds) . ")", $iContentId, $iProfileId, $this->_aObject['object']);
-        return $this->res($sQuery);
+        $aBindings = array(
+            'content' => $iContentId,
+    		'profile' => $iProfileId,
+    		'object' => $this->_aObject['object']
+        );
+
+        $sSetAddon = '';
+        $sWhere = " AND `profile_id` = :profile ";
+        if ($aProfiles || isAdmin()) {
+            $sSetAddon = ', `profile_id` = :profile ';
+            $sWhere = isAdmin() ? "" : " AND `profile_id` =  IN(" . $this->implode_escape($aProfiles) . ")";
+        }
+        
+        $sQuery = $this->prepare("UPDATE `sys_storage_ghosts` SET `content_id` = :content $sSetAddon WHERE `object` = :object $sWhere AND `id` IN (" . $this->implode_escape($mixedFileIds) . ")");
+        return $this->res($sQuery, $aBindings);
     }
 
     public function deleteGhosts($mixedFileIds, $iProfileId, $iContentId = false)
@@ -247,9 +260,9 @@ class BxDolStorageQuery extends BxDolDb
         return $iCount;
     }
 
-    public function getGhosts($iProfileId, $iContentId = false)
+    public function getGhosts($mixedProfileId, $iContentId = false)
     {
-        return $this->getFiles($iProfileId, true, $iContentId);
+        return $this->getFiles($mixedProfileId, true, $iContentId);
     }
 
     public function getGhost($iFileId)
@@ -258,29 +271,43 @@ class BxDolStorageQuery extends BxDolDb
         return $this->getRow($sQuery);
     }
 
-    public function getFiles($iProfileId, $isGhostsOnly = false, $iContentId = false)
+    public function getFiles($mixedProfileId, $isGhostsOnly = false, $iContentId = false)
     {
-        $aBindings = array();
+        $aBindings = array();        
 
+        $sWhere = '';
         $sJoin = '';
         if ($isGhostsOnly) {
-        	$aBindings['profile_id'] = $iProfileId;
-        	$aBindings['object'] = $this->_aObject['object'];
-
-            $sJoin .= " INNER JOIN `sys_storage_ghosts` AS `g` ON (`f`.`id` = `g`.`id` AND `g`.`profile_id` = :profile_id AND `g`.`object` = :object ";
+            $aBindings['object'] = $this->_aObject['object'];
+
+            $sOnProfile = '';
+            if (is_array($mixedProfileId) && $mixedProfileId) {
+                $sOnProfile = " AND `g`.`profile_id` IN(" . $this->implode_escape($mixedProfileId) . ") ";
+            } 
+            elseif (!is_array($mixedProfileId) && false !== $mixedProfileId) {
+                $aBindings['profile_id'] = $mixedProfileId;
+                
+                $sOnProfile = " AND `g`.`profile_id` = :profile_id ";                
+            }
+            
+            $sJoin .= " INNER JOIN `sys_storage_ghosts` AS `g` ON (`f`.`id` = `g`.`id` AND `g`.`object` = :object " . $sOnProfile;
             if (false !== $iContentId) {
-            	$aBindings['content_id'] = $iContentId;
+                $aBindings['content_id'] = $iContentId;
 
                 $sJoin .= " AND `g`.`content_id` = :content_id";
             }
-            $sJoin .= ')';
-        }
 
-        $sWhere = '';
-        if(false !== $iProfileId) {
-        	$aBindings['profile_id'] = $iProfileId;
+            $sJoin .= ')';
+        } 
+        else {
+            if (is_array($mixedProfileId) && $mixedProfileId) {
+                $sWhere = " WHERE `f`.`profile_id` IN(" . $this->implode_escape($mixedProfileId) . ") ";
+            }
+            elseif (!is_array($mixedProfileId) && false !== $mixedProfileId) {
+                $aBindings['profile_id'] = $mixedProfileId;
 
-        	$sWhere = "WHERE `f`.`profile_id` = :profile_id";
+                $sWhere = " WHERE `f`.`profile_id` = :profile_id ";
+            }
         }
 
         $sQuery = "SELECT `f`.* FROM " . $this->_sTableFiles . " AS `f` " . $sJoin . $sWhere;

+ 7 - 4
inc/classes/BxDolUploader.php

@@ -321,7 +321,7 @@ abstract class BxDolUploader extends BxDol
             $oImagesTranscoder = BxDolTranscoderImage::getObjectInstance($sImagesTranscoder);
 
         $a = '';
-        $aGhosts = $oStorage->getGhosts($iProfileId, $iContentId);
+        $aGhosts = $oStorage->getGhosts(isAdmin() && $iContentId ? false : $iProfileId, $iContentId);
         foreach ($aGhosts as $aFile) {
             $sFileIcon = '';
 
@@ -361,10 +361,13 @@ abstract class BxDolUploader extends BxDol
 
         $aFile = $oStorage->getFile ($iFileId);
         if (!$aFile)
-            return _t('_Error Occured');
+            return _t('_error occured');
 
-        if ($aFile['profile_id'] != $iProfileId)
-            return _t('_Error Occured');
+        $oProfile = BxDolProfile::getInstance($iProfileId);
+        $oAccount = $oProfile ? $oProfile->getAccountObject() : null;
+        $aProfiles = $oAccount ? $oAccount->getProfiles() : array();
+        if (!isset($aProfiles[$aFile['profile_id']]) && !isAdmin())
+            return _t('_sys_txt_access_denied');
 
         if (!$oStorage->deleteFile($iFileId))
             return $oStorage->getErrorString();

+ 52 - 2
modules/base/general/classes/BxBaseModGeneralFormEntry.php

@@ -63,7 +63,7 @@ class BxBaseModGeneralFormEntry extends BxTemplFormView
 
         if (isset($CNF['FIELD_CHANGED']))
             $aValsToAdd[$CNF['FIELD_CHANGED']] = time();
-
+            
         return parent::update ($iContentId, $aValsToAdd, $aTrackTextFieldsChanges);
     }
 
@@ -140,17 +140,47 @@ class BxBaseModGeneralFormEntry extends BxTemplFormView
         return $this->getCleanValue($s);
     }
 
+    public function processFiles ($sFieldFile, $iContentId = 0, $isAssociateWithContent = false)
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        $mixedFileIds = $this->getCleanValue($sFieldFile);
+        if(!$mixedFileIds)
+            return true;
+
+        $oStorage = BxDolStorage::getObjectInstance($this->aInputs[$sFieldFile]['storage_object']);
+        if (!$oStorage)
+            return false;
+
+        $iProfileId = $this->getContentOwnerProfileId($iContentId);
+
+        $aGhostFiles = $oStorage->getGhosts ($iProfileId, $isAssociateWithContent ? 0 : $iContentId, true);
+
+        if (!$aGhostFiles)
+            return true;
+
+        foreach ($aGhostFiles as $aFile) {
+            if ($aFile['private'])
+                $oStorage->setFilePrivate ($aFile['id'], 0);
+            if ($iContentId)
+                $this->_associalFileWithContent($oStorage, $aFile['id'], $iProfileId, $iContentId);
+        }
+
+        return true;
+    }
+
     function addCssJs ()
     {
         if (!isset($this->aParams['view_mode']) || !$this->aParams['view_mode']) {
             if (self::$_isCssJsAdded)
                 return;
             $this->_oModule->_oTemplate->addCss('forms.css');
+            $this->_oModule->_oTemplate->addJs('modules/base/general/js/|forms.js');
         }
 
         return parent::addCssJs ();
     }
-
+    
     function genViewRowValue(&$aInput)
     {
         $s = parent::genViewRowValue($aInput);
@@ -168,6 +198,26 @@ class BxBaseModGeneralFormEntry extends BxTemplFormView
         $this->_oMetatagsObject = $o;
     }
 
+    function getContentOwnerProfileId ($iContentId)
+    {
+        // file owner must be author of the content or profile itself in case of profile based module
+        if ($iContentId) {
+            if ($this->_oModule instanceof iBxDolProfileService) {
+                $oProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->MODULE);
+            }
+            else {
+                $aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
+                $oProfile = $aContentInfo ? BxDolProfile::getInstance($aContentInfo[$CNF['FIELD_AUTHOR']]) : null;
+            }
+            $iProfileId = $oProfile ? $oProfile->id() : bx_get_logged_profile_id();
+        }
+        else {
+            $iProfileId = bx_get_logged_profile_id();
+        }
+
+        return $iProfileId;
+    }
+
 }
 
 /** @} */

+ 30 - 0
modules/base/general/js/forms.js

@@ -0,0 +1,30 @@
+
+function bx_base_general_select_thumb(eCheckbox) {
+	bx_base_general_select_ghost(eCheckbox, 'thumb');
+}
+
+function bx_base_general_select_ghost(eCheckbox, sName) {
+	var eCont = $(eCheckbox).parents('.bx-form-input-files-result');
+    if (!eCont.length)
+        return;
+
+    eCont.find('.bx-base-general-use-as-' + sName + ' input:checked').each (function () {        
+        if($(this).attr('id') != $(eCheckbox).attr('id'))
+        	$(this).css('border', '1px solid red').attr('checked', false);
+    });
+}
+
+function bx_base_general_delete_ghost (iFileId, sFileUrl, sFileIcon, aEditors, oUploaderInstance) {
+    if ('undefined' !== typeof(bx_editor_remove_img)) {
+        bx_editor_remove_img (
+            aEditors,
+            ['img[src="' + sFileIcon + '"]', 'img[src="' + sFileUrl + '"]', '#bx-base-general-img-' + iFileId, '.bx-base-general-icon-' + iFileId]
+        );
+    }
+    oUploaderInstance.deleteGhost(iFileId);
+}
+
+function bx_base_general_insert_to_post (iFileId, sFileUrl, sEditorId) {
+    bx_editor_insert_img (sEditorId, 'bx-base-general-img-' + iFileId, sFileUrl, 'bx-base-general-img');
+}
+

+ 27 - 0
modules/base/general/template/css/forms.css

@@ -1,7 +1,34 @@
 
+/* uploader */
+
+.bx-uploader-ghost .bx-base-general-icon-wrapper {
+    float:left;
+}
+
+.bx-uploader-ghost .bx-base-general-icon-wrapper img {
+    max-height:12.5rem;
+}
+
+.bx-uploader-ghost .bx-btn {
+	float: none;
+	display: inline-block;
+	vertical-align: top; 
+}
+
+.bx-base-general-uploader-ghost input.bx-form-input-text {
+    width:18.75rem;
+}
+
+.bx-base-general-use-as-thumb input,
+.bx-base-general-use-as-thumb label {
+    vertical-align:middle;
+}
+
+/* location input */
 
 .bx-form-input-location-cont > div {
     float:left;
     line-height:1.5rem;
 }
 
+

+ 2 - 3
modules/base/profile/classes/BxBaseModProfileDb.php

@@ -28,7 +28,7 @@ class BxBaseModProfileDb extends BxBaseModGeneralDb
     public function updateContentPictureById($iContentId, $iProfileId, $iPictureId, $sFieldPicture)
     {
     	$aBindings = array(
-    		$sFieldPicture => $iPictureId,
+    		'pic' => $iPictureId,
     		'id' => $iContentId
     	);
 
@@ -39,8 +39,7 @@ class BxBaseModProfileDb extends BxBaseModGeneralDb
             $sWhere = " AND `author` = :author ";
         }
 
-        $sQuery = "UPDATE `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` SET `" . $sFieldPicture . "` = :" . $sFieldPicture . " WHERE `id` = :id" . $sWhere;
-
+        $sQuery = "UPDATE `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` SET `" . $sFieldPicture . "` = :pic WHERE `id` = :id" . $sWhere;
         return $this->query($sQuery, $aBindings);
     }
 

+ 52 - 21
modules/base/profile/classes/BxBaseModProfileFormEntry.php

@@ -30,12 +30,14 @@ class BxBaseModProfileFormEntry extends BxBaseModGeneralFormEntry
             $this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']]['info'] = $sInfo;
 		}
 
-        if (!empty($CNF['FIELD_PICTURE'])) {
-            $this->_aImageFields[$CNF['FIELD_PICTURE']] = array (
-                'storage_object' => $CNF['OBJECT_STORAGE'],
-                'images_transcoder' => $CNF['OBJECT_IMAGES_TRANSCODER_THUMB'],
-                'field_preview' => $CNF['FIELD_PICTURE_PREVIEW'],
-            );
+        if (!empty($CNF['FIELD_PICTURE']) && isset($this->aInputs[$CNF['FIELD_PICTURE']])) {
+            $this->aInputs[$CNF['FIELD_PICTURE']]['storage_object'] = $CNF['OBJECT_STORAGE'];
+            $this->aInputs[$CNF['FIELD_PICTURE']]['uploaders'] = !empty($this->aInputs[$CNF['FIELD_PICTURE']]['value']) ? unserialize($this->aInputs[$CNF['FIELD_PICTURE']]['value']) : $CNF['OBJECT_UPLOADERS'];
+            $this->aInputs[$CNF['FIELD_PICTURE']]['images_transcoder'] = $CNF['OBJECT_IMAGES_TRANSCODER_THUMB'];
+            $this->aInputs[$CNF['FIELD_PICTURE']]['storage_private'] = 0;
+            $this->aInputs[$CNF['FIELD_PICTURE']]['multiple'] = false;
+            $this->aInputs[$CNF['FIELD_PICTURE']]['content_id'] = 0;
+            $this->aInputs[$CNF['FIELD_PICTURE']]['ghost_template'] = '';
         }
 
         if (!empty($CNF['FIELD_COVER'])) {
@@ -46,9 +48,6 @@ class BxBaseModProfileFormEntry extends BxBaseModGeneralFormEntry
             );
         }
 
-        if (!empty($CNF['FIELD_PICTURE_PREVIEW']))
-            $this->_aImageFields[$CNF['FIELD_PICTURE_PREVIEW']] = $this->_aImageFields[$CNF['FIELD_PICTURE']];
-
         if (!empty($CNF['FIELD_COVER_PREVIEW']))
             $this->_aImageFields[$CNF['FIELD_COVER_PREVIEW']] = $this->_aImageFields[$CNF['FIELD_COVER']];
 
@@ -61,9 +60,15 @@ class BxBaseModProfileFormEntry extends BxBaseModGeneralFormEntry
     {
         $CNF = &$this->_oModule->_oConfig->CNF;
 
-        if (!empty($aValues[$CNF['FIELD_PICTURE']]) && $aValues[$CNF['FIELD_PICTURE']] && isset($this->aInputs[$CNF['FIELD_PICTURE']]) && $this->aInputs[$CNF['FIELD_PICTURE']]) {
-            $this->aInputs[$CNF['FIELD_PICTURE']]['required'] = false;
-            unset($this->aInputs[$CNF['FIELD_PICTURE']]['checker']);
+        if (isset($this->aInputs[$CNF['FIELD_PICTURE']])) {
+
+            $aContentInfo = false;
+            if ($aValues && !empty($aValues[$CNF['FIELD_ID']])) {
+                $aContentInfo = $this->_oModule->_oDb->getContentInfoById ($aValues[$CNF['FIELD_ID']]);
+                $this->aInputs[$CNF['FIELD_PICTURE']]['content_id'] = $aValues[$CNF['FIELD_ID']];
+            }
+
+            $this->aInputs[$CNF['FIELD_PICTURE']]['ghost_template'] = $this->_oModule->_oTemplate->parseHtmlByName('form_ghost_template.html', $this->_getPhotoGhostTmplVars($aContentInfo));
         }
 
         parent::initChecker($aValues, $aSpecificValues);
@@ -111,18 +116,15 @@ class BxBaseModProfileFormEntry extends BxBaseModGeneralFormEntry
     {
         $CNF = &$this->_oModule->_oConfig->CNF;
 
-        if (!empty($this->aInputs[$CNF['FIELD_PICTURE']]) && !empty($this->aInputs[$CNF['FIELD_PICTURE']]['file_id'])) {
-            $aValsToAdd = array_merge($aValsToAdd, array (
-                $CNF['FIELD_PICTURE'] => $this->aInputs[$CNF['FIELD_PICTURE']]['file_id'],
-            ));
-        }
-
         if (!empty($this->aInputs[$CNF['FIELD_COVER']]) && !empty($this->aInputs[$CNF['FIELD_COVER']]['file_id'])) {
             $aValsToAdd = array_merge($aValsToAdd, array (
                 $CNF['FIELD_COVER'] => $this->aInputs[$CNF['FIELD_COVER']]['file_id'],
             ));
         }
 
+        if (isset($CNF['FIELD_PICTURE']))
+            $aValsToAdd[$CNF['FIELD_PICTURE']] = 0; // we will update this field later, since we don't know content id yet
+        
         return parent::insert ($aValsToAdd, $isIgnore);
     }
 
@@ -133,9 +135,9 @@ class BxBaseModProfileFormEntry extends BxBaseModGeneralFormEntry
         if (!empty($this->aInputs[$CNF['FIELD_COVER']]) && !empty($this->aInputs[$CNF['FIELD_COVER']]['file_id']))
             $aValsToAdd[$CNF['FIELD_COVER']] = $this->aInputs[$CNF['FIELD_COVER']]['file_id'];
 
-        if (!empty($this->aInputs[$CNF['FIELD_PICTURE']]) && !empty($this->aInputs[$CNF['FIELD_PICTURE']]['file_id']))
-            $aValsToAdd[$CNF['FIELD_PICTURE']] = $this->aInputs[$CNF['FIELD_PICTURE']]['file_id'];
-
+        if (isset($CNF['FIELD_PICTURE']))
+            $aValsToAdd[$CNF['FIELD_PICTURE']] = 0; // we will update this field later
+        
         return parent::update ($iContentId, $aValsToAdd, $aTrackTextFieldsChanges);
     }
 
@@ -148,6 +150,16 @@ class BxBaseModProfileFormEntry extends BxBaseModGeneralFormEntry
                 $this->_deleteFile ($iContentId, $sField, $aContentInfo[$sField]);
         }
 
+        if (isset($CNF['FIELD_PICTURE']) && isset($CNF['OBJECT_STORAGE']) && $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE'])) {
+            $iProfileId = $this->getContentOwnerProfileId($iContentId);
+            $aFiles = $oStorage->getGhosts($iProfileId, $iContentId);
+            foreach ($aFiles as $aFile) {
+                if (!$oStorage->getFile($aFile['id']))
+                    continue;
+                $bRet = $oStorage->deleteFile($aFile['id'], $this->_iAccountProfileId);
+            }
+        }
+
         return parent::delete($iContentId, $aContentInfo);
     }
 
@@ -172,6 +184,12 @@ class BxBaseModProfileFormEntry extends BxBaseModGeneralFormEntry
         return $iFileId;
     }
 
+    protected function _associalFileWithContent($oStorage, $iFileId, $iProfileId, $iContentId)
+    {
+        $oStorage->updateGhostsContentId ($iFileId, $iProfileId, $iContentId);
+        $this->_oModule->_oDb->updateContentPictureById($iContentId, 0/*$iProfileId*/, $iFileId, $this->_oModule->_oConfig->CNF['FIELD_PICTURE']);
+    }
+    
     function _deleteFile ($iContentId, $sFieldPicture, $iFileId, $bForceFieldUpdate = false)
     {
         if (!$iFileId)
@@ -193,6 +211,19 @@ class BxBaseModProfileFormEntry extends BxBaseModGeneralFormEntry
         return $bRet;
     }
 
+    protected function _getPhotoGhostTmplVars($aContentInfo = array())
+    {
+    	$CNF = &$this->_oModule->_oConfig->CNF;
+
+    	return array (
+			'name' => $this->aInputs[$CNF['FIELD_PICTURE']]['name'],
+            'content_id' => $this->aInputs[$CNF['FIELD_PICTURE']]['content_id'],
+			'bx_if:set_thumb' => array (
+				'condition' => false,
+				'content' => array (),
+			),
+		);
+    }
 }
 
 /** @} */

+ 10 - 0
modules/base/profile/classes/BxBaseModProfileFormsEntryHelper.php

@@ -90,8 +90,14 @@ class BxBaseModProfileFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
         if (!$this->isAutoApproval() && BX_PROFILE_STATUS_ACTIVE == $aProfileInfo['status'] && !empty($aTrackTextFieldsChanges['changed_fields']))
             $oProfile->disapprove(BX_PROFILE_ACTION_AUTO, 0, $this->_oModule->serviceActAsProfile());
 
+        // process uploaded files
+        $oForm = $this->getObjectFormEdit();
+        $oForm->processFiles($CNF['FIELD_PICTURE'], $iContentId, false);
+
         // create an alert
         bx_alert($this->_oModule->getName(), 'edited', $aContentInfo[$CNF['FIELD_ID']]);
+
+        return '';
     }
 
     public function onDataAddAfter ($iAccountId, $iContentId)
@@ -115,6 +121,10 @@ class BxBaseModProfileFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
             (isAdmin() ? MEMBERSHIP_ID_ADMINISTRATOR : getParam($CNF['PARAM_DEFAULT_ACL_LEVEL']));
         BxDolAcl::getInstance()->setMembership($iProfileId, $iAclLevel, 0, true);
 
+        // process uploaded files
+        $oForm = $this->getObjectFormAdd();
+        $oForm->processFiles($CNF['FIELD_PICTURE'], $iContentId, true);
+
         // alert
         bx_alert($this->_oModule->getName(), 'added', $iContentId);
 

+ 1 - 0
modules/base/profile/template/css/forms.css

@@ -0,0 +1 @@
+@import url(../../../general/template/css/forms.css);

+ 9 - 0
modules/base/profile/template/form_ghost_template.html

@@ -0,0 +1,9 @@
+<div id="bx-uploader-file-{storage_object}-{file_id}" class="bx-uploader-ghost bx-def-margin-sec-top bx-clearfix">
+    <input type="hidden" name="__name__[]" value="{file_id}" />
+    <div class="bx-base-general-icon-wrapper bx-def-margin-sec-right">
+        <img src="{file_icon}" class="bx-def-round-corners bx-base-general-icon bx-base-general-icon-{file_id}" />
+    </div>
+    <span class="bx-base-general-uploader-ghost">
+        <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
+    </span>
+</div>

+ 2 - 42
modules/base/text/classes/BxBaseModTextFormEntry.php

@@ -75,7 +75,7 @@ class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
 
         $iContentId = parent::insert ($aValsToAdd, $isIgnore);
         if(!empty($iContentId))
-            $this->_processFiles ($CNF['FIELD_PHOTO'], $iContentId, true);
+            $this->processFiles ($CNF['FIELD_PHOTO'], $iContentId, true);
 
         return $iContentId;
     }
@@ -93,40 +93,11 @@ class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
 
         $iRet = parent::update ($iContentId, $aValsToAdd, $aTrackTextFieldsChanges);
 
-        $this->_processFiles ($CNF['FIELD_PHOTO'], $iContentId, false);
+        $this->processFiles ($CNF['FIELD_PHOTO'], $iContentId, false);
 
         return $iRet;
     }
 
-    function _processFiles ($sFieldFile, $iContentId = 0, $isAssociateWithContent = false)
-    {
-        $CNF = &$this->_oModule->_oConfig->CNF;
-
-        $mixedFileIds = $this->getCleanValue($sFieldFile);
-        if(!$mixedFileIds)
-            return true;
-
-        $oStorage = BxDolStorage::getObjectInstance($this->aInputs[$sFieldFile]['storage_object']);
-        if (!$oStorage)
-            return false;
-
-        $iProfileId = bx_get_logged_profile_id();
-
-        $aGhostFiles = $oStorage->getGhosts ($iProfileId, $isAssociateWithContent ? 0 : $iContentId);
-
-        if (!$aGhostFiles)
-            return true;
-
-        foreach ($aGhostFiles as $aFile) {
-            if ($aFile['private'])
-                $oStorage->setFilePrivate ($aFile['id'], 0);
-            if ($iContentId)
-                $this->_associalFileWithContent($oStorage, $aFile['id'], $iProfileId, $iContentId);
-        }
-
-        return true;
-    }
-
     function _deleteFile ($iFileId, $sStorage = '')
     {
         $CNF = &$this->_oModule->_oConfig->CNF;
@@ -146,17 +117,6 @@ class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
         return $oStorage->deleteFile($iFileId, $iProfileId);
     }
 
-    function addCssJs ()
-    {
-        if (!isset($this->aParams['view_mode']) || !$this->aParams['view_mode']) {
-            if (self::$_isCssJsAdded)
-                return;
-            $this->_oModule->_oTemplate->addJs('modules/base/text/js/|forms.js');
-        }
-
-        return parent::addCssJs ();
-    }
-
     protected function _associalFileWithContent($oStorage, $iFileId, $iProfileId, $iContentId)
     {
         $oStorage->updateGhostsContentId ($iFileId, $iProfileId, $iContentId);

+ 0 - 30
modules/base/text/js/forms.js

@@ -1,30 +0,0 @@
-
-function bx_base_text_select_thumb(eCheckbox) {
-	bx_base_text_select_ghost(eCheckbox, 'thumb');
-}
-
-function bx_base_text_select_ghost(eCheckbox, sName) {
-	var eCont = $(eCheckbox).parents('.bx-form-input-files-result');
-    if (!eCont.length)
-        return;
-
-    eCont.find('.bx-base-text-use-as-' + sName + ' input:checked').each (function () {        
-        if($(this).attr('id') != $(eCheckbox).attr('id'))
-        	$(this).css('border', '1px solid red').attr('checked', false);
-    });
-}
-
-function bx_base_text_delete_ghost (iFileId, sFileUrl, sFileIcon, aEditors, oUploaderInstance) {
-    if ('undefined' !== typeof(bx_editor_remove_img)) {
-        bx_editor_remove_img (
-            aEditors,
-            ['img[src="' + sFileIcon + '"]', 'img[src="' + sFileUrl + '"]', '#bx-base-text-img-' + iFileId, '.bx-base-text-icon-' + iFileId]
-        );
-    }
-    oUploaderInstance.deleteGhost(iFileId);
-}
-
-function bx_base_text_insert_to_post (iFileId, sFileUrl, sEditorId) {
-    bx_editor_insert_img (sEditorId, 'bx-base-text-img-' + iFileId, sFileUrl, 'bx-base-text-img');
-}
-

+ 0 - 22
modules/base/text/template/css/forms.css

@@ -1,25 +1,3 @@
 
 @import url(../../../general/template/css/forms.css);
 
-.bx-uploader-ghost .bx-base-text-icon-wrapper {
-    float:left;
-}
-
-.bx-uploader-ghost .bx-base-text-icon-wrapper img {
-    max-height:12.5rem;
-}
-
-.bx-uploader-ghost .bx-btn {
-	float: none;
-	display: inline-block;
-	vertical-align: top; 
-}
-
-.bx-base-text-uploader-ghost input.bx-form-input-text {
-    width:18.75rem;
-}
-
-.bx-base-text-use-as-thumb input,
-.bx-base-text-use-as-thumb label {
-    vertical-align:middle;
-}

+ 11 - 11
modules/base/text/template/form_ghost_template.html

@@ -1,20 +1,20 @@
 <div id="bx-uploader-file-{storage_object}-{file_id}" class="bx-uploader-ghost bx-def-margin-sec-top bx-clearfix">
     <input type="hidden" name="__name__" value="{file_id}" />
-    <div class="bx-base-text-icon-wrapper bx-def-margin-sec-right">
-        <img src="{file_icon}" class="bx-def-round-corners bx-base-text-icon bx-base-text-icon-{file_id}" />
+    <div class="bx-base-general-icon-wrapper bx-def-margin-sec-right">
+        <img src="{file_icon}" class="bx-def-round-corners bx-base-general-icon bx-base-general-icon-{file_id}" />
     </div>
-    <span class="bx-base-text-uploader-ghost">
+    <span class="bx-base-general-uploader-ghost">
         <b><bx_text:_sys_txt_form_entry_input_picture_pic_url /></b><br />
         <input class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom" type="text" value="{file_url}" readonly="1" /> <br />
 
-        <span id="bx-base-text-intert-to-post-link-{file_id}" style="display:none;">
-            <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_text_insert_to_post('{file_id}', '{file_url}', '__editor_id__');"><bx_text:_sys_txt_form_entry_input_picture_insert /></a>
+        <span id="bx-base-general-intert-to-post-link-{file_id}" style="display:none;">
+            <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_insert_to_post('{file_id}', '{file_url}', '__editor_id__');"><bx_text:_sys_txt_form_entry_input_picture_insert /></a>
         </span>
-        <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_text_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
+        <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
 
         <bx_if:set_thumb>
-            <span class="bx-base-text-use-as-thumb">
-                <input type="checkbox" name="__name_thumb__[]" value="{file_id}" onclick="bx_base_text_select_thumb(this)" id="__name_thumb__-{file_id}" /> 
+            <span class="bx-base-general-use-as-thumb">
+                <input type="checkbox" name="__name_thumb__[]" value="{file_id}" onclick="bx_base_general_select_thumb(this)" id="__name_thumb__-{file_id}" /> 
                 <label for="__name_thumb__-{file_id}">__txt_pict_use_as_thumb__</label>
             </span>
         </bx_if:set_thumb>
@@ -22,12 +22,12 @@
 </div>
 <script>
     if ('object' == typeof(tinymce))
-        $('#bx-base-text-intert-to-post-link-{file_id}').show();
+        $('#bx-base-general-intert-to-post-link-{file_id}').show();
 
-    $('#bx-uploader-file-{storage_object}-{file_id} .bx-base-text-use-as-thumb input[value="__thumb_id__"]').attr('checked', true);
+    $('#bx-uploader-file-{storage_object}-{file_id} .bx-base-general-use-as-thumb input[value="__thumb_id__"]').attr('checked', true);
 
     // disable images drag&drop, because resized images address can be reset after some time
-    $(".bx-base-text-icon-{file_id}").bind('dragstart', function(){
+    $(".bx-base-general-icon-{file_id}").bind('dragstart', function(){
         return false; 
     });
 </script>

+ 1 - 1
modules/boonex/albums/classes/BxAlbumsConfig.php

@@ -99,7 +99,7 @@ class BxAlbumsConfig extends BxBaseModTextConfig
             'OBJECT_MENU_MANAGE_TOOLS' => 'bx_albums_menu_manage_tools', //manage menu in content administration tools
             'OBJECT_GRID_ADMINISTRATION' => 'bx_albums_administration',
         	'OBJECT_GRID_COMMON' => 'bx_albums_common',
-        	'OBJECT_UPLOADERS' => array('bx_albums_simple', 'bx_albums_html5'),
+        	'OBJECT_UPLOADERS' => array('bx_albums_simple', 'bx_albums_html5', 'bx_albums_crop'),
 
             // menu items which visibility depends on custom visibility checking
             'MENU_ITEM_TO_METHOD' => array (

+ 7 - 7
modules/boonex/albums/template/form_ghost_template.html

@@ -1,18 +1,18 @@
 <div id="bx-uploader-file-{storage_object}-{file_id}" class="bx-uploader-ghost bx-def-margin-sec-top bx-clearfix">
     <input type="hidden" name="__name__[]" value="{file_id}" />
-    <div class="bx-base-text-icon-wrapper bx-def-margin-sec-right">
-        <img src="{file_icon}" class="bx-def-round-corners bx-base-text-icon bx-base-text-icon-{file_id}" />
+    <div class="bx-base-general-icon-wrapper bx-def-margin-sec-right">
+        <img src="{file_icon}" class="bx-def-round-corners bx-base-general-icon bx-base-general-icon-{file_id}" />
     </div>
-    <span class="bx-base-text-uploader-ghost">
+    <span class="bx-base-general-uploader-ghost">
         <b><bx_text:_bx_albums_form_entry_file_title /></b>
         <br />
         <input class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom" type="text" value="{file_title_attr}" name="title-{file_id}" /> <br />
 
-        <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_text_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
+        <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
 
         <bx_if:set_thumb>
-            <span class="bx-base-text-use-as-thumb">
-                <input type="checkbox" name="__name_thumb__[]" value="{file_id}" onclick="bx_base_text_select_thumb(this)" id="__name_thumb__-{file_id}" /> 
+            <span class="bx-base-general-use-as-thumb">
+                <input type="checkbox" name="__name_thumb__[]" value="{file_id}" onclick="bx_base_general_select_thumb(this)" id="__name_thumb__-{file_id}" /> 
                 <label for="__name_thumb__-{file_id}"><bx_text:_sys_txt_form_entry_input_picture_use_as_thumb /></label>
             </span>
         </bx_if:set_thumb>
@@ -20,5 +20,5 @@
     </span>
 </div>
 <script>
-    $('#bx-uploader-file-{storage_object}-{file_id} .bx-base-text-use-as-thumb input[value="__thumb_id__"]').attr('checked', true);
+    $('#bx-uploader-file-{storage_object}-{file_id} .bx-base-general-use-as-thumb input[value="__thumb_id__"]').attr('checked', true);
 </script>

+ 2 - 2
modules/boonex/market/classes/BxMarketFormEntry.php

@@ -117,7 +117,7 @@ class BxMarketFormEntry extends BxBaseModTextFormEntry
 
         $iContentId = parent::insert ($aValsToAdd, $isIgnore);
         if(!empty($iContentId))
-            $this->_processFiles($CNF['FIELD_FILE'], $iContentId, true, $CNF['OBJECT_STORAGE_FILES']);
+            $this->processFiles($CNF['FIELD_FILE'], $iContentId, true, $CNF['OBJECT_STORAGE_FILES']);
 
         return $iContentId;
     }
@@ -141,7 +141,7 @@ class BxMarketFormEntry extends BxBaseModTextFormEntry
 
         $iResult = parent::update ($iContentId, $aValsToAdd, $aTrackTextFieldsChanges);
 
-        $this->_processFiles($CNF['FIELD_FILE'], $iContentId, false, $CNF['OBJECT_STORAGE_FILES']);
+        $this->processFiles($CNF['FIELD_FILE'], $iContentId, false, $CNF['OBJECT_STORAGE_FILES']);
 
         return $iResult;
     }

+ 15 - 15
modules/boonex/market/template/form_ghost_template.html

@@ -1,32 +1,32 @@
 <div id="bx-uploader-file-{storage_object}-{file_id}" class="bx-uploader-ghost bx-def-margin-sec-top bx-clearfix">
     <input type="hidden" name="__name__" value="{file_id}" />
-    <div class="bx-base-text-icon-wrapper bx-def-margin-sec-right">
-        <img src="{file_icon}" class="bx-def-round-corners bx-base-text-icon bx-base-text-icon-{file_id}" />
+    <div class="bx-base-general-icon-wrapper bx-def-margin-sec-right">
+        <img src="{file_icon}" class="bx-def-round-corners bx-base-general-icon bx-base-general-icon-{file_id}" />
     </div>
-    <span class="bx-base-text-uploader-ghost">
+    <span class="bx-base-general-uploader-ghost">
         <b><bx_text:_sys_txt_form_entry_input_picture_pic_url /></b><br />
         <input class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom" type="text" value="{file_url}" readonly="1" /> <br />
 
 		<b><bx_text:_bx_market_form_entry_input_pictures_title /></b><br />
     	<input class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom" type="text" name="title-{file_id}" value="{file_title_attr}" /><br />
 
-        <span id="bx-base-text-intert-to-post-link-{file_id}" style="display:none;">
-            <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_text_insert_to_post('{file_id}', '{file_url}', '__editor_id__');"><bx_text:_sys_txt_form_entry_input_picture_insert /></a>
+        <span id="bx-base-general-intert-to-post-link-{file_id}" style="display:none;">
+            <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_insert_to_post('{file_id}', '{file_url}', '__editor_id__');"><bx_text:_sys_txt_form_entry_input_picture_insert /></a>
         </span>
-        <span id="bx-base-text-delete-link-{file_id}">
-        	<a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_text_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
+        <span id="bx-base-general-delete-link-{file_id}">
+        	<a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
         </span>
         <bx_if:set_thumb>
         	<br />
-            <span class="bx-base-text-use-as-thumb">
-                <input type="checkbox" name="__name_thumb__[]" value="{file_id}" onclick="bx_base_text_select_thumb(this)" id="__name_thumb__-{file_id}" /> 
+            <span class="bx-base-general-use-as-thumb">
+                <input type="checkbox" name="__name_thumb__[]" value="{file_id}" onclick="bx_base_general_select_thumb(this)" id="__name_thumb__-{file_id}" /> 
                 <label for="__name_thumb__-{file_id}"><bx_text:_bx_market_form_entry_input_pictures_use_as_thumb /></label>
             </span>
         </bx_if:set_thumb>
         <bx_if:set_cover>
         	<br />
-            <span class="bx-base-text-use-as-cover">
-                <input type="checkbox" name="__name_cover__[]" value="{file_id}" onclick="bx_base_text_select_ghost(this, '__name_cover__')" id="__name_cover__-{file_id}" /> 
+            <span class="bx-base-general-use-as-cover">
+                <input type="checkbox" name="__name_cover__[]" value="{file_id}" onclick="bx_base_general_select_ghost(this, '__name_cover__')" id="__name_cover__-{file_id}" /> 
                 <label for="__name_cover__-{file_id}"><bx_text:_bx_market_form_entry_input_pictures_use_as_cover /></label>
             </span>
         </bx_if:set_cover>
@@ -34,13 +34,13 @@
 </div>
 <script>
     if ('object' == typeof(tinymce))
-        $('#bx-base-text-intert-to-post-link-{file_id}').show();
+        $('#bx-base-general-intert-to-post-link-{file_id}').show();
 
-    $('#bx-uploader-file-{storage_object}-{file_id} .bx-base-text-use-as-thumb input[value="__thumb_id__"]').attr('checked', true);
-    $('#bx-uploader-file-{storage_object}-{file_id} .bx-base-text-use-as-cover input[value="__cover_id__"]').attr('checked', true);
+    $('#bx-uploader-file-{storage_object}-{file_id} .bx-base-general-use-as-thumb input[value="__thumb_id__"]').attr('checked', true);
+    $('#bx-uploader-file-{storage_object}-{file_id} .bx-base-general-use-as-cover input[value="__cover_id__"]').attr('checked', true);
 
     // disable images drag&drop, because resized images address can be reset after some time
-    $(".bx-base-text-icon-{file_id}").bind('dragstart', function(){
+    $(".bx-base-general-icon-{file_id}").bind('dragstart', function(){
         return false; 
     });
 </script>

+ 11 - 11
modules/boonex/market/template/form_ghost_template_file.html

@@ -1,23 +1,23 @@
 <div id="bx-uploader-file-{storage_object}-{file_id}" class="bx-uploader-ghost bx-def-margin-sec-top bx-clearfix">
     <input type="hidden" name="__name__" value="{file_id}" />
-    <div class="bx-base-text-icon-wrapper bx-def-margin-sec-right">
-        <img src="{file_icon}" class="bx-def-round-corners bx-base-text-icon bx-base-text-icon-{file_id}" />
+    <div class="bx-base-general-icon-wrapper bx-def-margin-sec-right">
+        <img src="{file_icon}" class="bx-def-round-corners bx-base-general-icon bx-base-general-icon-{file_id}" />
     </div>
-    <span class="bx-base-text-uploader-ghost">
+    <span class="bx-base-general-uploader-ghost">
 		<b><bx_text:_bx_market_form_entry_input_files_name /></b><br />
         <input class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom" type="text" value="{file_name}" readonly="1" /><br />
 
     	<b><bx_text:_bx_market_form_entry_input_files_version /></b><br />
     	<input class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom" type="text" name="version-{file_id}" value="{file_version_attr}" /><br />
 
-        <span id="bx-base-text-intert-to-post-link-{file_id}" style="display:none;">
-            <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_text_insert_to_post('{file_id}', '{file_url}', '__editor_id__');"><bx_text:_sys_txt_form_entry_input_picture_insert /></a>
+        <span id="bx-base-general-intert-to-post-link-{file_id}" style="display:none;">
+            <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_insert_to_post('{file_id}', '{file_url}', '__editor_id__');"><bx_text:_sys_txt_form_entry_input_picture_insert /></a>
         </span>
-        <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_text_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
+        <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
 
         <bx_if:set_thumb>
-            <span class="bx-base-text-use-as-thumb">
-                <input type="checkbox" name="__name_thumb__[]" value="{file_id}" onclick="bx_base_text_select_thumb(this)" id="__name_thumb__-{file_id}" /> 
+            <span class="bx-base-general-use-as-thumb">
+                <input type="checkbox" name="__name_thumb__[]" value="{file_id}" onclick="bx_base_general_select_thumb(this)" id="__name_thumb__-{file_id}" /> 
                 <label for="__name_thumb__-{file_id}"><bx_text:_bx_market_form_entry_input_files_use_as_main /></label>
             </span>
         </bx_if:set_thumb>
@@ -26,12 +26,12 @@
 </div>
 <script>
     if ('object' == typeof(tinymce))
-        $('#bx-base-text-intert-to-post-link-{file_id}').show();
+        $('#bx-base-general-intert-to-post-link-{file_id}').show();
 
-    $('#bx-uploader-file-{storage_object}-{file_id} .bx-base-text-use-as-thumb input[value="__thumb_id__"]').attr('checked', true);
+    $('#bx-uploader-file-{storage_object}-{file_id} .bx-base-general-use-as-thumb input[value="__thumb_id__"]').attr('checked', true);
 
     // disable images drag&drop, because resized images address can be reset after some time
-    $(".bx-base-text-icon-{file_id}").bind('dragstart', function(){
+    $(".bx-base-general-icon-{file_id}").bind('dragstart', function(){
         return false; 
     });
 </script>

+ 2 - 1
modules/boonex/organizations/classes/BxOrgsConfig.php

@@ -96,7 +96,8 @@ class BxOrgsConfig extends BxBaseModProfileConfig
             'OBJECT_PAGE_VIEW_ENTRY_CLOSED' => 'bx_organizations_view_profile_closed',
             'OBJECT_PRIVACY_VIEW' => 'bx_organizations_allow_view_to',
             'OBJECT_GRID_ADMINISTRATION' => 'bx_organizations_administration',
-        	'OBJECT_GRID_COMMON' => 'bx_organizations_common',
+            'OBJECT_GRID_COMMON' => 'bx_organizations_common',
+            'OBJECT_UPLOADERS' => array('sys_simple', 'sys_html5', 'sys_crop'),
 
             'TRIGGER_MENU_PROFILE_VIEW_SUBMENU' => 'trigger_profile_view_submenu',
             'TRIGGER_MENU_PROFILE_VIEW_ACTIONS' => 'trigger_profile_view_actions',

+ 2 - 7
modules/boonex/organizations/install/sql/install.sql

@@ -109,12 +109,11 @@ INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `ch
 ('bx_organization', 'bx_organizations', 'org_desc', '', '', 0, 'textarea', '_bx_orgs_form_profile_input_sys_org_desc', '_bx_orgs_form_profile_input_org_desc', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 1),
 ('bx_organization', 'bx_organizations', 'org_cat', '', '#!bx_organizations_cats', 0, 'select', '_bx_orgs_form_profile_input_sys_org_cat', '_bx_orgs_form_profile_input_org_cat', '', 1, 0, 0, '', '', '', 'avail', '', '_bx_orgs_form_profile_input_org_cat_err', 'Xss', '', 1, 1),
 ('bx_organization', 'bx_organizations', 'org_name', '', '', 0, 'text', '_bx_orgs_form_profile_input_sys_org_name', '_bx_orgs_form_profile_input_org_name', '', 1, 0, 0, '', '', '', 'avail', '', '_bx_orgs_form_profile_input_org_name_err', 'Xss', '', 1, 0),
-('bx_organization', 'bx_organizations', 'picture', '', '', 0, 'file', '_bx_orgs_form_profile_input_sys_picture', '_bx_orgs_form_profile_input_picture', '', 0, 0, 0, '', '', '', '', '', '_bx_orgs_form_profile_input_picture_err', 'Int', '', 1, 0),
-('bx_organization', 'bx_organizations', 'picture_preview', '', '', 0, 'custom', '_bx_orgs_form_profile_input_sys_picture_preview', '_bx_orgs_form_profile_input_picture_preview', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0);
+('bx_organization', 'bx_organizations', 'picture', 'a:1:{i:0;s:8:"sys_crop";}', 'a:3:{s:10:"sys_simple";s:26:"_sys_uploader_simple_title";s:9:"sys_html5";s:25:"_sys_uploader_html5_title";s:8:"sys_crop";s:24:"_sys_uploader_crop_title";}', 0, 'files', '_bx_orgs_form_profile_input_sys_picture', '_bx_orgs_form_profile_input_picture', '', 0, 0, 0, '', '', '', '', '', '_bx_orgs_form_profile_input_picture_err', 'Int', '', 1, 0);
+
 
 INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES 
 ('bx_organization_add', 'cover_preview', 2147483647, 0, 1),
-('bx_organization_add', 'picture_preview', 2147483647, 0, 2),
 ('bx_organization_add', 'delete_confirm', 2147483647, 0, 3),
 ('bx_organization_add', 'cover', 2147483647, 0, 4),
 ('bx_organization_add', 'picture', 2147483647, 1, 5),
@@ -126,7 +125,6 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_organization_delete', 'cover_preview', 2147483647, 0, 0),
 ('bx_organization_delete', 'picture', 2147483647, 0, 0),
 ('bx_organization_delete', 'delete_confirm', 2147483647, 1, 0),
-('bx_organization_delete', 'picture_preview', 2147483647, 0, 0),
 ('bx_organization_delete', 'cover', 2147483647, 0, 0),
 ('bx_organization_delete', 'do_submit', 2147483647, 1, 1),
 ('bx_organization_delete', 'org_name', 2147483647, 0, 2),
@@ -134,7 +132,6 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_organization_edit', 'cover_preview', 2147483647, 0, 1),
 ('bx_organization_edit', 'delete_confirm', 2147483647, 0, 2),
 ('bx_organization_edit', 'cover', 2147483647, 0, 3),
-('bx_organization_edit', 'picture_preview', 2147483647, 1, 4),
 ('bx_organization_edit', 'picture', 2147483647, 1, 5),
 ('bx_organization_edit', 'org_name', 2147483647, 1, 6),
 ('bx_organization_edit', 'org_cat', 2147483647, 1, 7),
@@ -144,13 +141,11 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_organization_edit_cover', 'delete_confirm', 2147483647, 0, 1),
 ('bx_organization_edit_cover', 'org_name', 2147483647, 0, 2),
 ('bx_organization_edit_cover', 'picture', 2147483647, 0, 3),
-('bx_organization_edit_cover', 'picture_preview', 2147483647, 0, 4),
 ('bx_organization_edit_cover', 'org_cat', 2147483647, 0, 5),
 ('bx_organization_edit_cover', 'cover_preview', 2147483647, 1, 6),
 ('bx_organization_edit_cover', 'cover', 2147483647, 1, 7),
 ('bx_organization_edit_cover', 'do_submit', 2147483647, 1, 8),
 ('bx_organization_view', 'cover_preview', 2147483647, 0, 1),
-('bx_organization_view', 'picture_preview', 2147483647, 0, 2),
 ('bx_organization_view', 'delete_confirm', 2147483647, 0, 3),
 ('bx_organization_view', 'picture', 2147483647, 0, 4),
 ('bx_organization_view', 'cover', 2147483647, 0, 5),

+ 1 - 0
modules/boonex/organizations/template/css/forms.css

@@ -0,0 +1 @@
+@import url(../../../../base/profile/template/css/forms.css);

+ 1 - 0
modules/boonex/organizations/template/form_ghost_template.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/profile/template/form_ghost_template.html />

+ 2 - 1
modules/boonex/persons/classes/BxPersonsConfig.php

@@ -96,7 +96,8 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'OBJECT_PAGE_VIEW_ENTRY_CLOSED' => 'bx_persons_view_profile_closed',
             'OBJECT_PRIVACY_VIEW' => 'bx_persons_allow_view_to',
             'OBJECT_GRID_ADMINISTRATION' => 'bx_persons_administration',
-        	'OBJECT_GRID_COMMON' => 'bx_persons_common',
+            'OBJECT_GRID_COMMON' => 'bx_persons_common',
+            'OBJECT_UPLOADERS' => array('sys_simple', 'sys_html5', 'sys_crop'),
 
             'TRIGGER_MENU_PROFILE_VIEW_SUBMENU' => 'trigger_profile_view_submenu',
             'TRIGGER_MENU_PROFILE_VIEW_ACTIONS' => 'trigger_profile_view_actions',

+ 2 - 7
modules/boonex/persons/install/sql/install.sql

@@ -108,12 +108,11 @@ INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `ch
 ('bx_person', 'bx_persons', 'do_submit', '_bx_persons_form_profile_input_submit', '', 0, 'submit', '_bx_persons_form_profile_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_person', 'bx_persons', 'description', '', '', 0, 'textarea', '_bx_persons_form_profile_input_sys_desc', '_bx_persons_form_profile_input_desc', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 1),
 ('bx_person', 'bx_persons', 'fullname', '', '', 0, 'text', '_bx_persons_form_profile_input_sys_fullname', '_bx_persons_form_profile_input_fullname', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_persons_form_profile_input_fullname_err', 'Xss', '', 1, 0),
-('bx_person', 'bx_persons', 'picture', '', '', 0, 'file', '_bx_persons_form_profile_input_sys_picture', '_bx_persons_form_profile_input_picture', '', 0, 0, 0, '', '', '', '', '', '_bx_persons_form_profile_input_picture_err', 'Int', '', 1, 0),
-('bx_person', 'bx_persons', 'picture_preview', '', '', 0, 'custom', '_bx_persons_form_profile_input_sys_picture_preview', '_bx_persons_form_profile_input_picture_preview', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0);
+('bx_person', 'bx_persons', 'picture', 'a:1:{i:0;s:8:"sys_crop";}', 'a:3:{s:10:"sys_simple";s:26:"_sys_uploader_simple_title";s:9:"sys_html5";s:25:"_sys_uploader_html5_title";s:8:"sys_crop";s:24:"_sys_uploader_crop_title";}', 0, 'files', '_bx_persons_form_profile_input_sys_picture', '_bx_persons_form_profile_input_picture', '', 0, 0, 0, '', '', '', '', '', '_bx_persons_form_profile_input_picture_err', 'Int', '', 1, 0);
+
 
 INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES 
 ('bx_person_add', 'cover_preview', 2147483647, 0, 1),
-('bx_person_add', 'picture_preview', 2147483647, 0, 2),
 ('bx_person_add', 'delete_confirm', 2147483647, 0, 3),
 ('bx_person_add', 'cover', 2147483647, 0, 4),
 ('bx_person_add', 'picture', 2147483647, 1, 5),
@@ -125,13 +124,11 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_person_delete', 'cover_preview', 2147483647, 0, 0),
 ('bx_person_delete', 'picture', 2147483647, 0, 0),
 ('bx_person_delete', 'delete_confirm', 2147483647, 1, 0),
-('bx_person_delete', 'picture_preview', 2147483647, 0, 0),
 ('bx_person_delete', 'do_submit', 2147483647, 1, 1),
 ('bx_person_delete', 'fullname', 2147483647, 0, 2),
 ('bx_person_edit', 'cover_preview', 2147483647, 0, 1),
 ('bx_person_edit', 'delete_confirm', 2147483647, 0, 2),
 ('bx_person_edit', 'cover', 2147483647, 0, 3),
-('bx_person_edit', 'picture_preview', 2147483647, 1, 4),
 ('bx_person_edit', 'picture', 2147483647, 1, 5),
 ('bx_person_edit', 'fullname', 2147483647, 1, 6),
 ('bx_person_edit', 'description', 2147483647, 1, 7),
@@ -140,12 +137,10 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_person_edit_cover', 'delete_confirm', 2147483647, 0, 1),
 ('bx_person_edit_cover', 'fullname', 2147483647, 0, 2),
 ('bx_person_edit_cover', 'picture', 2147483647, 0, 3),
-('bx_person_edit_cover', 'picture_preview', 2147483647, 0, 4),
 ('bx_person_edit_cover', 'cover_preview', 2147483647, 1, 6),
 ('bx_person_edit_cover', 'cover', 2147483647, 1, 7),
 ('bx_person_edit_cover', 'do_submit', 2147483647, 1, 8),
 ('bx_person_view', 'cover_preview', 2147483647, 0, 1),
-('bx_person_view', 'picture_preview', 2147483647, 0, 2),
 ('bx_person_view', 'delete_confirm', 2147483647, 0, 3),
 ('bx_person_view', 'picture', 2147483647, 0, 4),
 ('bx_person_view', 'cover', 2147483647, 0, 5),

+ 1 - 0
modules/boonex/persons/template/css/forms.css

@@ -0,0 +1 @@
+@import url(../../../../base/profile/template/css/forms.css);

+ 1 - 0
modules/boonex/persons/template/form_ghost_template.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/profile/template/form_ghost_template.html />