### GPL Interactive Mode Notice
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/assets/pages/eula.html
Example of a short notice to display when a GPL-licensed program starts in interactive mode, informing users about its free software status and warranty.
```text
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type \`show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type \`show c' for details.
```
--------------------------------
### Install and Run wangEditor Demo
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/assets/lib/wangEditor/wangEditor-3.1.1.md
Instructions for setting up the wangEditor development environment, installing dependencies, and running the demo locally.
```bash
git clone git@github.com:wangfupeng1988/wangEditor.git
cd wangEditor
npm i
# For Windows users:
npm run win-example
# For Mac users:
npm run example
```
--------------------------------
### Install Datory Package
Source: https://github.com/siteserver/cms/blob/master/src/Datory/README.md
Command to add the Datory NuGet package to a .NET project for independent usage.
```bash
dotnet add package Datory
```
--------------------------------
### Install Monaco Editor using npm
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/assets/lib/monaco-editor/monaco-editor-0.20.0.md
Installs the Monaco Editor package from npm. This command fetches the latest version and its dependencies, making the editor available for use in your project.
```bash
$ npm install monaco-editor
```
--------------------------------
### jQuery showLoading: Default Indicator
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/resources/jquery/showloading/jquery.showLoading.example.html
Shows the default loading indicator on the '#activity_pane' element when the 'a.loading-default' link is clicked. This is a basic usage of the plugin.
```javascript
jQuery(document).ready( function() {
// When a user clicks the 'loading-default' link,
// call showLoading on the activity pane
// with default options
jQuery('a.loading-default').click( function() {
jQuery('#activity_pane').showLoading();
});
});
```
--------------------------------
### Build SSCMS for Linux x64
Source: https://github.com/siteserver/cms/blob/master/README.md
Commands to build and publish the SSCMS project for Linux 64-bit platforms using npm and .NET CLI. Includes steps for installing dependencies, building the solution, publishing CLI and Web projects, and copying build artifacts.
```bash
npm install
npm run build-linux-x64
dotnet build ./build-linux-x64/build.sln -c Release
dotnet publish ./build-linux-x64/src/SSCMS.Cli/SSCMS.Cli.csproj -r linux-x64 -c Release -o ./publish/sscms-linux-x64
dotnet publish ./build-linux-x64/src/SSCMS.Web/SSCMS.Web.csproj -r linux-x64 -c Release -o ./publish/sscms-linux-x64
npm run copy-linux-x64
```
--------------------------------
### Applying GPL License to New Programs
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/assets/pages/eula.html
Template text to include in new programs to license them under the GNU General Public License (GPL). It specifies redistribution rights and warranty disclaimers.
```text
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
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 3 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, see .
```
--------------------------------
### Pull Latest SSCMS Docker Image
Source: https://github.com/siteserver/cms/blob/master/docker/README.md
Fetches the most recent version of the SSCMS core Docker image from Docker Hub. This is the recommended way to get the latest features and bug fixes.
```bash
docker pull sscms/core:latest
```
--------------------------------
### jQuery showLoading: Custom 'bars'-style Indicator
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/resources/jquery/showloading/jquery.showLoading.example.html
Applies a custom loading indicator with the class 'loading-indicator-bars' to the '#activity_pane' element when the 'a.loading-bars' link is clicked.
```javascript
jQuery(document).ready( function() {
// When a user clicks the 'loading-bars' link,
// call showLoading with addClass specified
jQuery('a.loading-bars').click( function() {
jQuery('#activity_pane').showLoading( {
'addClass': 'loading-indicator-bars'
} );
});
});
```
--------------------------------
### Build SSCMS for Windows x64
Source: https://github.com/siteserver/cms/blob/master/README.md
Commands to build and publish the SSCMS project for Windows 64-bit platforms using npm and .NET CLI. Includes steps for installing dependencies, building the solution, publishing CLI and Web projects, and copying build artifacts.
```bash
npm install
npm run build-win-x64
dotnet build ./build-win-x64/build.sln -c Release
dotnet publish ./build-win-x64/src/SSCMS.Cli/SSCMS.Cli.csproj -r win-x64 -c Release -o ./publish/sscms-win-x64
dotnet publish ./build-win-x64/src/SSCMS.Web/SSCMS.Web.csproj -r win-x64 -c Release -o ./publish/sscms-win-x64
npm run copy-win-x64
```
--------------------------------
### Run SSCMS Container with SQLite (Local Volume)
Source: https://github.com/siteserver/cms/blob/master/docker/README.md
Starts an SSCMS Docker container in detached mode. It maps port 80, ensures the container restarts automatically, mounts the local 'wwwroot' directory for data persistence, and configures the container to use SQLite as the database via environment variables.
```bash
docker run -d \
--name my-sscms \
-p 80:80 \
--restart=always \
-v "$(pwd)"/wwwroot:/app/wwwroot \
-e SSCMS_SECURITY_KEY=e2a3d303-ac9b-41ff-9154-930710af0845 \
-e SSCMS_DATABASE_TYPE=SQLite \
sscms/core:latest
```
--------------------------------
### Run SSCMS Container with SQLite (Docker Volume)
Source: https://github.com/siteserver/cms/blob/master/docker/README.md
Launches an SSCMS Docker container in detached mode, similar to the local volume example, but utilizes a named Docker volume ('volume-sscms') for data persistence. Docker manages this volume, providing a more robust storage solution.
```bash
docker run -d \
--name my-sscms \
-p 80:80 \
--restart=always \
-v volume-sscms:/app/wwwroot \
-e SSCMS_SECURITY_KEY=e2a3d303-ac9b-41ff-9154-930710af0845 \
-e SSCMS_DATABASE_TYPE=SQLite \
sscms/core:latest
```
--------------------------------
### jQuery showLoading: Usage with load() Method
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/resources/jquery/showloading/jquery.showLoading.example.html
Demonstrates integrating showLoading and hideLoading with the jQuery load() method. The loading indicator is shown before the content is loaded and hidden in the load callback.
```javascript
jQuery('#activity_pane').showLoading();
jQuery('#activity_pane').load(
'/path/to/my/url',
{},
function() {
//
//this is the ajax callback
//
jQuery('#activity_pane').hideLoading();
}
);
```
--------------------------------
### Build SSCMS for Windows x32
Source: https://github.com/siteserver/cms/blob/master/README.md
Commands to build and publish the SSCMS project for Windows 32-bit platforms using npm and .NET CLI. Includes steps for installing dependencies, building the solution, publishing CLI and Web projects, and copying build artifacts.
```bash
npm install
npm run build-win-x32
dotnet build ./build-win-x32/build.sln -c Release
dotnet publish ./build-win-x32/src/SSCMS.Cli/SSCMS.Cli.csproj -r win-x32 -c Release -o ./publish/sscms-win-x32
dotnet publish ./build-win-x32/src/SSCMS.Web/SSCMS.Web.csproj -r win-x32 -c Release -o ./publish/sscms-win-x32
npm run copy-win-x32
```
--------------------------------
### Create SSCMS wwwroot Directory
Source: https://github.com/siteserver/cms/blob/master/docker/README.md
Creates a local directory named 'wwwroot' in the current working directory. This directory will be used to persist SSCMS site data when running the container.
```bash
mkdir wwwroot
```
--------------------------------
### Build SSCMS for Linux ARM64
Source: https://github.com/siteserver/cms/blob/master/README.md
Commands to build and publish the SSCMS project for Linux ARM64 platforms using npm and .NET CLI. Includes steps for installing dependencies, building the solution, publishing CLI and Web projects, and copying build artifacts.
```bash
npm install
npm run build-linux-arm64
dotnet build ./build-linux-arm64/build.sln -c Release
dotnet publish ./build-linux-arm64/src/SSCMS.Cli/SSCMS.Cli.csproj -r linux-arm64 -c Release -o ./publish/sscms-linux-arm64
dotnet publish ./build-linux-arm64/src/SSCMS.Web/SSCMS.Web.csproj -r linux-arm64 -c Release -o ./publish/sscms-linux-arm64
npm run copy-linux-arm64
```
--------------------------------
### jQuery showLoading: Simulate AJAX Load
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/resources/jquery/showloading/jquery.showLoading.example.html
Triggers a loading indicator and simulates a 1-second AJAX load by using the 'afterShow' callback. The loading indicator is hidden after the delay.
```javascript
jQuery(document).ready( function() {
// When a user clicks the 'loading-ajax' link,
// call showLoading, sleep, then call hide loading
// with default options
jQuery('a.loading-ajax').click( function() {
jQuery('#activity_pane').showLoading( {
'afterShow': function() {
setTimeout( "jQuery('#activity_pane').hideLoading()", 1000 );
}
} );
});
});
```
--------------------------------
### jQuery showLoading: Hide Indicator
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/resources/jquery/showloading/jquery.showLoading.example.html
Hides the loading indicator on the '#activity_pane' element when the 'a.loading-hide' link is clicked. This is used to remove an active loading state.
```javascript
jQuery(document).ready( function() {
// When a user clicks the 'loading-hide' link,
// call hideLoading on the activity pane
jQuery('a.loading-hide').click( function() {
jQuery('#activity_pane').hideLoading();
});
});
```
--------------------------------
### SSCMS Environment Variables Configuration
Source: https://github.com/siteserver/cms/blob/master/docker/README.md
Defines the environment variables used to configure the SSCMS Docker container. These variables control security, database connections, and other operational parameters.
```APIDOC
SSCMS_SECURITY_KEY: Required. Secret key for encrypted communication between SSCMS client and server, typically a GUID string.
SSCMS_DATABASE_TYPE: Required. Specifies the database type for SSCMS. Accepted values:
- MySQL: MySQL database
- SQLServer: Microsoft SQL Server database
- PostgreSQL: PostgreSQL database
- SQLite: SQLite database
SSCMS_DATABASE_HOST: Database host address.
SSCMS_DATABASE_PORT: Database access port.
SSCMS_DATABASE_USER: Database username.
SSCMS_DATABASE_PASSWORD: Database password.
SSCMS_DATABASE_NAME: Database name.
SSCMS_DATABASE_CONNECTION_STRING: Direct database connection string. Use either this or individual host/port/user/password/name parameters.
SSCMS_REDIS_CONNECTION_STRING: Redis cache connection string.
Note: If SSCMS_DATABASE_TYPE is SQLite, the database is stored in 'wwwroot/sitefiles/database.sqlite'. For other database types, connection details must be provided.
```
--------------------------------
### Pull Specific SSCMS Docker Image Version
Source: https://github.com/siteserver/cms/blob/master/docker/README.md
Retrieves a specific version of the SSCMS core Docker image by specifying a version tag. Replace `<版本号>` with the desired version number.
```bash
docker pull sscms/core:<版本号>
```
--------------------------------
### C# Datory Repository Usage
Source: https://github.com/siteserver/cms/blob/master/src/Datory/README.md
Demonstrates how to create a Datory repository and perform a query with filtering, ordering, and limiting. It uses parameter binding for security and integrates with Redis for caching.
```csharp
var repository = new Repository(settingsManager.Database, settingsManager.Redis);
await repository.GetAllAsync(Q
.Select("Name")
.Where("GroupId", 100)
.Limit(10)
.OrderByDesc("Id")
);
```
--------------------------------
### Initialize wangEditor
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/assets/lib/wangEditor/wangEditor-3.1.1.md
Demonstrates the basic usage of wangEditor by initializing an editor instance targeting a specific DOM element and creating it.
```javascript
var E = window.wangEditor
var editor = new E('#div1')
editor.create()
```
--------------------------------
### Baidu Maps API Usage in Editor
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/assets/lib/ueditor/dialogs/map/map.html
Demonstrates how to use the Baidu Maps API within a web editor context. It covers initializing maps, performing local searches, handling marker positions, and inserting either static map images or interactive iframes into the editor content. This section outlines the core API calls and editor integration commands.
```APIDOC
Baidu Maps API Integration:
Map Object:
BMap.Map(containerId)
- Initializes a new map instance in the specified container.
- Parameters:
- containerId: The ID of the HTML element to contain the map.
Map Methods:
enableScrollWheelZoom()
- Enables the mouse scroll wheel to zoom the map.
enableContinuousZoom()
- Enables continuous zooming when using the scroll wheel.
centerAndZoom(point, zoom)
- Sets the center point and zoom level of the map.
- Parameters:
- point: A BMap.Point object representing the center coordinates.
- zoom: The zoom level (integer).
addControl(control)
- Adds a control to the map.
- Parameters:
- control: An instance of a Baidu Map control (e.g., BMap.NavigationControl).
setViewport(points)
- Adjusts the map's viewport to fit a given array of points.
- Parameters:
- points: An array of BMap.Point objects.
getCenter()
- Returns the current center point of the map.
- Returns: BMap.Point
getSize()
- Returns the current size of the map container.
- Returns: { width: number, height: number }
Marker Object:
BMap.Marker(point)
- Creates a new marker at the specified point.
- Parameters:
- point: A BMap.Point object.
setPoint(point)
- Sets the position of the marker.
- Parameters:
- point: A BMap.Point object.
enableDragging()
- Enables the marker to be dragged by the user.
Local Search:
BMap.LocalSearch(keyword, options)
- Creates a local search object.
- Parameters:
- keyword: The city name for the search.
- options: An object containing search options, including:
- onSearchComplete: Callback function executed when search results are available.
search(keyword)
- Executes a local search.
- Parameters:
- keyword: The search query (e.g., address or place name).
Static Image API:
URL Format:
https://api.map.baidu.com/staticimage?center=lng,lat&zoom=level&width=width&height=height&markers=lng,lat
Parameters:
- center: Longitude and latitude of the map center.
- zoom: Zoom level.
- width: Width of the static image.
- height: Height of the static image.
- markers: Longitude and latitude of markers to display.
Editor Integration (UEditor):
editor.execCommand('inserthtml', htmlString)
- Inserts HTML content into the editor.
- Parameters:
- htmlString: The HTML string to insert (e.g., an iframe or img tag for the map).
```
--------------------------------
### SiteServer CMS Image Uploader Initialization
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/assets/lib/ueditor/dialogs/wordimage/wordimage.html
Configures the editor and initializes the image uploader component. It sets global variables for image handling, defines upload parameters, and specifies Flash-related options and callbacks for managing the upload process, including file selection, deletion, and completion status.
```javascript
editor.setOpt({ wordImageFieldName:"upfile", compressSide:0, maxImageSideLength:900 }); //全局变量 var imageUrls = [], //用于保存从服务器返回的图片信息数组 selectedImageCount = 0, //当前已选择的但未上传的图片数量 optImageUrl = editor.getActionUrl(editor.getOpt('imageActionName')), optImageFieldName = editor.getOpt('imageFieldName'), optImageCompressBorder = editor.getOpt('imageCompressEnable') ? editor.getOpt('imageCompressBorder') : null, maxSize = editor.getOpt('imageMaxSize') / 1024, extension = editor.getOpt('imageAllowFiles').join(';').replace(/\./g, '\*.'); /* 添加额外的GET参数 */ var params = utils.serializeParam(editor.queryCommandValue('serverparam')) || '', urlWidthParams = optImageUrl + (optImageUrl.indexOf('?') == -1 ? '?':'&') + params; utils.domReady(function(){ //创建Flash相关的参数集合 var flashOptions = { container:"flashContainer", //flash容器id url:urlWidthParams, // 上传处理页面的url地址 ext: editor.queryCommandValue('serverParam') || {}, //可向服务器提交的自定义参数列表 fileType: '{"description":"' + lang.fileType + '", "extension":"' + extension + '"}', //上传文件格式限制 flashUrl:'imageUploader.swf', //上传用的flash组件地址 width:600, //flash的宽度 height:272, //flash的高度 gridWidth:120, // 每一个预览图片所占的宽度 gridHeight:120, // 每一个预览图片所占的高度 picWidth:100, // 单张预览图片的宽度 picHeight:100, // 单张预览图片的高度 uploadDataFieldName: optImageFieldName, // POST请求中图片数据的key picDescFieldName:'pictitle', // POST请求中图片描述的key maxSize: maxSize, // 文件的最大体积,单位M compressSize:1, // 上传前如果图片体积超过该值,会先压缩,单位M maxNum:32, // 单次最大可上传多少个文件 compressSide: 0, //等比压缩的基准,0为按照最长边,1为按照宽度,2为按照高度 compressLength: optImageCompressBorder //能接受的最大边长,超过该值Flash会自动等比压缩 }; //回调函数集合,支持传递函数名的字符串、函数句柄以及函数本身三种类型 var callbacks = { selectFileCallback: function(selectFiles){ // 选择文件的回调 selectedImageCount += selectFiles.length; if(selectedImageCount) baidu.g("upload").style.display = ""; dialog.buttons[0].setDisabled(true); //初始化时置灰确定按钮 }, deleteFileCallback: function(delFiles){ // 删除文件的回调 selectedImageCount -= delFiles.length; if (!selectedImageCount) { baidu.g("upload").style.display = "none"; dialog.buttons[0].setDisabled(false); //没有选择图片时重新点亮按钮 } }, uploadCompleteCallback: function(data){ // 单个文件上传完成的回调 try{var info = eval("(" + data.info + ")"); info && imageUrls.push(info); selectedImageCount--; }catch(e){} }, uploadErrorCallback: function (data){ // 单个文件上传失败的回调, console && console.log(data); }, allCompleteCallback: function(){ // 全部上传完成时的回调 dialog.buttons[0].setDisabled(false); //上传完毕后点亮按钮 } //exceedFileCallback: 'exceedFileCallback', // 文件超出限制的最大体积时的回调 //startUploadCallback: startUploadCallback // 开始上传某个文件时的回调 }; wordImage.init(flashOptions, callbacks); });
```
--------------------------------
### Run SSCMS in Docker
Source: https://github.com/siteserver/cms/blob/master/README.md
Instructions for pulling the latest SSCMS Docker image and running a container with specified configurations, including port mapping, restart policy, volume mounting, and environment variables.
```bash
docker pull sscms/core:latest
docker run -d \
--name my-sscms \
-p 80:80 \
--restart=always \
-v volume-sscms:/app/wwwroot \
-e SSCMS_SECURITY_KEY=e2a3d303-ac9b-41ff-9154-930710af0845 \
-e SSCMS_DATABASE_TYPE=SQLite \
sscms/core
```
--------------------------------
### Baidu Map Initialization and Editor Integration
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/assets/lib/ueditor/dialogs/map/map.html
Initializes the Baidu Map based on existing image or iframe attributes from an editor's selection. It parses URL parameters for center, zoom, and markers, then sets up the map and marker. If no map is selected, it defaults to a standard location and zoom level.
```javascript
function init(){
var mapNode = editor.selection.getRange().getClosedNode(),
isMapImg = mapNode && /api[.]map[.]baidu[.]com/ig.test(mapNode.getAttribute("src")),
isMapIframe = mapNode && domUtils.hasClass(mapNode, 'ueditor_baidumap');
if(isMapImg || isMapIframe){
var url, centerPos, markerPos;
if(isMapIframe) {
url = decodeURIComponent(mapNode.getAttribute("src"));
$G('is_dynamic').checked = true;
styleStr = mapNode.style.cssText;
} else {
url = mapNode.getAttribute("src");
styleStr = mapNode.style.cssText;
}
centerPos = getPars(url,"center").split(",");
markerPos = getPars(url, "markers").split(",");
point = new BMap.Point(Number(centerPos[0]),Number(centerPos[1]));
marker = new BMap.Marker(new BMap.Point(Number(markerPos[0]), Number(markerPos[1])));
map.addControl(new BMap.NavigationControl());
map.centerAndZoom(point, Number(getPars(url,"zoom")));
} else {
point = new BMap.Point(116.404, 39.915); // 创建点坐标
marker = new BMap.Marker(point);
map.addControl(new BMap.NavigationControl());
map.centerAndZoom(point, 10); // 初始化地图,设置中心点坐标和地图级别。
}
marker.enableDragging();
map.addOverlay(marker);
}
init();
document.getElementById('address').onkeydown = function (evt){
evt = evt || event;
if (evt.keyCode == 13) {
doSearch();
}
};
dialog.onok = function (){
var center = map.getCenter();
var zoom = map.getZoom();
var size = map.getSize();
var mapWidth = size.width;
var mapHeight = size.height;
var point = marker.getPosition();
if($G('is_dynamic').checked) {
var URL = editor.options.UEDITOR_HOME_URL,
url = [URL + (/\/$/.test(URL) ? '':'/') + "dialogs/map/show.html" + '#center=' + center.lng + ',' + center.lat,
'&zoom=' + zoom,
'&width=' + mapWidth,
'&height=' + mapHeight,
'&markers=' + point.lng + ',' + point.lat,
'&markerStyles=' + 'l,A'].join('');
editor.execCommand('inserthtml', '');
} else {
var url = "https://api.map.baidu.com/staticimage?center=" + center.lng + ',' + center.lat + "&zoom=" + zoom + "&width=" + size.width + '&height=' + size.height + "&markers=" + point.lng + ',' + point.lat;
editor.execCommand('inserthtml', '
');
}
};
document.getElementById("address").focus();
```
--------------------------------
### Baidu Map Initialization and Search Logic
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/assets/lib/ueditor/dialogs/map/map.html
Initializes a Baidu Map instance, enables zoom controls, and defines a local search function. The search function takes city and address inputs, displays results, and adjusts the map viewport accordingly. It handles cases where no results are found.
```javascript
var map = new BMap.Map("container"),marker,point,styleStr;
map.enableScrollWheelZoom();
map.enableContinuousZoom();
function doSearch(){
if (!document.getElementById('city').value) {
alert(lang.cityMsg);
return;
}
var search = new BMap.LocalSearch(document.getElementById('city').value, {
onSearchComplete: function (results){
if (results && results.getNumPois()) {
var points = [];
for (var i=0; i 1) {
map.setViewport(points);
} else {
map.centerAndZoom(points[0], 13);
}
point = map.getCenter();
marker.setPoint(point);
} else {
alert(lang.errorMsg);
}
}
});
search.search(document.getElementById('address').value || document.getElementById('city').value);
}
```
--------------------------------
### Google Maps Initialization and Search
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/assets/lib/ueditor/dialogs/gmap/gmap.html
Initializes a Google Map, sets up an address search functionality using the Google Geocoding API, and handles marker placement. It also includes event listeners for triggering searches.
```javascript
domUtils.on(window,"load",function(){
var map = new google.maps.Map(document.getElementById('container'), {
zoom: 3,
streetViewControl: false,
scaleControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var imgcss;
var marker = new google.maps.Marker({
map: map,
draggable: true
});
function doSearch(){
var address = document.getElementById('address').value;
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var bounds = results[0].geometry.viewport;
map.fitBounds(bounds);
marker.setPosition(results[0].geometry.location);
marker.setTitle(address);
} else alert(lang.searchError);
});
}
$G('address').onkeydown = function (evt){
evt = evt || event;
if (evt.keyCode == 13) {
doSearch();
}
};
$G("doSearch").onclick = doSearch;
dialog.onok = function (){
var center = map.getCenter();
var point = marker.getPosition();
var url = "http://maps.googleapis.com/maps/api/staticmap?center=" + center.lat() + ',' + center.lng() + "&zoom=" + map.zoom + "&size=520x340&maptype=" + map.getMapTypeId() + "&markers=" + point.lat() + ',' + point.lng() + "&sensor=false";
editor.execCommand('inserthtml', '
');
};
function getPars(str,par){
var reg = new RegExp(par+"=((\\d+|[.,])\*)","g");
return reg.exec(str)[1]
}
var img = editor.selection.getRange().getClosedNode();
if(img && img.src.indexOf("http://maps.googleapis.com/maps/api/staticmap")!=-1){
var url = img.getAttribute("src");
var centers = getPars(url,"center").split(",");
point = new google.maps.LatLng(Number(centers[0]),Number(centers[1]));
map.setCenter(point);
map.setZoom(Number(getPars(url,"zoom")));
centers = getPars(url,"markers").split(",");
marker.setPosition(new google.maps.LatLng(Number(centers[0]),Number(centers[1])));
imgcss = img.style.cssText;
}else{
setTimeout(function(){
doSearch();
},30)
}
});
```
--------------------------------
### Monaco Editor Package Structure
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/assets/lib/monaco-editor/monaco-editor-0.20.0.md
Details the contents of the monaco-editor npm package, which includes different versions and source maps for integration and development.
```text
esm: ESM version of the editor (compatible with e.g. webpack)
dev: AMD bundled, not minified
min: AMD bundled, and minified
min-maps: source maps for min
monaco.d.ts: specifies the API of the editor
```
--------------------------------
### SSCMS Source Code Structure
Source: https://github.com/siteserver/cms/blob/master/README.md
Provides a high-level overview of the SSCMS project's directory structure, listing key directories and their purposes for developers.
```text
│ sscms.sln Visual Studio 项目文件
│
├─docker Docker 配置文件
├─src/Datory 数据库基础类
├─src/SSCMS 接口、基础类
├─src/SSCMS.Cli 命令行工具
├─src/SSCMS.Core CMS核心代码
├─src/SSCMS.Web CMS App
└─tests 测试
```
--------------------------------
### Redirect to CMS Documentation
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/guide.html
This JavaScript code snippet redirects the browser to the SiteServer CMS documentation page by setting the `location.href` property.
```javascript
location.href = 'https://sscms.com/docs/v7/getting-started/';
```
--------------------------------
### Baidu Maps API Custom Map Initialization and Interaction
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/assets/lib/ueditor/dialogs/map/show.html
Initializes a Baidu map using provided URL parameters for center, zoom, and markers. It sets up map events to update an external iframe's source when the map is moved or zoomed, or when a marker is dragged, facilitating integration within an editable content environment. Requires the Baidu Maps API library and specific URL parameters.
```javascript
百度地图API自定义地图 html, body { margin: 0; padding: 0; overflow: hidden; }
function getParam(name) { return location.href.match(new RegExp('[?#&]' + name + '=([^?#&]+)', 'i')) ? RegExp.$1 : ''; }
var map, marker;
var centerParam = getParam('center');
var zoomParam = getParam('zoom');
var widthParam = getParam('width');
var heightParam = getParam('height');
var markersParam = getParam('markers');
var markerStylesParam = getParam('markerStyles');
//创建和初始化地图函数:
function initMap() {
// [FF]切换模式后报错
if (!window.BMap) {
return;
}
var dituContent = document.getElementById('dituContent');
dituContent.style.width = widthParam + 'px';
dituContent.style.height = heightParam + 'px';
createMap(); //创建地图
setMapEvent(); //设置地图事件
addMapControl(); //向地图添加控件
// 创建标注
var markersArr = markersParam.split(',');
var point = new BMap.Point(markersArr[0], markersArr[1]);
marker = new BMap.Marker(point);
marker.enableDragging();
map.addOverlay(marker); // 将标注添加到地图中
if(parent.editor && parent.document.body.contentEditable=="true") {
//在编辑状态下
setMapListener(); //地图改变修改外层的iframe标签src属性
}
}
//创建地图函数:
function createMap() {
map = new BMap.Map("dituContent"); //在百度地图容器中创建一个地图
var centerArr = centerParam.split(',');
var point = new BMap.Point(parseFloat(centerArr[0]), parseFloat(centerArr[1])); //定义一个中心点坐标
map.centerAndZoom(point, parseInt(zoomParam)); //设定地图的中心点和坐标并将地图显示在地图容器中
}
//地图事件设置函数:
function setMapEvent() {
map.enableDragging(); //启用地图拖拽事件,默认启用(可不写)
map.enableScrollWheelZoom(); //启用地图滚轮放大缩小
map.enableDoubleClickZoom(); //启用鼠标双击放大,默认启用(可不写)
map.enableKeyboard(); //启用键盘上下左右键移动地图
}
//地图控件添加函数:
function addMapControl() {
//向地图中添加缩放控件
var ctrl_nav = new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_LEFT, type: BMAP_NAVIGATION_CONTROL_LARGE});
map.addControl(ctrl_nav);
//向地图中添加缩略图控件
var ctrl_ove = new BMap.OverviewMapControl({anchor: BMAP_ANCHOR_BOTTOM_RIGHT, isOpen: 1});
map.addControl(ctrl_ove);
//向地图中添加比例尺控件
var ctrl_sca = new BMap.ScaleControl({anchor: BMAP_ANCHOR_BOTTOM_LEFT});
map.addControl(ctrl_sca);
}
function setMapListener() {
var editor = parent.editor,
containerIframe,
iframes = parent.document.getElementsByTagName('iframe');
for (var key in iframes) {
if (iframes[key].contentWindow == window) {
containerIframe = iframes[key];
break;
}
}
if (containerIframe) {
map.addEventListener('moveend', mapListenerHandler);
map.addEventListener('zoomend', mapListenerHandler);
marker.addEventListener('dragend', mapListenerHandler);
}
function mapListenerHandler() {
var zoom = map.getZoom(),
center = map.getCenter(),
marker = window.marker.getPoint();
containerIframe.src = containerIframe.src.replace(new RegExp('([?#&])center=([^?#&]+)', 'i'), '$1center=' + center.lng + ',' + center.lat)
.replace(new RegExp('([?#&])markers=([^?#&]+)', 'i'), '$1markers=' + marker.lng + ',' + marker.lat)
.replace(new RegExp('([?#&])zoom=([^?#&]+)', 'i'), '$1zoom=' + zoom);
editor.fireEvent('saveScene');
}
}
```
--------------------------------
### SiteServer CMS Base Styles
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/assets/lib/ueditor/dialogs/snapscreen/snapscreen.html
Defines the fundamental CSS rules for the SiteServer CMS interface, controlling layout, typography, and element appearance. This includes styles for the body, headings, content areas, navigation elements, and input fields.
```css
html,body { font-size: 12px; width:100%; height:100%; overflow: hidden; margin:0px; padding:0px; }
h2 { font-size: 16px; margin: 20px auto;}
.content{ padding:5px 15px 0 15px; height:100%; }
dt,dd { margin-left: 0; padding-left: 0;}
dt a { display: block; height: 30px; line-height: 30px; width: 55px; background: #EFEFEF; border: 1px solid #CCC; padding: 0 10px; text-decoration: none; }
dt a:hover{ background: #e0e0e0; border-color: #999 }
dt a:active{ background: #ccc; border-color: #999; color: #666; }
dd { line-height:20px;margin-top: 10px;}
span{ padding-right:4px;}
input{width:210px;height:21px;background: #FFF;border:1px solid #d7d7d7;padding: 0px; margin: 0px; }
```
--------------------------------
### Xiumi Editor Integration (HTML, CSS, JavaScript)
Source: https://github.com/siteserver/cms/blob/master/src/SSCMS.Web/wwwroot/sitefiles/assets/lib/ueditor/third-party/custom/xiumi-ue-dialog-v5.html
This snippet demonstrates the core integration of the Xiumi editor. It includes CSS for styling the iframe container and JavaScript for initializing the editor, handling its load event, preventing default scroll behavior, and processing messages received from the editor iframe for inserting content and closing dialogs.
```html
```
```css
html, body {
padding: 0;
margin: 0;
}
#xiumi {
position: absolute;
width: 100%;
height: 100%;
border: none;
box-sizing: border-box;
}
```
```javascript
var xiumi = document.getElementById('xiumi');
var xiumi_url = window.location.protocol + "//xiumi.us";
xiumi.onload = function () {
console.log("postMessage");
xiumi.contentWindow.postMessage('ready', xiumi_url);
};
document.addEventListener("mousewheel", function (event) {
event.preventDefault();
event.stopPropagation();
}, false);
window.addEventListener('message', function (event) {
if (event.origin == xiumi_url) {
// Assuming 'editor' and 'dialog' are globally available objects
// editor.execCommand('insertHtml', event.data);
// dialog.close();
console.log("Received message from Xiumi:", event.data);
// Placeholder for actual editor/dialog interaction
alert("Content from Xiumi: " + event.data);
}
}, false);
```